[opensuse] USB, udev and serial numbers
I have a number of serial port <-> USB converters connected to a PC. I need to ensure that I always talk to the same device no matter what is connected on the USB port. So, I thought I would use the device's serial number in a udev rule. With 'lsusb -v' I see this: idVendor 0x0403 Future Technology Devices International, Ltd idProduct 0x6001 FT232 USB-Serial (UART) IC bcdDevice 6.00 iManufacturer 1 FTDI iProduct 2 FT232R USB UART iSerial 3 A7004luX In /var/log/messages, I see this: kernel: [ 2283.948108] usb 6-2: SerialNumber: A7004luX The serial number is different for each converter. So it seems like the value to use. I have made a udev rule that should make a symlink to the device, and relax the permissions: BUS=="usb", SYSFS{iSerial}=="A7004luX", MODE="0666", SYMLINK+="usbp2", OWNER="rst", GROUP="users" After reloading the rules (udevadm control --reload-rules), I would like to see the symlink created when I plug in the device. Unfortunately, that is not the case. For another device, I use SYSFS{idVendor} to determine the vendor. iSerial seems to be in the same group of variables. Perhaps it is not and only the lsusb listing makes it appear so. A google of 'udev iSerial' returned nothing a all. How odd. Any suggestions are welcome. Yours sincerely, Roger Oberholtzer OPQ Systems / Ramböll RST Office: Int +46 10-615 60 20 Mobile: Int +46 70-815 1696 roger.oberholtzer@ramboll.se ________________________________________ Ramböll Sverige AB Krukmakargatan 21 P.O. Box 17009 SE-104 62 Stockholm, Sweden www.rambollrst.se -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Wed, Dec 14, 2011 at 02:25:59PM +0100, Roger Oberholtzer wrote: [ 8< ]
The serial number is different for each converter. So it seems like the value to use.
I have made a udev rule that should make a symlink to the device, and relax the permissions:
BUS=="usb", SYSFS{iSerial}=="A7004luX", MODE="0666", SYMLINK+="usbp2", OWNER="rst", GROUP="users"
After reloading the rules (udevadm control --reload-rules), I would like to see the symlink created when I plug in the device. Unfortunately, that is not the case.
For another device, I use SYSFS{idVendor} to determine the vendor. iSerial seems to be in the same group of variables. Perhaps it is not and only the lsusb listing makes it appear so.
A google of 'udev iSerial' returned nothing a all. How odd.
Maybe this recent thread in German helps http://lists.opensuse.org/opensuse-de/2011-12/msg00120.html Lars -- Lars Müller [ˈlaː(r)z ˈmʏlɐ] Samba Team SUSE Linux, Maxfeldstraße 5, 90409 Nürnberg, Germany
On Wed, 2011-12-14 at 14:38 +0100, Lars Müller wrote:
On Wed, Dec 14, 2011 at 02:25:59PM +0100, Roger Oberholtzer wrote: [ 8< ]
The serial number is different for each converter. So it seems like the value to use.
I have made a udev rule that should make a symlink to the device, and relax the permissions:
BUS=="usb", SYSFS{iSerial}=="A7004luX", MODE="0666", SYMLINK+="usbp2", OWNER="rst", GROUP="users"
After reloading the rules (udevadm control --reload-rules), I would like to see the symlink created when I plug in the device. Unfortunately, that is not the case.
For another device, I use SYSFS{idVendor} to determine the vendor. iSerial seems to be in the same group of variables. Perhaps it is not and only the lsusb listing makes it appear so.
A google of 'udev iSerial' returned nothing a all. How odd.
Maybe this recent thread in German helps http://lists.opensuse.org/opensuse-de/2011-12/msg00120.html
It looked like what was different was they used ATTRS() instead of SYSFS(). That did not make a difference. BUS=="usb", ATTRS{iSerial}=="A7004luX", MODE="0666", SYMLINK+="usbp1", OWNER="rst", GROUP="users" The part of udev that has always confused me is knowing which category an item is in. When I run udevadm, I see this when I plug in the device: UDEV [1323874499.445208] add /devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.0/ttyUSB0/tty/ttyUSB0 (tty) UDEV_LOG=3 ACTION=add DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.0/ttyUSB0/tty/ttyUSB0 SUBSYSTEM=tty DEVNAME=/dev/ttyUSB0 SEQNUM=1408 ID_PORT=0 ID_PATH=pci-0000:00:1d.0-usb-0:2:1.0 ID_VENDOR=FTDI ID_VENDOR_ENC=FTDI ID_VENDOR_ID=0403 ID_MODEL=FT232R_USB_UART ID_MODEL_ENC=FT232R\x20USB\x20UART ID_MODEL_ID=6001 ID_REVISION=0600 ID_SERIAL=FTDI_FT232R_USB_UART_A7004luX ID_SERIAL_SHORT=A7004luX ID_TYPE=generic ID_BUS=usb ID_USB_INTERFACES=:ffffff: ID_USB_INTERFACE_NUM=00 ID_USB_DRIVER=ftdi_sio ID_IFACE=00 ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd ID_MODEL_FROM_DATABASE=FT232 USB-Serial (UART) IC MAJOR=188 MINOR=0 Since I see other udev rules with ENV{ID_USB_INTERFACES} and the like, I also tried ENV{ID_SERIAL_SHORT}=="A7004luX". No go. It is not just that the symlink does not show up where expected. I think the rule is not triggering. When a rule does trigger, a line like this gets printed by udevadm: DEVLINKS=/dev/char/188:0 /dev/serial/by-path/pci-0000:00:1d.0-usb-0:2:1.0-port0 /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A7004luX-if00-port0 /dev/mylink The symlink one requested is shown. In my case, the name is not shown. The rule is not triggering or completing successfully. I forgot to mention that this in for openSUSE 11.2 Yours sincerely, Roger Oberholtzer OPQ Systems / Ramböll RST Office: Int +46 10-615 60 20 Mobile: Int +46 70-815 1696 roger.oberholtzer@ramboll.se ________________________________________ Ramböll Sverige AB Krukmakargatan 21 P.O. Box 17009 SE-104 62 Stockholm, Sweden www.rambollrst.se -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Wed, 2011-12-14 at 15:00 +0100, Roger Oberholtzer wrote:
On Wed, 2011-12-14 at 14:38 +0100, Lars Müller wrote:
On Wed, Dec 14, 2011 at 02:25:59PM +0100, Roger Oberholtzer wrote: [ 8< ]
The serial number is different for each converter. So it seems like the value to use.
I have made a udev rule that should make a symlink to the device, and relax the permissions:
BUS=="usb", SYSFS{iSerial}=="A7004luX", MODE="0666", SYMLINK+="usbp2", OWNER="rst", GROUP="users"
After reloading the rules (udevadm control --reload-rules), I would like to see the symlink created when I plug in the device. Unfortunately, that is not the case.
For another device, I use SYSFS{idVendor} to determine the vendor. iSerial seems to be in the same group of variables. Perhaps it is not and only the lsusb listing makes it appear so.
A google of 'udev iSerial' returned nothing a all. How odd.
This command lists the complete names of the variables you can use in the udev rules file. udevadm info --query=all --attribute-walk --name=/dev/whatever.the.name.is Interesting that the serial value is a different name than the one shown in 'lsusb -v' or in 'udevadm monitor' when the device is plugged in. Is more really merrier? My rule should be: BUS=="usb", ATTRS{serial}=="A7004luX", MODE="0666", SYMLINK+="usbp2", OWNER="rst", GROUP="users" Yours sincerely, Roger Oberholtzer OPQ Systems / Ramböll RST Office: Int +46 10-615 60 20 Mobile: Int +46 70-815 1696 roger.oberholtzer@ramboll.se ________________________________________ Ramböll Sverige AB Krukmakargatan 21 P.O. Box 17009 SE-104 62 Stockholm, Sweden www.rambollrst.se -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (2)
-
Lars Müller
-
Roger Oberholtzer