USB Network Gate

How to get the list of USB devices without GUI and kernel module on Linux?

Jaroslaw in USB Network Gate 19 Jun 2017, 08:05 | 0 comments

When the embedded system based on Linux is used, it may be useful to find out how to get the list of USB devices, if the GUI is not available. It can be done not just with the help of our command line utility, but with the built-in features of the system as well.

One will need to run the following command in the terminal:

for device in $(ls /sys/bus/usb/devices/*/product); do echo $device;cat $device;done

The output will look as follows:

/sys/bus/usb/devices/2-5.1/product
USB-PS/2 Optical Mouse
/sys/bus/usb/devices/usb1/product
EHCI Host Controller

The first line contains the address of the device (the hub port). For the mouse in the example it is 2-5.1.

The second line represents the name of the USB device.

To share a USB device (a USB mouse in this example), the following command should be executed in the console utility:

eveusbc share 1045 2-5.1