D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Checking modem status

 

On 12/06/13 21:39, Martin Gautier wrote:
>
> what would said script look like (bash/perl/php)? Any
> suggestions on tools which could do the checking and return a result to
> a bash script for example?

We use Perl to drive "cu" for this at work.

But I think anything that can drive a suitable serial app will be fine.

I note though the script at work does a 2 second wait for cu to finish
messing about, then issues an ATZ. Might be worth trying ATZ as first
command to reset to a known good status for the rest of the script.

That said the code we have isn't as well written as the example using
Open2 in the Perl FAQ.
http://learn.perl.org/faq/perlfaq8.html

Doing it from Bash I'd probably use "expect", and "cu", since you can
easily set a timeout, and probably only care if it succeeds or fails
(not what the output is).

There are probably a whole host of other newer tools which will drive it
all more straight forwardly these days if you care, as emulating serial
modems was quite a popular way for mobile phones and such like to
provide data connection. Can't help feeling it was just the kind of
technology we needed to leave behind, having evolved too far after its
original design.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq