2

I have a FTDI USB-Serial (UART) IC connected to my Raspberry Pi. When I type lsusb I can see all my USB buses:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 050d:705c Belkin Components F5D7050 Wireless G Adapter v4000 [Zydas ZD1211B]
Bus 001 Device 005: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

I am using python-serial to communicate with the USB via Serial. For this I need the address:

ser = serial.Serial('/dev/ttyUSB0',  9600, timeout = 0.1)

By trial and error I determined the address is /dev/ttyUSB0. I went to directory /dev/ and took a guess. Where can I find a mapping of (in this case) Device 0005 to the actual address?

Getting the USB tree lusub -t yields:

lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/3p, 480M
        |__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M
        |__ Port 2: Dev 5, If 0, Class=vend., Driver=ftdi_sio, 12M
        |__ Port 3: Dev 4, If 0, Class=vend., Driver=zd1211rw, 480M

but does not tell me the address.

3

You will find it using lshw command:

lshw -businfo -numeric -class usb

Will print everything you need. Non-standard Debian but useful, you may want the hwinfo command which produce detailed informations.

  • Thanks but I am using the wheezy distro and neither hwinfo or lshw are valid. I get -bash: lshw: command not found – PhillyNJ Mar 6 '14 at 17:16
  • So am I. You can install it from the Raspian distro, just issue sudo apt-get install hwinfo. – jlandercy Mar 6 '14 at 19:18
5

After plugging in the device, (or after boot if it's already plugged in), you should see in dmesg what the device has been registered as in /dev. The device registration will also trigger a udev call. You can create a custom rule to always assign it to a specific device.

For example, creating a /udev/rules.d/90serial file with this should work, and create /dev/myUSBserial:

SUBSYSTEM=="usb", ATTR{idVendor}=="0403", MODE:="666", SYMLINK+="myUSBserial"

More info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.