summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2013-06-10 13:43:29 +0200
committerAnton Kochkov <anton.kochkov@gmail.com>2013-06-13 22:02:18 +0200
commit735f55c29c05055059922b99513043887d7a8e89 (patch)
treec860bb60915ecb2983e33fb3bf0cee2c6ee8a7e8 /payloads/libpayload
parent088f5694009f710dc0a7fc9437a02d05b08829ed (diff)
libpayload: usb: Skip non-endpoint descriptors during init
During device initialization, skip any non-endpoint descriptor before reading the endpoint descriptors. By now, only HID descriptors were skipped. Change-Id: I190f3ae44b864aa71d5f32c3738097cf8f33a61b Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/3446 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/drivers/usb/usb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c
index 23561c40aa..6dafd076c4 100644
--- a/payloads/libpayload/drivers/usb/usb.c
+++ b/payloads/libpayload/drivers/usb/usb.c
@@ -332,8 +332,10 @@ set_address (hci_t *controller, int speed, int hubport, int hubaddr)
endpoint_descriptor_t *endp =
(endpoint_descriptor_t *) (((char *) current)
+ current->bLength);
- if (interface->bInterfaceClass == 0x3)
- endp = (endpoint_descriptor_t *) (((char *) endp) + ((char *) endp)[0]); // ignore HID descriptor
+ /* Skip any non-endpoint descriptor */
+ if (endp->bDescriptorType != 0x05)
+ endp = (endpoint_descriptor_t *)(((char *)endp) + ((char *)endp)[0]);
+
memset (dev->endpoints, 0, sizeof (dev->endpoints));
dev->num_endp = 1; // 0 always exists
dev->endpoints[0].dev = dev;