Enhancement of comm.c to get IC35 manager up and running

Dominik Strasser dominik.strasser at mchp.siemens.de
Thu Apr 19 09:10:34 CDT 2001


With the attched patch (and the other one I am going to send in a
minute) I was able to get the Sync-SW of my IC 35 PDA up and running
under Linux.
The SW seems to be quite whacky, but this is what Windows SW quite often
seems to be.

The patch contains two changes:
first of all the enabling of Dtr handshake doesn't mean that we want
RTS/CTS handshake!
sendly there was a problem with the Comm timeout:
The application does a SetCommTimeouts with
lptimeouts->ReadIntervalTimeout set to 0xffffffff.
When you add 99 and divide by 100, you get 0 which was not intended.
Btw. the predence in the original expression seems also wrong as +99/100
means + 0 !
On the other hand, the MS documentation says about  ReadIntervalTimeout:
"A value of zero indicates that interval time-outs are not used. !"
Does this mean that if set to 0, no timeouts occurwhich would mean that
we have to timeout after 25.5 seconds or does it mean that timeouts
should be set to 0.
Somebody with a better understanding of this sentence can change the
"means no timeout line" to 0xff.

Changelog:
Dominik Strasser <dominik.strasser at t-online.de>
	Don't use RTSCTS if Str handshake is enabled
	Use appropriate Unix timeout values in SetCommTimeouts

-- 
Dominik Strasser	| Phone:  +49 89 636-43691
SIEMENS AG		| Fax:    +49 89 636-42284
CT SE 4			| E-Mail:Dominik.Strasser at mchp.siemens.de
Otto-Hahn-Ring 6	|
D-81739 Muenchen	| Room: 53-263
-------------- next part --------------
--- comm.c	Thu Apr 19 15:55:15 2001
+++ comm.c.new	Thu Apr 19 15:54:26 2001
@@ -2387,7 +2387,6 @@
 	}
 #ifdef CRTSCTS
 	if (	lpdcb->fOutxCtsFlow 			||
-		lpdcb->fDtrControl == DTR_CONTROL_ENABLE||
 		lpdcb->fRtsControl == RTS_CONTROL_ENABLE
 	) 
 	  {
@@ -2395,7 +2394,7 @@
 	    TRACE("CRTSCTS\n");
 	  }
 	
-	if (lpdcb->fDtrControl == DTR_CONTROL_DISABLE)
+	if (lpdcb->fDtrControl == DTR_CONTROL_ENABLE)
 	  {
 	    port.c_cflag &= ~CRTSCTS;
 	    TRACE("~CRTSCTS\n");
@@ -2749,8 +2748,26 @@
         FIXME("tcgetattr on fd %d failed!\n",fd);
         return FALSE;
     }
+
     /* VTIME is in 1/10 seconds */
-    tios.c_cc[VTIME]= (lptimeouts->ReadIntervalTimeout+99)/100;
+	{
+		unsigned int ux_timeout;
+
+		if(lptimeouts->ReadIntervalTimeout == 0) /* 0 means no timeout */
+		{
+			ux_timeout = 0;
+		}
+		else
+		{
+			ux_timeout = (lptimeouts->ReadIntervalTimeout+99)/100;
+			if(ux_timeout == 0)
+			{
+				ux_timeout = 1; /* must be at least some timeout */
+			}
+		}
+		tios.c_cc[VTIME] = ux_timeout;
+	}
+
     if (-1==tcsetattr(fd,0,&tios)) {
         FIXME("tcsetattr on fd %d failed!\n",fd);
         return FALSE;


More information about the wine-patches mailing list