I am using two Wavecom 16-port modems. When I attach the modems to my system, I am able to list of all the /dev/ttyUSB
port names, but also I want to know, which mo
You can get this information from the sys
filesystem. It is easy to check from the shell, and then do a program that does the same:
cd /sys/devices
find -name "ttyUSB0"
. It will probably find them in something like ./pci0000:00/0000:00:1d.0/usb2/2-2/2-2.1/2-2.1:1.0/...
The pci*
part is the USB controller. The interesting bit is the 2-2.1
which is the USB device. In that directory there are a lot of files that identify your device:
serial
: The serial number. Probably what you want.idVendor
and idProduct
: The USB identifier of the device.An easy alternatively to steps 1 and 2 is:
cd /sys/class/tty/
readlink ttyUSBn
will give you the full path of the device directory.As a footnote, note that some parts of the sysfs
are considered API stable and some parts are not. For more information see the official sysfs rules.