There are hundreds of USB units in the marketplace—keyboards, scanners, printers, mouses, and numerous others that every one work on Linux. Their vendor particulars are saved within the USB ID Repository.
lsusb
The Linux lsusb
command lists details about the USB units linked to a system, however typically the knowledge is incomplete. For instance, I not too long ago seen that the model of one in every of my USB units was not acknowledged. the gadget was practical, however itemizing the small print of my linked USB units offered no identification data. Here is the output from my lsusb
command:
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation three.zero root hub
Bus 001 Device 004: ID 046d:082c Logitech, Inc.
Bus 001 Device 003: ID 0951:16d2 Kingston Technology
Bus 001 Device 002: ID 18f8:1486
Bus 001 Device zero05: ID 051d:zero002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 001: ID 1d6b:zero002 Linux Foundation 2.zero root hub
As you possibly can see within the final column, there’s one gadget with no producers description. To decide what the gadget is, I must do a deeper inspection of my USB gadget tree. Fortunately, the lsusb
command has extra choices. One is -D gadget
, to elicit per-device particulars, as the person web page explains:
“Do not scan the /dev/bus/usb listing, as an alternative show solely details about the gadget whose gadget file is given. The gadget file must be one thing like /dev/bus/usb/001/001. This choice shows detailed data just like the v choice; you should be root to do that.”
I did not assume it was simply obvious how you can move the gadget path to the lsusb command, however after rigorously studying the person web page and the preliminary output I used to be capable of decide how you can assemble it. USB units reside within the UDEV filesystem. Their gadget path begins within the USB gadget listing /dev/bus/usb/
. The remainder of the trail is made up of the gadget’s Bus ID and Device ID. My non-descript gadget is Bus 001, Device 002, which interprets to 001/002, and completes the trail /dev/bus/usb/001/002
. Now I can move this path to lsusb
. I will additionally pipe to extra
since there’s typically various data there:
$ lsusb -D /dev/bus/usb/001/002 |extra
Device: ID 18f8:1486
Device Descriptor:
bLength 18
bDescriptorSort 1
bcdUSB 1.10
bDeviceClass zero (Defined at Interface stage)
bDeviceSubClass zero
bDeviceProtocol zero
bMaxPacketSizezero eight
idVendor 0x18f8
idProduct 0x1486
bcdDevice 1.00
iManufacturer zero
iProduct 1
iSerial zero
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorSort 2
wTotalLength 59
bNumInterfaces 2
bConfigurationWorth 1
iConfiguration zero
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorSort four
bInterfaceQuantity zero
bAlternateSetting zero
bNumEndpoints 1
bInterfaceClass three Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface zero
HID Device Descriptor:
Unfortunately, this did not present the element I hoped to seek out. The two fields that seem within the preliminary output, idVendor
and idProduct
, are each empty. There is a few assist, as scanning down a bit reveals the phrase Mouse. A-HA! So, this gadget is my mouse.
The USB ID Repository
This made me marvel how I may populate these fields, not just for myself but in addition for different Linux customers. It seems there’s already an open supply undertaking for this: the USB ID Repository. It is a public repository of all recognized IDs utilized in USB units. It can be utilized in varied applications, together with the USB Utilities, to show human-readable gadget names.
You can browse the repository for explicit units both from the web site or by downloading the database. Users are additionally welcome to submit new knowledge. This is what I did for my mouse, which was absent.
Update your USB IDs
The USB ID database is saved in a file known as usb.ids
. This location could differ relying on the Linux distribution.
On Ubuntu 18.04, this file is positioned in /var/lib/usbutils
. To replace the database, use the command update-usbids
, which you could run with root privileges or with sudo
:
$ sudo update-usbids
If a brand new file is offered, will probably be downloaded. The present file shall be backed up and changed by the brand new one:
$ ls -la
complete 1148
drwxr-xr-x 2 root root 4096 Jan 15 00:34 .
drwxr-xr-x 85 root root 4096 Nov 7 08:05 ..
-rw-r--r-- 1 root root 614379 Jan 9 15:34 usb.ids
-rw-r--r-- 1 root root 551472 Jan 15 00:34 usb.ids.previous
Recent variations of Fedora Linux retailer the database file in /usr/share/hwdata
. Also, there isn’t a replace script. Instead, the database is maintained in a package deal named hwdata
.
# dnf information hwdataInstalled Packages
Name : hwdata
Version : zero.332
Release : 1.fc31
Architecture : noarch
Size : 7.5 M
Source : hwdata-zero.332-1.fc31.src.rpm
Repository : @System
From repo : updates
Summary : Hardware identification and configuration knowledge
URL : https://github.com/vcrhonek/hwdata
License : GPLv2+
Description : hwdata accommodates varied identification and configuration knowledge,
: such as the pci.ids and usb.ids databases.
Now my USB gadget checklist exhibits a reputation subsequent to this beforehand unnamed gadget. Compare this to the output above:
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation three.zero root hub
Bus 001 Device 004: ID 046d:082c Logitech, Inc. HD Webcam C615
Bus 001 Device 003: ID 0951:16d2 Kingston Technology
Bus 001 Device 014: ID 18f8:1486 [Maxxter]
Bus 001 Device zero05: ID 051d:zero002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 001: ID 1d6b:zero002 Linux Foundation 2.zero root hub
You could discover that different gadget descriptions change because the repository is repeatedly up to date with new units and particulars about current ones.
Submit new knowledge
There are two methods to submit new knowledge: by utilizing the online interface or by emailing a specifically formatted patch file. Before I started, I learn by means of the submission pointers. First, I needed to register an account, after which I wanted to make use of the undertaking’s submission system to supply my mouse’s ID and identify. The course of is identical for including any USB gadget.
Have you used the USB ID Repository? If so, please share your response within the feedback.