Improving the lsusb command’s database
The lsusb command in linux is very useful to find out the unique ids of your USB hardware devices in your computer.
For examle, right now if I do:
yen@yen-laptop:~$ lsusb
Bus 005 Device 003: ID 5986:0100 Bison Acer OrbiCam
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 046d:c01b Logitech, Inc. MX310 Optical Mouse
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
It is able to find my external USB Mouse and my integrated USB Camera.
Those 8 letter-digits that you can see are really useful to find help in the Internet to make your device work on your Linux distribution. For example if I search in google: 5986:0100 , I will get around 700 results of people talking about my exactly same model of Webcam and how to make it work in linux (in case it doesn’t work out of the box).
Then I wondered how is the program able to find the description of the device, example: “Bison Acer OrbiCam”, I guessed he was using some kind of internal database and I made a few more research. I realized that everything is stored in a file named usb.ids (Note: Freebsd structure is different).
That file can be found at:
/var/lib/misc/usb.ids which is maintained by SVN here.
and it’s maintained by the people of the linux-usb project.
To update your usb.ids files to the most recent one, you can use the command “sudo update-usbids” which basically will download it from their site.
So far so good, but around December last year, the database was still a bit poor (only around 4.000 USB devices) and it coudn’t find many of my stuff, so I decided to help them.
Profiting that I love python and python is perfect for text treatment(most easy and powerful language I’ve ever seen) and Web Scraping.
First thing I had to do is to find out there some sources to take USB device descriptions from USB Ids, after googling a bit I got important sources:
- The FreeBSD separated usb ids project. (479 new USB devices)
- Official USB.org list (278 new USB vendor ids)
-Some personal project site. (156 new usb ids)
-And the big pie…. the DriverAgent.com website(web scrapping from python script) (5470 new ids).
I have attached the python script that I created to extract all the new Ids.
[usb.py] and [driveragent.py]
Finally I only had to compare both files and do a patch to send them to the usdb.id maintainers.
I feel proud to think that I contributed to double the amount of the ids for that project. Let’s see if some day I dare to do the same for the lscpi command and database, anybody does? .






