0

I am having some problem assigning rules from udev.

I have 2 FTDI232 chips mounted on my board (they are totally 3 but I am interested in 2 of them right now), the kernel manages them with the drivers ftdi_sio, names them as ttyUS0 and ttyUSB1 and I am applying these rules in order to name them as usbS1 and usbS2:

KERNELS=="1-2.1" KERNEL=="ttyUSB0" ATTR{idVendor}=="0403" ATTR{idProduct}=="6001" SUBSYSTEMS=="usb" NAME="usbS1"
KERNELS=="1-2.2" KERNEL=="ttyUSB1" ATTR{idVendor}=="0403" ATTR{idProduct}=="6001" SUBSYSTEMS=="usb" NAME="usbS2"

according to the inormation from dmesg

[    4.676116] usb 1-2.1: new full-speed USB device number 3 using ehci-omap
[    4.811920] usb 1-2.1: New USB device found, idVendor=0403, idProduct=6001
[    4.819244] usb 1-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    4.826965] usb 1-2.1: Product: FT232R USB UART
[    4.831726] usb 1-2.1: Manufacturer: FTDI
[    4.835968] usb 1-2.1: SerialNumber: A101XRTT
[    4.963256] usb 1-2.2: new full-speed USB device number 4 using ehci-omap
[    5.102355] usb 1-2.2: New USB device found, idVendor=0403, idProduct=6001
[    5.109649] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    5.117370] usb 1-2.2: Product: FT232R USB UART
[    5.122161] usb 1-2.2: Manufacturer: FTDI
[    5.126403] usb 1-2.2: SerialNumber: A101XRTQ

...

[   16.839935] usbserial: USB Serial support registered for FTDI USB Serial Device
[   16.848327] ftdi_sio 1-2.1:1.0: FTDI USB Serial Device converter detected
[   16.856781] usb 1-2.1: Detected FT232RL
[   16.977935] usb 1-2.1: FTDI USB Serial Device converter now attached to ttyUSB0
[   16.986785] ftdi_sio 1-2.2:1.0: FTDI USB Serial Device converter detected
[   16.994720] usb 1-2.2: Detected FT232RL
[   17.099914] usb 1-2.2: FTDI USB Serial Device converter now attached to ttyUSB1
[   17.108581] ftdi_sio 1-2.7:1.0: FTDI USB Serial Device converter detected
[   17.116485] usb 1-2.7: Detected FT232RL
[   17.165710] i2c 2-005c: Driver mt9v032 requests probe deferral
[   17.187561] twl4030_madc 48070000.i2c:twl@48:madc: clk disabled, enabling
[   17.228759] usb 1-2.7: FTDI USB Serial Device converter now attached to ttyUSB2

But it's not working. I don't know why.

On a older system (with kernel 2.6.34) I was simply applying these rules:

KERNELS=="2-2.1" SUBSYSTEMS=="usb" NAME="usbS1"
KERNELS=="2-2.2" SUBSYSTEMS=="usb" NAME="usbS2"

which works fine on that system, but not on this one I am working on right now (of course with the KERNELS parameters changed).

What's wrong in my rules file ?

1

It might be one of the following situations:

  1. In the rule, you refer directly to these devices by their kernel name (KERNEL=), and maybe the kernel does not call your devices ttyUSB?, therefore, the rule does not apply
  2. udev does not or cannot read the file where you have written your rules.
  3. udev has already another rule overriding yours for the same devices, applying the ttyUSB? name to them.

So, I would suggest that you...

  • Check that the kernel name of your device is indeed ttyUSB?
  • Check that no other rule from udev makes any other renaming of the same device that could override your rules.
  • Check that indeed udev loads new rules at all (test with other devices if possible) and that udev can read the file where your new rules are... or test that these rules are read by placing them inside an existing rules file.
1

To help with debugging you can (not as root):

udevadm monitor

then plug in the device to see what event udev sees. You will probably see that your rules match more than one of the add events.

You can convert the device name into a path, eg

udevadm info -q path -n /dev/ttyUSB0

then give this output path to

udevadm test <path>

to trace what files udev is reading and the rules it follows. It doesn't actually run commands and so on, so it is only a hint.

0

I solved as so:

KERNELS=="1-2.1", SUBSYSTEMS=="usb", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", SYMLINK+="usbS0"
KERNELS=="1-2.2", SUBSYSTEMS=="usb", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", SYMLINK+="usbS1"
KERNELS=="1-2.7", SUBSYSTEMS=="usb", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", SYMLINK+="usbS3"

The commas and the SYMLINK directives made it work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.