How to create /dev/ttyACMx alias for 3D printer automatically
If you have a 3D printer that connects via USB, you might have noticed that the device name (/dev/ttyACM0
, /dev/ttyACM1
, etc) can change between reboots or board resets.
In order to fix this, I recommend creating a udev rule that creates a symlink to any /dev/ttyACM device that is connected to your system.
This only works if you never connect more than one 3D printer (or other /dev/ttyACMx
device at a ) at a time.
Create
/etc/udev/rules.d/99-3d-printer-alias.rules
with the following content:
SUBSYSTEM=="tty", KERNEL=="ttyACM[0-9]*", SYMLINK+="serial/3dprinter"
This will create a symlink /dev/serial/3dprinter
that points to the first /dev/ttyACMx
device that is connected.
After creating the file, you can either reboot your system or run
sudo udevadm control --reload-rules
sudo udevadm trigger