Airprint with CUPS on DD-WRT 27 Jul, 2020 Airprint with CUPS on DD-WRT

Another note to self on enabling Airprint for a legacy network printer with Avahi and CUPS on DD-WRT (HP P3005).

Prerequisites: router with DD-WRT and a USB port (to install cupsd via Entware), a network capable printer. My notes on the router setup are here.

Mostly a rehash of the tutorials from TomatoUSB1 and EzUnix2, in case those links go dead:

  • opkg install hplip-full
  • opkg install cups cups-filters cups-pdf # this was required to get CUPS to recognize application/pdf as valid filter and to enable pdftoraster needed below.
  • Add this to Firewall starup script:

      # CUPSd WebInterface (http/tcp)
      iptables -I INPUT -p tcp --dport 631 -i vlan2 -j ACCEPT
      # CUPSd printer port
      iptables -I INPUT -p tcp --dport 9100 -i vlan2 -j ACCEPT
    
  • Navigate to CUPS web interface http://< router-ip >:631 > Administration > Add Printer
    • Choose HP Printer (HPLIP), Continue
    • Connection: socket://< network-printer-ip >:9100, Continue
    • Provide Name, Description, Location and choose to ‘Share This Printer’, Continue
    • Choose Make: HP, Continue
    • Choose Model: HP LaserJet p3005…, Add Printer
  • Run:

      echo "image/urf application/pdf 100 pdftoraster" > /opt/share/cups/mime/airprint.convs
      echo "image/urf urf string(0,UNIRAST<00>)" > /opt/share/cups/mime/airprint.types
    
  • Create /opt/etc/avahi/services/airprint-hpp3005.service with the following content 3,4:

      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE service-group SYSTEM "avahi-service.dtd">
      <service-group>
        <name replace-wildcards="yes">AirPrint HP1220C @ %h</name>
        <service>
          <type>_ipp._tcp</type>
          <subtype>_universal._sub._ipp._tcp</subtype>
          <port>631</port>
          <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/(name-from-cups)</txt-record>
          <txt-record>note=your note</txt-record>
          <txt-record>product=(GPL Ghostscript)</txt-record>
          <txt-record>printer-state=3</txt-record>
          <txt-record>printer-type=0x82b01c</txt-record>
          <txt-record>pdl=application/octet-stream,application/pdf,application/postscript,image/gif,image/jpeg,image/png,image/tiff,image/urf,text/html,text/plain,application/vnd.cups-banner,application/vnd.cups-command,application/vnd.cups-pdf,application/vnd.cups-postscript</txt-record>
        </service>
      </service-group>
    

    You could generate this file from TJ Fontaine’s airprint-generate, but that did not work for me with some Python errors I chose not to pursue.

  • /opt/etc/init.d/rc.unslung restart

Done, you should find this printer via Airprint. You can use the CUPS web interface to configure printer defaults (duplex, two-sided printing, economy/high quality etc.).

For the record, HP p3005 has a decent web interface at http://< printer-ip > and also at the CUPS port: http://< printer-ip >:631.

References



Tags  ·   DD-WRT  ·   CUPS  ·   Airprint  ·   Show Comments ▾


     
Original design for Tumblr crafted by Prashanth Kamalakanthan.
Adapted for Tumblr & Jekyll by Sai Charan. Customized theme available on Github.

Sai Charan's blog by Sai Charan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Creative Commons License