Fix for diald dial failure problem (kernel 2.0.34 bug?)

Robert de Bath (rd103924@mayday.cix.co.uk)
Sun, 19 Jul 1998 15:44:02 +0100 (BST)


This error:

Jul 19 14:04:16 slip2 diald[1911]: Delaying 15 seconds before clear to dial.
Jul 19 14:04:44 slip2 diald[1911]: SIGHUP: modem got hung up on.
Jul 19 14:04:44 slip2 diald[1911]: could not get initial terminal attributes: I/
O error
Jul 19 14:04:44 slip2 diald[1911]: failed to set terminal attributes: I/O error
Jul 19 14:04:44 slip2 diald[1911]: Running connect (pid = 1960).
Jul 19 14:04:45 slip2 chat[1961]: Can't get terminal parameters: I/O error
Jul 19 14:04:45 slip2 diald[1911]: Connect script failed.

Which can be duplicated by doing:

$ stty 5:0:800014b2:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0 </dev/ttyS0

to the relevent serial port when diald is running but idle.
The problem seems to be caused by a '-clocal' hangup being triggered by a
loopback 'stty 0' hangup before the flag is reset. This _may_ be a kernel
bug or simply a misunderstanding.

It can be avoided by the following patch:

--- modem.c.orig Fri Jun 20 07:08:42 1997
+++ modem.c Sun Jul 19 15:21:46 1998
@@ -251,6 +251,7 @@
{
int npgrpid;
int i;
+ int line_disc;
/*
* Open the serial device and set it up.
*/
@@ -348,6 +349,13 @@

if (!req_pid) {
/* hang up and then start again */
+ set_up_tty(modem_fd, 1, inspeed);
+ if( ioctl(modem_fd, TIOCGETD, &line_disc) < 0 || line_disc != N_TTY )
+ {
+ line_disc = N_TTY;
+ ioctl(modem_fd, TIOCSETD, &line_disc);
+ }
+
set_up_tty(modem_fd, 1, 0);
sleep(1);
set_up_tty(modem_fd, 1, inspeed);

The patch also fixes a situation where the line discipline has been left in
an unusual state by this or another program. Without this patch it will
hang the connect script.

-- 
Rob.                           (Robert de Bath <http://www.cix.co.uk/~mayday>)
                                                 <http://poboxes.com/rdebath>

- 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.altern.org/andrebalsa/doc/lkml-faq.html