H
Hal Vaughan
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
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