[SOLVED]Can't get (e)udev rule to work.

You have a problem with Salix? Post here and we'll do what we can to help.
Kimdino
Donor
Posts: 17
Joined: 18. Mar 2017, 01:24
Location: Dorset, England

[SOLVED]Can't get (e)udev rule to work.

Post by Kimdino »

I have a 'Future Technology Devices' USB-NMEA 0183 transceiver and I would like the system to automatically give non-root access to this device. At a later date (i.e. when I get the code written) I would also like it to start software to log various NMEA sentences. With this in mind the device node needs to have a clearly recogniseable name that a piece of simple code may identify and connect to.

I have created a '/lib/udev/rules.d/97-ftdi-usb-nmea.rules' file containing the following.

Code: Select all

# Future Technology Devices FTZ9U2GL (FT232) USB/NMEA 0183 converter.
ATTRS{idvendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="usb2nmea%n", GROUP="users", MODE="0666"
Previous attempts have included SUBSYSTEM=="tty", and SUBSYTEM=="usb",.
I have also tried ID_VENDOR_ID=="0403", ID_MODEL_ID=="6001",
I have also tried placing the file in '/etc/udev/rules.d'.
I have checked the rules files permissions and they are '-rw-r--r--', the same as the other existing rules.
None of this has produced the desired symlink, or appeared to have any effect..

Plugging in the device has always created a node at '/devttyUSBx' with no problem, and 'lsmod' reveals that the 'ftdi_sio' module is loaded, along with 'usbserial', when the device is plugged in. Just can't get it to do the additional bits that I want.

Running 'udevadm monitor --kernel --udev --property' produces the following when the device is plugged in.

Code: Select all

KERNEL[13709.254344] add      /devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4 (usb)
ACTION=add
BUSNUM=003
DEVNAME=/dev/bus/usb/003/013
DEVNUM=013
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4
DEVTYPE=usb_device
MAJOR=189
MINOR=268
PRODUCT=403/6001/600
SEQNUM=8622
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13709.256530] add      /devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0
DEVTYPE=usb_interface
INTERFACE=255/255/255
MODALIAS=usb:v0403p6001d0600dc00dsc00dp00icFFiscFFipFFin00
PRODUCT=403/6001/600
SEQNUM=8623
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13709.256567] add      /devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0/ttyUSB0 (usb-serial)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0/ttyUSB0
SEQNUM=8624
SUBSYSTEM=usb-serial

KERNEL[13709.256923] add      /devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0/ttyUSB0/tty/ttyUSB0 (tty)
ACTION=add
DEVNAME=/dev/ttyUSB0
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0/ttyUSB0/tty/ttyUSB0
MAJOR=188
MINOR=0
SEQNUM=8625
SUBSYSTEM=tty

UDEV  [13709.273047] add      /devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4 (usb)
ACTION=add
BUSNUM=003
DEVNAME=/dev/bus/usb/003/013
DEVNUM=013
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4
DEVTYPE=usb_device
ID_BUS=usb
ID_MM_DEVICE_MANUAL_SCAN_ONLY=1
ID_MODEL=USB-RS232_Cable
ID_MODEL_ENC=USB-RS232\x20Cable
ID_MODEL_FROM_DATABASE=FT232 USB-Serial (UART) IC
ID_MODEL_ID=6001
ID_REVISION=0600
ID_SERIAL=FTDI_USB-RS232_Cable_FTZ9U2GL
ID_SERIAL_SHORT=FTZ9U2GL
ID_USB_INTERFACES=:ffffff:
ID_VENDOR=FTDI
ID_VENDOR_ENC=FTDI
ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd
ID_VENDOR_ID=0403
MAJOR=189
MINOR=268
PRODUCT=403/6001/600
SEQNUM=8622
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=709264174

UDEV  [13709.279193] add      /devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0
DEVTYPE=usb_interface
ID_MODEL_FROM_DATABASE=FT232 USB-Serial (UART) IC
ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd
INTERFACE=255/255/255
MODALIAS=usb:v0403p6001d0600dc00dsc00dp00icFFiscFFipFFin00
PRODUCT=403/6001/600
SEQNUM=8623
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=709274789

UDEV  [13709.280022] add      /devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0/ttyUSB0 (usb-serial)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0/ttyUSB0
SEQNUM=8624
SUBSYSTEM=usb-serial
USEC_INITIALIZED=709279967

UDEV  [13709.284113] add      /devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0/ttyUSB0/tty/ttyUSB0 (tty)
ACTION=add
DEVLINKS=/dev/serial/by-id/usb-FTDI_USB-RS232_Cable_FTZ9U2GL-if00-port0 /dev/serial/by-path/pci-0000:00:16.2-usb-0:4.4:1.0-port0
DEVNAME=/dev/ttyUSB0
DEVPATH=/devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.0/ttyUSB0/tty/ttyUSB0
ID_BUS=usb
ID_MM_CANDIDATE=1
ID_MODEL=USB-RS232_Cable
ID_MODEL_ENC=USB-RS232\x20Cable
ID_MODEL_FROM_DATABASE=FT232 USB-Serial (UART) IC
ID_MODEL_ID=6001
ID_PATH=pci-0000:00:16.2-usb-0:4.4:1.0
ID_PATH_TAG=pci-0000_00_16_2-usb-0_4_4_1_0
ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
ID_PCI_INTERFACE_FROM_DATABASE=EHCI
ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
ID_REVISION=0600
ID_SERIAL=FTDI_USB-RS232_Cable_FTZ9U2GL
ID_SERIAL_SHORT=FTZ9U2GL
ID_TYPE=generic
ID_USB_DRIVER=ftdi_sio
ID_USB_INTERFACES=:ffffff:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=FTDI
ID_VENDOR_ENC=FTDI
ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd
ID_VENDOR_ID=0403
MAJOR=188
MINOR=0
SEQNUM=8625
SUBSYSTEM=tty
USEC_INITIALIZED=709284031
I have been using http://www.reactivated.net/writing_udev_rules.html & https://linuxconfig.org/tutorial-on-how ... les-syntax for instructions on writing the rules. Both are clear and simple enough. Can't see how I could get it wrong!
Can anyone see why my rule does not work?
I cannot see it mentioned anywhere that 'eudev' rules differ in any way from 'udev' rules, can anyone confirm this?
Last edited by Kimdino on 27. Feb 2018, 12:09, edited 2 times in total.
User avatar
gapan
Salix Wizard
Posts: 6238
Joined: 6. Jun 2009, 17:40

Re: Can't get (e)udev rule to work.

Post by gapan »

I haven't looked into your post in detail, but have you restarted eudev or rebooted after you made the change?

One thing though: put your own rules in /etc/udev/rules.d, not /lib/udev/rules.d
Image
Image
Kimdino
Donor
Posts: 17
Joined: 18. Mar 2017, 01:24
Location: Dorset, England

Re: Can't get (e)udev rule to work.

Post by Kimdino »

Hi gapan,
The system has had a couple of weeks of rebooting since . I have tried the file in both directories, even simultaneously at times. (Yep, grasping at straws.)
User avatar
gapan
Salix Wizard
Posts: 6238
Joined: 6. Jun 2009, 17:40

Re: Can't get (e)udev rule to work.

Post by gapan »

Can you post the output of

Code: Select all

sudo lsusb
with the device plugged in?

(I edited your previous post and added code tags. You should use them too, makes everything easier to read)
Image
Image
Kimdino
Donor
Posts: 17
Joined: 18. Mar 2017, 01:24
Location: Dorset, England

Re: Can't get (e)udev rule to work.

Post by Kimdino »

'lsusb' shows the device as:

Code: Select all

Bus 003 Device 010: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
User avatar
gapan
Salix Wizard
Posts: 6238
Joined: 6. Jun 2009, 17:40

Re: Can't get (e)udev rule to work.

Post by gapan »

It should work then. Can you maybe try with "ATTR" instead of "ATTRS" in the udev rule?
Image
Image
Kimdino
Donor
Posts: 17
Joined: 18. Mar 2017, 01:24
Location: Dorset, England

Re: Can't get (e)udev rule to work.

Post by Kimdino »

ATTRS changed to ATTR, and no change. Even after rebooting.

Do you know how udev would behave if just one statement in the rule was garbage? Would it carry on and process the statements that made sense, or ignore the rule totally?
User avatar
gapan
Salix Wizard
Posts: 6238
Joined: 6. Jun 2009, 17:40

Re: Can't get (e)udev rule to work.

Post by gapan »

It would ignore the rule totally.

Does the symlink get created? I'm thinking that maybe another rule is changing the permissions back.
Image
Image
Kimdino
Donor
Posts: 17
Joined: 18. Mar 2017, 01:24
Location: Dorset, England

Re: Can't get (e)udev rule to work.

Post by Kimdino »

Symlink not created.

I have just run 'grep -rnT 6001 *rule*' & 'grep -rnT 6001 *rule*' on the rules directories. Only the following showed up in addition to my entry, but it is commented out. Anyway I did check for '/dev/gps*' but no such entry is being created.

Code: Select all

rules.d/97-gpsd.rules:  31     :#ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug"
Last edited by Kimdino on 27. Feb 2018, 11:53, edited 1 time in total.
User avatar
gapan
Salix Wizard
Posts: 6238
Joined: 6. Jun 2009, 17:40

Re: Can't get (e)udev rule to work.

Post by gapan »

Oh, I think I got it. You have "idvendor". Should be "idVendor" (capital V).
Image
Image
Post Reply