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

Commit a481d096 authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

Support for 3rd party USB Vendor IDs in adb.

Vendor IDs are read from ~/.android/adb_usb.ini. The format is very simple:
1 number per line. First number is ID count, followed by the ID themselves.
Lines starting with # are considered comments.

Other misc changes: moved VENDOR_ID_* to usb_vendors.c to prevent direct
access. Made transport_usb.c reuse the USB constant introduced in usb_osx
(moved them to adb.h)
parent a09fbd16
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -919,9 +919,6 @@ int adb_main(int is_daemon)
    fdevent_loop();

    usb_cleanup();
#if ADB_HOST
    usb_vendors_cleanup();
#endif

    return 0;
}
+3 −4
Original line number Diff line number Diff line
@@ -357,11 +357,10 @@ typedef enum {
#define ADB_PORT 5037
#define ADB_LOCAL_TRANSPORT_PORT 5555

// Google's USB Vendor ID
#define VENDOR_ID_GOOGLE        0x18d1
#define ADB_CLASS              0xff
#define ADB_SUBCLASS           0x42
#define ADB_PROTOCOL           0x1

// HTC's USB Vendor ID
#define VENDOR_ID_HTC           0x0bb4

void local_init();
int  local_connect(int  port);
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ int adb_connect(const char *service)
            fprintf(stdout,"* daemon started successfully *\n");
        }
        /* give the server some time to start properly and detect devices */
        adb_sleep_ms(2000);
        adb_sleep_ms(3000);
        // fall through to _adb_connect
    } else {
        // if server was running, check its version to make sure it is not out of date
+3 −5
Original line number Diff line number Diff line
@@ -135,12 +135,10 @@ int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_
    unsigned i;
    for (i = 0; i < vendorIdCount; i++) {
        if (vid == vendorIds[i]) {
            /* class:vendor (0xff) subclass:android (0x42) proto:adb (0x01) */
            if(usb_class == 0xff) {
                if((usb_subclass == 0x42) && (usb_protocol == 0x01)) {
            if (usb_class == ADB_CLASS && usb_subclass == ADB_SUBCLASS &&
                    usb_protocol == ADB_PROTOCOL) {
                return 1;
            }
            }

            return 0;
        }
+0 −3
Original line number Diff line number Diff line
@@ -32,9 +32,6 @@

#define  DBG   D

#define ADB_SUBCLASS           0x42
#define ADB_PROTOCOL           0x1

static IONotificationPortRef    notificationPort = 0;
static io_iterator_t*           notificationIterators;

Loading