USBH: UVC: improve debug message

This commit is contained in:
Diego Ismirlian 2019-09-30 18:36:18 -03:00
parent 7a57cfe93d
commit 7c57d8a924
1 changed files with 7 additions and 2 deletions

View File

@ -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 {