making a working version for my CISCO 800 series router

This commit is contained in:
David Lesaffre 2013-01-29 16:07:16 +01:00
parent 2fa23e598e
commit 956e7d9f8b

View File

@ -340,13 +340,13 @@ static void* serial_thread_func(void* arg)
while (1) while (1)
{ {
freerdp_thread_wait(serial->thread); freerdp_thread_wait_timeout(serial->thread, 500);
serial->nfds = 1; serial->nfds = 1;
FD_ZERO(&serial->read_fds); FD_ZERO(&serial->read_fds);
FD_ZERO(&serial->write_fds); FD_ZERO(&serial->write_fds);
serial->tv.tv_sec = 20; serial->tv.tv_sec = 1;
serial->tv.tv_usec = 0; serial->tv.tv_usec = 0;
serial->select_timeout = 0; serial->select_timeout = 0;
@ -356,12 +356,15 @@ static void* serial_thread_func(void* arg)
freerdp_thread_reset(serial->thread); freerdp_thread_reset(serial->thread);
serial_process_irp_list(serial); serial_process_irp_list(serial);
if (WaitForSingleObject(serial->in_event, 0) == WAIT_OBJECT_0) switch (WaitForSingleObject(serial->in_event, 0)) {
case WAIT_OBJECT_0:
case WAIT_TIMEOUT:
{ {
if (serial_check_fds(serial)) if (serial_check_fds(serial))
ResetEvent(serial->in_event); ResetEvent(serial->in_event);
} }
} }
}
freerdp_thread_quit(serial->thread); freerdp_thread_quit(serial->thread);
@ -683,6 +686,7 @@ static BOOL serial_check_fds(SERIAL_DEVICE* serial)
case 0: case 0:
if (serial->select_timeout) if (serial->select_timeout)
{ {
__serial_check_fds(serial);
serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_NONE, STATUS_TIMEOUT); serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_NONE, STATUS_TIMEOUT);
serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_READ, STATUS_TIMEOUT); serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_READ, STATUS_TIMEOUT);
serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_WRITE, STATUS_TIMEOUT); serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_WRITE, STATUS_TIMEOUT);