RPi Zero W printer server

Posted on Feb 17, 2021 Software

Our good old Canon MF4010 laser printer has served us well over the years. There is only one problem: you have to connect it via USB. Now that the family does work and school from home, having a network enabled printer would be nice to have. Previous attempts to make the printer available using CUPS have failed. That changed when I encountered the p910nd  printer daemon.

The configuration is super simple. This is my /etc/default/p910nd file:


P910ND_OPTS="-f /dev/usb/lp0"

# Debian specific (set to 1 to enable start by default)
P910ND_START=1

The p910nd can be installed on the RPI. In this case I'm using a RPI Zero W that will allow me to connect to the Wifi network.

Service discovery

To make the printer discoverable using mDNS add /etc/avahi/services/printer.service to the already installed avahi daemon.


<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">

<service-group>
  <name replace-wildcards="yes">Canon MF4010 laserprinter on %h</name>
  <service>
    <type>_pdl-datastream._tcp</type>
    <port>9100</port>
    <txt-record>qtotal=1</txt-record>
    <txt-record>ty=Canon MF4010</txt-record>
    <txt-record>product=(Canon MF4010)</txt-record>
    <txt-record>usb_MFG=Canon</txt-record>
    <txt-record>usb_MDL=MF4010 series</txt-record>
    <txt-record>Color=F</txt-record>
    <txt-record>Duplex=F</txt-record>
    <txt-record>Bind=F</txt-record>
    <txt-record>Collate=F</txt-record>
    <txt-record>Sort=F</txt-record>
    <txt-record>Staple=F</txt-record>
    <txt-record>Punch=F</txt-record>
    <txt-record>PaperMax=legal-A4</txt-record>
  </service>
</service-group>

On the computer(s) that want to use this printer you have to install the Canon driver.

Wifi issue

The RPi Zero did not connect to my WPA Enterprise network. Others have had the same issue. Changing the order of the drivers does the trick. Edit the file /lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant to look like this:

WPA supplicant hook

Wireless printer: check!