diff options
author | jbeich <jbeich@FreeBSD.org> | 2016-09-28 17:43:38 +0800 |
---|---|---|
committer | jbeich <jbeich@FreeBSD.org> | 2016-09-28 17:43:38 +0800 |
commit | e23a51d6348bc8b1277daf4cee37390699d2cdc0 (patch) | |
tree | 8b6758596b1b19caf02371cb5df2c1a92ef1bbe4 /devel | |
parent | 9bd8e6463a124f4412fd390044941b0c9a2736aa (diff) | |
download | freebsd-ports-gnome-e23a51d6348bc8b1277daf4cee37390699d2cdc0.tar.gz freebsd-ports-gnome-e23a51d6348bc8b1277daf4cee37390699d2cdc0.tar.zst freebsd-ports-gnome-e23a51d6348bc8b1277daf4cee37390699d2cdc0.zip |
devel/android-tools-adb{,-devel}: drop unnecessary non-ASCII serial handling
Linux replaced the code as well in
https://android.googlesource.com/platform/system/core/+/9309ecbcec42%5E!/
PR: 199185
Diffstat (limited to 'devel')
-rw-r--r-- | devel/android-tools-adb-devel/Makefile | 2 | ||||
-rw-r--r-- | devel/android-tools-adb-devel/files/usb_libusb.cpp | 52 | ||||
-rw-r--r-- | devel/android-tools-adb/Makefile | 2 | ||||
-rw-r--r-- | devel/android-tools-adb/files/usb_libusb.cpp | 52 |
4 files changed, 16 insertions, 92 deletions
diff --git a/devel/android-tools-adb-devel/Makefile b/devel/android-tools-adb-devel/Makefile index 2f6deaf378cb..4706fe003561 100644 --- a/devel/android-tools-adb-devel/Makefile +++ b/devel/android-tools-adb-devel/Makefile @@ -3,7 +3,7 @@ # Hint: git describe --abbrev=12 --match android-n-preview-5 DISTVERSION= n-preview-5-126 DISTVERSIONSUFFIX= -g2f21b7cecda2 -PORTREVISION= 0 +PORTREVISION= 1 PKGNAMESUFFIX= -devel CONFLICTS_INSTALL= ${PORTNAME}-[0-9]* diff --git a/devel/android-tools-adb-devel/files/usb_libusb.cpp b/devel/android-tools-adb-devel/files/usb_libusb.cpp index cfed6aa214e6..abc5522cf2ea 100644 --- a/devel/android-tools-adb-devel/files/usb_libusb.cpp +++ b/devel/android-tools-adb-devel/files/usb_libusb.cpp @@ -484,51 +484,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"); - 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"); - 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; } } diff --git a/devel/android-tools-adb/Makefile b/devel/android-tools-adb/Makefile index d0df4e87f4bc..c28df87d9faa 100644 --- a/devel/android-tools-adb/Makefile +++ b/devel/android-tools-adb/Makefile @@ -3,7 +3,7 @@ PORTNAME= android-tools-adb DISTVERSIONPREFIX= android- DISTVERSION?= 7.0.0_r1 -PORTREVISION?= 0 +PORTREVISION?= 1 CATEGORIES= devel .ifndef EXTRA_PATCHES PATCH_SITES= https://github.com/android/platform_system_core/commit/ diff --git a/devel/android-tools-adb/files/usb_libusb.cpp b/devel/android-tools-adb/files/usb_libusb.cpp index cfed6aa214e6..abc5522cf2ea 100644 --- a/devel/android-tools-adb/files/usb_libusb.cpp +++ b/devel/android-tools-adb/files/usb_libusb.cpp @@ -484,51 +484,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"); - 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"); - 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; } } |