From owner-freebsd-hackers Wed Dec 15 20:52:27 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from jason.argos.org (a1-3b058.neo.rr.com [24.93.181.58]) by hub.freebsd.org (Postfix) with ESMTP id 3738D15543 for ; Wed, 15 Dec 1999 20:52:21 -0800 (PST) (envelope-from mike@argos.org) Received: from localhost (mike@localhost) by jason.argos.org (8.9.1/8.9.1) with ESMTP id XAA23930 for ; Wed, 15 Dec 1999 23:52:11 -0500 Date: Wed, 15 Dec 1999 23:52:11 -0500 (EST) From: Mike Nowlin To: freebsd-hackers@freebsd.org Subject: fixing a catch-22 with getty Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG (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