USBD return value for wrong URB submit

This commit is contained in:
Wojciech Zajac 2014-06-18 11:54:24 +02:00 committed by Lionel Sambuc
parent 5655b1f1a4
commit 7df0836d35

View file

@ -185,19 +185,27 @@ ddekit_usb_submit_urb(struct ddekit_usb_urb * d_urb)
dev = (hcd_device_state *)(d_urb->dev); dev = (hcd_device_state *)(d_urb->dev);
drv = (hcd_driver_state *)(dev->driver); drv = (hcd_driver_state *)(dev->driver);
/* Remember original URB */ /* Check for latest URB completion */
dev->urb.original_urb = (void *)d_urb; if (NULL == dev->urb.original_urb) {
/* TODO: URB's should be queued somewhere if DDEKit is not changed */ /* Remember original URB */
/* Turn DDEKit URB format to one that is easier to handle by HCD, also dev->urb.original_urb = (void *)d_urb;
* check if URB is valid */
hcd_decode_urb(&(dev->urb), d_urb);
/* Start handling URB event */ /* TODO: If multiple URB's have to be queued, this code
drv->current_event = HCD_EVENT_URB; * or DDEKit's must be altered accordingly */
hcd_handle_event(drv); /* Turn DDEKit URB format to one that is easier to
* handle by HCD, also check if URB is valid */
hcd_decode_urb(&(dev->urb), d_urb);
return EXIT_SUCCESS; /* Start handling URB event */
drv->current_event = HCD_EVENT_URB;
hcd_handle_event(drv);
return EXIT_SUCCESS;
}
/* Last URB must not have been completed */
return EXIT_FAILURE;
} }
@ -286,6 +294,9 @@ hcd_completion_cb(hcd_urb * urb)
hcd_encode_urb(urb, d_urb); hcd_encode_urb(urb, d_urb);
completion_cb(d_urb->priv); completion_cb(d_urb->priv);
/* URB was handled, forget about it */
urb->original_urb = NULL;
} }