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>
This commit is contained in:
Scott Anderson 2012-05-31 12:04:23 -07:00
parent c7993af64b
commit 3608d83242
2 changed files with 4 additions and 3 deletions

View File

@ -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. */

View File

@ -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);