getting modems to hang up revisited

Chuq Von Rospach chuqui at nsc.UUCP
Wed Oct 9 02:24:18 AEST 1985


Thanks to the quick response to my question by Steve Bellovin
(ulysses!smb), Matt Crawford (oddjob!matt), and Mark Callow (saber!msc)
I found the steps I missed in getting my modems to hang up. For those that
might be interested in this, here are the things that you need to be 
aware of:

    o make sure the cable from your system to the modem transfers Carrier
    Detect and Data Terminal Ready

    o make sure your modem doesn't force DTR high (ours did, because our
    old cables didn't supply DTR. Upgrading the cable doesn't help if you
    don't change the modem setting)

    o You need to make sure your kernel recognizes Carrier Detect. This is
    controlled by the 'flags' field in the configuration file for your
    DHU, DH, or DZ. See the man(4) page for details.

    o You need to make sure that the driver keeps the port closed long
    enough for the DTR drop to be recognized by the modem. I found that
    both the DHU driver and the DH driver don't leave DTR low long enough
    for my modems to recognize it. This can be dealt with a sleep() call 
    in init before opening the port or by fixing the driver in the kernel.
    If your driver has an "#ifdef PORTSELECTOR" turning on the ifdef should
    solve the problem. If not, you should add the following code fragments:

    in xxxopen():
	tp->t_ispeed = ISPEED;
	tp->t_ospeed = ISPEED;
	tp->t_flags = IFLAGS;
+	tp->t_state |= TS_HUPCLS;
	tp->t_dev = dev;
	tp->t_state |= TS_CARR_ON;

in xxxclose():

	if ((tp->t_state&(TS_HUPCLS|TS_WOPEN)) || (tp->t_state&TS_ISOPEN)==0)
+	{
+		extern int wakeup();

		(void) dhumctl(unit, DHU_OFF, DMSET);
+		/* Hold DTR low for 0.5 seconds */
+		timeout(wakeup, (caddr_t) &tp->t_dev, hz/2);
+		sleep((caddr_t) &tp->t_dev, PZERO);
	}
	ttyclose(tp);

    o If you want the modem to hang up if someone doesn't succeed in
    logging in, you should add a ":to#60" to the gettytab entries to
    cause getty to exit after 60 second (login already does this, so
    no change is needed).

Again, thanks to the net for the help and I hope this information is
helps someone else...

chuq

-- 
:From the caverns of the Crystal Cave: Chuq Von Rospach 
nsc!chuqui at decwrl.ARPA                 {decwrl,hplabs,ihnp4,pyramid}!nsc!chuqui

Our time is past -- it is a time for men, not magic. Come, let us leave
this world to the usurpers and rest our weary bones....



More information about the Comp.unix.wizards mailing list