Binding USB hotplug to a usb port

You can instruct udev / hotplug to create the correct dev entry following the ID of the device.
See the udev(8) man page here:
You'll find an example that should be what you need to do:

# USB printer to be called lp_color
BUS=="usb", SYSFS{serial}=="W09090207101241330", NAME="lp_color"

Change "W09...." with the serial number of each device, and "NAME" with the name of the device you need.
I would not use "ttyUSBn" as it could be used by other devices, instead i would use some like "usbModemx" or similar.
Also, the script modemplug can be replaced by a line in udev.conf

# ttyUSB1 should always be called pda with two additional symlinks
KERNEL=="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld"

NOTE:- Your kernel should be above to 2.6.30 around.
udevadm test /class/tty/ttyUSB1 |grep ID

[root@localhost ~]# cat /etc/udev/rules.d/99-mod.rules
BUS=="usb", ID=="4-1:1.0", NAME="usbModem01"
BUS=="usb", ID=="2-2:1.0", NAME="usbModem02"

No comments:

Post a Comment