[comp.unix.i386] Configuring a Toshiba-p351 printer under ISC-386/ix?

wek@point.UUCP (Bill Kuykendall) (11/15/89)

>The Toshiba then printed 132-columns of "X"'s and multiple page-ejects.

That one got me, too.  Your printer is set up to expect a CRLF combination
at the end of each line (which is the way DOS stores ascii files) but unix
stores only the LF character (the "newline" character).

Since you'll probably want to continue to use the printer for DOS under
VP/ix, you should _not_ change the printer switches.  Instead, locate the
file /usr/spool/lp/admins/lp/interfaces/dumb_1 (whew!) and make the
following change:

                     cat "$file" 2>&1
                     cat "$file" |utod 2>&1

utod is a filter that will convert LFs into CRLFs as the file is printed.
It stands for unix-to-dos.  There's a dtou also, BTW.

------
Bill K

pim@cti-software.nl (Pim Zandbergen) (11/20/89)

wek@point.UUCP (Bill Kuykendall) writes:

|Since you'll probably want to continue to use the printer for DOS under
|VP/ix, you should _not_ change the printer switches.  Instead, locate the
|file /usr/spool/lp/admins/lp/interfaces/dumb_1 (whew!) and make the
|following change:

|                     cat "$file" 2>&1
|                     cat "$file" |utod 2>&1

or insert:
                      stty opost onlcr 0<&1
-- 
Pim Zandbergen                                   domain : pim@cti-software.nl
CTI Software BV                                  uucp   : ..!uunet!ctisbv!pim
Laan Copes van Cattenburch 70                    phone  : +31 70 542302
2585 GD The Hague, The Netherlands               fax    : +31 70 512837

david@monymsys.uucp (David Kozinn) (11/22/89)

I'm running Microport System V/386 here, but I think that the following should
work on an ISC system as well. I took one of the more basic interfaces and
modified it very slightly to support my p351. This does a couple of "tricks" -
The first is that it always resets the printer to use the Qume control codes,
and the second is that it implements the -olq (letter quality mode) and
-odraft (draft mode) commands.

#! /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:
#	p351
# This archive created: Tue Nov 21 11:44:36 1989
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'p351'
then
	echo shar: "will not over-write existing file 'p351'"
else
cat << \SHAR_EOF > 'p351'
#ident "@(#)lp:Toshiba P351 Parallel"
# lp interface for printer with	parallel interface
#
#	Modified  for direct support of the Toshiba P351 printer by DBK
#
#	All characters are passed through to printer unmodified.
#	No banners are printed.
#
# Replace the line below to send an initialization sequence to the printer,
# such as the sequence that resets to power-up configuration.  Use
# a command like (hypothetically)
#	echo "\033z\c"
# to send the sequence "ESC z" to the printer WITHOUT a carriage return
# or linefeed (this is what the \c means) if "ESC z" is a command that
# means something to your printer.  The existing command simply advances
# one page (sends ^L).
#
# DBK - The following sequence resets the printer and puts it in Qume 
# emulation mode (in case the default was IBM mode)
echo "\033\015P\033_0"
#
id=$1
name=$2
title=$3
copies=$4

# Parse any options specified by the -o command
# Currently available are:
#	 -draft  Use draft quality output (default)
#   -lq     Use letter quality output

QUALITY=draft

for i in $5
do
	case "$i" in

		-draft | draft | -d | d)
			QUALITY=draft
				;;
		-lq | lq | -LQ | -lq)
			QUALITY=lq
				;;
		esac
done

case "$QUALITY" in
	draft)
		echo "\033*0\c"
		;;
	lq)
		echo "\033*2\c"
		;;
esac

shift; shift; shift; shift; shift
files="$*"
i=1
while [	$i -le $copies ]
do
	for file in $files
	do
		cat "$file" 2>&1
		echo "\014\c"
	done
	i=`expr	$i + 1`
done
if [ $? != 0 ]
then
	disable -r"write error" `basename $0`
	exit 1
fi

exit 0

SHAR_EOF
chmod +x 'p351'
fi
exit 0
#	End of shell archive
-- 
David Kozinn            | UUCP:      {rutgers | uunet}!cbmvax!cgh!monymys!david
MONY Financial Services	| UUCP:      ...!rutgers!princeton!mccc!monymsys!david
Glenpointe Center West  | Internet:  cgh!monymsys!david@manta.pha.pa.us
Mail Drop 75-14         | GEnie:     D.KOZINN
Teaneck, NJ 07666-6888  | Telephone: +1-201-907-6990

mark@gizzmo.UUCP (mark hilliard) (11/27/89)

In article <[430.1]comp.unix.i386;1@point.UUCP> wek@point.UUCP (Bill Kuykendall) writes:
>>The Toshiba then printed 132-columns of "X"'s and multiple page-ejects.
>That one got me, too.  Your printer is set up to expect a CRLF combination
>
>                     cat "$file" 2>&1
>
ok there is a better way, just change the cat to lef so:

>                     lef "$file" 2>&1

Mark Hilliard
N2HHR
rutgers!rochester!kodak!gizzmo!mark

mre@boulder.colorado.edu (Marcus O. Ertle) (11/28/89)

In article <105@gizzmo.UUCP> mark@gizzmo.UUCP (mark hilliard) writes:
>In article <[430.1]comp.unix.i386;1@point.UUCP> wek@point.UUCP (Bill Kuykendall) writes:
>>>The Toshiba then printed 132-columns of "X"'s and multiple page-ejects.
>>That one got me, too.  Your printer is set up to expect a CRLF combination
>>
>>                     cat "$file" 2>&1
>>
>ok there is a better way, just change the cat to lef so:
>
>>                     lef "$file" 2>&1
>
>Mark Hilliard

I'm not sure how Bill Kuykendall got ownership of this problem - hope 
you didn't get deluged with mail Bill - I had posted the original query.
To recap, my Toshiba p351 printer, connected as /dev/lp1, was not 
printing ascii output correctly.  It did not handle CRLF the way it 
should.  It generated line-feeds but no carriage returns.

Many thanks to all who have given advise on this.  I have tried nearly
all suggestions.  All I could understand anyway - how does: 
	stty opost onlcr 0<&1 
work?  I have also tried every combination of dip-switches on the
Toshiba - without success.  

As many pointed out, the Toshiba was expecting DOS (CRLF) output, and 
getting UNIX (LF).  I tried using utod :
	cat "$file" |utod 2>&1
or lef:
	lef "$file" 2>&1
which got me a little closer to good output - CRLF handled correctly - 
but a previously undetected problem cropped up.  The Toshiba did not 
handle tab-characters correctly - a tab caused the print-head to go to 
the right margin.

In desperation, I wrote my own version of a UNIX-to-DOS filter which 
handled NL correctly (\r\n) and replaced tab (\t) with column-number 
modulo 8.  I know this is arbitrary, but it works for UNIX, ascii files.
For VP/ix - will probably need to pass file unchanged.  

In any case, thanks for all the help netland - I've probably taken up
enough time on this subject.  Through your suggestions, I have learned
a little bit about how printing works under SysV.

For what its worth - my opinion only:  Despite some small problems, I 
have found ISC relatively friendly and easy to use.  I think when/if
man pages come out, that will help us novice/new-to-SysV users.  I
really like the install and sysadm menus - my other car is a VAX-with 
ULTRIX - which means wading through a lot to learn system 
administration.

- Marc Ertle
- NGDC

pim@cti-software.nl (Pim Zandbergen) (11/29/89)

mre@boulder.colorado.edu (Marcus O. Ertle) writes:

>Many thanks to all who have given advise on this.  I have tried nearly
>all suggestions.  All I could understand anyway - how does: 
>	stty opost onlcr 0<&1 
>work? 

This tells the tty driver to do the translation for you.
Normally, stty(1) acts on standard input. But when printing,
standard input is not connected to the printer, so with '0<&1',
stty will act on standard output.

>In desperation, I wrote my own version of a UNIX-to-DOS filter which 
>handled NL correctly (\r\n) and replaced tab (\t) with column-number 
>modulo 8.

This could also have been done with:
	stty opost onlcr tab3 0<&1
	cat $file

But, strangely, this does not work with the ISC 386/ix parallel
port driver. At least not in 2.0.1. Solved in 2.0.2/2.2 ?
-- 
Pim Zandbergen                             domain : pim@cti-software.nl
CTI Software BV                            uucp   : uunet!mcsun!hp4nl!ctisbv!pim
Laan Copes van Cattenburch 70              phone  : +31 70 542302
2585 GD The Hague, The Netherlands         fax    : +31 70 512837