From 1c02213e89f99c6f532b27048feb8f3170cac296 Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Fri, 5 Dec 2014 12:11:20 -0800 Subject: [PATCH] fastboot: Support USB 3.x SuperSpeed devices on Linux When enumerating USB 3.x devices, an extra 6-byte SuperSpeed companion descriptor follows each standard endpoint descriptor. The loop parsing the descriptors will stumble if they're not handled. Since they're not needed once the bulk endpoints are identified, we can simply skip over them. Change-Id: I7e73bcf9135f23c3059cd7c55b432557b28cb6ef --- fastboot/usb_linux.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fastboot/usb_linux.c b/fastboot/usb_linux.c index fabbd516453..022f3643dfa 100644 --- a/fastboot/usb_linux.c +++ b/fastboot/usb_linux.c @@ -223,6 +223,13 @@ static int filter_usb_device(char* sysfs_name, } else { out = ept->bEndpointAddress; } + + // For USB 3.0 devices skip the SS Endpoint Companion descriptor + if (check((struct usb_descriptor_hdr *)ptr, len, + USB_DT_SS_ENDPOINT_COMP, USB_DT_SS_EP_COMP_SIZE) == 0) { + len -= USB_DT_SS_EP_COMP_SIZE; + ptr += USB_DT_SS_EP_COMP_SIZE; + } } info.has_bulk_in = (in != -1);