and c050 is the product id looked up as RX 250 Optical Mouse. RX 250 Optical MouseĠ46d is the vendor id looked up as Logitech, Inc. In that case the plain lsusb entry would look like: Bus 006 Device 002: ID 046d:c050 Logitech, Inc. The class of the device is HID, which means a human interface device.
#Linux lsusb vendor product driver
The interessting part in the Driver=usbhid, where you can find out which driver the kernel uses for that specific device. |_ Port 1: Dev 2, If 0, Class=HID, Driver=usbhid, 1.5M A USB-mouse would, for example, look like this: /: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M However, I like the -t option for further information about plugged devices. But, notice an USB device can imitate a wrong id (See Rubber Ducky for example). The lsusb utillity takes his information from a file called /var/lib/usbutils/usb.ids to look up the vendor ids, product ids, classes, subclasses and protocols. and "FT232 USB-Serial (UART) IC" is the right entry for VID:PID 0403:6001 in usb.ids."If it quacks like a keyboard and types like a keyboard it must be a Got ID_MODEL_FROM_DATABASE: FT232 USB-Serial (UART) IC This program (with the Arduino attached) outputs: $. If ((v = udev_device_get_property_value(card, "ID_MODEL_FROM_DATABASE")) )įprintf(stdout, "got ID_MODEL_FROM_DATABASE: %s\n", v) įprintf(stdout, "failed getting ID_MODEL_FROM_DATABASE: %s\n", v)
udev_get_sys_path(udev) for me: '/sys' $ udevadm info -name=/dev/ttyUSB0 -attribute-walk | grep "looking at device" Bus 002 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC build with: gcc -o udevl -ludev -Wall -g udevl.cįprintf(stderr, "Failed to allocate udev context.\n")
#Linux lsusb vendor product install
Here is a small example I just put together, based on udev-util.c - note that I've used an Arduino Duemillanove with FTDI FT232 chip, whose udev path I find using udevadm (see comments in code below), and then I hardcoded it in the below program, udevl.c: // sudo apt-get install libudev-dev Haven't tried this myself, but libudev's udev_device_get_property_value should be it it is used in pulseaudio's udev-util.c as udev_device_get_property_value(card, "ID_VENDOR_FROM_DATABASE")).
Note that when accessing information about the system in Linux OS, it's much preferred to do it via shell commands (such as lsusb) than to directly parse the system files these commands access.
You can also make it be verbose ( lsusb -v) and printing a lot of stuff. MX310 Optical Mouseīus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubīus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub RTL8187 Wireless Adapterīus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubīus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubīus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubīus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubīus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubīus 006 Device 002: ID 046d:c01b Logitech, Inc. You can show information for all devices: $ lsusbīus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubīus 001 Device 004: ID 0421:01c7 Nokia Mobile Phonesīus 001 Device 003: ID 0bda:8187 Realtek Semiconductor Corp. You can use its -d option to query a certain vendor/product (but it seems to work only for currently plugged devices): $ lsusb -d 0e21:0750īus 001 Device 005: ID 0e21:0750 Cowon Systems, Inc.
Lsusb command queries information about currently plugged USB devices.