I'm using two devices which are an USB to Serial converter and a GSM module. Both of them are shown as
How can I determine which file descriptor (FD) is which USB device?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
You could set up some
udev rules. There is some information here.
That way you can make sure your serial converter and GSM modules consistently mount to the same place.
As hinted, you may find information using
lsusb. However — assuming you don't know how plug and play works on USB — the "why"
lsusb is that every removable device, that you plug into the USB connector, signals to the system (amongst other information) identifiers for the vendor and product, respectively
idProduct, both of which you can see in
Another way is to check the system log, which provides more verbose information:
Apr 19 11:20:05 my_machine kernel: [1768201.806503] usb 3-3: new full-speed USB device number 72 using xhci_hcd Apr 19 11:20:05 my_machine kernel: [1768201.823169] usb 3-3: New USB device found, idVendor=067b, idProduct=2303 Apr 19 11:20:05 my_machine kernel: [1768201.823179] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Apr 19 11:20:05 my_machine kernel: [1768201.823185] usb 3-3: Product: USB-Serial Controller D Apr 19 11:20:05 my_machine kernel: [1768201.823191] usb 3-3: Manufacturer: Prolific Technology Inc. Apr 19 11:20:05 my_machine kernel: [1768201.824118] pl2303 3-3:1.0: pl2303 converter detected Apr 19 11:20:05 my_machine kernel: [1768201.825628] usb 3-3: pl2303 converter now attached to ttyUSB0 Apr 19 11:20:05 my_machine mtp-probe: checking bus 3, device 72: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-3"
In this log excerpt you will see the VendorID and ProductID of a Serial-on-USB controller, which uses a chip, a PL2303 (
pl2303), from a company named "
Prolific Technology Inc.".
By looking at these lines you will know what device you plugged in (e.g.
idVendor=067b, idProduct=2303), when (
Apr 19 11:20:05) and what device node the device (
ttyUSB0) can be accessed through. You'll also get the full system path to the device, namely
On a Debian machine, or on a Raspberry Pi installed with Raspbian, the system log file is
lsusb. This should give you the data that you require and enable you to determine which FD points to which device.
lsusbis a utility for displaying information about USB buses in the system and the devices connected to them.
See man page or type
man lsusb in a terminal.