How to get Vendor ID of an Android-powered device via adb?
Asked Answered
P

5

17

I have a problem with how to get vendor ID and product ID of an Android-powered device.

Are there any commands of adb that can do this?

I can get vendor id and product id while device inserted, but after installing windows drivers, I could not tell apart the real vendor id if I insert two devices at on time. So I need to find out the vendor ID via ADB or any other connections between the hardware device and the android device.

Proviso answered 10/4, 2012 at 9:48 Comment(0)
C
22

If you are running Ubuntu/Linux Just Key in

lsusb -v

and press enter. It will bring out details of all USB devices. Check for a field called "idVendor" in the results and find your device. Eg: My Motorola Defy[vendor id = 22b8] gives,

" idVendor 0x22b8 Motorola PCS"

Coronary answered 1/1, 2013 at 18:10 Comment(1)
This in no way connects the information that adb has (serial number) to the actual vendor/product id. On this level, having several phones of the same model will make it impossible to recognize them from one another.Khoury
O
4

i don't know whether you got the solution but connecting my phone via USB cable to my computer and typing the below line of code on ubuntu terminal i was able to get Vendor ID

lsusb

For example, if you had a Nexus One connected you would get:

Bus 002 Device 004: ID 18d1:4e12

In this case the Vendor Id is “18d1″ and the Product ID is “4e12″. (we are interested in vendor id of course)

Originate answered 24/3, 2016 at 6:40 Comment(2)
i'm getting lsusb: /sys/bus/usb/devices//1-2: Permission denied on mac.Withdrew
@NoumanCh You just need to type lsusb only on the terminal. Try also to make sure your phone is accessible from the computer. e.g if you has set usb configuration to charging only, you can change to transfer filesOriginate
P
2

ADB itself will not help find the Vendor ID of a connected piece of hardware, indeed (for the Google ADB driver) it's necessary to have the Vendor ID set up in advance of it working with ADB.

Fortunately, there's an easy way to find the Vendor ID (and Product ID) of any device connected to a Windows PC. The device doesn't even need drivers for this approach to work:

  1. Start Device Manager
  2. In the Hardware tree, right-click the hardware entry for the device for which the Vendor ID is to be determined.

Properties for item to be checked

  1. On the Details tab, set the property drop-down to be "Hardware Ids". The Vendor ID is the 4 character hexadecimal number following the letters VID_. In the case below, the Vendor ID is 18D1:

Showing the Vendor and Product ID

The PID_, which follows, is the Product ID. It also has a 4-digit hexadecimal number.

Prescribe answered 17/12, 2015 at 18:59 Comment(0)
L
1

if you want to get in your android application you can use following code

    UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
    HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
    Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
    while (deviceIterator.hasNext()) {
        UsbDevice device = deviceIterator.next();

        Log.e("DB", gson.toJson(device));
    }
Labdanum answered 20/10, 2020 at 8:27 Comment(0)
D
0

Hope this link help you

-s serialNumber is the adb command that give you a specific emulator/device instance, referred to by its adb-assigned serial number (such as "emulator-5556").I think this is the adb command that you are looking for.

Dolf answered 10/4, 2012 at 13:13 Comment(1)
thanks for your answer,I know serialNumber,and it should be encoded partly with pid and vid,but I don't know how.I want the ID for windows not for Android.Proviso

© 2022 - 2024 — McMap. All rights reserved.