Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!mips!sjsca4!poffen From: poffen@sj.ate.slb.com (Russ Poffenberger) Newsgroups: comp.os.msdos.programmer Subject: Re: How to hang up modem line? Message-ID: <1990Nov20.001532.17058@sj.ate.slb.com> Date: 20 Nov 90 00:15:32 GMT References: <11744@spool.cs.wisc.edu> <5750@uqcspe.cs.uq.oz.au> Reply-To: poffen@sj.ate.slb.com (Russ Poffenberger) Organization: Schlumberger Technologies, San Jose, CA. Lines: 48 In article <5750@uqcspe.cs.uq.oz.au> rhys@batserver.cs.uq.oz.au writes: >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. > Many modems can be configured for the action to take when DTR changes state. If you have problems, read the modem manual and see it it can be setup so that DTR hangs up the line. Russ Poffenberger DOMAIN: poffen@sj.ate.slb.com Schlumberger Technologies UUCP: {uunet,decwrl,amdahl}!sjsca4!poffen 1601 Technology Drive CIS: 72401,276 San Jose, Ca. 95110 (408)437-5254