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.

Enjoy,
Larry

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 1.1.1.1
diff -r1.1.1.1 externs.h
55d54
< EXT unsigned char msr;

Index: intr.c

RCS file: /usr/share/cvs_rep/qnx/hardware/devc/ser8250/intr.c,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 intr.c
61c61
< 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 1.1.1.1
diff -r1.1.1.1 tto.c
42c42
< return(((msr << :sunglasses: | in8(port[REG_MC])) & 0xf003);

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

I too have been having problems with devc-ser8250, but I thought it might
have been a problem with the serial I/O card I was using. My application
supports a full duplex protocol over a serial port at 56K to a device which
we manufacture. To emulate our device, I wrote a loopback program and used
a null modem cable to link /dev/ser1 and /sev/ser2 together. The
application ran perfectly fine, except every so often, the data flow
“freezes” for anywhere from 2 to 15 seconds. Using the debugger, I
determined that readcond(), did not return within the provided timeout (I
asked it to return with >1 bytes or after 5 seconds). This problem occurs
on releases 6.0B, 6.0C and 6.1A. Both /dev/ser1 and /dev/ser2 are linked to
COM1 and COM2 respectively (standard PC board).

In addition to the data flow “freezing”, I also appear to be having a
problem with my serial I/O card. I purchased a Blueheat 8-port serial card
from connecttech and I run their wrapper, which in turn invokes devc-ser8250
with the correct parameters. Now, I run the same loopback program on ports
attached to the serial I/O card and it ceases to operate correctly. Its
almost as if it does not recognise hardware flow control (actually
connecttech ships their Blueheat card wrapper with a special program as they
say that QNX’s stty cannot determine the state of the hardware control
lines). I wonder if the problem is actually with dev-ser8250 and not with
stty.

Any insight…


Randy Aeberhardt
<raeberhardt@tantalus-systems.com>
<www.tantalus-systems.com>


“Larry Holding” <larryh@ansys.co.za> wrote in message
news:9r0u6k$sre$1@inn.qnx.com

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.

Enjoy,
Larry

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 1.1.1.1
diff -r1.1.1.1 externs.h
55d54
EXT unsigned char msr;

Index: intr.c

RCS file: /usr/share/cvs_rep/qnx/hardware/devc/ser8250/intr.c,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 intr.c
61c61
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 1.1.1.1
diff -r1.1.1.1 tto.c
42c42
return(((msr << > :sunglasses: > | in8(port[REG_MC])) & 0xf003);

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



\