From 3608d832425ca3a6d00c4040f3bb979c5aa49899 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 31 May 2012 12:04:23 -0700 Subject: [PATCH] adb: Fix two problems with device path implementation. The commands that use "host-serial::" service did not handle "-s usb:". The -s parameter is passed as the serial number in the protocol and then matched against either the serial number or device path. However, skip_host_serial() in sockets.c did not know about the usb: syntax, the serial number was parsed incorrectly. Before this change: $ adb -s usb:1-4.1 get-state error: unknown host service After: $ adb -s usb:1-4.1 get-state device Code was added in find_transport() in transport.c to match device paths, but find_transport() is only used for socket connections so matching device paths is not needed. Change-Id: I922cec963659dafadd0fbc8fa36dee3b55fe366c Signed-off-by: Scott Anderson --- adb/sockets.c | 4 ++++ adb/transport.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/adb/sockets.c b/adb/sockets.c index df223b133..a73fc6218 100644 --- a/adb/sockets.c +++ b/adb/sockets.c @@ -598,6 +598,10 @@ unsigned unhex(unsigned char *s, int len) char *skip_host_serial(char *service) { char *first_colon, *serial_end; + if (!strncmp(service, "usb:", 4)) { + return strchr(service + 4, ':'); + } + first_colon = strchr(service, ':'); if (!first_colon) { /* No colon in service string. */ diff --git a/adb/transport.c b/adb/transport.c index 70fc58ed1..9c63640df 100644 --- a/adb/transport.c +++ b/adb/transport.c @@ -922,9 +922,6 @@ atransport *find_transport(const char *serial) if (t->serial && !strcmp(serial, t->serial)) { break; } - if (t->devpath && !strcmp(serial, t->devpath)) { - break; - } } adb_mutex_unlock(&transport_lock);