Re: [OFFTOPIC] Detector for modem for driver I want to code

Riley Williams (rhw@MemAlpha.CX)
Fri, 25 Jun 1999 01:36:35 +0100 (GMT)


Hi Mike.

> I'm in need of a device which will connect to the phone line,
> and either the printer port or a serial port. The device is to
> toggle a pin on the printer port when the phone line is
> currently "busy" due to a voice phonecall in place, or an
> incoming ring signal. I either want a ready made device, or
> schematics for one.

> It is important that the device takes all phoneline voltages
> into account including on-hook, off-hook, and RING. I am aware
> of the voltages, and don't want the 90VAC ring signal on a
> parallel port pin. ;o)

> It is likely to be a very simple circuit indeed. I just don't
> have the time to devel one, and have no idea where to search on
> the net for one. I figured someone in this list could point me
> in the right direction - either a technical mailing list that
> deals with things like this, or some website or another.

> What I'm using it for is this: I want to automate my modem to
> poll for mail once an hour or so, do a fetchmail and sendmail,
> and then to log off. I *ONLY* want it to do that though if the
> line is NOT in use currently (I only have one line).

That part of your specification is part of normal modem behaviour: If
it picks up the line and doesn't hear a dial tone, it drops the line
without even trying to dial.

In fact, I basically do that myself, and there's never been any
problem with it. The only difference in my case is that it polls when
the phone charges are cheap rate and not when they're otherwise - I
have to pay for my calls to the surfboard.

> Also, if the modem is already online, I want my script to just
> sit idle.

That's the easy part - your script can do that without any hardware at
all. Try the following bash script:

Q> #!/bin/bash
Q> X=`/sbin/ifconfig | cut -d ' ' -f 1 | grep "^$1\$"`
Q> if [ -n "$X" ]; then
Q> exit 0
Q> else
Q> exit 1
Q> fi

Save that as /sbin/online with mode 0755, then use `online ppp0` as
the command to run when you want to determine if you're online. It
returns TRUE (=0) if you are online, and FALSE (=1) if not.

> So basically, if I'm not online, and not talking voice, I want
> my script to go out for a mail run and then disconnect. To do
> so, I need a device to detect if the phone line is not in use.

> Someone suggested to me that the modem will not dial if ATX4
> command is in the init string, and there is no dialtone.

Ah...you've already met what I referred to earlier - sorry.

> That is true, but that is not what I want because 1) I have to
> use ATX3 because I have "call answer" and the modem wont dial
> out if I have messages waiting because it can't detect the
> dialtone - so I need to force it with X3...

I find that strange, as I have "call answer" as well, and I have no
problem using my modem with ATX4 in the dial string. I'd have to
presume that either your telephone provider uses a different dialtone
if there are messages waiting, or your modem incorrectly detects dial
tone in the first place.

If it's the latter, you could easily find that replacing the modem is
the cheapest option.

> ...and 2) The modem still takes the line off hook with X4 and
> looks for a dialtone. I've got my phone plugged into the modem,
> and as such, my voice call will get interrupted by the modem
> every 30 seconds and I'll get cut off.

SOme modems will interrupt the line if there's a glitch in their power
connection, so plugging your phone in through the modem is rarely a
good idea.

> So, I really do need this device. Any help would be greatly
> appreciated. Sorry for the [OT] posting.

I'll have a go at designing one for you, but don't hold your breath.

Best wishes from Riley.

+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |
+----------------------------------------------------------------------+
* ftp://ftp.MemAlpha.cx/pub/rhw/Linux
* http://www.MemAlpha.cx/kernel.versions.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/