tester777 n00b
Joined: 17 Feb 2013 Posts: 6
|
Posted: Wed Mar 20, 2013 7:55 pm Post subject: Fixed udev rules for USB modems |
|
|
On gentoo i have 10 USB modems and every of them has 3 interfaces /dev/ttyUSB0, 1, 2 and so on for each modem. Sometimes their postitions can change, so it is very difficult to work with them.
I'm working with each modem first interface. So for first modem it would be ttyUSB0, other ttyUSB1 and ttyUSB2 i dont need for sending commands to modem.
How can I write static udev rules for each of them so they would have fixed position, and how could i rename ttyUSB0 in something like modem-xxxxxxx interface for easier working with them ?
lsusb output:
Code: | client dev # lsusb
Bus 002 Device 039: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem |
dmesg output for one of the huawei modems:
Code: | [166041.393547] usb 2-6: default language 0x0409
[166041.402548] usb 2-6: udev 40, busnum 2, minor = 167
[166041.402552] usb 2-6: New USB device found, idVendor=12d1, idProduct=1001
[166041.402555] usb 2-6: New USB device strings: Mfr=1, Product=2, SerialNumber=1
[166041.402558] usb 2-6: Product: HUAWEI Mobile
[166041.402660] usb 2-6: usb_probe_device
[166041.402664] usb 2-6: configuration #1 chosen from 1 choice
[166041.405566] usb 2-6: adding 2-6:1.0 (config #1, interface 0)
[166041.408589] option 2-6:1.0: usb_probe_interface
[166041.408593] option 2-6:1.0: usb_probe_interface - got id
[166041.408600] option 2-6:1.0: GSM modem (1-port) converter detected
[166041.408803] usb 2-6: GSM modem (1-port) converter now attached to ttyUSB0
[166041.408835] usb 2-6: adding 2-6:1.1 (config #1, interface 1)
[166041.411572] option 2-6:1.1: usb_probe_interface
[166041.411576] option 2-6:1.1: usb_probe_interface - got id
[166041.411581] option 2-6:1.1: GSM modem (1-port) converter detected
[166041.411683] usb 2-6: GSM modem (1-port) converter now attached to ttyUSB1
[166041.411703] usb 2-6: adding 2-6:1.2 (config #1, interface 2)
[166041.414572] option 2-6:1.2: usb_probe_interface
[166041.414576] option 2-6:1.2: usb_probe_interface - got id
[166041.414580] option 2-6:1.2: GSM modem (1-port) converter detected
[166041.414682] usb 2-6: GSM modem (1-port) converter now attached to ttyUSB2
[166041.414714] hub 2-0:1.0: state 7 ports 10 chg 0000 evt 0040
|
**EDIT:**
Tried to find port adresses like this:
Code: | client rules.d # udevadm info -q path -n /dev/ttyUSB0
/devices/pci0000:00/0000:00:02.0/usb2/2-6/2-6:1.0/ttyUSB0/tty/ttyUSB0 |
then created file /etc/udev/rules.d/10-local.rules and wrote there lines like this:
Code: | KERNEL=="ttyUSB*", KERNELS=="2-6:1.0", NAME="ttyUSB0_654"
KERNEL=="ttyUSB*", KERNELS=="2-6:1.1", NAME="ttyUSB1_654"
KERNEL=="ttyUSB*", KERNELS=="2-6:1.2", NAME="ttyUSB2_654" |
but looks like it's not working. |
|