Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

option driver correctly matched USB ID and loads driver for this device. For example

# lsusb
Bus 001 Device 002: ID 19d2:0031 ONDA Communication S.p.A. ZTE MF636
Bus 001 Device 003: ID 12d1:14ac Huawei Technologies Co., Ltd.

It also creates ttyUSBX devices for managing the hardware

crw-rw---- 1 root uucp 188, 0 Jul  4 13:48 /dev/ttyUSB0
crw-rw---- 1 root uucp 188, 1 Jul  4 13:49 /dev/ttyUSB1
crw-rw---- 1 root uucp 188, 2 Jul  4 13:35 /dev/ttyUSB2
crw-rw---- 1 root uucp 188, 3 Jul  4 13:37 /dev/ttyUSB3
crw-rw---- 1 root uucp 188, 4 Jul  4 13:37 /dev/ttyUSB4
crw-rw---- 1 root uucp 188, 5 Jul  4 13:37 /dev/ttyUSB5
crw-rw---- 1 root uucp 188, 6 Jul  4 13:37 /dev/ttyUSB6
crw-rw---- 1 root uucp 188, 7 Jul  4 13:37 /dev/ttyUSB7

However, I have more then one usb serial devices and I want to know which ttyUSB is for which USBID. Ex. /dev/ttyUSB1 -> 19d2:0031

Do you know any point where I can get this information?

share|improve this question
add comment

migrated from serverfault.com Jul 4 '13 at 14:13

This question came from our site for professional system and network administrators.

3 Answers

Have a look at the sysfs filesystem. An example for my USB serial:

$ lsusb
Bus 003 Device 016: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
$ ls -l /sys/bus/usb-serial/devices
lrwxrwxrwx 1 root root 0 Jul  4 17:37 ttyUSB0 -> ../../../devices/pci0000:00/0000:00:1c.0/0000:02:00.0/usb3/3-1/3-1:1.0/ttyUSB0
$ $ grep PRODUCT= /sys/bus/usb-serial/devices/ttyUSB0/../uevent
PRODUCT=67b/2303/300

As you can see, ttyUSB0 maps to 067b:2303 on my computer. An other locations worth exploring are /sys/class/tty/. Pay attention to symlinks.

share|improve this answer
add comment

I would use udev and write some rules which create symlinks for the devices.

To get enough information to distinguish the devices try something like this for all devices:

$ udevadm info --query all -name /dev/ttyUSB0 --attribute-walk
share|improve this answer
add comment

I had a similar problem.

Write this to /etc/udev/rules.d/50-usb.rules

SUBSYSTEM=="tty", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0031", SYMLINK+="ONDA"
SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14ac", SYMLINK+="HUAWEI"

to the end. Reboot.

Now you can use /dev/ONDA to get to your ONDA device.

If you want non-root users to be able to use these, then add

, MODE="0666"

to the end of each line.

Best luck!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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