Skip site navigation (1)Skip section navigation (2)
Date:               Wed, 17 Jan 1996 09:41:01 +600 CDT
From:      "Larry Dolinar" <LARRYD@bldg1.croute.com>
To:        questions@freebsd.org
Cc:        freebsd-questions@freebsd.org
Subject:         Re: printer and parallel port problems
Message-ID:  <14ED9F6113@bldg1.croute.com>

next in thread | raw e-mail | index | archive | help
Thus spake Doug White <dwhite@riley-net170-164.uoregon.edu> (Tue, 9 Jan 
1996):

|  On Mon, 8 Jan 1996, Chris Warth wrote:
|  
|  > Can anyone suggest a simple test to see if the parallel port is even
|  > working?  In the meantime I'll try to load windows to see if that can
|  > talk nicely to the printer.
|  
|  Find a big (>1 pg) document and cat it out:
|  
|  cat bigdocument > /dev/lpt0
|  
|  If it prints then it's not your printer.
|  
|  I'd recommend checking out the Printing guide in the Handbook.  It goes 
|  through setup and testing step-by-step, very well put together IMHO.
|  

1.  Make sure irq 7 isn't used by anything else, or use lptcontrol to set
    the mode to polled.  Without reconfig'ng the kernel, polled is much 
    preferrable.

2.  Create a simple /etc/printcap as follows; mine's for an HP 540 
    inkjet (parenthetical comments for reference ONLY):

#
lp|HP Deskjet 540:\
    :lp=/dev/lpt0:\                         (output device)
    :sd=/var/spool/lpd:\                    (spool directory)
    :lf=/var/log/lpd-errs:\                 (log file)
    :if=/usr/local/libexec/if_dj_540:\      (input filter, see comments)
    :tr=\f:\                                (trailing string,    "   )
    :sh:\                                   (suppress banner)
    :mx#0:                                  (unlimited job size)

The input filter (if) could be anywhere; this one just adds CR to the
normal LF sequence of unix: without it, most printers will just
stair-step the output, and page printers (lasers/inkjets) will truncate
the line.

The trailer (tr) is used when the queue empties.  I found that the form 
feed (\f) was basically required for the HP to print properly.

3.  Make an input filter similar to the following:

# if_dj540      simple parlor trick to add CR to LF for printer
#
awk '{printf "%s\r\n", $0}' -

For those of you that don't see quite what this does: every line of 
standard input is printed with CRLF attached.  There are certainly more 
elegant ways of doing it, but this one avoids the approach of 
reprogramming the printer to append CR to LF, then having to undo it at 
the end of every job (unless you dedicate your printer to FreeBSD  8)  ).

4.  Just    lpr <file_of_choice> and you should be there...


cheers,
larry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14ED9F6113>