Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jun 2012 02:35:52 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Gary Aitken <ah@dreamchaser.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: HP networked printer -- hp-setup won't use, hp-probe finds
Message-ID:  <20120603023552.acd054ac.freebsd@edvax.de>
In-Reply-To: <4FCAAB17.2010905@dreamchaser.org>
References:  <4FC7F8AE.1010307@dreamchaser.org> <alpine.BSF.2.00.1206021024530.35474@wojtek.tensor.gdynia.pl> <4FCAAB17.2010905@dreamchaser.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 02 Jun 2012 18:08:55 -0600, Gary Aitken wrote:
> I've deinstalled cups and its dependencies and rebuilt only hpijs.

You could have kept it installed (maybe some ports will want
it as a dependency), just disable it in /etc/rc.conf.



> lpr works to the printer for the simple demo text filter hp supplies 
> (The printer is directly connected to the network, not via USB or parallel port)
> However, when I try to use gs + hpijs as a filter, it fails.

Did you write your own filter?

For comparison: I'm using a HP Laserjet 4000 duplex here,
networked, with /opt/libexec/ps2pcl-dup.sh being the
filter for use with duplexing:

#!/bin/sh
printf "\033&k2G" || exit 2
gs -q -dBATCH -dNOPAUSE -dPARANOIDSAFER -dSAFER -sPAPERSIZE=a4 -r600x600 \
        -sDEVICE=ljet4d -dDuplex=true \
        -sOutputFile=- - && exit 0
exit 2

The entry for this printer in /etc/printcap is:

Laserjet|ljet4d;r=600x600;q=high;c=full;p=a4;m=auto:\
    :rm=192.168.100.100:\
    :rp=raw:\
    :lp=:\
    :if=/opt/libexec/ps2pcl-dup.sh:\
    :sd=/var/spool/lpd/Laserjet:\
    :lf=/var/spool/lpd/Laserjet/log:\
    :af=/var/spool/lpd/Laserjet/acct:\
    :mx#0:\
    :sh:

The name "Laserjet" is set in $PRINTER as the system's default
printer. There's also "Laserjet-nodup" where the filter simply
omits the duplexing functionality.

I assume you did something similarly?



> the log shows:
> Jun  2 16:58:18 fbsdbox lpd[10367]: lp: lost connection
> Jun  2 16:58:18 fbsdbox lpd[10367]: restarting lp
> unable to set device=HP Officejet Pro 8500 a909g hpijs, err=16
> unable to read client data err=-2
> Jun  2 16:38:54 fbsdbox lpd[10367]: lp: lost connection
> Jun  2 16:38:54 fbsdbox lpd[10367: lp: job could not be sent to remote host ...
> Jun  2 16:38:54 fbsdbox lpd[10367]: mail sent to user garya about job <unknown> on printer lp (FATALERR)

Can you provide the command you've used for printing? By default,
the printer subsystem accepts PS (which is the normal printing
output format of _any_ printing application).

CUPS, as well as apsfilter, offer some built-in functionality
for converting data from non-PS (e. g. text, images) to PS when
you call lpr, for example:

	% lpr picture.jpg
	% lpr source.c
	% lpr stuff.txt

As long as you print PS (or from any application within X that
outputs PS), this shouldn't be an issue for you.



> The .ppd.gz file was not located in the path exported from the filter script.
> However, when I put /usr/local/share/ppd/HP in the path, it made no difference.
> Where are your .ppd files or .ppd.gz files located?

Depends. CUPS puts them into /usr/local/etc/cups/ppd, there's
also the possibility that other tools that handle PPD files
search for them in a location defined in their documentation.
For example, the CUPS ppd files are already extracted.



> Also, the ppd.gz files from the port *did not* include any
> ppd.gz file for this printer.  However, the cups port did,
> but they were installed elsewhere.  So I just copied them
> over, but I'm wondering if there is a db or internal cache
> somewhere that has to be rebuilt.

The ppd handling tool usually manages that.



> It looks to me like it is unable to locate a .ppd.gz or .ppd
> which matches the device name "enough" to be used.  Anyone know
>   who is generating the error

It's lpd (see message).

It's accessing a printer called "lp" (does it exist with tha
name?) and loses the connection, and try to restart it. The
inability is expressed as "unable to set device=HP Officejet
Pro 8500 a909g hpijs", I'm not sure if spaces are allowed?
(Check "man 5 printcap" to be sure.)



> Ok, I tweeked /etc/printcap and the filter to call the printer
> a "DESKJET 960" and it worked. 

Is your $PRINTER set to this name? In that case, you could
easily move from "lp" (the default name) to omitting -P<name>
in the lp* commands.



> So one obviously has to do more than just supply the correct
> .ppd.gz file in the correct spot.

Right. If you look into a .ppd file, you'll see PostScript in
there. It's (highly inaccurately described) code that instructs
the PS interpreter (usually gs) on how to create the correct
output language for the particular printer, tell details about
options and parameters of the printer (such as paper feeds,
duplexer, paper sizes and so on).



> ideas?

Some of your code (scripts and commands) would help (at least
me) to understand your current state better.





-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



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