Subject: Serial question in mac68k-current
To: None <port-mac68k@NetBSD.ORG, current-users@NetBSD.ORG>
From: Monroe Williams <monroe@teleport.com>
List: current-users
Date: 02/13/1996 18:01:13
I'm working on a StyleWriter printer driver for NetBSD-mac68k (it
should work on other ports too, given the right serial cable, but
that's what I'm developing on).  The driver works quite well with the
StyleWriter I at the moment, and I'm trying to get the Color
StyleWriter 2400 working (in black & white mode).  For some reason, the
printer driver (running as a spawn of lpd, connected to /dev/tty01)
seems to be wedging the whole system while trying to read single bytes
back from the printer.

The driver is expecting the printer to send a single byte in response
to a control code (the byte should be 0x00 or 0x01).  It makes an
appropriate read() call and never comes back.  All other processes on
the machine stop, the network is unresponsive, etc.  I can still get to
the kernel debugger with the interrupt switch, and it always seems to
be in the serial interrupt handler.  (I can copy down the details of
the stack trace if it will help.)  Since I'm figuring out the control
codes for the printer as I go, it may actually be sending anything
(lots of data, break sequences, etc.), so I'm not sure it's a single
null byte causing the problem.  I'm pretty sure it's something the
printer is sending, since I've also seen things go awry during the boot
sequence if I don't unplug the printer before rebooting.  Also,
sometimes unplugging the serial cable to the printer will get things to
start happening again for a couple of seconds, but it usually hangs
again very shortly thereafter.

What I'd like to figure out is:  what could the printer possibly be
doing to the serial port that would bring down the system?  Does 'stty
-echo' mean that absolutely nothing will be echoed, or could certain
incoming binary data cause the printer and the serial driver to start
chatting at full speed?  (I suspect that could cause the symptoms I
see...)

This is with a -current kernel supped a couple of weeks ago.
/etc/printcap sets the serial port to 57600 baud, no flow control,
'raw' mode, echo off.  (Yes, the printer requires 57600 with no flow
control.  It looked wrong to me too, but it's all that works.)

Thanks,
-- monroe
------------------------------------------------------------------------
Monroe Williams                                      monroe@teleport.com