HUPCL and getty... what's going on?!?

Cliff Yamamoto cyamamot at kilroy.jpl.nasa.gov
Sat Dec 1 18:26:50 AEST 1990


Greetings!

Well I've been losing too much sleep over this, so after weeks of hacking
I must plea for help.  The situation is...

I'm implementing a dialback procedure.  When people dial in to the USR HST
Dual, no problem.  The gettytab is perfect, the autobaud works and everyone
can cycle throught different baud rates due to the 'nz' entry.  The modem
DCE follows the baud rate and I've made the gettytab autobaud to prevent
flow problems (this is not the problem - works great).  This is on a SS+
running 4.1 with the eeprom settings of 'ttyb-rts-dtr-off=false and
'ttyb-ignore-cd=false'.

Dialback is the headache.  As soon as the modems connect (after dial back
and establishing carrier), the Sun drops DTR and kills the connection!  The
quick fix?  Disable DTR monitor on the USR so the modem ignores the DTR.
Sure it works, but now the modem doesn't hang up on logouts.  The users
must manually hang up their end.

What I've found... With a 232 protocol analyzer as soon as CD goes high
(for carrier detect) the sun drops DTR.  I've tried the breakout box, but
I'd like to keep the RTS/CTR and DSR/DTR stuff kosher.

** ASSUMPTIONS HERE **
My understanding is getty will always drop DTR whenever it's parent process
terminates (such as after a logout).  I also understand that using termio
(in the dialback program) I can clear the HUPCL flag and prevent the modem
from hanging up when I close the device and terminate the dialback process.
So my code fragment looks like this: (with some comments added by me).


    sprintf(devname,"%s%d",DIALDEV,line);
    acufd = open(devname, O_RDWR);	/* open device */

    sleep(5);	/* pause for getty to get out of the way */
    ioctl(acufd, TCGETS, &s);
    s.c_iflag = (BRKINT | ICRNL | IXON | ISTRIP);
    s.c_oflag = (OPOST | ONLCR | XTABS);
    s.c_cflag = (speedval | CS7 | CREAD | PARENB);
    s.c_lflag = (ISIG | ICANON);
    ioctl(acufd, TCSETS, &s);

    printf("%s: dialing...\n",progname);
    if (!dial(number)){				/* successful dial */
	printf("%s: dial succeeded\n",progname);  <<==-- I can always dial ok
	ioctl(acufd, TCGETS, &s);
	s.c_cflag &= (~HUPCL);  <<==-- does this stop getty from dropping me?
	ioctl(acufd, TCSETS, &s);
    } else {
	printf("%s: dial failed\n", progname);
    }

    close(acufd);
    unlink(lockname);
}

So how do I know getty is my HEADACHE???!?

- Because when I comment out the /usr/etc/getty entry for the modem (ttyd0)
  in /etc/ttytab, then my modem connects and never drops carrier (of course
  there is no autobaud and login prompt).
- Becuase when I modify the code above and sleep() for several seconds just
  before the 'close(acufd)' statement, the modem doesn't drop carrier until
  the dialback program does a close on the device.

Have I missed anything?  I'm I doing something wrong in the program?  Dial
in is no problem, the Sun never drops the modem even after displaying the
login prompt.  When the dialback program dials the modem and steps aside
after getting a connect, getty comes along and drops DTR (even *BEFORE*
the nx entry in gettytab does anything - eg. getty doesn't even perform any
speed table changes before it drops the carrier.)

Any clues or helpful hints would be appreciated!  I'll summerize if there's
interest or if I can get it working somehow.

-- Cliff



More information about the Comp.unix.questions mailing list