🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #3084

Re: How to hang up modem line?

#3084
From: Rhys Weatherley
Date: Sat, 17 Nov 1990 22:40
43 lines
2344 bytes
so@brownie.cs.wisc.edu (Bryan S. So) writes:


>Other than sending +++ATZ to the modem, is there a more 
>efficient way to hang up the phone line?  

Try "+++ATH0" instead - it doesn't re-initialise the modem.  (The "H0" may
vary a bit - use the proper hangup sequence of your modem).  And don't forget
to have at least a one second pause either side of the "+++" sequence.

>I have tried to 

>    outportb(mcr, 0);	/*  Modem control register 	*/
>    outportb(lcr, 0);	/*  Line control register 	*/
>    outportb(ier, 0);	/*  Interrupt enable register 	*/

Rather than clearing everything, just drop the DTR signal for a few
milliseconds.  The code I use is:

	outportb(mcr,inportb(mcr) & 0xFE);	/* Zero out bit 0 (DTR) */
	delay(100);				/* Wait 100 ms: can vary */
	outportb(mcr,inportb(mcr) | 0x01);	/* Set DTR to 1 again */

This way, you can keep communicating with the modem to maybe begin a
new connection or whatever.  Also, it allows you to send the hangup
string afterwards if dropping the DTR didn't work (see below).

>in Turbo C.  It hangs up the phone line on many modems,
>but not on several.  Is there a better way to do it?

Ultimately, there is no "foolproof" way, but the best I have found is
to drop the DTR signal (as I have done above), and then if a carrier still
exists on the line, then send the hangup string.  This is used by Telix
(as far as I can tell), and many of my programs and seems quite adequate.
Make the hangup string configurable by the user, and it should be possible
the handle any situation.

Rhys.

+===============================+==============================+
||  Rhys Weatherley             |  University of Queensland,  ||
||  rhys@batserver.cs.uq.oz.au  |  Australia.  G'day!!        ||
+===============================+==============================+
Technical Details
Message-ID: <5750@uqcspe.cs.uq.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!brolga!uqcspe!batserver.cs.uq.oz.au!rhys
References: <11744@spool.cs.wisc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!brolga!uqcspe!batserver.cs.uq.oz.au!rhys
From: rhys@batserver.cs.uq.oz.au (Rhys Weatherley)
Newsgroups: comp.os.msdos.programmer
Subject: Re: How to hang up modem line?
Message-ID: <5750@uqcspe.cs.uq.oz.au>
Date: 17 Nov 90 22:40:13 GMT
References: <11744@spool.cs.wisc.edu>
Sender: news@uqcspe.cs.uq.oz.au
Reply-To: rhys@batserver.cs.uq.oz.au
Lines: 43