I was debugging termios.c and this patch fixes two small problems--two
debug printf format problems and another one that causes an extra char
to be read on timeout.
The extra char problem is easily duplicated by using the "w" command
under rigtctl. Most all other commands use fixed-length response
strings which don't exhibit the problem. But since "w" does not know
how long the response should be it loops until it times out. Every time
it times out it would return 1 extra character (this was 100% repeatable
on two different rigs).
Turns out it was a simple typo in the code as the read was using the
write event instead of the read event.
Fix bytes read count accumulation in Windows serial I/O.
read_string from communications port doesn't handle timeout on
anything but the first character read.
Honour VMIN tty parameter correctly.
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>