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>
This commit is contained in:
Nico Huber 2013-06-10 13:43:29 +02:00 committed by Anton Kochkov
parent 088f569400
commit 735f55c29c
1 changed files with 4 additions and 2 deletions

View File

@ -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;