diff options
author | Jan Beich <jbeich@FreeBSD.org> | 2016-09-28 09:43:38 +0000 |
---|---|---|
committer | Jan Beich <jbeich@FreeBSD.org> | 2016-09-28 09:43:38 +0000 |
commit | f324180c13f3fb1e7bd9ea0d71a40dc0d24be2f7 (patch) | |
tree | 8b6758596b1b19caf02371cb5df2c1a92ef1bbe4 /devel/android-tools-adb | |
parent | 524a7123fb4c156aeae5853d178fe179eff0175f (diff) | |
download | ports-f324180c13f3fb1e7bd9ea0d71a40dc0d24be2f7.tar.gz ports-f324180c13f3fb1e7bd9ea0d71a40dc0d24be2f7.zip |
Notes
Diffstat (limited to 'devel/android-tools-adb')
-rw-r--r-- | devel/android-tools-adb/Makefile | 2 | ||||
-rw-r--r-- | devel/android-tools-adb/files/usb_libusb.cpp | 52 |
2 files changed, 8 insertions, 46 deletions
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; } } |