zed.0xff.me

printing from OSX & iOS to Canon MF-4018 shared via WNDR3700

0. Reason for this all

HP Photosmart 5510

Just bought an HP Photosmart 5510 with wifi & ePrint and my MacBook Air found and installed it via wifi without the need of any drivers or anything.

Canon MF4018

But I also have older Canon MF4018, connected directly to WNDR3700 via usb, and which I failed to set up for printing from my Macs via wifi.

1. Drivers

Netgear WNDR3700

The main reason why I failed is Canon’s drivers for MF4018 (or MF4010, their printing functions are the same). They only have more or less usable drivers for Windows and Linux, closed-source and bad designed, with a lot of proprietary stuff.

There is a way to make your OpenWRT router act like a print server for Windows & Linux clients, but it refuses to work with OSX client.

And even if we’ll somehow force it to work with OSX client, it will still need a lot of Canon drivers installed on Mac and carefully configured. And definitely will not work with iOS

2. Workaround

You can use one simple workaround if you have an x86 or x86_64 computer running 24/7 at your place. Or if you want to manually turn it on every time when you need to print something.

You can then install CUPS on your device, or use a Windows Printer Sharing.

Unacceptable for me. I only have WNDR3700 on ar71xx platform, and AppleTV2 on ARM Cortex A8 running nearly 24/7 at my home.

3. An Insight

If I can’t run an x86 PC 24/7 at my place — who or what can stop me to run it somewhere on Internet?!

(I already have a pair of servers on Internet, so let’s increase their load average a little :)

IMPORTANT: You’ll need to have a Real IP address at your place, or some other way of receiving data from your Internet server, like a SSH tunnel.

4. Step-by-step guide

  1. WNDR3700 (or other OpenWrt-based router, or DD-WRT one, or wl500g)
    1. Connect MF4018 via usb
    2. Set up p910nd
    3. Open port 9100 in firewall:
      iptables -A INPUT -j ACCEPT -p tcp -s your.internet.server.real.ip --dport 9100
  2. Internet server
    1. install CUPS
    2. install Canon Proprietary drivers: for example UFRII/UFRII LT Printer Driver for Linux v2.20
    3. Add a printer:
      lpadmin -p mf4010 -P CNCUPSMF4010ZK.ppd -v socket://my.home.real.ip:9100 -o printer-is-shared=true
    4. enable CUPS Internet sharing:
    5. set up CUPS and/or firewall to only allow connections from YOUR home/office network
  3. Optional steps, needed only for seamless printer autoconfiguration for OSX/iOS devices
    1. Configure
      1. Internet server: use airprint-generate to generate a .service file for your printer
      2. edit generated file: add <host-name>my.internet.server.real.ip</host-name>
      3. WNDR3700: install avahi-daemon, feed it with previously generated file, start it
    2. Now in OSX “Add Printers” Dialog just click “+” and it should see your printer, iOS should see your printer when you’ll try to print some photo

my autogenerated & edited mf4010.service file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0"?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">Canon MF4018</name>
  <service>
    <type>_ipp._tcp</type>
    <subtype>_universal._sub._ipp._tcp</subtype>
    <port>631</port>
    <host-name>my.internet.server.real.ip</host-name>       <!-- EDIT THIS -->
    <txt-record>txtvers=1</txt-record>
    <txt-record>qtotal=1</txt-record>
    <txt-record>Transparent=T</txt-record>
    <txt-record>URF=none</txt-record>
    <txt-record>rp=printers/mf4010</txt-record>
    <txt-record>note=laser</txt-record>
    <txt-record>product=(GPL Ghostscript)</txt-record>
    <txt-record>printer-state=3</txt-record>
    <txt-record>printer-type=0x821484</txt-record>
    <txt-record>pdl=application/octet-stream,application/pdf,application/postscript,image/gif,image/jpeg,image/png,image/tiff,text/html,text/plain,application/vnd.cups-banner,application/vnd.cups-postscript,application/vnd.cups-raw,application/vnd.hp-hpgl,image/x-bitmap</txt-record>
  </service>
</service-group>