Subject: DSR support on serial ttys?
To: None <netbsd-help@NetBSD.ORG>
From: William O Ferry <WOFerry+@CMU.EDU>
List: netbsd-help
Date: 02/14/1998 20:45:27
    I've managed to hook up a HP DeskJet 550C to my SPARCclassic running
NetBSD.  I've been working on a filter to handle printing postscript
files (via ghostscript), and others through various levels of
conversions.  The filter works normally, but has one condition where
things really blow up.

    The DeskJet runs at 1200-19200 bps, and has an 80KB buffer. 
Depending on the speed I choose, printouts either work, or various
things go wrong.  With much experimenting I think I've brought it down
to the buffer and the DSR line.

    I set the printer at 2400bps (really slow, but it ensures that the
printer stays ahead of the computer), and printed a one page postscript
file (gs generates a 146KB printer output file from this .ps file).  The
page printed out just fine.  I took the printer offline and printed
again, and the machine blew up.  Basically, gs printed for a few
minutes, then the memory usage rapidly started increasing from 5.2MB all
the way up to 46MB (I only have 48MB of RAM in my SPARC).  By this point
the machine was completely useless, I had to use L1-A to halt and
restart the SPARC.  I put the printer back online, and it printed a
little more than half of the page.  If I have gs output to a file and
cat that file in the filter (printer offline), it prints out the same
amount, but at least nothing runs away (cat quits, but only having sent
the first half or so.

    This really seems to me that it's the printer's buffer overflowing
that's causing the problem.  The printer's DTR line signals whether it's
able to accept more input or if the buffer is full.  This is mapped
properly to the DSR pin on the SPARC's "A" serial port.  Though looking
at the stty(1) manpage and such, there doesn't seem to be any support
for DSR, only CTS.  Is this true?  Is there a flag in the printcap (or a
bit to set/clear in the flag or local mode fields) that will fix this? 
The printcap(5) manpage and browsing through sys/ioctl_compat.h didn't
seem to have anything I was looking for.

    Does anybody have any suggestions for how to solve this?  I assume
it's a problem with lpd, though gs has a rather poor way of handling
it...  =)  I'd greatly appreciate any help, I'd really like to get this
printer up and running (and at higher than 2400 bps...  =)

    Thanks in advance.

                                                          Will Ferry

-----------------------------------------------------------------------
 William O Ferry  <woferry@CMU.EDU> | finger: woferry@Warp.RES.CMU.EDU
 http://light.res.cmu.edu/~woferry/ | talk:   finger for online status
-----------------------------------------------------------------------