The problem is that USB3 can add a `superspeed' companion descriptor
to each endpoint.  This patch skips over such descriptors in adb and
fastboot.

Signed-off-by: Peter Chubb <peter.ch...@nicta.com.au>

diff -ur android-tools-4.2.2+git20130529/core/adb/usb_linux.c 
android-tools-local/core/adb/usb_linux.c
--- android-tools-4.2.2+git20130529/core/adb/usb_linux.c        2013-05-30 
06:16:54.000000000 +1000
+++ android-tools-local/core/adb/usb_linux.c    2014-08-29 13:57:08.063089767 
+1000
@@ -137,6 +137,7 @@
     DIR *busdir , *devdir ;
     struct dirent *de;
     int fd ;
+    int is_usb3;
 
     busdir = opendir(base);
     if(busdir == 0) return;
@@ -195,6 +196,7 @@
             vid = device->idVendor;
             pid = device->idProduct;
             DBGX("[ %s is V:%04x P:%04x ]\n", devname, vid, pid);
+            is_usb3 = device->bcdUSB == 0x0300;
 
                 // should have config descriptor next
             config = (struct usb_config_descriptor *)bufptr;
@@ -237,8 +239,12 @@
                             // looks like ADB...
                         ep1 = (struct usb_endpoint_descriptor *)bufptr;
                         bufptr += USB_DT_ENDPOINT_SIZE;
+                        if (is_usb3 && bufptr[1] == USB_DT_SS_ENDPOINT_COMP)
+                            bufptr += USB_DT_SS_EP_COMP_SIZE;
                         ep2 = (struct usb_endpoint_descriptor *)bufptr;
                         bufptr += USB_DT_ENDPOINT_SIZE;
+                        if (is_usb3 && bufptr[1] == USB_DT_SS_ENDPOINT_COMP)
+                            bufptr += USB_DT_SS_EP_COMP_SIZE;
 
                         if (bufptr > devdesc + desclength ||
                             ep1->bLength != USB_DT_ENDPOINT_SIZE ||
diff -ur android-tools-4.2.2+git20130529/core/fastboot/usb_linux.c 
android-tools-local/core/fastboot/usb_linux.c
--- android-tools-4.2.2+git20130529/core/fastboot/usb_linux.c   2013-05-30 
06:16:54.000000000 +1000
+++ android-tools-local/core/fastboot/usb_linux.c       2014-08-29 
14:03:41.189491186 +1000
@@ -217,6 +217,11 @@
             len -= ept->bLength;
             ptr += ept->bLength;
 
+            if (check(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;
+            }
+
             if((ept->bmAttributes & 0x03) != 0x02)
                 continue;
 

-- 
Dr Peter Chubb                                  peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au          Software Systems Research Group/NICTA


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to