020-cherry-picked-superspeed-fix.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 58b01e01875e2f6ae593ded197430bc23713dd0a Mon Sep 17 00:00:00 2001
  2. From: Ingo Rohloff <lundril@gmx.de>
  3. Date: Fri, 16 May 2014 21:51:41 +0200
  4. Subject: [PATCH] ADB on linux: Handle USB SuperSpeed extra Descriptors
  5. Under Linux, ADB manually parses USB Descriptors to check for
  6. possible ADB USB Interfaces. USB Devices connected with SuperSpeed
  7. will exhibit extra USB SuperSpeed Endpoint Companion Descriptors.
  8. This patch handles these USB SuperSpeed specific USB Descriptors.
  9. Change-Id: Icd1e5fdde0b324c7df4f933583499f2c52a922f3
  10. Signed-off-by: Ingo Rohloff <lundril@gmx.de>
  11. ---
  12. adb/usb_linux.c | 12 ++++++++++++
  13. 1 file changed, 12 insertions(+)
  14. --- a/adb/usb_linux.c
  15. +++ b/adb/usb_linux.c
  16. @@ -238,8 +238,20 @@ static void find_usb_device(const char *
  17. // looks like ADB...
  18. ep1 = (struct usb_endpoint_descriptor *)bufptr;
  19. bufptr += USB_DT_ENDPOINT_SIZE;
  20. + // For USB 3.0 SuperSpeed devices, skip potential
  21. + // USB 3.0 SuperSpeed Endpoint Companion descriptor
  22. + if (bufptr+2 <= devdesc + desclength &&
  23. + bufptr[0] == USB_DT_SS_EP_COMP_SIZE &&
  24. + bufptr[1] == USB_DT_SS_ENDPOINT_COMP) {
  25. + bufptr += USB_DT_SS_EP_COMP_SIZE;
  26. + }
  27. ep2 = (struct usb_endpoint_descriptor *)bufptr;
  28. bufptr += USB_DT_ENDPOINT_SIZE;
  29. + if (bufptr+2 <= devdesc + desclength &&
  30. + bufptr[0] == USB_DT_SS_EP_COMP_SIZE &&
  31. + bufptr[1] == USB_DT_SS_ENDPOINT_COMP) {
  32. + bufptr += USB_DT_SS_EP_COMP_SIZE;
  33. + }
  34. if (bufptr > devdesc + desclength ||
  35. ep1->bLength != USB_DT_ENDPOINT_SIZE ||