comm: more baud rates
Rein Klazes
rklazes at xs4all.nl
Wed Apr 14 05:51:25 CDT 2004
Hi,
Application does:
GetCommState(hcom,&savedcb); // save status
{ communication session }
SetCommState(hcom,&savedcb); // restore status
For baud rates this actually works only for the standard windows rates.
My port happened to be at 50 baud and wine crashed in the last
SetCommState call.
I add some common baud rates, they should be portable across systems:
they mentioned in Stevens' book without any portability notes.
Changelog:
dlls/kernel : comm.c
Add missing POSIX baud rates to GetCommState and SetCommState.
Rein.
--
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/dlls/kernel/comm.c 2004-04-13 06:03:10.000000000 +0200
+++ mywine/dlls/kernel/comm.c 2004-04-13 19:10:21.000000000 +0200
@@ -1131,10 +1131,28 @@
#ifdef CBAUD
port.c_cflag &= ~CBAUD;
switch (lpdcb->BaudRate) {
+ case 0:
+ port.c_cflag |= B0;
+ break;
+ case 50:
+ port.c_cflag |= B50;
+ break;
+ case 75:
+ port.c_cflag |= B75;
+ break;
case 110:
case CBR_110:
port.c_cflag |= B110;
break;
+ case 134:
+ port.c_cflag |= B134;
+ break;
+ case 150:
+ port.c_cflag |= B150;
+ break;
+ case 200:
+ port.c_cflag |= B200;
+ break;
case 300:
case CBR_300:
port.c_cflag |= B300;
@@ -1147,6 +1165,9 @@
case CBR_1200:
port.c_cflag |= B1200;
break;
+ case 1800:
+ port.c_cflag |= B1800;
+ break;
case 2400:
case CBR_2400:
port.c_cflag |= B2400;
@@ -1218,10 +1239,28 @@
}
#elif !defined(__EMX__)
switch (lpdcb->BaudRate) {
+ case 0:
+ port.c_ospeed = B0;
+ break;
+ case 50:
+ port.c_ospeed = B50;
+ break;
+ case 75:
+ port.c_ospeed = B75;
+ break;
case 110:
case CBR_110:
port.c_ospeed = B110;
break;
+ case 134:
+ port.c_ospeed = B134;
+ break;
+ case 150:
+ port.c_ospeed = B150;
+ break;
+ case 200:
+ port.c_ospeed = B200;
+ break;
case 300:
case CBR_300:
port.c_ospeed = B300;
@@ -1234,6 +1273,9 @@
case CBR_1200:
port.c_ospeed = B1200;
break;
+ case 1800:
+ port.c_ospeed = B1800;
+ break;
case 2400:
case CBR_2400:
port.c_ospeed = B2400;
@@ -1481,9 +1523,27 @@
speed= (cfgetospeed(&port));
#endif
switch (speed) {
+ case B0:
+ lpdcb->BaudRate = 0;
+ break;
+ case B50:
+ lpdcb->BaudRate = 50;
+ break;
+ case B75:
+ lpdcb->BaudRate = 75;
+ break;
case B110:
lpdcb->BaudRate = 110;
break;
+ case B134:
+ lpdcb->BaudRate = 134;
+ break;
+ case B150:
+ lpdcb->BaudRate = 150;
+ break;
+ case B200:
+ lpdcb->BaudRate = 200;
+ break;
case B300:
lpdcb->BaudRate = 300;
break;
@@ -1493,6 +1553,9 @@
case B1200:
lpdcb->BaudRate = 1200;
break;
+ case B1800:
+ lpdcb->BaudRate = 1800;
+ break;
case B2400:
lpdcb->BaudRate = 2400;
break;
More information about the wine-patches
mailing list