From 7c57d8a92488ecbcc7b29c7c9131ec41aceb6c17 Mon Sep 17 00:00:00 2001 From: Diego Ismirlian Date: Mon, 30 Sep 2019 18:36:18 -0300 Subject: USBH: UVC: improve debug message --- os/hal/src/usbh/hal_usbh_uvc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/os/hal/src/usbh/hal_usbh_uvc.c b/os/hal/src/usbh/hal_usbh_uvc.c index 8c82554..3a8b488 100644 --- a/os/hal/src/usbh/hal_usbh_uvc.c +++ b/os/hal/src/usbh/hal_usbh_uvc.c @@ -181,7 +181,8 @@ static void _post(USBHUVCDriver *uvcdp, usbh_urb_t *urb, memory_pool_t *mp, uint usbhuvc_message_base_t *const new_msg = (usbhuvc_message_base_t *)chPoolAllocI(mp); if (new_msg != NULL) { /* allocated the new buffer, now try to post the message to the mailbox */ - if (chMBPostI(&uvcdp->mb, (msg_t)msg) == MSG_OK) { + msg_t r = chMBPostI(&uvcdp->mb, (msg_t)msg); + if (r == MSG_OK) { /* everything OK, complete the missing fields */ msg->type = type; msg->length = urb->actualLength; @@ -189,8 +190,12 @@ static void _post(USBHUVCDriver *uvcdp, usbh_urb_t *urb, memory_pool_t *mp, uint /* change the URB's buffer to the newly allocated one */ urb->buff = ((usbhuvc_message_data_t *)new_msg)->data; } else { + if (r == MSG_RESET) { + uurbwarn("UVC: error, mailbox reset"); + } else { + uurberr("UVC: error, mailbox overrun"); + } /* couldn't post the message, free the newly allocated buffer */ - uurberr("UVC: error, mailbox overrun"); chPoolFreeI(&uvcdp->mp_status, new_msg); } } else { -- cgit v1.2.3