2

I have a four-port USB hub and four USB/serial adaptors. I want to ensure that the adaptor in port 0 is always called 'ttyUSB0' and so on.

udev will not allow device renames, with a rule such as:

KERNEL=="ttyUSB*", KERNELS=="1-1.4", NAME="ttyCOM3"

I get:

NAME="ttyUSB3" ignored, kernel device nodes can not be renamed; please fix it in /etc/udev/rules.d/00-ttyUSB.rules:3

a symlink is allowed, with a rule such as:

KERNEL=="ttyUSB*", KERNELS=="1-1.4", SYMLINK+="ttyCOM3"

resulting in:

/etc/udev/rules.d# ls -al /dev/ttyUSB0 /dev/ttyCOM*
lrwxrwxrwx 1 root root         7 Oct  7 11:22 /dev/ttyCOM3 -> ttyUSB0
crw-rw---- 1 root dialout 188, 0 Oct  7 11:22 /dev/ttyUSB0

the udev manual says "See systemd.link(5) for a higher-level mechanism for setting the interface name. The name of a device node cannot be changed by udev"

but this seems to only refer to network interfaces.

Is it possible to configure systemd (or some other layer) to create the ttyUSB[0123] nodes the way I want?

Thanks,

  • not systemd but udev rules. Check the related links shown at the right – Serge Oct 07 '16 at 14:08
  • All I've read implies this no longer possible with udev. It can make symlinks, but does not control the initial assignment of ttyUSB[0123] which is what I am hoping for. Is there a specific example of this? – Dave Lawrence Oct 07 '16 at 21:08
  • Why symlinks could not satisfy your needs? – Serge Oct 08 '16 at 16:49
  • Hi, I can work with the symlinks, but I would like to know if the initial naming of the ports can be fixed as I've described as was obviously possible in the past as I've seen examples using NAME (as above) – Dave Lawrence Oct 09 '16 at 14:17
  • It depends on order of enumeration of all ports, so if you plug one more serial usb adapter the order could change. I would not rely on that naming but create symlinks using device serial number and other attributes available to udev. – Serge Oct 09 '16 at 16:41
  • Hi, yes, that is the point of my question; the ports can enumerate in any order, but previously udev used to be able to [re]name the ports ttyUSB[0123] according to the USB node numbers, but that mechanism seems to have been removed. The implication is that this is still possible using a different layer [e.g. systemd] – Dave Lawrence Oct 09 '16 at 16:52

0 Answers0