[comp.sys.sun] LaserWriter II baud rate question

runyan@edsews.eds.com (David Runyan) (03/30/89)

(This may be the second posting of this question. If so, please excuse
 our posting problems.) 

Several weeks ago, Brent Chapman posted a reply in comp.sys.sun to a laser
printer question which pointed to the LaserWriter II Owner's Guide for
instructions on how to increase the printer's baud rate to 38.4K. We
followed the owner's guide, and sure enough, our LaserWriter was changed
to accept 38.4K.

There was one major problem with changing the printer speed.  We could not
get our Sun 3/50 (OS 3.5) print server to communicate with a 38.4K printer
(rats!).  We tried tweeking /etc/gettytab and ttys to reference the new
speed, but nothing seem to work.

Please help me with these questions:

Is it possible to drive a PostScript printer from a Sun 3/50 3.5 at speeds
greater than 9600 baud?   If so, can anyone explain, or point me to some
documentation which describes, the setup required to drive a printer at
38.4 (or even 19.2)? 

Email your response please.

thanks 

-- 
        David Runyan
        EDS - Technical Systems Development
        runyan@eds.com
        UUCP: {uunet|sun|sharkey}!edsews!runyan

chuck@trantor.harris-atd.com (Chuck Musciano) (04/07/89)

> Is it possible to drive a PostScript printer from a Sun 3/50 3.5 at speeds
> greater than 9600 baud?   If so, can anyone explain, or point me to some
> documentation which describes, the setup required to drive a printer at
> 38.4 (or even 19.2)?

No need to mess with the gettytab or ttys.  Just set the "br" parameter in
the printcap entry to the desired baud rate.

We run our LaserWriter at 19.2 KBaud.  We never could get reliable
operation at 38.4.


Chuck Musciano			ARPA  : chuck@trantor.harris-atd.com
Harris Corporation 		Usenet: ...!uunet!x102a!trantor!chuck
PO Box 37, MS 3A/1912		AT&T  : (407) 727-6131
Melbourne, FL 32902		FAX   : (407) 727-{5118,5227,4004}

miker@central.sun.com (Mike Raffety) (04/21/89)

We run several of our LaserWriters at 19,200 baud; if you've succeeded
with changing the printer itself to a higher baud rate, all you need to do
is set the "br" parameter in your printcap to indicate the different speed
(e.g., "...:br#19200:...").  You do NOT need to do anything with /etc/ttys
or /etc/gettytab, except to make sure that that port is DISABLED (i.e., no
getty running on it); they are ignored by the printing subsystem.

Sun-3s support speeds up to 38,400 baud; even if Sun won't say so, they
wrote the software (stty, lpd, getty, etc.) to allow it.

richard%aiai.edinburgh.ac.uk@nss.cs.ucl.ac.uk (Richard Tobin) (04/22/89)

> There was one major problem with changing the printer speed.  We could not
> get our Sun 3/50 (OS 3.5) print server to communicate with a 38.4K printer
> (rats!).  We tried tweeking /etc/gettytab and ttys to reference the new
> speed, but nothing seem to work.

I just tried this for our new laser printer.  The way it's supposed to
work is that you change the "br" entry in /etc/printcap to 38400, and
restart the daemon (actually I think it should happen for the next job
anyway).

Well, it didn't work.  Stty revealed that the speed was still 9600.
Speeds of 1200 and 19200 worked however.  An ugly suspicion crossed my
mind...

Yes, the baud rate variable is declared as a short.  (Actually, it would
probably not matter if it didn't explicitly check for the variable being
greater than zero.)

I don't have Sun sources (I was looking at 4.2 sources on a Vax - it still
appears to be a short in 4.3), so rather than hope that the Vax sources
would work I patched the binary.

The table looks like this:

struct bauds {
        int     baud;
        int     speed;
} bauds[] = {
        50,     B50,
	...
        19200,  EXTA,
        38400,  EXTB,
        0,      0
};

Since the binary is stripped (boo! hiss!) you'll need a good text editor.
EXTB is defined to be 15, so look for the string \0 \0 \226 \0 \0 \0 \0
\017.  I changed it to \0 \0 \0 \046 \0 \0 \0 \0 \017, so that setting a
baud rate of 38 in /etc/printcap will do the trick.

BTW, this speeded up printing a 256x256 bitmap from 2:41 to 1:48.

-- Richard

rclaeson%ERBE.SE@uunet.UU.NET (Robert Claeson) (04/25/89)

chuck@trantor.harris-atd.com (Chuck Musciano) writes:

> We run our LaserWriter at 19.2 KBaud.  We never could get reliable
> operation at 38.4.

This is probably more due to something in the Sun than in the laserwriter.
We run all our printers at 38.4 Kbps off an Annex terminal server and have
never had any problems with that.

-- 
Robert Claeson, ERBE DATA AB, P.O. Box 77, S-175 22 Jarfalla, Sweden
Tel: +46 (0)758-202 50  Fax: +46 (0)758-197 20
EUnet:   rclaeson@ERBE.SE               uucp:   {uunet,enea}!erbe.se!rclaeson
ARPAnet: rclaeson%ERBE.SE@uunet.UU.NET  BITNET: rclaeson@ERBE.SE

guy@uunet.uu.net (Guy Harris) (05/05/89)

>Sun-3s support speeds up to 38,400 baud; even if Sun won't say so,

The SunOS 4.0 documentation does indicate that 38.4KB is supported on the
CPU serial ports and on ALM-2 ports (no ALM-1/Systech/MTI ports, the
serial port chip there doesn't support 38.4).  This means "the hardware
can be run up to that speed"; you can probably find circumstances that
choke it when running 38.4KB input (as with lots of other boxes), and I
don't know if it'll run full-tilt 38.4KB on output.

>they wrote the software (stty, lpd, getty, etc.) to allow it.

The folks at Berkeley wrote "lpd" and "getty" (well, actually, "getty"
was, I think, in part done at Melbourne); Sun made some additions (like
making "lpd" use "statfs" instead of groveling over the superblock to find
out how full a file system is - the latter doesn't work very well over NFS
[[ So *that's* what they changed to make it work!  --wnl ]]).  "stty" is
basically Berkeley+AT&T work, with some amount of Sun work added in (more
in 4.0).

[[ Regarding lpd:  note that if you take the 4.3BSD source for lpd and
friends, recompile it and install it on a Sun running 4.0.x, you can not
make a Sun client be the server for a print queue.  Why?  Because
everything is NFS, and lpd wants to muck around in the superblock to (I
believe) find out how much space is left on the device.  How did I
discover this?  The hard way.  --wnl ]]

dove@uunet.uu.net (Webster Dove) (05/08/89)

We run our printer at 38400 off ttyb without problems using xon-xoff.
To do this I had to edit the transcript package psint.sh cmd file to
do stty 38400, since lpd under 3.5 cannot do this.

drl@kodak.com (Daniel R Lance) (05/10/89)

In article <1492@auspex.auspex.com> auspex!guy@uunet.uu.net (Guy Harris) writes:
>
>The SunOS 4.0 documentation does indicate that 38.4KB is supported on the
>CPU serial ports and on ALM-2 ports (no ALM-1/Systech/MTI ports, the
>serial port chip there doesn't support 38.4).  This means "the hardware
>can be run up to that speed"; you can probably find circumstances that
>choke it when running 38.4KB input (as with lots of other boxes), and I
>don't know if it'll run full-tilt 38.4KB on output.

I have had my LaserWriterIINTX running reliably on /dev/ttya of a 3/260,
OS 4.0.1, at 38,400 baud for the last week.  It's easy to do:

1) Stop the line printer queue.

2)  Send the following PostScript code to the printer.  (using cat or
kermit).  This is documented in the LaserWriter IINTX manual from Apple.

--cut here--
statusdict begin 25 sccbatch exch pop
0 eq {stop} if
serverdict begin 0 exitserver
statusdict begin 25 38400 64 setsccbatch
--cut here--

3) Change the entry in /etc/termcap to read :br#38400:

4) Kill -HUP the lpd process.

5) Restart the line printer queue.

I timed some large jobs and saw an effective throughput of about 16,000
baud when printing 1K x 1K black and white rasterfiles;  the printer's
PostScript interpreter is not be able to handle data at 38,400 baud in all
cases.  However, I have noted that normal text-based printing jobs run
significantly faster at 38400 baud than at 9600 baud.  At the higher baud
rate the speed of the print engine is more likely to limit overall
printing speed.

If you can't use 38,400 baud due to cabling cosiderations,  you can use
the above procedure to change your LaserWriter's speed to 19,200 baud,
which will still afford a significant performance improvement.

I haven't tried this with other printers, so I can't vouch that it works
with older LaserWriters or other PostScript printers.  However, a little
poking around in your printer's manual should point you in the right
direction.

--drl
Daniel R. Lance / Federal Systems Division, Eastman Kodak Company
drl@kodak.com / ..!rochester!kodak!lance

henkel%nepjt@ncsuvx.ncsu.edu (Chuck Henkel) (05/17/89)

In article <1875@kodak.UUCP> drl@kodak.com (Daniel R Lance) writes:
>X-Sun-Spots-Digest: Volume 7, Issue 280, message 4 of 18
>
>I have had my LaserWriterIINTX running reliably on /dev/ttya of a 3/260,
>OS 4.0.1, at 38,400 baud for the last week.  It's easy to do:
>
> [...deleted...]
>
>2)  Send the following PostScript code to the printer.  (using cat or
>kermit).  This is documented in the LaserWriter IINTX manual from Apple.
>
>--cut here--
>statusdict begin 25 sccbatch exch pop
>0 eq {stop} if
>serverdict begin 0 exitserver
>statusdict begin 25 38400 64 setsccbatch
                           ^^  
Be careful here. Here's another version of this same program:

	statusdict begin 25 sccbatch exch pop
	OPTIONS eq {stop} if
	serverdict begin 0 exitserver
	statusdict begin 25 BAUD OPTIONS setsccbatch

where OPTIONS and BAUD are replaced with the desired values (see manual).

Note that if the OPTIONS parameter is not different from the current value
stored in the printer, this program exits without setting the baud rate!
This bit me.

Here's the program for determining the current value of OPTIONS, 
(it's straight out of the manual)

	/Helvetica findfont 14 scalefont setfont
	30 500 moveto
	(Options: ) show
	statusdict begin 25 sccbatch 10 string cvs show
	pop showpage

By the way, what happens if you set the printer to 38400 baud, and then
find that your Sun can't talk to it? How do you reset the printer to the
old baud rate? Sounds like something that could catch someone. (Me, I also
have a mac hooked up to the printer through the other port, so I can
change it that way.)

Also, I didn't even try to use 38400 baud because some guy had posted
saying there was a bug in lpr that prevented its use. (Something about
using a short to store the baud rate, and 38400 won't fit in a short.) I
did get it to work at 19200 though.

| Chuck Henkel                      | Support nuclear power: Each year    |
| N.C. State University             | the combustion of fossil fuels      |
| Department of Nuclear Engineering | dumps 5 billion tons of greenhouse  |
| henkel%nepjt@ncsuvx.ncsu.edu      | gases into our atmosphere.          |

rfinch@caldwr.UUCP (Ralph Finch) (05/17/89)

In article <1875@kodak.UUCP>, drl@kodak.com (Daniel R Lance) writes:
. . .
> I have had my LaserWriterIINTX running reliably on /dev/ttya of a 3/260,
> OS 4.0.1, at 38,400 baud for the last week.  It's easy to do:

I called Daniel on the phone and clarified some points:

> 1) Stop the line printer queue.

I.E. type:

lpc
disable lw
stop lw
quit

<substitute your printer name for lw above>

> 2)  Send the following PostScript code to the printer.  (using cat or
> kermit).  This is documented in the LaserWriter IINTX manual from Apple.
. . .

Sort of documented.  I used the following csh script file:
____cut here____
#
# set the Laserwriter IINTX baud rate

cat << EOF | lpr
%!
serverdict begin 0 exitserver
statusdict begin 25 38400 64 setsccbatch
EOF
____cut here____

Cut the above to a file by the name of, say, set_rate.  Then type:
chmod +x set_rate
set_rate

> 3) Change the entry in /etc/termcap to read :br#38400:

/etc/printcap

> 4) Kill -HUP the lpd process.

Sometimes this was necessary, sometimes step 5) alone did the trick.

> 5) Restart the line printer queue.

I.E. type:
lpc
restart lw
enable lw
quit

If you used the kill -HUP <lpd process #> in step 4), to restart type:

/usr/lib/lpd

Here is a file to check your current settings (Postscript material
taken from the Apple LaserWriter IINTX guide, p. 123-124).
____cut here____
#
# get the current settings (status) of the LaserWriterIINTX.

cat << EOF | lpr
%!
/Helvetica findfont 14 scalefont setfont
/cr{show 182 currentpoint 20 sub exch pop moveto}def
/tb{show 300 currentpoint exch pop moveto}def
/Which{5 -1 roll 4 exch sub -1 roll cr
3{pop}repeat}def
statusdict begin 25 sccbatch end 182 650 moveto
exch (Baud  :)tb 10 string cvs cr
(Parity:)tb dup 30 bitshift -30 bitshift
(none-space) (odd) (even) (none-mark) Which
(Handshake:)tb dup 27 bitshift -29 bitshift
(XON/XOFF) (DSR/DTR) (ETX/ACK) (bad value) Which
(Data bits:)tb dup 25 bitshift -30 bitshift
(standard)(7)(8)(bad value) Which
(Stop bits:)tb -7 bitshift 0 eq{(1)}{(2)}ifelse
show showpage
EOF
____cut here____

Treat this in a similar fashion as the set_rate program above.

Ralph Finch
...ucbvax!ucdavis!caldwr!rfinch

Svante.Lindahl@front.se (Svante Lindahl) (05/18/89)

In Sun-Spots v7n290 henkel%nepjt@ncsuvx.ncsu.edu  (Chuck Henkel) writes:
> By the way, what happens if you set the printer to 38400 baud, and then
> find that your Sun can't talk to it? How do you reset the printer to the
> old baud rate? 

You write a small program that opens the line to the LW, sets the speed to
38400, and sends some PostScript code to the printer to set the speed back
to 19200 (or 9600 or whatever). If anyone needs it, I have such a program.

Svante.Lindahl@front.se	    (!-net:  ...!uunet!front.se!svante)
			    (non-mx: Svante.Lindahl%front.se@uunet.uu.net)

dav@hplabs.hp.com (David L. Markowitz) (05/20/89)

In article <2968@ncsuvx.ncsu.edu>, henkel%nepjt@ncsuvx.ncsu.edu (Chuck Henkel) writes:
> By the way, what happens if you set the printer to 38400 baud, and then
> find that your Sun can't talk to it? How do you reset the printer to the
> old baud rate? Sounds like something that could catch someone. (Me, I also
> have a mac hooked up to the printer through the other port, so I can
> change it that way.)

I had this problem, but careful perusal of the manual showed that the
printer can be reset to 9600 by toggling a switch off, wait a few seconds,
toggling it on again, and cycling power.

> Also, I didn't even try to use 38400 baud because some guy had posted
> saying there was a bug in lpr that prevented its use. (Something about
> using a short to store the baud rate, and 38400 won't fit in a short.) I
> did get it to work at 19200 though.

38400 will work under 4.0.1 (get the serial patch tape), but not 3.X.
19200 is the maximum speed that lpd understands in 3.X.  They fixed lpd in
4.0, but unfortunately they forgot to fix "tip" (Hello?  Sun?  Hello?).
It still maxes out at 19200.

I have one system running 4.0.1 that has an NTXII, so I tried to set it up
at 38400.  After ten minutes of lpd using 9600 anyway, I was about to pull
out some hair when I remembered that this system supported Interleaf TPS
3.X, and they had required replacing the 4.0 lpd with the 3.X one to work
around a bug.  (*sigh*)  It does work at 19200, though.

	David L. Markowitz		Rockwell International
	...!sun!sunkist!arcturus!dav	dav@arcturus.UUCP
	The above opinions are merely that, and only mine.

bruce@diamond (Bruce D. Wright) (05/24/89)

In Sun-Spots v7n290 henkel%nepjt@ncsuvx.ncsu.edu (Chuck Henkel) writes:
> By the way, what happens if you set the printer to 38400 baud, and then
> find that your Sun can't talk to it? How do you reset the printer to the
> old baud rate? 

Our LaserWriter manual says on p. 123:

You can override the PostScript-specified data transfer rate and, on the
LaserWriter IINTX, the handshake setting, by resetting the LaserWriter II
switches that normally govern those settings. This returns control over
those printer settings to the switches, unless you reset them again by
sending a PostScript program. To reset a switch, move it to the opposite
position, wait 30 seconds, and then return it to the desired postion.

The manual has all kinds of little tricks and programs for managing the
printer. It is worthwhile to take a hour and carefully read through all
the non-Mac and PC stuff.

Bruce Wright
Agricultural Engineering
Texas A&M University
bruce@diamond.tamu.edu

davecb@nexus.yorku.ca (David Collier-Brown) (06/06/89)

In article <3397@kalliope.rice.edu> felix!arcturus!dav@hplabs.hp.com (David L. Markowitz) writes:
| X-Sun-Spots-Digest: Volume 8, Issue 2, message 1 of 9
| 38400 will work under 4.0.1 (get the serial patch tape), but not 3.X.
| 19200 is the maximum speed that lpd understands in 3.X.  They fixed lpd in
| 4.0, but unfortunately they forgot to fix "tip" (Hello?  Sun?  Hello?).
| It still maxes out at 19200.
| 
| I have one system running 4.0.1 that has an NTXII, so I tried to set it up
| at 38400.  After ten minutes of lpd using 9600 anyway, I was about to pull
| out some hair when I remembered that this system supported Interleaf TPS
| 3.X, and they had required replacing the 4.0 lpd with the 3.X one to work
| around a bug.  (*sigh*)  It does work at 19200, though.

    Now that's **odd**.
    I used to work for Interleaf Canada, and did find that LaserWriter
IInx's could be connected at 38400 under 3.4 (and 3.5) using either the
3.4 (bug-free) or 3.5 (spurious-out-of-space-on "lpr -s") lpd's.
    Mind you, I won't INSTALL one at anything but 9600, but that's
because the sites are "turnkey", and tend to wedge their LaserWriters
real good if you leave them at anything but the default speed. 

dave

David Collier-Brown,  | davecb@yunexus, ...!yunexus!davecb or
72 Abitibi Ave.,      | {toronto area...}lethe!dave 
Willowdale, Ontario,  | Joyce C-B:
CANADA. 223-8968      |    He's so smart he's dumb.