> If I read the kernel source right, TIOCSERGETLSR returns only a flag to
> match the state of UART_LCR_TEMT (0x40, transmit shift register
> empty). Maybe you already know that and haven't gotten to it yet :-)
DAMN! Now I'm totally confused. The get_lsr_info routine, which is invoked
by TIOCSERGETLSR, checks for UART_LSR_TEMT and returns TIOCSER_TEMT, which
is 0x01 (at least in my kernel 2.2.13). But I wrote the
following code to check the TSR, and it works!
while(1) // wait for empty TSR
{
if(ioctl(fd,TIOCSERGETLSR,&aLSR)==-1) {
fprintf(stderr," (GETLSR ERROR!)");
break;
}
if(aLSR&&0x40) break; // TSR is empty
// ^^^^ this should not work, because TIOCSERGETLSR returns 0
or TIOCSER_TEMT (0x01)???
usleep(3000UL); // sleep for 3 ms (1/BAUDRATE*3), BAUDRATE=9600
}
Strange.
Btw, on my system it tooks around 9 ms (3 loops) 'til TSR is empty. This
sounds rather long? Why doesn't get_lsr_info return the LSR? Too easy?
Michael
-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [EMAIL PROTECTED]