Summary: SVR4 and postscript printers.

Robert Withrow witr at rwwa.COM
Tue Apr 30 12:45:05 AEST 1991


Previously, I asked for assistance on getting PostScript (tm) printers
working on SVR4.0.2.0 and, especially, for help with the POSTIO
filter.  Several people wrote or posted with assistance.  Two wrote
with detailed instructions: I have appended those instructions at the
end of this post.

Unfortunately, none of the suggestions worked for my setup.  First,
they all required the use of a serial port and I wanted to use the
parallel port.  Second, even when I attached the printer to a serial
port it still didn't work.  The symptom in each case was that the
POSTIO filter would get into a loop talking to the printer and would
never print anything.  While several people assured me that the postio
filter works on their system, I must conclude that it is buggy, and
may or may not work on a specific system, depending on the
characteristics of the printer.  Also, no one was able to provide me
with a MAN page for POSTIO, even though it has 10 or 12 options.  I
really don't know what it is supposed to do; the FM is silent about
that.

Also, I discovered a bug in either the documentation of the /dev/lp,
or with the initialization of the system: the /dev/lp driver is not
mentioned in the autopush file read at init time and so it doesn't
have ldterm pushed onto it when it is opened.  Since the documentation
claims that /dev/lp obeys TERMIO(7), this could be considered a bug.

All is not lost, however.  I went and got the PostScript reference
manual and hacked together the following programlet: If you replace
the original /usr/lib/lp/postscript/postio with this the printer seems
to work fine (when attached to /dev/lp).  It isn't fancy and it
doesn't detect printer errors, but dumb and functional is much better
than fancy and nonfunctional.  Note that you must replace the file
/usr/lib/lp/postscript/postio with this, not just modify the Command:
field of the filter table: The standard interface program refers to
/usr/lib/lp/postscript/postio directly to print the banner.
(Alternately, you could edit the interface program).

-=-=-=-=-=-
/* A dumb replacement for the POSTIO filter */

#include <unistd.h>

#define BUFFERSIZE (4096)
#define EOFCHAR (0x04)		/* Ascii EOT == ^D */

main()
{
  unsigned char buffer[BUFFERSIZE];
  int count, something = 0;
  
  while ((count=read(STDIN_FILENO,buffer,BUFFERSIZE)) > 0) {
    something=1;
    write(STDOUT_FILENO,buffer,count);
  }
  if (something) {
    buffer[0] = EOFCHAR;
    write(STDOUT_FILENO,buffer,1);
  }
  exit(0);
}
-=-=-=-=-=-=
Other suggestions (that did not work on my system):

Andy Crump ( ...!tektronix!reed!littlei!andyc |
andyc at littlei.intel.com) suggested:

Yep.  Here's the info you need.  There is certainly missing info in
the SVR4 documentation and some bugs still lurking.  This info works
on an Apple laserwriter, QMS PS-810, and HP laserjetII with postscript
cartidge for sure.  Your mileage may vary with other postscript
printers.

Here's the scoop (do all this as root):

0) Be sure that your printer is connect to a SERIAL line and not a
parallel one.

1) Configure the printer queue as such:
	
	a) lpadmin -p {name of queue} -v /dev/tty01 -T PS -I PS
                                           ^ name of serial port you are using.
	b) lpadmin -d {name of queue} [optional, make this the default printer]

2) Create a text file (/tmp/foo) that looks like this:

Input types: postdown
Output types: PS
Printer types: PS
Printers: any
Filter type: fast
Command: /usr/lib/lp/postscript/postio -q
Options: PRINTER * = -L/dev/null

3) type the command : 
	lpfilter -f postio -F /tmp/foo

4) Enable and accept the printer:

	accept {name of queue}
	enable {name of queue}

5) just to be sure:

	lpshut
	/usr/lib/lpsched

6) To print a ascii file:

	lp -d {name of queue} filename  

  Try: lp /etc/passwd

7) To print a postscript file:

	lp -d {name of queue} -Tpostscript filename  

8) to print a troff file (via /usr/ucb/troff):

	lp -d {name of queue} -Ttroff file

This works fine for us.  Let me know if you have any problems.
--

Along the same lines, Lee Daniel Crocker (lee at mport.com) suggested:

We at Microport use an Apple Laserwriter with our SVR4.  It is on a 9600
bps serial connection, and I used the following setup procedure:

(su to root)
$ lpadmin -p apple -v /dev/tty00 -I PS -T PS
$ lpfilter -f postio -l >temp

The file "temp" should contain a line that starts "Command: /usr...".  Edit
this to read:

Command: /usr/lib/lp/postscript/postio -l/dev/tty00 -b9600

Then continue:

$ lpfilter -f postio -F temp
$ rm temp
$ accept apple
$ enable apple
$ lpadmin -d apple

Now, to print a plain text file, just "lp <filename>".  To print a PostScript
program file, use "lp -Tpostscript <filename>".

You can verify that postio can communicate with your printer by running it
in interactive mode:

$ /usr/lib/lp/postscript/postio -l/dev/tty00 -i

After it comes up, type "executive" and press return.  You will not see the
word as you type it, but you will see a banner, and then the printer will
start echoing what you type.  From here, you can send interactive commands
to the printer.  Try "FontDirectory { pop == } forall".  EOF (Ctrl-D) quits.
-- 
---
 Robert Withrow, R.W. Withrow Associates, Swampscott MA 01907 USA
 Tel: +1 617 598 4480, Fax: +1 617 598 4430, Net: witr at rwwa.COM



More information about the Comp.unix.sysv386 mailing list