From 735f55c29c05055059922b99513043887d7a8e89 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Mon, 10 Jun 2013 13:43:29 +0200 Subject: 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 Reviewed-on: http://review.coreboot.org/3446 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Anton Kochkov --- payloads/libpayload/drivers/usb/usb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'payloads/libpayload') 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; -- cgit v1.2.3