Wine and the serial port

lawson_whitney at juno.com lawson_whitney at juno.com
Mon Nov 5 21:34:41 CST 2001


On Sun, 4 Nov 2001, Gerson Kurz wrote:

> I have an application that talks to hardware via the serial port.
> (Actually, it talks to a lot of hardware, banking peripherals). The app
> runs on both Win32 and OS/2.

Uwe, I think, mentioned winemaker.  He knows whereof he
speaks.  winemaker is awesome.  You get this by a little winelib program
winemaker and I constructed from a --debugmsg +storage trace.
>
> Of course, the main theme is porting the thing natively to linux (and I'm
> working on that). But just for fun I tried to get it to work with WINE, and
> while the "device emulation" works perfectly (much to my surprise, really
> good work guys!) the serial communication doesn't go far. The hardware
> receives the data, but the signals (RTS/CTS etc.) are NOT correctly handled
> by WINE.
>
> Is this an area that is being worked on?

Maybe it is now.  I would be interested to know if the attached patch
from Mike McCormack addresses your issue with RTS/CTS.  It makes my app
run better, Mike and I agree it looks right, but Alexandre has the
majority vote.  Oh, in case you are not used to patch, you can apply
this one like so:

cd <wine>
patch -p 0 --dry-run < dtr_control.diff
patch -p 0  < dtr_control.diff

or,

cat dtr_control.diff | patch -p 0 -d <wine> --dry-run
cat dtr_control.diff | patch -p 0 -d <wine>

<wine> is of course the root of the Wine source tree.

Lawson

Constants aren't, and variables won't.
-------------- next part --------------
Index: dlls/kernel/comm.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/comm.c,v
retrieving revision 1.41
diff -u -w -r1.41 comm.c
--- dlls/kernel/comm.c	2001/10/21 15:01:20	1.41
+++ dlls/kernel/comm.c	2001/11/06 00:11:07
@@ -1060,14 +1060,13 @@
 	    port.c_cflag |= CRTSCTS;
 	    TRACE("CRTSCTS\n");
 	  }
+#endif	
 	
 	if (lpdcb->fDtrControl == DTR_CONTROL_ENABLE)
 	  {
-	    port.c_cflag &= ~CRTSCTS;
-	    TRACE("~CRTSCTS\n");
+             WARN("DSR/DTR flow control not supported\n");
 	  }
 
-#endif	
 	if (lpdcb->fInX)
 		port.c_iflag |= IXON;
 	else
@@ -1242,18 +1241,20 @@
 	lpdcb->fNull = 0;
 	lpdcb->fBinary = 1;
 
+	/* termios does not support DTR/DSR flow control */
+	lpdcb->fOutxDsrFlow = 0;
+	lpdcb->fDtrControl = DTR_CONTROL_DISABLE;
+
 #ifdef CRTSCTS
 
 	if (port.c_cflag & CRTSCTS) {
-		lpdcb->fDtrControl = DTR_CONTROL_ENABLE;
 		lpdcb->fRtsControl = RTS_CONTROL_ENABLE;
 		lpdcb->fOutxCtsFlow = 1;
-		lpdcb->fOutxDsrFlow = 1;
 	} else 
 #endif
 	{
-		lpdcb->fDtrControl = DTR_CONTROL_DISABLE;
 		lpdcb->fRtsControl = RTS_CONTROL_DISABLE;
+		lpdcb->fOutxCtsFlow = 0;
 	}
 	if (port.c_iflag & IXON)
 		lpdcb->fInX = 1;


More information about the wine-users mailing list