[PATCH] fixes failure to hang up modem V2.2.2

Richard B. Johnson (root@chaos.analogic.com)
Tue, 9 Mar 1999 11:16:05 -0500 (EST)


Here is a patch that fixes the current kernel's failure to lower DTR
when B0 is set for baud-rate. Standard disclaimer: It works for me.

--- linux-2.2.2/drivers/char/serial.c.orig Tue Mar 9 10:43:33 1999
+++ linux-2.2.2/drivers/char/serial.c Tue Mar 9 11:10:07 1999
@@ -2162,39 +2162,26 @@
{
struct async_struct *info = (struct async_struct *)tty->driver_data;
unsigned long flags;
-
- if ( (tty->termios->c_cflag == old_termios->c_cflag)
- && ( RELEVANT_IFLAG(tty->termios->c_iflag)
- == RELEVANT_IFLAG(old_termios->c_iflag)))
- return;
-
- change_speed(info, old_termios);

- /* Handle transition to B0 status */
- if ((old_termios->c_cflag & CBAUD) &&
- !(tty->termios->c_cflag & CBAUD)) {
- info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS);
- save_flags(flags); cli();
- serial_out(info, UART_MCR, info->MCR);
- restore_flags(flags);
- }
-
- /* Handle transition away from B0 status */
- if (!(old_termios->c_cflag & CBAUD) &&
- (tty->termios->c_cflag & CBAUD)) {
- info->MCR |= UART_MCR_DTR;
- if (!(tty->termios->c_cflag & CRTSCTS) ||
- !test_bit(TTY_THROTTLED, &tty->flags)) {
- info->MCR |= UART_MCR_RTS;
- }
- save_flags(flags); cli();
- serial_out(info, UART_MCR, info->MCR);
- restore_flags(flags);
+ /* If the speed is not B0, set it and enable DTR and possibly RTS */
+ if(tty->termios->c_cflag & CBAUD) {
+ change_speed(info, old_termios);
+ info->MCR |= UART_MCR_DTR;
+ if (!(tty->termios->c_cflag & CRTSCTS) ||
+ !test_bit(TTY_THROTTLED, &tty->flags)) {
+ info->MCR |= UART_MCR_RTS;
+ }
+ }
+ else {
+ /* The speed is B0, clear DTR and RTS */
+ info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS);
}
+ save_flags(flags); cli();
+ serial_out(info, UART_MCR, info->MCR);
+ restore_flags(flags);

/* Handle turning off CRTSCTS */
- if ((old_termios->c_cflag & CRTSCTS) &&
- !(tty->termios->c_cflag & CRTSCTS)) {
+ if (!(tty->termios->c_cflag & CRTSCTS)) {
tty->hw_stopped = 0;
rs_start(tty);
}

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.2.2 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/