Skip to content

Commit

Permalink
win32termios: fix in tcflush
Browse files Browse the repository at this point in the history
Under Windows, the Icom transceive messages do not get flushed
properly. Returned data is cached in windows serial buffer and
are received by hamlib as response to initial request.
Lada suggested to add PURGE_RXCLEAR flag to tcflush (lib/termios.c),
actually clearing and making the buffer empty.

Look at http://msdn.microsoft.com/en-us/library/windows/desktop/aa363428%28v=vs.85%29.aspx
PURGE_RXABORT only terminates overlapped reads but not input buffer.

Nate suggested to add the PURGE_TXCLEAR flag to the output queue as well.

Signed-off-by: Ladislav Vaiz <spam@nagano.cz>
Signed-off-by: Nate Bargmann <n0nb@n0nb.us>
  • Loading branch information
fillods committed May 6, 2013
1 parent d331253 commit 683cc7e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/termios.c
Expand Up @@ -2593,23 +2593,23 @@ int tcflush( int fd, int queue_selector )
switch( queue_selector )
{
case TCIFLUSH:
if ( !PurgeComm( index->hComm, PURGE_RXABORT ) )
if ( !PurgeComm( index->hComm, PURGE_RXABORT|PURGE_RXCLEAR ) )
{
goto fail;
}
break;
case TCOFLUSH:
if ( !PurgeComm( index->hComm, PURGE_TXABORT ) )
if ( !PurgeComm( index->hComm, PURGE_TXABORT|PURGE_TXCLEAR ) )
{
goto fail;
}
break;
case TCIOFLUSH:
if ( !PurgeComm( index->hComm, PURGE_TXABORT ) )
if ( !PurgeComm( index->hComm, PURGE_TXABORT|PURGE_TXCLEAR ) )
{
goto fail;
}
if ( !PurgeComm( index->hComm, PURGE_RXABORT ) )
if ( !PurgeComm( index->hComm, PURGE_RXABORT|PURGE_RXCLEAR ) )
{
goto fail;
}
Expand Down

0 comments on commit 683cc7e

Please sign in to comment.