typos in ntdll/serial.c code

Reinhard Karcher rkarcher at frey.de
Mon Jan 1 10:41:52 CST 2007

Hello wine developers,

the attached patch fixes some issues I had with the 16 bit configuration
program for our SOHO PBX.

- The first change corrects the logic for SERIAL_DTR_CONTROL. If it is
  *cleared*, TIOCM_DTR has to be released and if it is *set* TIOCM_DTR
  has to be asserted. The way I have rewritten it is based on the
  style of condition used for RTS some line below.
- The second change: Checking for DSR_HANDSHAKE does not really make sense
  to me when the coded guarded by that is just about RTS.
  I suppose it is meant to not toggle the RTS line when CRTSCTS is
  in effect, as on Unix one cannot toggle RTS and CTS handshaking
  on its own.

The debug log contains:
trace:comm:SetCommState16 cid 0, ptr 0xb695ba
trace:comm:dump_dcb bytesize=8 baudrate=9600 fParity=0 Parity=0 stopbits=1
trace:comm:dump_dcb ~IXON ~IXOFF
trace:comm:dump_dcb fOutxCtsFlow=1 fRtsControl=1
trace:comm:dump_dcb fOutxDsrFlow=0 fDtrControl=0
trace:comm:dump_dcb CRTSCTS

Without the 1st patch DTR is set instead of cleared;
without the 2nd patch RTS is cleared instead of set as observed by

My PBX needs RTS to send its data to my computer.

Michael Karcher

diff -ur ../wine-0.9.28/dlls/ntdll/serial.c ../wine-0.9.28n/dlls/ntdll/serial.c
--- ../wine-0.9.28/dlls/ntdll/serial.c  2006-11-25 12:00:22.000000000 +0100
+++ ../wine-0.9.28n/dlls/ntdll/serial.c 2006-12-28 18:21:54.000000000 +0100
@@ -595,13 +595,13 @@
     if (shf->ControlHandShake & SERIAL_DTR_HANDSHAKE)
         WARN("DSR/DTR flow control not supported\n");
-    } else if (shf->ControlHandShake & SERIAL_DTR_CONTROL)
+    } else if ((shf->ControlHandShake & SERIAL_DTR_CONTROL) == 0)
         whack_modem(fd, ~TIOCM_DTR, 0);
         whack_modem(fd, 0, TIOCM_DTR);
 #ifdef TIOCM_RTS
-    if (!(shf->ControlHandShake & SERIAL_DSR_HANDSHAKE))
+    if (!(shf->ControlHandShake & SERIAL_CTS_HANDSHAKE))
         if ((shf->FlowReplace & (SERIAL_RTS_CONTROL|SERIAL_RTS_HANDSHAKE)) == 0)
             whack_modem(fd, ~TIOCM_RTS, 0);

More information about the wine-patches mailing list