Printing with AirPrint from macbook or iPhone to Epson (L355) and Dymo (4XL) printers connected to Raspberry PI3 with docker
docker-compose run
docker build --rm -f dockerfile -t pi-cups:latest .
docker run -d -p 631:631 --privileged -v /var/run/dbus:/var/run/dbus -v /dev/bus/usb:/dev/bus/usb --name pi-cups pi-cups
open with your favourite web browser:
http://<YOUR_PI_IP_ADDRESS>:631
u: print
p: print
cd foo2zjs
sudo make install
sudo make
cat /usr/share/foo2zjs/firmware/sihp1020.dl > /dev/usb/lp0
Create reload.sh
with content:
#!/bin/bash
docker-compose -f <path to>/docker-compose.yaml stop
docker-compose -f <path to>/docker-compose.yaml up -d
Run
sudo chmod +x reload.sh
Run
udevadm monitor --kernel --property --subsystem-match=usb
Connect your printer, you should see something like this:
monitor will print the received events for:
KERNEL - the kernel uevent
KERNEL[6147.486744] add /devices/pci0000:00/0000:00:0c.0/usb1/1-2 (usb)
ACTION=add <--------------------------------------------------------- ACTION of the device
BUSNUM=001
DEVNAME=/dev/bus/usb/001/010
DEVNUM=010
DEVPATH=/devices/pci0000:00/0000:00:0c.0/usb1/1-2
DEVTYPE=usb_device
MAJOR=189
MINOR=9
PRODUCT=90c/1000/1100 <---------------------------------------------------------
SEQNUM=2192
SUBSYSTEM=usb <---------------------------------------------------------
Edit file /etc/udev/rules.d/test.rules
Add:
ACTION=="add", SUBSYSTEM=="<<copy_subsystem>>", ENV{PRODUCT}=="<<copy_product>>", RUN=="/bin/bash <path to>/hotplug.sh"
not sure if neede -- udevadm control --reload
Create /hotplug.sh
#!/bin/bash
sleep 2
cat /usr/share/foo2zjs/firmware/sihp1020.dl > /dev/usb/lp0
Run
chmod +x /hotplug.sh
edit /entrypoint.sh
and add to second line
./hotplug.sh