Subject: Re: bin/20525: lpr cannot suppres headers
To: None <,,>
From: Luke Mewburn <>
List: netbsd-bugs
Date: 03/01/2003 10:42:04
On Fri, Feb 28, 2003 at 09:41:03AM -0500, gabriel rosenkoetter wrote:
  | On Fri, Feb 28, 2003 at 05:56:53AM -0800, wrote:
  | > When printing with lpr (/usr/bin/lpr), the 'sh' command in /etc/printcap fails to suppress the header page. The result is that an extra page is printed every time you print.
  | > The lpd setup is unmodified from the default install.
  | > >How-To-Repeat:
  | > My printcap:
  | > 
  | > lp|ljet4;r=300x300;q=medium;c=gray;p=a4;m=auto:\
  | >     :sh:\
  | You're experiencing buggy HP JetDirect hardware, not buggy NetBSD
  | software.
  | If you talk lpr to an HP, you get that crap page. If you don't get
  | it under Linux, you don't because Linux is speaking (some other,
  | pseudo-proprietary, protocol) on port 9100. You can do that too if
  | you use CUPS rather than our built-in lp stuff.
  | To make your printer stop printing the useless pages, telnet to it
  | (on port 23), issue a "banner 0" command, then issue a "quit"
  | command.

Note that older firmware revisions of the JetDirect cards do not
support the 'banner' command.

It is possible to update the firmware in most of the JetDirect cards to
a version which supports this, but that is a non trivial task.  I had
to do some real hairy stuff with dhcpd to get the older firmware to
tftp a config file to set the SNMP write community to something sane
so that I could use HP's firmware update tool.  The older JD firmware's
support for bootp was very picky about the size of the reply packtes,

After I updated the firmware in my JD card in my LJ4Mplus, I still
found that the `lpd' implementation left a lot to be desired, so I now
print to the printer via port 9100.

I've attached some snippets of files which may be of use.
The first is the printcap entry I use; my printer's name is `lj4mp',
and the print host is `argo' (all other machines have a copy of this
printcap and send via argo, so that multiple hosts don't try and
connect to the JD card at once, which can confuse the card).
The second is the dhcpd.conf entry I used to upload a config file
to the printer.
The third is the config file I used.

Hope that's useful,

=== /etc/printcap ===
lj4mp|lp|lj4|lj4m|HP LaserJet 4M plus:\

=== /etc/dhcpd.conf ===
option	jd-tftp-cfg		code 144 = string;
option	jd-tftp-server		code 150 = ip-address;

# [...]

host lj4mp {
	fixed-address		lj4mp;
	hardware ethernet	08:00:xx:xx:xx:xx;
	option	log-servers	argo;
	option	jd-tftp-server	argo;
	option	jd-tftp-cfg	"lj4mp.cfg";

=== tftp/lj4mp.cfg ===
get-community-name: public
set-community-name: pr1vate