1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

Cover zero timeout better with serial library.

This commit is contained in:
James Snyder 2010-02-03 21:22:28 +00:00
parent d890fd3c50
commit 9604c94f06

View File

@ -174,10 +174,17 @@ void ser_set_timeout_ms( ser_handler id, u32 timeout )
if( timeout == SER_INF_TIMEOUT )
{
termdata.c_cc[ VTIME ] = 0;
fcntl( id, F_SETFL, 0 ); // calls block
}
else if( timeout == SER_NO_TIMEOUT)
{
termdata.c_cc[ VTIME ] = 0;
fcntl( id, F_SETFL, FNDELAY ); // no blocking, timeout
}
else
{
termdata.c_cc[ VTIME ] = timeout / 100;
fcntl( id, F_SETFL, 0 ); // calls block
}
tcsetattr( id, TCSANOW, &termdata );
}