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

Commit 66e4691a authored by Xavier Ducrohet's avatar Xavier Ducrohet Committed by The Android Open Source Project
Browse files

AI 149490: Add support for 3rd party USB Vendor.

  BUG=1890147

Automated import of CL 149490
parent 8fbedcf7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ LOCAL_SRC_FILES := \
	$(USB_SRCS) \
	shlist.c \
	utils.c \
	usb_vendors.c \


ifneq ($(USE_SYSDEPS_WIN32),)
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@

#if !ADB_HOST
#include <private/android_filesystem_config.h>
#else
#include "usb_vendors.h"
#endif


@@ -846,6 +848,7 @@ int adb_main(int is_daemon)

#if ADB_HOST
    HOST = 1;
    usb_vendors_init();
    usb_init();
    local_init();

+5 −12
Original line number Diff line number Diff line
@@ -357,18 +357,9 @@ typedef enum {
#define ADB_PORT 5037
#define ADB_LOCAL_TRANSPORT_PORT 5555

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

// products for VENDOR_ID_GOOGLE
#define PRODUCT_ID_SOONER       0xd00d  // Sooner bootloader
#define PRODUCT_ID_SOONER_COMP  0xdeed  // Sooner composite device

// products for VENDOR_ID_HTC
#define PRODUCT_ID_DREAM        0x0c01  // Dream bootloader
#define PRODUCT_ID_DREAM_COMP   0x0c02  // Dream composite device
#define ADB_CLASS              0xff
#define ADB_SUBCLASS           0x42
#define ADB_PROTOCOL           0x1

void local_init();
int  local_connect(int  port);
@@ -382,7 +373,9 @@ int usb_close(usb_handle *h);
void usb_kick(usb_handle *h);

/* used for USB device detection */
#if ADB_HOST
int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol);
#endif

unsigned host_to_le32(unsigned n);
int adb_commandline(int argc, char **argv);
+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
+15 −13
Original line number Diff line number Diff line
@@ -23,6 +23,10 @@
#define  TRACE_TAG  TRACE_TRANSPORT
#include "adb.h"

#if ADB_HOST
#include "usb_vendors.h"
#endif

/* XXX better define? */
#ifdef __ppc__
#define H4(x)	(((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | (((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24)
@@ -125,23 +129,21 @@ void init_usb_transport(atransport *t, usb_handle *h)
#endif
}

#if ADB_HOST
int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol)
{
    if (vid == VENDOR_ID_GOOGLE) {
            /* might support adb */
    } else if (vid == VENDOR_ID_HTC) {
            /* might support adb */
    } else {
            /* not supported */
        return 0;
    unsigned i;
    for (i = 0; i < vendorIdCount; i++) {
        if (vid == vendorIds[i]) {
            if (usb_class == ADB_CLASS && usb_subclass == ADB_SUBCLASS &&
                    usb_protocol == ADB_PROTOCOL) {
                return 1;
            }

        /* class:vendor (0xff) subclass:android (0x42) proto:adb (0x01) */
    if(usb_class == 0xff) {
        if((usb_subclass == 0x42) && (usb_protocol == 0x01)) {
            return 1;
            return 0;
        }
    }

    return 0;
}
#endif
Loading