Printserver for label printer Brother QL570

The Brother QL570 is a label printer with USB interface. This article describes how to connect the printer through an inexpensive NEXX WT3020F mini pocket router to the local network.

QL570 with NEXX router as printserver

Install openWRT

Connect the LAN port (the connector near USB) of the router to your computer's network and login with user nexxadmin (please see en How to Turn a NEXX WT3020 Router into a Tor Router for details)
$ telnet 192.168.8.1
Download and install openWRT:
# cd /tmp
# wget http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7620/
       openwrt-15.05.1-ramips-mt7620-wt3020-8M-squashfs-sysupgrade.bin
# mtd_write -r write openwrt-15.05.1-ramips-mt7620-wt3020-8M-squashfs-sysupgrade.bin mtd3
# reboot
Now openWRT should run on the router and you can login with telnet on IP 192.168.1.1. First step is to change the password:
#passwd

Install drivers

#opkg update
#opkg install kmod-usb-printer
#opkg install p910nd

Enable printserver

# vi /etc/config/p910nd
config p910nd
        option device        /dev/usb/lp0
        option port          0
        option bidirectional 1
        option enabled       1

Configure firewall

Because the NEXX should act as printserver in the local network, the router functions are not used. To allow connections from the WAN port, we must open the firewall (don't connect it directly to the internet in this way!).
# vi /etc/config/firewall
Change input of zone config "wan" to "ACCEPT":
config zone                           
        option name             wan   
        list   network          'wan'
        list   network          'wan6'
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT
        option masq             1     
        option mtu_fix          1
Open the firewall for printserver:
config 'rule'                                          
        option 'src' 'lan'                    
        option 'proto' 'tcp'                 
        option 'dest_port' '9100'                  
        option 'target' 'ACCEPT'
Now the NEXX is connected via the WAN port to the local network and you can print labels via the printserver.

Optional: Start script on printer plug-in

If you would like to start a script every time the printer is turned on (e.g. to catch labels from a server), use this:
# vi /etc/hotplug.d/usb/20-ql570
#!/bin/sh

QL570_PRODID="4f9/2028/100"

if [ "${PRODUCT}" = "${QL570_PRODID}" ]; then
    if [ "${DEVTYPE}" = "usb_device" ]; then
        if [ "${ACTION}" = "add" ]; then
            echo "usb1 $ACTION" >> /tmp/test.txt
        fi
    fi
fi

Links

en How to Turn a NEXX WT3020 Router into a Tor Router