termios and raw data - bug?
peter.o.mueller at gmx.de
peter.o.mueller at gmx.de
Mon Sep 17 15:36:35 UTC 2001
Hi all,
searching why I'm not able to get binary data over the serial line (bit 8
set) I found the following "feature" of the 16550 character read function. If a
character is available the character will be returned, if there is no char
available -1 will be returned. So if data with bit 8 set comes in the
character was lost because the upper layer assumes it is -1 and just picks up the
next incoming char.
The following change in ns16550.c solves the problem: The char was set to
the lower byte of the return value, without expanding it sign correct.
unsigned short tmp=0;
..
ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS);
if(ucLineStatus & SP_LSR_RDY) {
cChar = (*getReg)(pNS16550, NS16550_RECEIVE_BUFFER);
tmp |= (unsigned char)cChar;
return (int)tmp;
} else {
return -1;
}
}
Not perfect but works. A look to the other inbyte_nonblocking_polled
functions show the same "feature".
Peter
P.S. I could not link when using makeraw. The functions seems not be
available in the libs. So I have to set the flags on my own as shown in the termios
man page.
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
More information about the users
mailing list