Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Dec 1999 23:52:11 -0500 (EST)
From:      Mike Nowlin <mike@argos.org>
To:        freebsd-hackers@freebsd.org
Subject:   fixing a catch-22 with getty
Message-ID:  <Pine.LNX.4.05.9912152332430.23523-100000@jason.argos.org>

next in thread | raw e-mail | index | archive | help

(this is on 3.4-RC as of Dec. 11)

Here's the situation -- a lot of modems are brain-dead, and don't do a
full reset when you tell them to (by a DTR drop, with (usually) AT&D3)...
The DTE baud rate likes to stay where it was, instead of returning to the
115200 that (my) gettys are expecting.  I was hoping to fix this by using
the "ic" init-chat script ability from gettytab -- send it a 115200
"ATS0=1\r" or something, and that's where the problems started... :)

Apparently, the chat scripts like to see a carrier on the line before it
will write to the tty.  Tried setting gettytab to impose CLOCAL on the
line, no luck.  Went into main.c and added the following to main():

(lines marked with "-->")
-->     struct termios tmpbmode;
...
...
	if (IC) {
              if (!opentty(ttyn, O_RDWR|O_NONBLOCK))
                       exit(1);
              setdefttymode(tname); 
-->           /* create a copy to work with  */
-->           (void)tcgetattr(STDIN_FILENO, &tmpbmode); 
-->           /* set CLOCAL in the working copy, and tcsetattr() it */ 
-->           tmpbmode.c_cflag |= CLOCAL;
-->           (void)tcsetattr(STDIN_FILENO, TCSANOW, &tmpbmode);
              if (getty_chat(IC, CT, DC) > 0) {
                    syslog(LOG_ERR, "modem init problem on %s", tty);
                    (void)tcsetattr(STDIN_FILENO, TCSANOW, &tmode);
                    exit(1);
              }
-->           /* restore the saved copy of the terminal attrs */
-->           setdefttymode(tname);
        }

        if (AC) {
......


(yes, I know it's icky, but it's an experiment.)

This did allow the chat script to work, and the modem did init correctly
at the right baud rate, but now I'm running into the fact that nothing
other than getty can talk to the port (UUCP, kermit, etc.), probably due
to the non-blocking open...  A "ps ax" shows the "TT" column with a value
of "c04" with the init script, where it is normally "--" when I just use
the "wait for carrier before becoming active" (blocking open) method.  

I DO want it to switch back to the wait-for-carrier way of life after the
init script is finished....

I'm going to continue working on this until the wee hours of the morning,
but maybe somebody has some ideas?

thanks - mike




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.05.9912152332430.23523-100000>