1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Print (lp or lpr) from router to network printer??

Discussion in 'Tomato Firmware' started by warsev, Aug 25, 2014.

  1. warsev

    warsev Networkin' Nut Member

    Problem: How to print a small file from the router to a networked printer.

    Purpose: Create a cron job to print a test pattern on the printer every few days to keep the print heads from going dry and clogging when I'm out of town or otherwise not using the printer.

    I've searched for hours and read everything I can find (so far) on the matter. I've found many examples of how to use a router as a print server for an attached USB printer. That's not what I want to do. I want to print from the router, preferably with something like 'lp' or 'lpr', to a networked printer.

    I presume the best course is to use cups with optware, but I can't find what packages I'd need or any idea how to configure. I have optware installed and running from a USB hard drive attached to the router. I'm successfully using it to run nginx.

    Router: Linksys WRT610Nv2 running Shibby Tomato 1.28.0000 MIPSR2-121 K26 USB Big-VPN.

    Insights on the matter will be greatly appreciated.

    Thanks,
    -Warren
     
  2. mmosoll

    mmosoll Serious Server Member

    - Yes, the best solution is to use CUPS. Check this previous post:

    http://www.linksysinfo.org/index.php?threads/optware-and-google-cloud-print.70319/

    - Others:

    a) Many years ago, with Linux I used lpd and printcap, I found this tutorial:

    https://wiki.netbsd.org/tutorials/how_to_setup_a_printer_with_lpd/

    b) The BusyBox documentation include several useful commands for printing (but they are not included in my last tomatoRAF version)

    http://www.busybox.net/BusyBox.html

    Code:
    lpd:
        lpd SPOOLDIR [HELPER [ARGS]]
    
        SPOOLDIR must contain (symlinks to) device nodes or directories with names matching print queue names. In the first case, jobs are sent directly to the device. Otherwise each job is stored in queue directory and HELPER program is called. Name of file to print is passed in $DATAFILE variable. Example:
    
                tcpsvd -E 0 515 softlimit -m 999999 lpd /var/spool ./print
    
    lpq:
        lpq [-P queue[@host[:port]]] [-U USERNAME] [-d JOBID]... [-fs]
    
        Options:
    
                -P      lp service to connect to (else uses $PRINTER)
                -d      Delete jobs
                -f      Force any waiting job to be printed
                -s      Short display
    
    lpr:
        lpr -P queue[@host[:port]] -U USERNAME -J TITLE -Vmh [FILE]...
    
        Options:
    
                -P      lp service to connect to (else uses $PRINTER)
                -m      Send mail on completion
                -h      Print banner page too
                -V      Verbose
    If you can compile a version for your router, I found this bug tracker with some changes to the previous documentation:

    http://kit168.blogspot.com.es/2013/05/busybox-v1194-lpd-cant-start.html
     
  3. koitsu

    koitsu Network Guru Member

    I'd also suggest disclosing the exact brand and full model number of printer you plan on using.

    Some printers already have native LPR/LPD support (ex. HP LaserJet), while others claim to but don't work right (i.e. have firmware bugs, e.g. some Brother printers will actually lock up hard if connecting to their LPR/LPD port and sending a stream of bytes; the printer has to be power-cycled after -- I speak from personal experience on this one).
     
    Marcel Tunks likes this.

Share This Page