Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51d827aa authored by JP Abgrall's avatar JP Abgrall Committed by Android (Google) Code Review
Browse files

Merge "fastboot: Let "fastboot devices" work in all cases"

parents 3b8f00c9 a032dede
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -150,6 +150,11 @@ oops:
#endif

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
@@ -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"