Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Problems with Device::SerialPort (Modem Carrier Detection)

Thread Tools

Problems with Device::SerialPort (Modem Carrier Detection)

Hal Vaughan
Posts: n/a
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

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!

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MPLS: Carrier supporting carrier and AToM No_Problem Cisco 0 02-13-2007 03:30 PM
Matched Filter for Carrier Recovery VHDL 0 09-15-2005 06:42 AM
64K Leased Line & Carrier Transitions Michael Papadopolous Cisco 0 09-29-2004 11:57 AM
Cisco 801 IOS error - lost carrier. transceiver problem? Miles Cisco 3 08-15-2004 10:10 PM
VPN Debug - Lost Carrier darren butts Cisco 0 07-19-2004 04:20 PM