1

I am trying to assign unique symlinks to USB hubs with the same vendor ID and product ID with no serial numbers assigned to them. I read this, which is a similar problem: Fixed udev rules for USB modems and associated chat: https://chat.stackexchange.com/rooms/8004/discussion-between-derobert-and-user777.

deroberto's answer to use the symlinks that exist in /dev/serial/by-path/ seems like it should work, but I cannot formulate a udev rule. It seems this should work:

SUBSYSTEM=="tty", ACTION=="add", DEV=="/dev/serial/by-path/pci-0000:00:14.0-usb-0:4.2.1:1.0-port0", SYMLINK+="mySymLink1"

or just

ACTION=="add", DEV=="/dev/serial/by-path/pci-0000:00:14.0-usb-0:4.2.1:1.0-port0", SYMLINK+="mySymLink1"

But I can't get anything to do it, for whatever reason. Any help is greatly appreciated. I would have just commented on deroberto's answer in the other thread, but I don't have enough reputation for that.

For reference

$ ls -l /dev/serial/by-path/*
rwxrwxrwx 1 root root 13 Jun 11 20:43 /dev/serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0 -> ../../ttyUSB5
lrwxrwxrwx 1 root root 13 Jun 11 20:43 /dev/serial/by-path/pci-0000:00:14.0-usb-0:4.2.1:1.0-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Jun 11 20:43 /dev/serial/by-path/pci-0000:00:14.0-usb-0:4.2.1:1.1-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Jun 11 20:43 /dev/serial/by-path/pci-0000:00:14.0-usb-0:4.2.1:1.2-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Jun 11 20:43 /dev/serial/by-path/pci-0000:00:14.0-usb-0:4.2.1:1.3-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root 13 Jun 11 20:43 /dev/serial/by-path/pci-0000:00:14.0-usb-0:4.2.2:1.0-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Jun 11 20:43 /dev/serial/by-path/pci-0000:00:14.0-usb-0:4.2.2:1.1-port0 -> ../../ttyUSB6
. 
.
.
lrwxrwxrwx 1 root root 14 Jun 11 20:43 /dev/serial/by-path/pci-0000:00:14.0-usb-0:4.2.4:1.3-port0 -> ../../ttyUSB16
user96966
  • 11
  • 1
  • 3
  • you might have to use the devfs paths for usb bus; e.g. if lsusb output shows the device connected to Bus 001 Device 003, that would correspond to /dev/bus/usb/001/003 character device. – ILMostro_7 Sep 24 '18 at 04:38

1 Answers1

1

Here is a selector I'm using for USB-attached devices:

DEVPATH=="/devices/*.usb/usb1/1-1/1-1.[1-4]/dvb/dvb[0-9]*.*[0-8]"

  • Do you know if it is possible to deactivate only one of two devices that have in commen idVentor and idProduct? Please see my question. – Johan Sep 12 '23 at 08:15