Hi!
I need to install multiple UMTS modems in one machine!
I want to correlate the /dev/ttyUSB* interfaces with VendorId and ProductID as given from "lsusb" command.
For the moment i can find the module loaded for each interface:
$ find /sys/ | grep ttyUSB[0123456789]*$
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/1-3:1.0/ttyUSB4
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/1-3:1.0/ttyUSB4/tty/ttyUSB4
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/1-3:1.1/ttyUSB5
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/1-3:1.1/ttyUSB5/tty/ttyUSB5
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/1-3:1.2/ttyUSB6
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/1-3:1.2/ttyUSB6/tty/ttyUSB6
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/1-3:1.3/ttyUSB7
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/1-3:1.3/ttyUSB7/tty/ttyUSB7
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/2-2:1.0/ttyUSB0
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/2-2:1.0/ttyUSB0/tty/ttyUSB0
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/2-2:1.1/ttyUSB1
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/2-2:1.1/ttyUSB1/tty/ttyUSB1
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/2-2:1.3/ttyUSB2
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/2-2:1.3/ttyUSB2/tty/ttyUSB2
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/2-2:1.4/ttyUSB3
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/2-2:1.4/ttyUSB3/tty/ttyUSB3
/sys/bus/usb-serial/devices/ttyUSB0
/sys/bus/usb-serial/devices/ttyUSB1
/sys/bus/usb-serial/devices/ttyUSB2
/sys/bus/usb-serial/devices/ttyUSB3
/sys/bus/usb-serial/devices/ttyUSB4
/sys/bus/usb-serial/devices/ttyUSB5
/sys/bus/usb-serial/devices/ttyUSB6
/sys/bus/usb-serial/devices/ttyUSB7
/sys/bus/usb-serial/drivers/sierra/ttyUSB0
/sys/bus/usb-serial/drivers/sierra/ttyUSB1
/sys/bus/usb-serial/drivers/sierra/ttyUSB2
/sys/bus/usb-serial/drivers/sierra/ttyUSB3
/sys/bus/usb-serial/drivers/option1/ttyUSB4
/sys/bus/usb-serial/drivers/option1/ttyUSB5
/sys/bus/usb-serial/drivers/option1/ttyUSB6
/sys/bus/usb-serial/drivers/option1/ttyUSB7
/sys/class/tty/ttyUSB0
/sys/class/tty/ttyUSB1
/sys/class/tty/ttyUSB2
/sys/class/tty/ttyUSB3
/sys/class/tty/ttyUSB4
/sys/class/tty/ttyUSB5
/sys/class/tty/ttyUSB6
/sys/class/tty/ttyUSB7
$ lsusb
Bus 002 Device 002: ID 1199:68a3 Sierra Wireless, Inc.
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 003: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem
Bus 001 Device 001: ID 0000:0000
But this doen not solve my problem, as I will use multiple modems od the same vendor (same or different model) that use the same driver.
Does anyone know how I can find VendorId and ProductID of each /dev/ttyUSB* device??
BR,
Nikos
Hi Nikos (yes, I am Greek too),
What you seek is possible(read note). However, best fit solution depends on system/setup. Before I answer, are you running a fully capable distribution or are you on an embedded, busybox or something, system?
NOTE: If you are going to use the exact same modem model, with the exact same network provider, there are ONLY TWO ways to identify which tty device is associated with which unit:
1. By really relying on slot. It is more accurate than you expect.
2. Issue ATI (or ATI0, ATI1, ATI2 whatever fits) command to serial port, and determine each unit by its IMEI number.
Sakis
PS: Out of curiosity, and in case it is not business secret, which I respect, why do you need to run this setup? High availability? LCR? Virtualization? SMS, MMS (or any other GSM service) gateway? VoIP? Bonding of multiple PPP connections?
What you seek is possible(read note). However, best fit solution depends on system/setup. Before I answer, are you running a fully capable distribution or are you on an embedded, busybox or something, system?
NOTE: If you are going to use the exact same modem model, with the exact same network provider, there are ONLY TWO ways to identify which tty device is associated with which unit:
1. By really relying on slot. It is more accurate than you expect.
2. Issue ATI (or ATI0, ATI1, ATI2 whatever fits) command to serial port, and determine each unit by its IMEI number.
Sakis
PS: Out of curiosity, and in case it is not business secret, which I respect, why do you need to run this setup? High availability? LCR? Virtualization? SMS, MMS (or any other GSM service) gateway? VoIP? Bonding of multiple PPP connections?
Hi Sakis,
it seems to be a GreekTeam here
tx a lot for the information!
I use a device (Ubuntu Server 8.04 i386) with modems plugged dynamically!
I plug and unplug modems (perhaps not in the same slot), I swap sims among the modems and I use multiple modems of same or different model.
The problem is that I need to dynamically recognize the modems.
For the moment I work as you mentioned: I run '/bin/chat' sending an 'AT' command at all /dev/ttyUSB interfaces. Afterwards I send 'ATI' and 'AT+CGSN' on the ones that responded before, so I get the information I need.
My main issue is that each modem has several interfaces (diagnostic, modem, application port) and usually 2 of them (modem and application interfaces ) respond on AT commands but only one can be used for ppp connection.
And even worse, the relative interface numbers of modem and application interfaces are different according to the specific model.
I would like to have for each VendorID,ProductID pair of lsusb response the /dev/ttyUSB devices are correlated.
Is this possible?
dmesg, or /sys/modules can help?
Another question, even out of subject:
what is the highest baudrate that pppd can support?
When I try to connect at 21600000 (for Huawei K4505), pppd responds "Rate not supported"
Tx a lot!
BR,
Nikos
PS: I am measuring data throughput for some mobile operators
it seems to be a GreekTeam here

tx a lot for the information!
I use a device (Ubuntu Server 8.04 i386) with modems plugged dynamically!
I plug and unplug modems (perhaps not in the same slot), I swap sims among the modems and I use multiple modems of same or different model.
The problem is that I need to dynamically recognize the modems.
For the moment I work as you mentioned: I run '/bin/chat' sending an 'AT' command at all /dev/ttyUSB interfaces. Afterwards I send 'ATI' and 'AT+CGSN' on the ones that responded before, so I get the information I need.
My main issue is that each modem has several interfaces (diagnostic, modem, application port) and usually 2 of them (modem and application interfaces ) respond on AT commands but only one can be used for ppp connection.
And even worse, the relative interface numbers of modem and application interfaces are different according to the specific model.
I would like to have for each VendorID,ProductID pair of lsusb response the /dev/ttyUSB devices are correlated.
Is this possible?
dmesg, or /sys/modules can help?
Another question, even out of subject:
what is the highest baudrate that pppd can support?
When I try to connect at 21600000 (for Huawei K4505), pppd responds "Rate not supported"
Tx a lot!
BR,
Nikos
PS: I am measuring data throughput for some mobile operators
Hi again Nikos,
actually, I am a guest here just like you. Usb-ModeSwitch author (Josh) is from Germany.
First your initial request: "Associate ttyUSB devices with vendor and product IDs"
For this solution to work, a working HAL installation is required. Create a shell script with the following contents:
Output is one line per ttyUSB device. Each line is consisted of eight colon separated fields which resemble the following syntax:
1. Device node in /dev.
2. VendorID.
3. ProductID.
4. Interface of modem which provides this device node.
5. Driver assigned on this interface of modem.
6. Bus on which unit is connected. You can place stickers next to each USB port of your computer.
7. Serial number reported by driver/device.
8. Name of device according to USB database of your system. On Debian (I guess Ubuntu too), you can update that database by running update-usbids and database itself resides on /var/lib/usbutils/usb.ids.
Running this script on my PC (with my two modems plugged), returns:
You can extract specific columns by using the cut command:
Or sort according to the field you need:
Now lets go on second question: "Identifying which interface can do ppp"
This is a problem that both me and Josh encountered individually. We have currently join forces into brainstorming on whether a globally applied solution is possible, but we've not reached into (safe) conclusions yet. Since it happens that you have access to more hardware than me and Josh will ever meet in our lives combined, be sure we will contact you when/if we have anything to test.
So far, lacking information from hardware vendors, there are two methods:
1. Maintaining a database entry per modem (like the one found on /usr/share/hal/fdi/information/10freedesktop/10-modem.fdi on modern distributions).
2. Actually probe serial ports the way you already do (and this is actually what ModemManager accompanying modern NetworkManager versions is currently doing).
And the "out of subject" question: "Maximum baud rate possible"
About that, I think that even pppd relies on kernel for supported baud rates. By doing a fast research on ppp_async module found on 2.6.26 debian kernel, I reached to /include/asm/termbits.h where I found those definitions:
If indeed this is the correct place, seems like 4000000 is the maximum you can use.
I hope I helped,
Sakis
PS: If you are doing it within Greek landscape, I would be glad (as a consumer) to learn some benchmarking results through PM
actually, I am a guest here just like you. Usb-ModeSwitch author (Josh) is from Germany.
First your initial request: "Associate ttyUSB devices with vendor and product IDs"
For this solution to work, a working HAL installation is required. Create a shell script with the following contents:
Code: Select all
#!/bin/sh
for udi in `hal-find-by-capability --capability serial | sort`
do
parent=`hal-get-property --udi ${udi} --key "info.parent"`
device=`hal-get-property --udi ${udi} --key "linux.device_file"`
vendor=`hal-get-property --udi ${parent} --key "usb.vendor_id"`
product=`hal-get-property --udi ${parent} --key "usb.product_id"`
driver=`hal-get-property --udi ${parent} --key "info.linux.driver"`
bus=`hal-get-property --udi ${parent} --key "usb.bus_number"`
interf=`hal-get-property --udi ${parent} --key "usb.interface.number"`
grandpa=`hal-get-property --udi ${parent} --key "info.parent"`
name=`hal-get-property --udi ${grandpa} --key "info.product"`
serial=`hal-get-property --udi ${grandpa} --key "usb_device.serial"`
printf "%s:%.4x:%.4x:%d:%s:%s:%s:%s\n" \
"${device}" "${vendor}" "${product}" "${interf}" \
"${driver}" "${bus}" "${serial}" "${name}"
done
1. Device node in /dev.
2. VendorID.
3. ProductID.
4. Interface of modem which provides this device node.
5. Driver assigned on this interface of modem.
6. Bus on which unit is connected. You can place stickers next to each USB port of your computer.
7. Serial number reported by driver/device.
8. Name of device according to USB database of your system. On Debian (I guess Ubuntu too), you can update that database by running update-usbids and database itself resides on /var/lib/usbutils/usb.ids.
Running this script on my PC (with my two modems plugged), returns:
Code: Select all
$ ./test.sh
/dev/ttyUSB3:19d2:0031:0:option:7:1234567890ABCDEF:ZTE MF636
/dev/ttyUSB4:19d2:0031:1:option:7:1234567890ABCDEF:ZTE MF636
/dev/ttyUSB5:19d2:0031:3:option:7:1234567890ABCDEF:ZTE MF636
/dev/ttyUSB0:1bbb:0000:0:option:8:1234567890ABCDEF:USBModem Configuration
/dev/ttyUSB1:1bbb:0000:1:option:8:1234567890ABCDEF:USBModem Configuration
/dev/ttyUSB2:1bbb:0000:3:option:8:1234567890ABCDEF:USBModem Configuration
Code: Select all
$ ./test.sh | cut -d: -f1,2,3,5,8
/dev/ttyUSB3:19d2:0031:option:ZTE MF636
/dev/ttyUSB4:19d2:0031:option:ZTE MF636
/dev/ttyUSB5:19d2:0031:option:ZTE MF636
/dev/ttyUSB0:1bbb:0000:option:USBModem Configuration
/dev/ttyUSB1:1bbb:0000:option:USBModem Configuration
/dev/ttyUSB2:1bbb:0000:option:USBModem Configuration
Code: Select all
$ ./test.sh | sort -t: -k 4
/dev/ttyUSB3:19d2:0031:0:option:7:1234567890ABCDEF:ZTE MF636
/dev/ttyUSB0:1bbb:0000:0:option:8:1234567890ABCDEF:USBModem Configuration
/dev/ttyUSB4:19d2:0031:1:option:7:1234567890ABCDEF:ZTE MF636
/dev/ttyUSB1:1bbb:0000:1:option:8:1234567890ABCDEF:USBModem Configuration
/dev/ttyUSB5:19d2:0031:3:option:7:1234567890ABCDEF:ZTE MF636
/dev/ttyUSB2:1bbb:0000:3:option:8:1234567890ABCDEF:USBModem Configuration
This is a problem that both me and Josh encountered individually. We have currently join forces into brainstorming on whether a globally applied solution is possible, but we've not reached into (safe) conclusions yet. Since it happens that you have access to more hardware than me and Josh will ever meet in our lives combined, be sure we will contact you when/if we have anything to test.
So far, lacking information from hardware vendors, there are two methods:
1. Maintaining a database entry per modem (like the one found on /usr/share/hal/fdi/information/10freedesktop/10-modem.fdi on modern distributions).
2. Actually probe serial ports the way you already do (and this is actually what ModemManager accompanying modern NetworkManager versions is currently doing).
And the "out of subject" question: "Maximum baud rate possible"
About that, I think that even pppd relies on kernel for supported baud rates. By doing a fast research on ppp_async module found on 2.6.26 debian kernel, I reached to /include/asm/termbits.h where I found those definitions:
Code: Select all
#define BOTHER 0010000 /* non standard rate */
#define B57600 0010001
#define B115200 0010002
#define B230400 0010003
#define B460800 0010004
#define B500000 0010005
#define B576000 0010006
#define B921600 0010007
#define B1000000 0010010
#define B1152000 0010011
#define B1500000 0010012
#define B2000000 0010013
#define B2500000 0010014
#define B3000000 0010015
#define B3500000 0010016
#define B4000000 0010017
I hope I helped,
Sakis
PS: If you are doing it within Greek landscape, I would be glad (as a consumer) to learn some benchmarking results through PM

Tx a lot for the help!
HAL takes all info from /sys/ directory, so I guess I can find all the info there!
for example I discovered
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/idVendor
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/idProduct
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/idVendor
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/idProduct
I will come back to all these during the next days.
Tx again,
Nikos
HAL takes all info from /sys/ directory, so I guess I can find all the info there!
for example I discovered
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/idVendor
/sys/devices/pci0000:00/0000:00:0f.5/usb2/2-2/idProduct
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/idVendor
/sys/devices/pci0000:00/0000:00:0f.4/usb1/1-3/idProduct
I will come back to all these during the next days.
Tx again,
Nikos