1 |
Gretings, |
2 |
|
3 |
In the old days when we used direct port I/O to perform serial port actions, code like the following would display the port's status: |
4 |
|
5 |
#define BASE 0x03F8 /* COM1 port base address */ |
6 |
#define LS_REG (BASE+5) /* Line Status Register */ |
7 |
|
8 |
void ShowLineStatus(void) |
9 |
{ |
10 |
int status = inportb(LS_REG); |
11 |
if (status & 0x02) printf("Overrun Error\n"); |
12 |
if (status & 0x04) printf("Parity Error\n"); |
13 |
if (status & 0x08) printf("Framing Error\n"); |
14 |
if (status & 0x10) printf("Break Interrupt\n"); |
15 |
if (status & 0x80) printf("Timeout Error\n"); |
16 |
} |
17 |
|
18 |
How does one perform the same thing for /dev/ttyS0 (or any other serial port)? |
19 |
|
20 |
I've been looking at various ioctl's, but haven't yet spotted one that provides information on overrun errors, parity errors, etc. |
21 |
|
22 |
Thanks in advance! |
23 |
|
24 |
David |