Raw Serial/IO problem on RS6000

phil at inmet.inmet.com phil at inmet.inmet.com
Sat Apr 6 06:29:00 AEST 1991


I am experiencing a frustrating problem with serial I/O on an RS/6000
that I could use some advice about. (The problem also appears on PS/2s
as well but never mind).  First some remarks about what I am trying to
do.

I am using the serial port to communicate with a device in 8 bit raw
mode at 9600 baud.  I send an 8 byte message to the device and it issues
an 8 byte response.  This sequence is repeated indefinitely.  The device 
will not speak unless spoken to.  I have opened the serial port O_RDWR in 
raw mode and am using blocking I/O.  I do an alarm() before beginning each 
read to give me a timeout in case something goes wrong.  If something does 
go wrong I wait a while, do a TCFLUSH ioctl call to clear up garbage, and 
then resume.

Here's what happens.  Everything is fine except for one transaction in
several thousand.  On these rare occasions the timeout takes effect, but
when the flush is performed, it returns the information that a number of
characters EQUAL TO THOSE MISSING FROM THE READ were flushed.  As if they
were sitting in the input queue but were incapable of being read.  The
number of characters missing can vary but is most often just one.
It makes no difference if I make the timeout 2 seconds or 2 hours.  

I have independently verified that the device being spoken to never takes
more than 100 msec or so to respond to a message. The device also 
responds to a malformed message in a positive way which has also been
independently verified.  It is clear to me that it is not the device's
problem.

Does anyone know of a problem with AIX's serial device driver which
could cause these symptoms?



More information about the Comp.unix.aix mailing list