laser printers, 8 bit output and fflow control

Bill Johnston [csam] johnston at lbl-csam
Thu Feb 7 16:24:24 AEST 1985


  >
  >Bill Johnston asked about 8-bit serial lines with flow control, and
  >said that the Apple LaserWriter needs such a protocol. This is not
  >true. The Apple LaserWriter uses a 7-bit serial protocol, and in fact
  >the 7-bit characters that are significant to the software are only the 
  >printing Ascii characters and space. It does not use any binary/8-bit
  >characters or control characters. The data sent to it can contain
  >format-effector characters like newline and tab, but they are
  >effectively ignored.
  >
  >From: Brian Reid <reid at Glacier>
  >
  >[[Editor's note:  Fair enough.  The general problem still exists,
  >however, so if anyone knows...			--Rick]]

I stand corrected. While I have not seen the technical
manuals on the LaserWriter, the information that it used 8-bit codes
on the serial line came from an Apple technical person who thought he
knew what he was talking about. Now that I have read a little about
PostScript, I see that the answer is obvious; after all Postscript
is a fairly ordinary programming language, the source code of which is
passed to the interpreter in the printer controller. (This makes one
wonder about debugging. Does the PostScript interpreter pass syntactic and
semantic error messages back to the host?)

As the editor noted, the 8 bit issue still stands; we have an APS micro-5
which does fit the model in question, as does the HP LaserJet.

Several people suggested using litout and -raw, which I agree, from the stty
writeup looks like it should work. However, on our 4.2 system, and on it's
predecessors, this did not work. Given Chris Torek's piece of code showing the
nature of the bug, and the work around as a starting point, I was able to get
stty to work as desired. The trick seems to be to do 'stty litout' before you do
the stty that you think will work according to the man page.

By way of example, the following will permit the HP Laser Jet to accept
8 bit codes (along with 7 bit text) and to flow control the host:

	(The Laser Jet needs to map lf to cr-lf. The code <esc>&k2G should
	probably be prepended to each file printed.)

	stty litout
	stty litout -raw

	cat file >/dev/.....	#(cat probably won't work on 8 bit files, you
				  will have to use a simpler filter)

The following sets one back to 7 bit mode:

	stty litout
	stty -litout -raw

Thanks for the responses,
		Bill [johnston at lbl-csam]

P.S. After writing this, and before sending it, I got several more
responses, at least one of which (Steven Holmes at Purdue) suggested
essentially this solution. Van Jacobson at lbl-rtsg pointed out that
this is a bug in the distributed 4.2, but many people have fixed the
problem on their own.  Part of my confusion was due to working on
several systems, some of which have the litout problem fixed and some
of which do not.



More information about the Comp.unix.wizards mailing list