From cb21246f6e0d2bda9cbef725dd8416e7e3f560d7 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sat, 28 Oct 2017 09:28:39 -0700 Subject: [PATCH] SERIAL, MUX: General fix for Windows Platform physical serial port output Avoid Windows specific serial I/O behaviors which might not always have hardware state reported to user level code. The TMXR layer code already paces mux output so that reasonable behavior is observed. --- sim_serial.c | 8 -------- sim_tmxr.c | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/sim_serial.c b/sim_serial.c index 167c04fd..2d1dc95a 100644 --- a/sim_serial.c +++ b/sim_serial.c @@ -879,8 +879,6 @@ return read; /* return the number of int32 sim_write_serial (SERHANDLE port, char *buffer, int32 count) { -if (WaitForSingleObject (port->oWriteReady.hEvent, 0) == WAIT_TIMEOUT) - return 0; if ((!WriteFile (port->hPort, (LPVOID) buffer, /* write the buffer to the serial port */ (DWORD) count, NULL, &port->oWriteSync)) && (GetLastError () != ERROR_IO_PENDING)) { @@ -888,12 +886,6 @@ if ((!WriteFile (port->hPort, (LPVOID) buffer, /* write the buffer to the seri (int) GetLastError ()); return -1; /* return failure to caller */ } -if ((!WaitCommEvent (port->hPort, &port->dwEvtMask, &port->oWriteReady)) && - (GetLastError () != ERROR_IO_PENDING)) { - sim_error_serial ("WaitCommEvent", /* function failed; report unexpected error */ - (int) GetLastError ()); - return -1; /* return failure to caller */ - } return count; /* return number of characters written/queued */ } diff --git a/sim_tmxr.c b/sim_tmxr.c index 719350d1..820763ff 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -701,7 +701,7 @@ if (lp->serport) { /* serial port connectio return 0; written = sim_write_serial (lp->serport, &(lp->txb[i]), length); if (written > 0) - lp->txnexttime = floor (sim_gtime () + (lp->txdelta * sim_timer_inst_per_sec ())); + lp->txnexttime = floor (sim_gtime () + (written * lp->txdelta * sim_timer_inst_per_sec ())); return written; } else { /* Telnet connection */