The system is Ubuntu 16.04 with two Arduino devices connected via USB cables. When they are connected they appear in /dev directory as ttyACM0 and ttyACM1. Is it possible to assign a different name with a slightly different identifier such as ttyACM5?

I ran the udevadm info --name=/dev/ttyACM0 --attribute-walk command and based on the attributes they are differentiable (have different serial numbers). I tried putting a file in /etc/udev/rules.d with the lines:

ACTION=="add", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0043", ATTRS{serial}=="55839313738351017091", KERNEL="ttyUSB5", MODE="666" and ACTION=="add", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0043", ATTRS{serial}=="55839313738351017071", KERNEL="ttyUSB5", MODE="666"

But that didn't fly as the devices came up again as ttyAMC0 and ttyAMC1. Is it possible to assign a serial port a name with a slightly different number? Just a bit of background; I need to make sure the names don't flip flop between ttyACM0 and ttyACM1 after as I have a program establishing communications with these devices using their path (ex: /dev/ttyACM0), and I need the names to be stable after a PC power cycle, and also when using a USB hub. If assigning a name is off the table, any other options to achieve the desired goal?

Thanks in advance!

  • I suspect you shouldn't be trying to assign to the KERNEL attribute - try NAME="ttyUSB5" or (failing that) SYMLINK="ttyUSB5" (which won't change the primary node identifier, but should give you an alternate that you can refer to it by) – steeldriver Apr 24 '20 at 14:44
  • 1
    I use something like this: SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A400g81t", SYMLINK+="scope" in that example, the device will be called "scope" – Jean-Marie Apr 24 '20 at 14:45

The answers offered by @steeldriver and @Jean-Marie are both spot on and the SYMLINK="ttyUSB5" did work. Essentially it created a link that is a pointer to the name the system creates for the port. Thanks!

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.