aboutsummaryrefslogtreecommitdiffstats
path: root/fastboot
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2012-06-06 11:53:33 -0700
committerJP Abgrall <jpa@google.com>2012-06-06 11:53:33 -0700
commita032dedefe275b1d5a08b9856dfcfcb12579b4a7 (patch)
treeb92f30e9ffa72e2f9866c3d13d76f1dfec39bfd7 /fastboot
parent845f106a93d5f8ed710c80293d22d23e1b17ed3c (diff)
downloadsystem_core-a032dedefe275b1d5a08b9856dfcfcb12579b4a7.tar.gz
system_core-a032dedefe275b1d5a08b9856dfcfcb12579b4a7.tar.bz2
system_core-a032dedefe275b1d5a08b9856dfcfcb12579b4a7.zip
fastboot: Let "fastboot devices" work in all cases
Ignore ANDROID_SERIAL when requesting to list devices, or else it is impossible to list devices without unsetting the env var. Even ANDROID_SERIAL= fastboot devices or fastboot -s "" devices won't work. Change-Id: Ie92f35bda852c6ecea4ebaefb75b8f18c10b6d0c
Diffstat (limited to 'fastboot')
-rw-r--r--fastboot/fastboot.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index c44f9379..544893bd 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -151,6 +151,11 @@ oops:
int match_fastboot(usb_ifc_info *info)
{
+ return match_fastboot_with_serial(info, serial);
+}
+
+int match_fastboot_with_serial(usb_ifc_info *info, const char *local_serial)
+{
if(!(vendor_id && (info->dev_vendor == vendor_id)) &&
(info->dev_vendor != 0x18d1) && // Google
(info->dev_vendor != 0x8087) && // Intel
@@ -170,14 +175,14 @@ int match_fastboot(usb_ifc_info *info)
if(info->ifc_protocol != 0x03) return -1;
// require matching serial number or device path if requested
// at the command line with the -s option.
- if (serial && (strcmp(serial, info->serial_number) != 0 &&
- strcmp(serial, info->device_path) != 0)) return -1;
+ if (local_serial && (strcmp(local_serial, info->serial_number) != 0 &&
+ strcmp(local_serial, info->device_path) != 0)) return -1;
return 0;
}
int list_devices_callback(usb_ifc_info *info)
{
- if (match_fastboot(info) == 0) {
+ if (match_fastboot_with_serial(info, NULL) == 0) {
char* serial = info->serial_number;
if (!info->writable) {
serial = "no permissions"; // like "adb devices"