V
V
Vitaly2016-03-25 14:05:17
linux
Vitaly, 2016-03-25 14:05:17

How to bind usb modem via udev symlink?

All the best! I can't figure out how to fix the problem I'm facing.
I have several modems (2pcs) when connected, the system sees one modem as

ttyUSB0,ttyUSB1,ttyUSB2

voice, data and something else...
When connecting 2 modems, the system gets from USB0 .... to ttyUSB5.
Everything seems to be ok, but after a reboot, the modems are already defined differently. That is, if MTS_01 was previously equal to ttyUSB0,ttyUSB1,ttyUSB2, then now it is defined as ttyUSB3,ttyUSB4,ttyUSB5 , and the MTS_02 modem is now visible as ttyUSB0,ttyUSB1,ttyUSB2.
I decided to bind them via udev symlink, I created this rule:

KERNEL=="ttyUSB*", DEVPATH=="/devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3:1.0/*", SYMLINK+="mts-01-audio "
KERNEL=="ttyUSB*", DEVPATH=="/devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3:1.1/*", SYMLINK+="mts-01- data"
KERNEL=="ttyUSB*", DEVPATH=="/devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3:1.2/*", SYMLINK+="mts-01 -other"
KERNEL=="ttyUSB*", DEVPATH=="/devices/pci0000:00/0000:00:1d.7/usb7/7-1/7-1:1.0/*", SYMLINK+="mts- 02-audio"
KERNEL=="ttyUSB*", DEVPATH=="/devices/pci0000:00/0000:00:1d.7/usb7/7-1/7-1:1.1/*", SYMLINK+="mts -02-data"
KERNEL=="ttyUSB*", DEVPATH=="/devices/pci0000:00/0000:00:1d.7/usb7/7-1/7-1:1.2/*",SYMLINK+="mts-02-other"

I saw examples on the net where other parameters are taken in place of DEVPATH (like mine), but it works for me only with DEVPATH whose parameters I take with udevadm info --query=property --name=ttyUSB0 .
With such a rule, if you distort the modems, everything works fine, but if you reboot the system, then the usb number "usb7 / 7-1/7-1: 1" according to which the binding is actually made, for some reason changes, and accordingly the rules do not work :(
How can I bind a device by symlink?
I don’t see any other unique data that I could bind to :( the modem models are the same.
I tried to bind by the ATTRS{device} parameter, which can be found by entering the command
udevadm info -a -n /dev/ttyUSB , but it is identical for all ttyUSBs of this modem (i.e. for MTS-01 ttyUSB0,ttyUSB1 and ttyUSB2 it is the same) but different than y MTS-02 ttyUSB3... .
so I tried to add the DEVLINKS parameters there from the udevadm info command --query=property --name=ttyUSB there each ttyUSB has a different HUAWEI_Mobile-if00 ,HUAWEI_Mobile-if01 , HUAWEI_Mobile-if02

KERNEL=="ttyUSB*", DEVLINKS=="/dev/serial/by-id/usb-HUAWEI_Technology_HUAWEI_Mobile-if00-port0*" , ATTRS{device}=="0x2835", SYMLINK+="mts—audio"

and that doesn't work either

SUBSYSTEMS=="tty", ENV{DEVLINKS}=="/dev/serial/by-id/usb-HUAWEI_Technology_HUAWEI_Mobile-if00-port0*" , ATTRS{device}=="0x2835", SYMLINK+="mts—audio"

Maybe I'm not taking the parameters for binding from there (
udevadm info -a -n /dev/ttyUSB , udevadm info --query=property --name=ttyUSB , udevadm monitor --environment --udev
) or something else...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Teremshonok, 2016-03-31
@TerAnYu

I mounted via imei and set the necessary ports, something like this:
PS
Find the config as I mounted the modems does not work, but I used their imei to set the port.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question