Bug fix in serial driver

Stanislav V. Voronyi (stas@use.kharkov.ua)
Fri, 22 Aug 1997 20:15:16 +0300


Hi All!

when I try use ecu under 2.1.x kernel I found strange thing -
RTS signal goes off & never rise, so modem does not send any
char to computer. If I off CTSRTS flow control all works good.
The way to this bug follows:
ioctl(tty_fd, TCSETSW, {B0 ...}) /* drop DTR by old way using B0 speed */
ioctl(tty_fd, TCSETSW, {B38400, crtscts.....}) /* set parameters with crtscts flag on */
after this call RTS stays off. The reason is error in serial.c.
In original text checking of structure member hw_stoped incorect,
because this flag set to 1 when transmision FROM computer TO modem
stoped by modem (CTS go off). But RTS controled transmision
FROM modem TO computer & go off when tty->flags bit TTY_THROTTLED
set to 1. Patch to fix this error follow:
--------------- CUT HERE --------------------------
--- linux-2.1.51/drivers/char/serial.c.orig Tue Aug 19 22:35:31 1997
+++ linux-2.1.51/drivers/char/serial.c Tue Aug 19 23:02:41 1997
@@ -22,6 +22,9 @@
* 1/97: Extended dumb serial ports are a config option now.
* Saves 4k. Michael A. Griffith <grif@acm.org>
*
+ * 8/97: Fix bug in rs_set_termios with RTS
+ * Stanislav V. Voronyi <stas@uanet.kharkov.ua>
+ *
* This module exports the following rs232 io functions:
*
* int rs_init(void);
@@ -2379,8 +2382,8 @@
if (!(old_termios->c_cflag & CBAUD) &&
(tty->termios->c_cflag & CBAUD)) {
info->MCR |= UART_MCR_DTR;
- if (!tty->hw_stopped ||
- !(tty->termios->c_cflag & CRTSCTS)) {
+ if (!(tty->termios->c_cflag & CRTSCTS) ||
+ !test_bit(TTY_THROTTLED, &tty->flags)) {
info->MCR |= UART_MCR_RTS;
}
cli();
--------------- CUT HERE --------------------------