Corrected invalid URBs handling
This commit is contained in:
parent
e858b9b5e9
commit
6763c425bb
1 changed files with 31 additions and 21 deletions
|
@ -469,35 +469,45 @@ hcd_handle_urb(hcd_device_state * this_device, hcd_urb * urb)
|
||||||
|
|
||||||
DEBUG_DUMP;
|
DEBUG_DUMP;
|
||||||
|
|
||||||
transfer_status = EXIT_FAILURE;
|
|
||||||
|
|
||||||
/* TODO: One device only */
|
/* TODO: One device only */
|
||||||
USB_ASSERT(NULL != urb, "NULL URB given");
|
USB_ASSERT(NULL != urb, "NULL URB given");
|
||||||
USB_ASSERT(this_device == urb->target_device, "Unknown device for URB");
|
USB_ASSERT(this_device == urb->target_device, "Unknown device for URB");
|
||||||
|
|
||||||
switch (urb->type) {
|
/* Only if URB parsing was completed... */
|
||||||
case HCD_TRANSFER_CONTROL:
|
if (EXIT_SUCCESS == urb->inout_status) {
|
||||||
transfer_status = hcd_control_urb(this_device, urb);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HCD_TRANSFER_BULK:
|
transfer_status = EXIT_FAILURE;
|
||||||
case HCD_TRANSFER_INTERRUPT:
|
|
||||||
transfer_status = hcd_non_control_urb(this_device, urb);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HCD_TRANSFER_ISOCHRONOUS:
|
/* ...check for URB to handle */
|
||||||
/* TODO: ISO transfer */
|
switch (urb->type) {
|
||||||
USB_MSG("ISO transfer not supported");
|
case HCD_TRANSFER_CONTROL:
|
||||||
break;
|
transfer_status = hcd_control_urb(
|
||||||
|
this_device, urb);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
case HCD_TRANSFER_BULK:
|
||||||
USB_MSG("Invalid transfer type 0x%02X", (int)urb->type);
|
case HCD_TRANSFER_INTERRUPT:
|
||||||
break;
|
transfer_status = hcd_non_control_urb(
|
||||||
}
|
this_device, urb);
|
||||||
|
break;
|
||||||
|
|
||||||
/* In case of error, only dump message */
|
case HCD_TRANSFER_ISOCHRONOUS:
|
||||||
if (EXIT_SUCCESS != transfer_status)
|
/* TODO: ISO transfer */
|
||||||
USB_MSG("USB transfer failed");
|
USB_MSG("ISO transfer not supported");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
USB_MSG("Invalid transfer type 0x%02X",
|
||||||
|
(int)urb->type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* In case of error, only dump message */
|
||||||
|
if (EXIT_SUCCESS != transfer_status)
|
||||||
|
USB_MSG("USB transfer failed");
|
||||||
|
|
||||||
|
} else
|
||||||
|
USB_MSG("Invalid URB supplied");
|
||||||
|
|
||||||
/* Call completion regardless of status */
|
/* Call completion regardless of status */
|
||||||
hcd_completion_cb(urb);
|
hcd_completion_cb(urb);
|
||||||
|
|
Loading…
Reference in a new issue