From f324180c13f3fb1e7bd9ea0d71a40dc0d24be2f7 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 28 Sep 2016 09:43:38 +0000 Subject: 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 --- devel/android-tools-adb-devel/Makefile | 2 +- devel/android-tools-adb-devel/files/usb_libusb.cpp | 52 +++------------------- 2 files changed, 8 insertions(+), 46 deletions(-) (limited to 'devel/android-tools-adb-devel') 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; } } -- cgit v1.2.3