LumenPnP: Always assign the same serial port number on Linux

It is certainly a hassle when you always have to re-configure OpenPnP to open the correct serial device for LumenPnP.

In order to fix, this, we’ll create an alias /dev/lumenpnp that points to /dev/ttyACM0 or /dev/ttyACM1 or any other port that gets assigned to LumenPnP. Create /etc/udev/rules.d/99-lumenpnp.rules:

ACTION=="add", ENV{ID_VENDOR_ID}=="0483", ENV{ID_MODEL_ID}=="5740", SYMLINK+="lumenpnp"

Now, reload udev to activate the rule:

sudo udevadm control --reload-rules && sudo udevadm trigger

Now, open ~/.openpnp2/machine.xml, find this line:

<serial line-ending-type="LF" port-name="ttyACM0" baud="115200" ...

and set port-name to lumenpnp:

<serial line-ending-type="LF" port-name="lumenpnp" baud="115200" ...

After this, you need to restart OpenPnP. Typically, it works without reconnecting the device (due to udevadm trigger). If it doesn’t work, unplug and re-plug the mainboard USB connector.