devc-ser8250 bug!!

A few weeks ago I reported a bug in devc-ser8250 which was giving me a hard
time. Now that I have had a gap long enough to look closer at the bug, I
have fixed it (I hope).

The problem came with reading the state of the serial control lines, while
using more than on serial port. What would happen is that the state of the
incoming lines for whichever port’s lines changed most recently would be
reported for all the ports.

After downloading the devc ddk I discovered that a global variable was used
to hold the state of the most recent line change and this same variable was
used to service all requests for line status.

I have now patched my copy of devc-ser8250, as a bonus my copy of
devc-tser8250 was updated as well, free of charge. I have posted the diffs
below for anyone else who is interested.


P.S. Thanks to QNX who made it so easy to fix. (Download ddk, cvs out
source, patch source, type make).

Index: externs.h

RCS file: /usr/share/cvs_rep/qnx/hardware/devc/ser8250/externs.h,v
retrieving revision
diff -r1.1.1.1 externs.h
< EXT unsigned char msr;

Index: intr.c

RCS file: /usr/share/cvs_rep/qnx/hardware/devc/ser8250/intr.c,v
retrieving revision
diff -r1.1.1.1 intr.c
< unsigned char lsr;

unsigned char lsr,msr;

Index: tto.c

RCS file: /usr/share/cvs_rep/qnx/hardware/devc/ser8250/tto.c,v
retrieving revision
diff -r1.1.1.1 tto.c
< return(((msr << :sunglasses: | in8(port[REG_MC])) & 0xf003);

return(((in8(port[REG_MS]) << :sunglasses: | in8(port[REG_MC])) & 0xf003);