[comp.unix.microport] uport lp device problems, HP LaserJet II wont work

mike@ut-emx.UUCP (Mike O'Donnell) (05/18/89)

I apologize for posting this request again.  I received many fine
suggestions from the first time, but none seem to work.  I feel that
most are a step in the right direction, but not the complete solution.
I am going to try to provide more complete information about the
problem this time and hopefully someone can fit the pieces together.

I have am running uport SYS V 386 on a CompuAdd 386 PC.  I am also
using DOSmerge for the 386.  Attached to the parallel printer port
is an HP Laserjet II printer.  I have verified the port and am able
to copy a file directly to /dev/lp and have it show up at the printer.
Then I set up the printer using 'sysviz' and all of the other unix
printer commands.  I am particularly interested in using the printer
in the 'transparent' mode where the driver does no interpretation of
the output.  This is so I can do graphical output and WordPerfect 
output to the HPLJ.

However, when I use the 'lp' command from unix or the 'print' command
from DOS, strange things happen.  The very first time I print a file
after having turned the printer on, I get one line of text, a LF and
then the second line continues.  The output looks this:

+------------ TOP OF PAGE ----------------------------------------+
THIS IS THE FIRST LINE OF TEXT
                              THIS IS THE SECOND LINE OF TEXT
                                                             THIS IS


(nothing but blank page from here to the bottom)
+------------ BOTTOM OF PAGE -------------------------------------+

Then, when the next file is printed, the HPLJ READY light blinks, 
indicating that the data is being received, but usually the FORM FEED
button must be pushed to eject the page.  And when the page is ejected,
there is nothing on it.

I have used the 'lpset' command, and I have used another device
in /dev which has 128 added to the minor device number, apparently
meaning that this device uses the driver in the 'raw' mode.  Nothing
seems to help.

Next I put the printer on a serial port.  If I print a DOS file
which contains both CR and LF characters, it seems to do OK.  So
then I put the printer back on the parallel port and files with
CR and LF don't work.

Another problem related to the parallel port, and this one seems
somewhat unpredictable.  After using 'lpset' to put the port into
the 'transparent' mode, I 'cat' a file to the device, and get a 
message similar to 'cannot create device'.  The 'lpset' program
seems to really screw things up.

Again I apologize for posting this problem again, and for the length
of this article, but I guess that I am really getting desperate.  Any
help will be greatly appreciated.  Again, thanks. 

Mike O'Donnell
Lower Colorado River Authority
3001 Lake Austin Blvd., #201
Austin, Texas 78703
(512) 473-4058

williamt@athena1.Sun.COM (William A. Turnbow) (05/19/89)

I too ran into this same problem.  Problem seems to be that lf is not
translated to a cr-lf on output.  I never spent much time tracking
it down though -- I just did a global replace of lf with crlf in an
editor.

I am told that the print script for lp daemon can be made to handle this
though...

Perhaps there is a setting on the LaserJet?

-wat-

rick@pcrat.UUCP (Rick Richardson) (05/19/89)

Here is the lp printer interface that we supply with JetRoff.  It
handles serial or parallel configurations, and translates CR/LF
by default, but you turn this off with the "-otroff" option to
"lp" when you want to print troff or graphics.

-Rick

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	hplaser-par
# This archive created: Fri May 19 07:13:00 1989
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'hplaser-par'
then
	echo shar: "will not over-write existing file 'hplaser-par'"
else
sed 's/^X//' << \SHAR_EOF > 'hplaser-par'
X# hplaser: lp model interface for HP LaserJet Series II
X#
X# command arguments are:
X#	request-id user-name title copies printer-options file1 [file2 ...]
X#	$1         $2        $3    $4     $5
X#
X# options are:
X#	-otroff		#No cr/lf mapping (for JetRoff, etc.)
X#	-oland		#Landscape orientation for unformatted text
X#	-o2on1		#Two pages on one page for unformatted text
X#	-oi		#Indent 8 characters for unformatted text
X#	-o17cpi		#17 CPI for unformatted text
X#
X# Configuration:
Xspeed=exta	#Serial interface speed (19.2)
Xspeed=		#Parallel interface leave blank
Xbanner=0	#Enable printing of banner page
Xpicture=0	#Enable printing of $HOME/.mugshot on banner page
X		#.mugshot is any PCL, typically a scanned picture of the user
X#
X#
Xnoraw="\033&k2G"
Xraw="\033&k0G"
Xif [ "$speed" != "" ]
Xthen
X	stty sane $speed ixon ixoff -ixany -parity onlcr -tabs -opost <&1
Xfi
X# character sequence to initialize printer before printing
XSET=""
X# character sequence to reset printer after printing done
XRESET="\033E"
X#
X#	First, get printer banner page out in portrait, courier
X#
Xif [ $banner = 1 ]
Xthen
X	PCOURIER=	#"\033&l66p2e7.6c66F"
X	GRAY="\033*c2400a150b30g2P"
X	TLOC="\033*p0x0Y"
X	echo "$RESET$noraw$PCOURIER$TLOC$GRAY\n\n\n\n"
X	banner "  $2"
X	echo "\n"
X	user=`grep "^$2:" /etc/passwd | line | cut -d: -f5`
X	if [ -n "$user" ]
X	then
X		echo "                User: $user\n"
X	else
X		echo "\n"
X	fi
X	echo "                Request id: $1    Printer: `basename $0`\n"
X	echo "                Options: $5\n"
X	echo "                `date`"
X	echo "\n"
X	if [ -n "$3" ]
X	then
X		banner $3
X	fi
X	if [ $picture = 1 ]
X	then
X		home=`grep "^$2:" /etc/passwd | line | cut -d: -f6`
X		if [ -f "$home/.mugshot" ]
X		then
X			echo "$raw\c"
X			echo "                \c"
X			cat $home/.mugshot
X			echo "$noraw\c"
X		fi
X	fi
X	echo "\014\c"
Xelse
X	echo "$RESET\c"
Xfi
X#
X#	Now process user options
X#
Xtrap 'echo $RESET\\c; exit' 0 2 3 15
Xcopies=$4
Xopts=$5
Xshift 5
Xfiles="$*"
Xtwo_on_one=0
Xi=1
Xifraw="$noraw"
Xfor o in $opts
Xdo
X	case $o in
X	troff)
X		SET="$SET\033E"
X		ifraw="$raw"
X		;;
X	land)
X		#	&l1O		-	landscape orientation
X		#	(s16.66H	-	primary font pitch
X		#	&l5.4		-	vert motion index 48ths/in
X		#	&l6E		-	Top margin
X		#	&l66F		-	text length
X	SET="$SET\033&l1O\033(s16.66H\033&l5.4C\033&l6E\033&a0R\033&l66F"
X		;;
X	17cpi)
X		#	(s16.66H	-	primary font pitch
X		#	&l5.4		-	vert motion index 48ths/in
X		#	&l6E		-	Top margin
X		#	&l66F		-	text length
X		SET="$SET\033(s16.66H"
X		;;
X	i)	# indent 8 characters
X		SET="$SET\033&a8L"
X		;;
X	2on1)
X	SET="$SET\033&l1O\033(s16.66H\033&l5.4C\033&l6E\033&a0R\033&l66F"
X		two_on_one=1;
X		;;
X	esac
Xdone
Xwhile [ $i -le $copies ]
Xdo
X	for file in $files
X	do
X		echo "$SET$ifraw\c"
X		if [ $two_on_one = 1 ]
X		then
X			cat "$file" | newform -i | \
X				sed "s/^/| /" | pr -2 -w175 -t
X			echo "$RESET\c"
X		else
X			cat "$file" 2>&1
X			echo "$RESET\c"
X		fi
X	done
X	i=`expr $i + 1`
Xdone
Xexit 0
SHAR_EOF
fi
exit 0
#	End of shell archive
-- 
Rick Richardson | JetRoff "di"-troff to LaserJet Postprocessor|uunet!pcrat!dry2
PC Research,Inc.| Mail: uunet!pcrat!jetroff; For anon uucp do:|for Dhrystone 2
uunet!pcrat!rick| uucp jetroff!~jetuucp/file_list ~nuucp/.    |submission forms.
jetroff Wk2200-0300,Sa,Su ACU {2400,PEP} 12013898963 "" \d\r\d ogin: jetuucp