Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Sep 2016 09:43:38 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r422863 - in head/devel: android-tools-adb android-tools-adb-devel android-tools-adb-devel/files android-tools-adb/files
Message-ID:  <201609280943.u8S9hclU080845@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Wed Sep 28 09:43:38 2016
New Revision: 422863
URL: https://svnweb.freebsd.org/changeset/ports/422863

Log:
  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

Modified:
  head/devel/android-tools-adb-devel/Makefile   (contents, props changed)
  head/devel/android-tools-adb-devel/files/usb_libusb.cpp
  head/devel/android-tools-adb/Makefile   (contents, props changed)
  head/devel/android-tools-adb/files/usb_libusb.cpp

Modified: head/devel/android-tools-adb-devel/Makefile
==============================================================================
--- head/devel/android-tools-adb-devel/Makefile	Wed Sep 28 09:01:46 2016	(r422862)
+++ head/devel/android-tools-adb-devel/Makefile	Wed Sep 28 09:43:38 2016	(r422863)
@@ -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]*

Modified: head/devel/android-tools-adb-devel/files/usb_libusb.cpp
==============================================================================
--- head/devel/android-tools-adb-devel/files/usb_libusb.cpp	Wed Sep 28 09:01:46 2016	(r422862)
+++ head/devel/android-tools-adb-devel/files/usb_libusb.cpp	Wed Sep 28 09:43:38 2016	(r422863)
@@ -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;
         }
     }
 

Modified: head/devel/android-tools-adb/Makefile
==============================================================================
--- head/devel/android-tools-adb/Makefile	Wed Sep 28 09:01:46 2016	(r422862)
+++ head/devel/android-tools-adb/Makefile	Wed Sep 28 09:43:38 2016	(r422863)
@@ -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/

Modified: head/devel/android-tools-adb/files/usb_libusb.cpp
==============================================================================
--- head/devel/android-tools-adb/files/usb_libusb.cpp	Wed Sep 28 09:01:46 2016	(r422862)
+++ head/devel/android-tools-adb/files/usb_libusb.cpp	Wed Sep 28 09:43:38 2016	(r422863)
@@ -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;
         }
     }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609280943.u8S9hclU080845>