Using the lsusb command in Linux I have come to know about bus and device numbers, along with its name of newly attached USB devices.
But how can I know on which device directory (/dev/*) USB device get attached in Linux using command lines only?
It isn't a rule that every device has to show up directly under /dev/, but some device classes will be nested under sub-directories inside /dev/.
USB device drivers are a bit different. If you connect a valid USB device, USB HCI would read the VID:PID and will tell the usb-core that the device with VID:PID combination is connected.
If the usbcore detects any registered driver for the VID:PID combination, it will couple it with the device, and the device file creation would happen accordingly
The device will show in /dev/bus/usb/.., even if, the corresponding driver is not present, to indicate that the device was detected.
You need to have the device driver to have the device in action/operation.
You can verify whether a device driver is coupled to the device through
cat /sys/kernel/debug/usb/devices
Each detected USB device will have an entry here, and also shows the "Driver=" field, to show which driver is associated with your device.
Now, IFF there is a driver, that makes an entry in appropriate /dev tree, you will find the device there.
NOT every device will show up directly under /dev/ in the first level. say, your mouse/keyboard will not show-up directly under /dev, but inside /dev/input/
Likewise, IF the connected USB device is a char/block device, it MAY show up there, that too have exceptions.
If your device is and ethernet/wifi device, the interface device will NOT show up under /dev/, cross-check with your existing eth0, wlan0, they will not appear directly under /dev/, but will in /proc/net/devices
sda/b/c shows up under /dev directly, because they are block devices and are managed by udev, as such.
Here is an example of lsusb output on my laptop:
Bus 004 Device 123: ID 2001:3c1b D-Link Corp. DWA-127 Wireless N 150 High-Gain Adapter(rev.A1) [Ralink RT3070]
It's the device 123 on the bus 004. /dev/bus/usb/004/123 is just the file for the interested device.
The path might vary on different kernels. The result above holds on kernel 3.15.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With