My SnapMaker resides in the basement. If using Luban, I can access it via WLAN, of course. But more advanced software like Cura or LightBurn does not have this access.
Consequently, we need to enhance the connectivity of the SnapMaker. By its USB port, I attach it to a Linux machine nearby. In my case this is a nice little micro PC, but any decent Raspberry Pi does the job. On this Linux machine I run OctoPrint, connecting to the SnapMaker and pretty nicely administrating all 3D print jobs. But, still limited to 3D printing and not tailored to either Laser or CNC operation. Files generated by Cura or any other software can be uploaded, though.
I order to access the SnapMaker directly from LightBurn or Cura, we need to do something else: Forwarding the USB port of the SnapMaker via network to a different computer.
In order to do so, some software has to be installed on the Linux machine that resides next to the SnapMaker:
sudo apt install linux-tools-generic hwdata
Part of these tools is the host for USB forwarding. The kernel module is started by
sudo modprobe usbip_host
In order to have this to start automatically when the machine boots, issue
sudo echo âusbip_hostâ >> /etc/modules
To test for the proper status of the module, boot your SnapMaker and issue the command
sudo usbip list -l
on the attached Linux machine. The output should contain two lines similar to the following
busid 1-3.2 (1a86:7523)
QinHeng Electronics : HL-340 USB-Serial adapter (1a86:7523)
The busid shows in which way the SnapMaker (which has the HL-340 USB-Serial adapter built in) is connected to your Linux machine. Write down this busid, which my be different in your case.
We now bind the SnapMaker USB port to usbip by issueing
sudo usbip bind -b 1-3.2 (of course with your actual busid)
and start the usbipd program
sudo usbipd
We do not start this as a daemon, since we might kill the port forwarding when using the local OctoPrint server.
As a final check, test wether the SnapMaker is exported properly:
sudo usbip list -r localhost
which results in an output similar to the following:
Exportable USB devices
- localhost
1-3.2: QinHeng Electronics : HL-340 USB-Serial adapter (1a86:7523)
: /sys/devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3.2
: Vendor Specific Class / unknown subclass / unknown protocol (ff/00/00)
Next, we switch to the machine running LightBurn - in my case my laptop computer. For the moment we say it is a Linux machine as well. Of course, it needs the client side of the usbip software:
sudo apt install linux-tools-generic hwdata
from which we take a kernel module
sudo modprobe vhci-hcd
Automatically starting this at boot time means to issue
sudo echo âvhci-hcdâ >> /etc/modules
We can then test if the SnapMaker is available by issueing
sudo usbip list -r
which results in an output similar to
Exportable USB devices
- 192.168.0.xx
1-3.2: QinHeng Electronics : CH340 serial converter (1a86:7523)
: /sys/devices/pci0000:00/0000:00:15.0/usb1/1-3/1-3.2
: Vendor Specific Class / unknown subclass / unknown protocol (ff/00/00)
As the next step, I include this USB port into the local USB structure on my laptop computer:
sudo usbip attach -r <IP address of the âŠ> -b 1-3.2
And, voilĂĄ, questioning the USB devices on my laptop by
sudo lsusb
then also includes the following line
Bus 001 Device 008: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Consequently, on my laptop I can then use the remote SnapMaker as if it were attached locally !
One more thing needs to be done in order to find it also by LightBurn, because at the moment the imported USB port can only be opened by root. So issue
sudo dmesg | grep USB
which tells us to which serial port the SnapMaker is attached, in this case /dev/ttyUSB1
[ 416.421307] usb 5-1: new full-speed USB device number 2 using vhci_hcd
[ 416.592190] usb 5-1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.64
[ 416.592200] usb 5-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 416.592204] usb 5-1: Product: USB Serial
[ 416.638979] usbserial: USB Serial support registered for generic
[ 416.639706] usbserial: USB Serial support registered for ch341-uart
[ 416.652698] usb 5-1: ch341-uart converter now attached to ttyUSB1
My final command then is
sudo chmod 666 /dev/ttyUSB1
Of course the change of the permissions can be made permanent, in the usual way.
And LightBurn connects very nicely to this port: