Subject: Re: Why /dev/lp?
To: None <netbsd-help@netbsd.org>
From: James K. Lowden <jklowden@schemamania.org>
List: netbsd-help
Date: 02/14/2002 23:36:53
On Thu, Feb 14, 2002 at 03:11:31PM -0800, Doctor Memory wrote:
> Hi!  I'm trying to get printing to work on my i386 box.  I've got an HP 
> DeskJet 500 hooked up to the parallel port.  If I cat something to 
> /dev/lpt0, it prints, but whenever I try to print using lp(1), the print 
> job just sits there.
> 
> The strange thing is, it's using a strange printcap that doesn't exist 
> on my system (or so it seems).  Here's my printcap (irrelevant lines 
> deleted):
> 
> #       $NetBSD: printcap,v 1.6 2000/02/02 16:04:51 hubertf Exp $
> #       from: @(#)printcap      8.1 (Berkeley) 6/9/93
> 
> #lp|local line printer:\
> #       :lp=/dev/lp:sd=/var/spool/lpd/lp:lf=/var/log/lpd-errs:
> 
> #Hewlett Packard DeskJet 500
> lp|deskjet|hp500dj|Hewlett Packard DeskJet 500:\        #name
>     :lp=/dev/lpt0:\             # print device
>     :sh:\                       # suppress header page
>     :sd=/var/spool/lpd/deskjet:\ # spool directory
>     :lp=/var/log/deskjet.log:\   # log file
>     :if=/usr/local/libexec/hpif:\ #input filter for text
>     :mx#0:                       # no max file size
> 
> The odd thing is, when I try to print I get an error in 
> /var/log/lpd-errs saying that '/dev/lp' doesn't exist.  This is odd 
> because (a) my log file should be /var/log/deskjet.log and (b) the 
> device should be /dev/lpt0.  I've restarted the daemon several times, 
> and stopped and restarted the queue (using lpc(8)) several times.  It 
> seems to be reading the first entry, even through I've commented it out.

Hi Tracy, 

I had a DJ 672C.  It broke; its replacement, a Lexmark E322, arrived
just tonight, so I'm all over printer questions right now.  No more
ghostscript for me.  

I think you might need to use the polled device?  Maybe it's just my
hardware.  Could be Just Wrong (tm) about that.  

These printcap entries did work, though:

lp|local printer|Erika's Color Printer:\
        :lp=/dev/lpa1:sd=/var/spool/lpd/lp:lf=/var/log/lpd-errs:\
        :sh:pl#66:pw#80:if=/usr/local/libexec/lpfilter:

ps|Ghostscript driver:\
        :lp=/dev/lpa1:sd=/var/spool/lpd/ps:lf=/var/log/lpd-errs:\
        :mx#0:sh:if=/usr/local/libexec/lpfilter-ps:

And here're my if's

$ cat /usr/local/libexec/lpfilter*
#!/bin/sh
# Treat LF as CR+LF
# Esc E: resets the printer.   Esc &2G: converts LF to CRLF
printf "\033E\033&k2G" && cat && printf "\014" && exit 0
# 014 is ascii form feed (12); ejects page
exit 2
#!/bin/sh
printf "\033E\033&k2G" || exit 2
/usr/pkg/bin/gs -dSAFER -dBATCH -dQUIET -dNOPAUSE -q -sDEVICE=cdj550 \
-sOutputFile=- - && exit 0
exit 2

HTH.

--jkl