I want to the file from which the command
retrieves the data. I am curious to see where this is stored.
and can anyone also tell that what can do with device id that displays in
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
lsusb reads its data from the kernel provided virtual
sys Filesystem mounted in
/sys; specifically from the location of relevant directories for USB devices. These devices are connected to different PCI buses and are (mostly) detected by
For example, in my computer here is one example of the localtion of a USB device connected to a particular PCI bus:
The contents of the directory:
% print -l * 4-1:1.0 authorized avoid_reset_quirk bcdDevice bConfigurationValue bDeviceClass bDeviceProtocol bDeviceSubClass bmAttributes bMaxPacketSize0 bMaxPower bNumConfigurations bNumInterfaces busnum configuration descriptors dev devnum devpath driver ep_00 idProduct idVendor ltm_capable maxchild port power quirks removable remove speed subsystem uevent urbnum version
lsusb just reads from relevant file(s) of this directory.
lsusb uses libudev to fetch the list of devices you see. Libudev, in turn, uses a combination of the udev database and searching through the
/sys filesystem to find hardware info.
Relevant code repositories:
Kernel has drivers for the devices and kernel adds them. Devices report their capabilties to the driver or to the BIOS. Some of them are reported by BIOS. I know that because I had a BIOS with bug and it was reporting fans, which were not present. When processor got hot, the kernel driver tried to switch on inexistent fans. Finally I solved the problem by compiling the kernel without support for fans.
Take a look at
/sys/devices. You will find your devices there. You can find lots of information about the devices in directories and files. Kernel creates them dynamically when devices are dis/connected.