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

Commit 8f3b8873 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

adb: cleanup some portions of client usb interfaces

Cleanup to remove open coded functions.

Test: build
Bug: 63736262
Bug: 38446744
Bug: 66912053
Change-Id: I3e6e5a22542934837b6a03523987141dc2776d48
parent 0a78cc1b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ static void find_usb_device(const std::string& base,
                            continue;
                        }
                            /* aproto 01 needs 0 termination */
                        if (interface->bInterfaceProtocol == 0x01) {
                        if (interface->bInterfaceProtocol == ADB_PROTOCOL) {
                            max_packet_size = ep1->wMaxPacketSize;
                            zero_mask = ep1->wMaxPacketSize - 1;
                        }
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ AndroidInterfaceAdded(io_iterator_t iterator)
        kr = (*iface)->GetInterfaceClass(iface, &if_class);
        kr = (*iface)->GetInterfaceSubClass(iface, &subclass);
        kr = (*iface)->GetInterfaceProtocol(iface, &protocol);
        if(if_class != ADB_CLASS || subclass != ADB_SUBCLASS || protocol != ADB_PROTOCOL) {
        if (!is_adb_interface(if_class, subclass, protocol)) {
            // Ignore non-ADB devices.
            LOG(DEBUG) << "Ignoring interface with incorrect class/subclass/protocol - " << if_class
                       << ", " << subclass << ", " << protocol;
+14 −16
Original line number Diff line number Diff line
@@ -531,9 +531,11 @@ int recognized_device(usb_handle* handle) {
        return 0;
    }

    if (is_adb_interface(interf_desc.bInterfaceClass, interf_desc.bInterfaceSubClass,
    if (!is_adb_interface(interf_desc.bInterfaceClass, interf_desc.bInterfaceSubClass,
                          interf_desc.bInterfaceProtocol)) {
        if (interf_desc.bInterfaceProtocol == 0x01) {
        return 0;
    }

    AdbEndpointInformation endpoint_info;
    // assuming zero is a valid bulk endpoint ID
    if (AdbGetEndpointInformation(handle->adb_interface, 0, &endpoint_info)) {
@@ -544,14 +546,10 @@ int recognized_device(usb_handle* handle) {
        D("AdbGetEndpointInformation failed: %s",
          android::base::SystemErrorCodeToString(GetLastError()).c_str());
    }
        }

    return 1;
}

    return 0;
}

void find_devices() {
    usb_handle* handle = NULL;
    char entry_buffer[2048];