Subject: Re: Serial ports on SPARCclassic?
To: None <port-sparc@NetBSD.ORG>
From: William O Ferry <WOFerry+@CMU.EDU>
List: port-sparc
Date: 02/14/1998 15:25:33
    Heh.  Okay, looks like I just needed to pay more attention to the
pinouts.  What I had failed to notice was that my SPARC uses the same
interface pins as my printer does (i.e. both had Tx on pin 2, etc).  So
a null modem adapter fixed all the problems.  Out of curiosity, does
anybody know if Sun's A/B splitter cable does the conversion, or if each
port would still need a null modem adapter?

    SO... I can talk to the printer just fine now.  But now I've run
into another problem.  I believe it's due to buffering, or more
importantly how lpd is handling a full printer buffer.  I'll describe
the failure in more detail below, but first let me give a quick idea of
my setup and when it fails.  Again this is a HP DeskJet 550C, which has
an 80KB internal buffer, supports up to 19200 bps, and uses the DTR pin
to signal when it's buffer is full.  The filter is hand-written,
basically handles raw deskjet files by shipping them straight through,
postscript by running gs, and text by enscript'ing and then running
through gs.  So it's pretty simple.

    At 9600 things seem to work pretty well, at least for simple one
page documents.  However, printing larger documents or printing at 19200
causes things to go really nasty.  In all cases the printer will stop
printing 1-2 inches before the bottom of the page, and just kinda hang. 
gs will flip out and start rapidly sucking up every last byte of RAM,
until the machine creeps to a halt and dies.  If I have gs output to a
file and then cat that file in the printer filter gs has no problems,
but again the last part of the printout is missing (though at least cat
just goes away).

    Given that document size or speed seems to affect this, I'm starting
to think it has to do with the printer's buffer filling, and how lpd is
(or isn't) handling this.  The printer should be using DTR to signal
when it's buffer has filled.

    How do I get lpd to check the DTR pin?  There doesn't seem to be a
printcap flag for it, and I looked in sys/ioctl_compat.h, and there did
not seem to be anything in there about dtr.  Do I need some external
program to actually handle the serial communications (i.e. can lpd not
handle this)?  Or can stty fix all of my problems (and if so can I just
run it at the beginning of the filter)?

    Thanks for all the help in getting this working.  I realize that my
current problems most likely aren't sparc related.  I can move this to
netbsd-help if people think I should.

                                                          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
-----------------------------------------------------------------------