Klipper – USB automount & copy gcodes in /home/pi/printer_data/gcodes – Raspberry – Armbian TVbox
This work for “pi” user, with Raspberry and Armbian TVbox
Go to https://github.com/Travis90x/TwoTrees-Sapphire-Plus-SP5-Klipper/tree/main/scripts
Copy the scripts files below
in /home/pi/printer_data/config/scripts
USB_KEY.sh
(This show all USB device connected, es: /dev/sda1 /dev/sda2 /dev/sdb1 etc..)
USB_MOUNT.sh
(This mount without superuser “sudo mount” all /dev/sdXY to /media/pi/XXX)
USB_UNMOUNT.sh
(This unmount all /dev/sdXY)
USB_COPY.sh
(This copy all file in /media/pi/XXX/gcodes in /home/pi/printer_data/gcodes)
execute in putty
sudo chmod +x /home/pi/printer_data/config/scripts/USB_KEY.sh
sudo chmod +x /home/pi/printer_data/config/scripts/USB_MOUNT.sh
sudo chmod +x /home/pi/printer_data/config/scripts/USB_UNMOUNT.sh
sudo chmod +x /home/pi/printer_data/config/scripts/USB_COPY.sh
sudo apt install udisks2sudo usermod -aG plugdev pi
in printer.cfg add the macros below
(or in printer.cfg add [include shell_command.cfg] and in shell_command.cfg add the macros below)
the macros listed below are in:
https://github.com/Travis90x/TwoTrees-Sapphire-Plus-SP5-Klipper/blob/main/shell_command.cfg
[gcode_macro USB_KEY]
[gcode_shell_command USB_KEY]
[gcode_macro USB_MOUNT]
gcode_shell_command USB_MOUNT]
[gcode_macro USB_UNMOUNT]
[gcode_shell_ommand USB_UNMOUNT]
[gcode_macro USB_COPY_GCODES]
[gcode_shell_command USB_COPY_GCODES]