Support for nonstandard baud rate in SetCommState.

This commit is contained in:
Lawson Whitney 2002-02-19 18:41:56 +00:00 committed by Alexandre Julliard
parent be49563060
commit 533e7eeaf4
4 changed files with 251 additions and 219 deletions

439
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -885,6 +885,7 @@ AC_CHECK_HEADERS(\
linux/cdrom.h \
linux/input.h \
linux/joystick.h \
linux/serial.h \
linux/ucdrom.h \
net/if.h \
netdb.h \

View File

@ -68,6 +68,10 @@
#include "debugtools.h"
#ifdef HAVE_LINUX_SERIAL_H
#include <linux/serial.h>
#endif
DEFAULT_DEBUG_CHANNEL(comm);
#if !defined(TIOCINQ) && defined(FIONREAD)
@ -911,6 +915,29 @@ BOOL WINAPI SetCommState(
break;
#endif
default:
#if defined (HAVE_LINUX_SERIAL_H) && defined (TIOCSSERIAL)
{ struct serial_struct nuts;
int arby;
ioctl(fd, TIOCGSERIAL, &nuts);
nuts.custom_divisor = nuts.baud_base / lpdcb->BaudRate;
if (!(nuts.custom_divisor)) nuts.custom_divisor = 1;
arby = nuts.baud_base / nuts.custom_divisor;
nuts.flags &= ~ASYNC_SPD_MASK;
nuts.flags |= ASYNC_SPD_CUST;
WARN("You (or a program acting at your behest) have specified\n"
"a non-standard baud rate %ld. Wine will set the rate to %d,\n"
"which is as close as we can get by our present understanding of your\n"
"hardware. I hope you know what you are doing. Any disruption Wine\n"
"has caused to your linux system can be undone with setserial \n"
"(see man setserial). If you have incapacitated a Hayes type modem,\n"
"reset it and it will probably recover.\n", lpdcb->BaudRate, arby);
ioctl(fd, TIOCSSERIAL, &nuts);
port.c_cflag |= B38400;
}
break;
#endif /* Don't have linux/serial.h or lack TIOCSSERIAL */
COMM_SetCommError(handle,IE_BAUDRATE);
close( fd );
ERR("baudrate %ld\n",lpdcb->BaudRate);

View File

@ -238,6 +238,9 @@
/* Define if you have the <linux/joystick.h> header file. */
#undef HAVE_LINUX_JOYSTICK_H
/* Define if you have the <linux/serial.h> header file. */
#undef HAVE_LINUX_SERIAL_H
/* Define if you have the <linux/ucdrom.h> header file. */
#undef HAVE_LINUX_UCDROM_H