Problems with Device::SerialPort (Modem Carrier Detection)

Discussion in 'Perl Misc' started by Hal Vaughan, Dec 9, 2005.

  1. Hal Vaughan

    Hal Vaughan Guest

    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
     
    Hal Vaughan, Dec 9, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,570
  2. Jimmy
    Replies:
    2
    Views:
    797
    touchring
    Nov 30, 2004
  3. Keith Lee
    Replies:
    6
    Views:
    4,065
    Joe Smith
    Mar 31, 2008
  4. sp
    Replies:
    1
    Views:
    846
    Steven Cheng [MSFT]
    Aug 28, 2008
  5. Eric Schwartz

    Loopback with Device::SerialPort?

    Eric Schwartz, Mar 18, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    192
    Eric Schwartz
    Mar 18, 2005
Loading...

Share This Page