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.
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"
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)
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:
VID_
. In the case below, the Vendor ID is 18D1
:The PID_
, which follows, is the Product ID. It also has a 4-digit hexadecimal number.
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));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With