When I use commands like lsusb, sudo fdisk -l, the output shows the brand that made the USB and other details, but I do not get how Linux OS recognizes it.
Asked
Active
Viewed 417 times
4
-
I am not a developer but I think the drivers for these devices make this possible. – George Udosen May 21 '19 at 10:09
-
4This will help: http://www.linux-usb.org/usb.ids – Jos May 21 '19 at 10:09
-
@Jos answer it or someone else will :+ – Rinzwind May 21 '19 at 10:11
-
3Possible duplicate of [lsusb - where device description comes from](https://askubuntu.com/questions/227881/lsusb-where-device-description-comes-from) – WinEunuuchs2Unix May 21 '19 at 23:18
-
@Rinzwind It was answered 7 years ago... ;) – WinEunuuchs2Unix May 21 '19 at 23:19
1 Answers
8
There is a list of USB vendors and devices, built into a separate package usbutils. When you connect a USB device, the USB driver reads the vendor ID string from the device, and looks it up in the vendor table. Same for the device ID.
The official list is maintained by the USB organisation. Here's the list itself in readable format.
-
1The table used to look up vendors and devices on your local system is stored in `/var/lib/usbutils/usb.ids` and part of the `usbutils` package. – Byte Commander May 21 '19 at 10:28
-
Thank you @ByteCommander. I just spent some time trying to locate it in the kernel source. I'll correct my answer. – Jos May 21 '19 at 10:37
-
Just had a quick look at `man lsusb` - the file is mentioned there ;) – Byte Commander May 21 '19 at 10:39
-
1You can change `usb.ids` if your manufacturer's name comes up blank or is misleading. I've had to do this a couple of times in the past. Once for a USB hub another time for a smartphone. – WinEunuuchs2Unix May 21 '19 at 10:41
-
@WinEunuuchs2Unix So you're saying the actual (human readable) list is parsed? There is not even a separate little database? Funny. However, it allows you to change your USB strings on the fly, which is useful. – Jos May 21 '19 at 10:44
-
@Jos Yes it's a config file. You can edit it: `wc /var/lib/usbutils/usb.ids` gives you: `19642 78701 551472 /var/lib/usbutils/usb.ids` So about 19k lines of manufacturer and device names. Use `less /var/lib/usbutils/usb.ids` to have a quick peek. – WinEunuuchs2Unix May 21 '19 at 10:50
-
Yes, I noticed that that file is identical to the second link I gave in my answer. – Jos May 21 '19 at 10:57