Fixes to termios.c on W32 targets

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.
Hamlib-3.0
Michael Black 2015-02-22 08:18:02 -06:00 zatwierdzone przez Nate Bargmann
rodzic 5b5386c711
commit 1d41268e4c
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -509,7 +509,7 @@ static int ClearErrors( struct termios_list *index, COMSTAT *Stat )
#ifdef DEBUG_ERRORS
if ( ErrCode )
{
printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n",
printf("%i frame %i %i overrun %li %i parity %u %i brk %i %i\n",
(int) ErrCode,
(int) ErrCode & CE_FRAME,
index->sis->frame,
@ -1445,7 +1445,7 @@ int win32_serial_read( int fd, void *vb, int size )
#ifdef DEBUG_VERBOSE
/* warning Roy Rogers! */
sprintf(message, " ========== ReadFile = %i %s\n",
( int ) nBytes, (char *) dest + total );
( int ) nBytes, *((char *) dest + total) );
report( message );
#endif /* DEBUG_VERBOSE */
@ -3306,7 +3306,7 @@ int win32_serial_select( int n, fd_set *readfds, fd_set *writefds,
SetCommMask( index->hComm, index->event_flag );
ClearErrors( index, &Stat );
if ( !WaitCommEvent( index->hComm, &dwCommEvent,
&index->sol ) )
&index->rol ) )
{
/* WaitCommEvent failed probably overlapped though */
if ( GetLastError() != ERROR_IO_PENDING )
@ -3320,7 +3320,7 @@ int win32_serial_select( int n, fd_set *readfds, fd_set *writefds,
be needed
*/
ClearErrors( index, &Stat );
wait = WaitForSingleObject( index->sol.hEvent, 100 );
wait = WaitForSingleObject( index->rol.hEvent, 100 );
switch ( wait )
{
case WAIT_OBJECT_0: