RE: Linux-2.4.20 modem control

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Thu Mar 20 2003 - 17:13:42 EST


On Wed, 19 Mar 2003, Richard B. Johnson wrote:

> On Wed, 19 Mar 2003, Ed Vance wrote:
>
> > On Wed, Mar 19, 2003 2:32 PM, Richard B. Johnson wrote:
> > > On Wed, 19 Mar 2003, Ed Vance wrote:
> > > [SNIPPED...]
> > >
> > > > Hi Richard,
> > > >
> > > > The following patch to serial.c in 2.4.20 is a brute-force addition
> > > > of a hang-up delay of 0.5 sec just before close returns to the user,
> > > > if the hupcl flag is set. Please try this to determine if there are
> > > > any other issues with the remote login. If it works, I'll write a
> > > > better patch that does not duplicate other delays, etc.
> > > >
> > > > Cheers,
> > > > Ed
> > > >
> > >
> > > Well, it's the "right church, but wrong pew". As soon as anything
> > > closes STDIO_FILENO, **bang** the modem hangs up. NotGood(tm)!
> > > So as long as I just execute the shell which was exec'ed ...
> > > getty...rlogin...bash never called close. However, `ls` on my
> > > machine is `color-ls` when it calls exit(0)... well you get
> > > the idea! I can log in, but can't actually execute anything that
> > > terminates, closing STDIO_FILENO...
> > >
> > >
> > Hi Richard,
> >
> > Bummer! Do you think that each of those events was a "last close"
> > of the port? Doesn't bash hold the port open while the `color-ls`
> > runs?
> >
> > Since the path only delays (doesn't change modem control), these
> > closes must have been hidden by quick reopens. Does the unmodified
> > agetty set the baud rate to zero to hangup, or was that your change?
> > I was thinking that I could move the delay to the code that
> > disconnects when baud rate zero is set.
> >
> > your thoughts?
> >
> > Cheers,
> > Ed

[SNIPPED...]

This patch works (no other promises).

--- linux-2.4.20/drivers/char/serial.c.orig 2003-03-20 16:21:55.000000000 -0500
+++ linux-2.4.20/drivers/char/serial.c 2003-03-20 16:31:23.000000000 -0500
@@ -1538,8 +1538,12 @@
         serial_out(info, UART_LCR, serial_inp(info, UART_LCR) & ~UART_LCR_SBC);

         if (!info->tty || (info->tty->termios->c_cflag & HUPCL))
- info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS);
- serial_outp(info, UART_MCR, info->MCR);
+ {
+ serial_outp(info, UART_MCR,info->MCR & ~(UART_MCR_DTR|UART_MCR_RTS));
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ/2); /* Disconnect modem */
+ }
+ serial_outp(info, UART_MCR, info->MCR); /* Don't keep it off */

         /* disable FIFO's */
         serial_outp(info, UART_FCR, (UART_FCR_ENABLE_FIFO |

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

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



This archive was generated by hypermail 2b29 : Sun Mar 23 2003 - 22:00:32 EST