I have a program that communicates with a US Robotics external serial
modem,
which has worked great until recently. I've changed some
hardware, or,
actually just moved it around, but it is not out of the question that
the
boot sequence has changed some settings.
I've used this in a module that communicates with the modem:
my $device = "/dev/ttyS0";
our $spdev = Device::SerialPort->new($device);
And later I have the following routine:
sub checkonline {
my ($state);
$state = 0;
if ($spdev->modemlines & $spdev->MS_RLSD_ON) {
$state = 1;
} else {
$state = 0;
}
slog("DEBUG Online check, state: $state");
return $state;
}
I do not know the internals, but my understanding is that this will
tell if
a carrier is detected. Many programs use this modem and the
system it
connects to is hard to reach, so I have a management program that
queues up
all the programs that need to use the modem to communicate with the
(difficult to reach) system on the other end. Once one
program finishes
using the modem, the next in the queue runs. One of the first
things it
does is call checkonline() (see above) to see if there is a connection.
Until this past week, that worked perfectly, but now it rarely detects
the
connection.
The entire point of this routine is that, when a new program is
running, I
need a way to detect quickly if it is online. If it is, then
I can call
the main menu of the remote system. If not, then I have to
redial.
Otherwise, I'd have to try to get the menu and examine all the returned
input to see if I am online or getting messages from the modem.
Are there conditions under which the above routine can't be relied on to
detect a carrier? Are there settings I can specify that will
make sure it
works every time? Is there another way that is 100% reliable
to detect if
there is a carrier? Even detecting if the modem is on or off
hook might
help, but ideally I need to know if it is online with another system.
I know some AT commands, but I do not have a very deep understanding of
the
actual serial port communication and what I can trust as being true for
all
(or most) modems and what is modem specific.
Thanks for any help on this!
Hal
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.