Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

vendor

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.

like image 378
user1323681 Avatar asked Apr 10 '12 09:04

user1323681


4 Answers

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"

like image 59
Ajith Memana Avatar answered Oct 31 '22 11:10

Ajith Memana


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)

like image 31
Edijae Crusar Avatar answered Oct 31 '22 12:10

Edijae Crusar


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.

like image 2
CJBS Avatar answered Oct 31 '22 10:10

CJBS


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));
    }
like image 1
rookieDeveloper Avatar answered Oct 31 '22 12:10

rookieDeveloper