如何使用rules.d分配串口名称?

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"

但这并没有实现,因为设备再次以ttyAMC0和ttyAMC1出现。是否可以为串行端口分配一个稍有不同的名称?只是一点背景;我需要确保名称不会在ttyACM0和ttyACM1之间翻转,因为我有一个程序使用它们的路径与这些设备建立通信(例如:/ dev / ttyACM0),并且我需要这些名称在PC之后必须稳定重新启动,以及使用USB集线器时。如果无法分配名称,是否有其他选项可以实现所需的目标?

提前致谢!

评论