adb: Fix two problems with device path implementation.
The commands that use "host-serial:<serial-number>:<request>"
service did not handle "-s usb:<path>". 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 <saa@android.com>
diff --git a/adb/sockets.c b/adb/sockets.c
index df223b1..a73fc62 100644
--- a/adb/sockets.c
+++ b/adb/sockets.c
@@ -598,6 +598,10 @@
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. */