FreeBSD Bugzilla – Attachment 157953 Details for
Bug 199185
[devel/android-tools-adb][patch] Accept devices w/o serial number
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Ignore non-ASCII languages
adb_libusb_serial_cleanup.diff (text/plain), 5.40 KB, created by
Jan Beich
on 2015-06-21 20:44:42 UTC
(
hide
)
Description:
Ignore non-ASCII languages
Filename:
MIME Type:
Creator:
Jan Beich
Created:
2015-06-21 20:44:42 UTC
Size:
5.40 KB
patch
obsolete
>Index: devel/android-tools-adb/files/patch-usb_libusb.c >=================================================================== >--- devel/android-tools-adb/files/patch-usb_libusb.c (revision 390139) >+++ devel/android-tools-adb/files/patch-usb_libusb.c (working copy) >@@ -1,5 +1,5 @@ >---- usb_libusb.c.orig 2013-08-01 17:14:17.000000000 +0800 >-+++ usb_libusb.c 2013-08-01 17:14:46.000000000 +0800 >+--- usb_libusb.c.orig 2015-04-13 15:24:18 UTC >++++ usb_libusb.c > @@ -37,7 +37,7 @@ > #define TRACE_TAG TRACE_USB > #include "adb.h" >@@ -22,3 +22,62 @@ > > return (1); > } >+@@ -484,51 +488,13 @@ check_device(libusb_device *dev) >+ goto fail; >+ } >+ >+- if (desc.iSerialNumber) { >+- // reading serial >+- uint16_t buffer[128] = {0}; >+- uint16_t languages[128] = {0}; >+- int languageCount = 0; >+- >+- memset(languages, 0, sizeof(languages)); >+- r = libusb_control_transfer(uh.devh, >+- LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, >+- LIBUSB_REQUEST_GET_DESCRIPTOR, LIBUSB_DT_STRING << 8, >+- 0, (uint8_t *)languages, sizeof(languages), 0); >+- >+- if (r <= 0) { >+- D("check_device(): Failed to get languages count\n"); >+- goto fail; >+- } >+- >+- languageCount = (r - 2) / 2; >+- >+- for (i = 1; i <= languageCount; ++i) { >+- memset(buffer, 0, sizeof(buffer)); >+- >+- r = libusb_control_transfer(uh.devh, >+- LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, >+- LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | desc.iSerialNumber, >+- languages[i], (uint8_t *)buffer, sizeof(buffer), 0); >+- >+- if (r > 0) { /* converting serial */ >+- int j = 0; >+- r /= 2; >+- >+- for (j = 1; j < r; ++j) >+- serial[j - 1] = buffer[j]; >+- >+- serial[j - 1] = '\0'; >+- break; /* languagesCount cycle */ >+- } >+- } >+- >+- if (register_device(&uh, serial) == 0) { >+- D("check_device(): Failed to register device\n"); >+- goto fail_interface; >+- } >+- >+- libusb_ref_device(dev); >++ if (desc.iSerialNumber != 0) { >++ libusb_get_string_descriptor_ascii(uh.devh, desc.iSerialNumber, >++ (unsigned char *)uh.serial, sizeof(uh.serial)); >++ } >++ if (register_device(&uh, uh.serial) == 0) { >++ D("check_device(): Failed to register device\n"); >++ goto fail_interface; >+ } >+ } >+ >Index: devel/android-tools-adb-devel/files/usb_libusb.cpp >=================================================================== >--- devel/android-tools-adb-devel/files/usb_libusb.cpp (revision 390139) >+++ devel/android-tools-adb-devel/files/usb_libusb.cpp (working copy) >@@ -484,52 +484,14 @@ check_device(libusb_device *dev) > goto fail; > } > >- if (desc.iSerialNumber) { >- // reading serial >- uint16_t buffer[128] = {0}; >- uint16_t languages[128] = {0}; >- int languageCount = 0; >- >- memset(languages, 0, sizeof(languages)); >- r = libusb_control_transfer(uh.devh, >- LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, >- LIBUSB_REQUEST_GET_DESCRIPTOR, LIBUSB_DT_STRING << 8, >- 0, (uint8_t *)languages, sizeof(languages), 0); >- >- if (r <= 0) { >- D("check_device(): Failed to get languages count\n"); >- goto fail; >- } >- >- languageCount = (r - 2) / 2; >- >- for (i = 1; i <= languageCount; ++i) { >- memset(buffer, 0, sizeof(buffer)); >- >- r = libusb_control_transfer(uh.devh, >- LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, >- LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | desc.iSerialNumber, >- languages[i], (uint8_t *)buffer, sizeof(buffer), 0); >- >- if (r > 0) { /* converting serial */ >- int j = 0; >- r /= 2; >- >- for (j = 1; j < r; ++j) >- serial[j - 1] = buffer[j]; >- >- serial[j - 1] = '\0'; >- break; /* languagesCount cycle */ >- } >- } >- >- if (register_device(&uh, serial) == 0) { >- D("check_device(): Failed to register device\n"); >- goto fail_interface; >- } >- >- libusb_ref_device(dev); >+ if (desc.iSerialNumber != 0) { >+ libusb_get_string_descriptor_ascii(uh.devh, desc.iSerialNumber, >+ (unsigned char *)uh.serial, sizeof(uh.serial)); > } >+ if (register_device(&uh, uh.serial) == 0) { >+ D("check_device(): Failed to register device\n"); >+ goto fail_interface; >+ } > } > > return;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 199185
:
155214
| 157953