Auto Klipper reconnection to the MCU

This allows Klipper to automatically reconnect when the MCU is powered on.

Get your USB vendor and product IDs

First you need to find you MCU's Vendor and Product ID. Type the following command in a SSH terminal.
TIP: to find out which USB device is your MCU, disconnect your MCU and run slusb again. and compare the two. You will find a line like this (this is my MCU):
Bus 001 Device 006: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
in this case, 1a86 is the Vendor ID and 7523 is the Product ID. Save those on the side...

Edit rules

Now we need to updated rules.d. Type:
cd /etc/udev/rules.d/
sudo nano 98-klipper.rules
and add this line at the end of the document:
SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", ACTION=="add", RUN+="/bin/sh -c '/bin/echo RESTART > /dev/pts/0'"
Make sure to change the idVendor and idProduct values to the ones you got in the first step. Then do Ctrl +X Y Enter to save the changes.


You did it!