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

Commit d6391c6a authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

merge from open-source master

parents d8bdf217 5a912bf0
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ void help()
        "\n"
        "device commands:\n"
        "  adb push <local> <remote>    - copy file/dir to device\n"
        "  adb pull <remote> <local>    - copy file/dir from device\n"
        "  adb pull <remote> [<local>]  - copy file/dir from device\n"
        "  adb sync [ <directory> ]     - copy host->device only if changed\n"
        "                                 (see 'adb help all')\n"
        "  adb shell                    - run remote shell interactively\n"
@@ -951,10 +951,8 @@ top:
    }

    if(!strcmp(argv[0], "bugreport")) {
        if (argc != 1) {
            return 1;
        }
        do_cmd(ttype, serial, "shell", "dumpstate", "-", 0);
        if (argc != 1) return usage();
        do_cmd(ttype, serial, "shell", "bugreport", 0);
        return 0;
    }

@@ -1022,8 +1020,13 @@ top:
    }

    if(!strcmp(argv[0], "pull")) {
        if(argc != 3) return usage();
        if (argc == 2) {
            return do_sync_pull(argv[1], ".");
        } else if (argc == 3) {
            return do_sync_pull(argv[1], argv[2]);
        } else {
            return usage();
        }
    }

    if(!strcmp(argv[0], "install")) {
+63 −64
Original line number Diff line number Diff line
@@ -150,13 +150,13 @@ static void find_usb_device(const char *base,
        while((de = readdir(devdir))) {
            unsigned char devdesc[256];
            unsigned char* bufptr = devdesc;
            unsigned char* bufend;
            struct usb_device_descriptor* device;
            struct usb_config_descriptor* config;
            struct usb_interface_descriptor* interface;
            struct usb_endpoint_descriptor *ep1, *ep2;
            unsigned zero_mask = 0;
            unsigned vid, pid;
            int i, interfaces;
            size_t desclength;

            if(badname(de->d_name)) continue;
@@ -173,6 +173,7 @@ static void find_usb_device(const char *base,
            }

            desclength = adb_read(fd, devdesc, sizeof(devdesc));
            bufend = bufptr + desclength;

                // should have device and configuration descriptors, and atleast two endpoints
            if (desclength < USB_DT_DEVICE_SIZE + USB_DT_CONFIG_SIZE) {
@@ -203,17 +204,17 @@ static void find_usb_device(const char *base,
                continue;
            }

                // loop through all the interfaces and look for the ADB interface
            interfaces = config->bNumInterfaces;
            for (i = 0; i < interfaces; i++) {
                if (bufptr + USB_DT_ENDPOINT_SIZE > devdesc + desclength)
                    break;
                // loop through all the descriptors and look for the ADB interface
            while (bufptr < bufend) {
                unsigned char length = bufptr[0];
                unsigned char type = bufptr[1];

                if (type == USB_DT_INTERFACE) {
                    interface = (struct usb_interface_descriptor *)bufptr;
                bufptr += USB_DT_INTERFACE_SIZE;
                if (interface->bLength != USB_DT_INTERFACE_SIZE ||
                    interface->bDescriptorType != USB_DT_INTERFACE) {
                    D("usb_interface_descriptor not found\n");
                    bufptr += length;

                    if (length != USB_DT_INTERFACE_SIZE) {
                        D("interface descriptor has wrong size\n");
                        break;
                    }

@@ -248,7 +249,6 @@ static void find_usb_device(const char *base,
                            D("bulk endpoints not found\n");
                            continue;
                        }

                            /* aproto 01 needs 0 termination */
                        if(interface->bInterfaceProtocol == 0x01) {
                            zero_mask = ep1->wMaxPacketSize - 1;
@@ -265,13 +265,12 @@ static void find_usb_device(const char *base,

                        register_device_callback(devname, local_ep_in, local_ep_out,
                                interface->bInterfaceNumber, device->iSerialNumber, zero_mask);

                        break;
                    }
                } else {
                    // seek next interface descriptor
                    bufptr += (USB_DT_ENDPOINT_SIZE * interface->bNumEndpoints);
                    bufptr += length;
                }
            } // end of for
            } // end of while

            adb_close(fd);
        } // end of devdir while
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@
#define VENDOR_ID_FOXCONN       0x0489
// Dell's USB Vendor ID
#define VENDOR_ID_DELL          0x413c
// Nvidia's USB Vendor ID
#define VENDOR_ID_NVIDIA        0x0955
// Garmin-Asus's USB Vendor ID
#define VENDOR_ID_GARMIN_ASUS   0x091E

@@ -71,6 +73,7 @@ int builtInVendorIds[] = {
    VENDOR_ID_SONY_ERICSSON,
    VENDOR_ID_FOXCONN,
    VENDOR_ID_DELL,
    VENDOR_ID_NVIDIA,
    VENDOR_ID_GARMIN_ASUS,
};