summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorGrissiom <[email protected]>2013-06-11 11:50:05 +0800
committerGrissiom <[email protected]>2013-06-11 11:50:05 +0800
commitb02993c9895d34e84f2dbf156ee274ad6abf84c0 (patch)
tree41fdaf5f4b550a0842457b396c2926e8f624758f /components
parented19483cb4f026c40e7c6a6bc09583e054ef0c5e (diff)
usbdevice/core: cope with some buggy drivers on USB_MSG_DATA_NOTIFY
Some driver will emit USB_MSG_DATA_NOTIFY before the USB get configured. Filter out those events.
Diffstat (limited to 'components')
-rw-r--r--components/drivers/usb/usbdevice/core/core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/drivers/usb/usbdevice/core/core.c b/components/drivers/usb/usbdevice/core/core.c
index c2965d6bb2..48fc69895c 100644
--- a/components/drivers/usb/usbdevice/core/core.c
+++ b/components/drivers/usb/usbdevice/core/core.c
@@ -1447,6 +1447,10 @@ static void rt_usbd_thread_entry(void* parameter)
_sof_notify(device);
break;
case USB_MSG_DATA_NOTIFY:
+ /* some buggy drivers will have USB_MSG_DATA_NOTIFY before the core
+ * got configured. */
+ if (device->state != USB_STATE_CONFIGURED)
+ break;
ep = rt_usbd_find_endpoint(device, &cls, msg.content.ep_msg.ep_addr);
if(ep != RT_NULL)
ep->handler(device, cls, msg.content.ep_msg.size);