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

Commit 425aefdc authored by Josh Gao's avatar Josh Gao
Browse files

adb: libusb: recognize devices with multiple interfaces.

A bug was introduced by commit 8bf37d7a wherein we accidentally only
look at the first interface of a device when checking whether a USB
device was an ADB device or not.

Bug: http://b/38201318
Test: none
Change-Id: I8e8e0963c77cd2cb03538d926ab735f4b57e52b7
parent 3f60a968
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -237,7 +237,7 @@ static void process_device(libusb_device* device) {
            // TODO: Is this assumption valid?
            // TODO: Is this assumption valid?
            LOG(VERBOSE) << "skipping interface with incorrect num_altsetting at " << device_address
            LOG(VERBOSE) << "skipping interface with incorrect num_altsetting at " << device_address
                         << " (interface " << interface_num << ")";
                         << " (interface " << interface_num << ")";
            return;
            continue;
        }
        }


        const libusb_interface_descriptor& interface_desc = interface.altsetting[0];
        const libusb_interface_descriptor& interface_desc = interface.altsetting[0];
@@ -245,7 +245,7 @@ static void process_device(libusb_device* device) {
                              interface_desc.bInterfaceProtocol)) {
                              interface_desc.bInterfaceProtocol)) {
            LOG(VERBOSE) << "skipping non-adb interface at " << device_address << " (interface "
            LOG(VERBOSE) << "skipping non-adb interface at " << device_address << " (interface "
                         << interface_num << ")";
                         << interface_num << ")";
            return;
            continue;
        }
        }


        LOG(VERBOSE) << "found potential adb interface at " << device_address << " (interface "
        LOG(VERBOSE) << "found potential adb interface at " << device_address << " (interface "
@@ -261,7 +261,7 @@ static void process_device(libusb_device* device) {
            const uint8_t transfer_type = endpoint_attr & LIBUSB_TRANSFER_TYPE_MASK;
            const uint8_t transfer_type = endpoint_attr & LIBUSB_TRANSFER_TYPE_MASK;


            if (transfer_type != LIBUSB_TRANSFER_TYPE_BULK) {
            if (transfer_type != LIBUSB_TRANSFER_TYPE_BULK) {
                return;
                continue;
            }
            }


            if (endpoint_is_output(endpoint_addr) && !found_out) {
            if (endpoint_is_output(endpoint_addr) && !found_out) {