Problems with HP LaserJet 4m on SPARCstation 10

1 view
Skip to first unread message

Michael Bruns

unread,
Feb 12, 1993, 9:27:48 AM2/12/93
to

We have the following problem with a HP LaserJet 4m connected
on a SPARCstation 10 with SunOS 4.1.3 via serial and parallel
Centronics port by using lpr. The printcap entry for the
serial line is:

#
lp|hp|hplj|HP LaserJet4:\
:lp=/dev/ttya:sd=/var/spool/lpd/hp:lf=/usr/adm/lpd-errs:\
:br#19200:mx#0:sh:ms=-parity:
#

When we use the printer for ASCII files it works fine but in the
case of PostScript files the LaserJet prints out the page but then
he reports an error: timeout.

Alternative we have tested the Centronics line with the printcap entry:

#
lp|hp|hplj|HP LaserJet4:\
:lp=/dev/bpp0:sd=/var/spool/lpd/hp:lf=/usr/adm/lpd-errs:sh:
#

Again, the page comes out with the same timeout error for PostScript
files and on ASCII files it produces only an empty page. Additional,
the command

cat postscript.file > /dev/bpp0

results in the same postscript printer error.

Is there anyone who can help with printcap entries or some ideas?

Michael Bruns
Max-Planck-Institut fuer Aeronomie
Max-Planck-Str.2
D-3411 Katlenburg-Lindau
Internet: br...@linmpi.mpae.gwdg.de (134.76.28.2)

---

Jack Stewart

unread,
Feb 15, 1993, 7:18:13 PM2/15/93
to
I had a very similar problem with the LaserJet 4m but after the
manuals arrived for the LaserJet 4m I was able to piece the solution
together.

The LaserJet 4m expect a ^D at the end of every postscript file.
Otherwise it will wait for input and after 40 seconds or so, send an
"Error TIMEOUT" message. But that isn't the only problem, once you
have put a ^D at the end of the postscript file, the printer is left
in postscript mode for ~15 seconds. Thus if you send a postscript
file followed by a ascii file, you will also get error messages.

The solution from the HP manuals is to send a PCL command call
Universal Exit Language at the begining and end of every print job.
The Universal Exit Language code is "<ESC>%-12345X". The rational
behind this convoluted approach is that the HP LaserJet 4M has an auto
personality (that is it can automatically switch between postscript
and PCL [ascii]).

I wrote my own filter in perl. It should probably be rewritten in C
but I haven't had the time. I have put an abridged version of the
script at the end of this message. It is also available via anonymous
ftp in pub/pshpfix.pl from ftp.ccsf.caltech.edu. In order for my
filter program to work I needed to set the ":sb:" option in
/etc/printcap.

I would strongly recommend that anyone with a LaserJet 4M get the full
set of manuals from HP. These printers are capable of many wierd and
wonderful things (such as paper tray selection from within postscript).

---Jack

--
Jack Stewart E-Mail: ja...@CCSF.Caltech.EDU
Caltech Concurrent Supercomputing Facilities, Phone: 818-356-2153
Mail Code # 158-79, 391 S. Holliston,
Pasadena, CA 91125. #include <std.disclaimer>


Here is the printcap entry:
-----
# HP LJ IV attached to an XCD Xconnect box
# and served with RTEL software
#
Borg|borg|ljiv|hp|RTELD printer:\
:lp=/dev/ttyq0:\
:lf=/usr/spool/rtel/hp_sd/log:\
:of=/usr/spool/rtel/pshpfix.pl:\
:sd=/usr/spool/rtel/hp_sd:\
:mx#0:\
:sb:
-----
Here is the perl script
-----
#!/usr/local/bin/perl
#
open(IN,"-") || die "Can't find STDIN\n";
open(OUT,">-") || die "Can't open STDOUT\n";
$|=1;

print OUT "\033%-12345X\n"; # UEL - Start with a Fresh Printer

$firstline=<IN>;
chop($firstline);
if ($firstline =~ /^(\w+):(\w+)\s+Job:\s+([\w,-,.,=,_]+)\s+Date:\s+(.+)/ )
{
print OUT "\n\n\n\n\n\n\n";
print OUT " Put Your Own Banner Here!!!";
print OUT "\n\n\n\n\n\n\n";
print OUT " For: $2\n";
print OUT " Host: $1\n";
print OUT " Job: $3\n";
print OUT " Date: "$4\n";
print OUT "\n\n\n";
}
else {
if ($firstline =~ /^%!/) {
$append="true";
}
print OUT $firstline,"\n";
}


while (<IN>) {
chop;
if (/^\f%!/) {
if ($append eq "true") {
print OUT "\cD\n";
} else { print OUT "\f";}
print OUT "\033%-12345X\n";
$append="true";
print OUT "%!",$',"\n";
next;
}
if (/^\f/) {
if ($append eq "true") {
print OUT "\cD\n";
} else { print OUT "\f";}
print OUT "\033%-12345X\n";
$append="false"; # Not Postscript
print OUT $',"\n";
next;
}
print OUT $_,"\n";
}

# File has been written out.
# Now Close it cleanly
if ($append eq "true") {
print OUT "\cD\n";
} else { print OUT "\f"; }

print OUT "\033%-12345X\n"; # UEL - End with a Fresh Printer

close(IN);
close(OUT);
exit(0);
-----
That's all there is too it.


Reply all
Reply to author
Forward
0 new messages