Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Module to talk to modem?

by dakedesu (Scribe)
on Jul 04, 2004 at 07:25 UTC ( [id://371680]=perlquestion: print w/replies, xml ) Need Help??

dakedesu has asked for the wisdom of the Perl Monks concerning the following question:

Sorry about not answering my "other" thread, which seems to have gotten a lot of replies. I will answer it, but I am still kind of jittery about it getting so many responses. I need to calm down, so I can make decent well thought out replies.

Anyways, now to the topic at hand.

I am looking for a Perl Module which will allow me to talk to my modem, dial out numbers, and maybe send data in the X.25 protocal. This is for hobby purposes, and I have no maliscous intents (so that should clear the ethical issues to those who know what the hell I am talking about).

I know Perl can interact with C/C++ in various module form, and well, I am actually asking for a CPAN modem as I have no idea what to do when talking to my modem.

If there are no CPAN modules, could somebody point me to the appropiate man pages, and various other forms of docs? Even if you could give me a good query string for google I would be happy

-- Jamie Payne

2006-03-16 Retitled by g0n, as per Monastery guidelines
Original title: 'POTS'

Replies are listed 'Best First'.
Re: Module to talk to modem?
by blue_cowdawg (Monsignor) on Jul 04, 2004 at 14:18 UTC

        am looking for a Perl Module which will allow me to talk to my modem, dial out numbers, and maybe send data in the X.25 protocal. This is for hobby purposes, and I have no maliscous intents (so that should clear the ethical issues to those who know what the hell I am talking about). I know Perl can interact with C/C++ in various module form, and well, I am actually asking for a CPAN modem as I have no idea what to do when talking to my modem.

    What you are looking for is on one hand not exactly rocket science and yet not a cake-walk either. Essentially it boils down to the following elements (and this is Sunday before I have had my first cup of coffee so I may miss something)

    • Establishing logical connectivity to your computer's RS232 port or modem.

      As mentioned elsewhere in the thread there is Device::Modem which when I looked at the docs seems to have very limited functionality. I might be tempted to crack some books and learn how my particular OS handles RS232 devices and roll my own module via h2xs.

    • Commnicating to the modem device via the "AT" command set or equivilant thereof. Most modern modems use the AT command set so this is a safe bet.
    • Handling the X.25 protocol.

      My very faint memories of the X.25 protocol lead me to believe that this is not for the faint of heart. Again this may be an application where I'd write my own module that I set up to pass data to it and let the workings of the module handle the encapsulation of the data within an X.25 packet.

      Likewise this module would deal with un-encapsulating data from recieved X.25 packets.

    • Somehow making this all work with some form of Expect or Expect::Simple to deal with the prospect of "I sent this and I'm expecting that" type of functionality.

    In your post you say you want to deal with X.25 over a modem. Are you sure you aren't using an X.25 PAD? If so the rules of the game may change.

      Hmmm... I am not sure if I trually know what I am doing here. I guess Perl popped into my head as Perl is very decent for quick demos, and I will generally jump onto perl for a quick demo purpose.

      I didn't really think of how much would end up getting written in C code anyways. In short, I really didn't design much of what I would be doing :/

      Please don't think I am a troll for posting this :(

      As per your last question, seeing as how I have used the device for ppp based connections, I am going to guess it is a modem.

      edit: already getting the old negative reputation points. Why do I always get those when I do something silly like admit I might have been foolish?

      -- Jamie Payne
Re: Module to talk to modem?
by superfrink (Curate) on Jul 04, 2004 at 08:08 UTC
    Okay, I'm curious so I searched for "modem" in CPAN and found Device::Modem . I did just post so today I guess I learned to search before I post a reply.

      Thanks, I didn't bother to search CPAN, because I didn't realise they would use a name that makes sense. I figured it would be group with something silly sounding like 'POE' or 'LWP'

      -- Jamie Payne
        I didn't bother to search CPAN

        And yet you asked people here to do the job for you?

Re: Module to talk to modem?
by superfrink (Curate) on Jul 04, 2004 at 08:01 UTC
    While I'm not really familiar with this I think you might be able to talk to the modem as a serial device under Linix (and probably others). Also try looking for "modem AT commands" or something like that. Finally this page will probably help a bit: http://www.zoltrix.com/support_html/modem/USEMODEM.HTM .
      Just a note from an old BBS'er. For any platform if you want to interact directly with a modem using its serial port and AT commands the modem has to have a hardware interface. "WinModems" or software driven modems as are common these days won't let you talk to them directly as a serial port. (e.g. from a dos prompt you couldn't do 'echo ATA > COM1' to make it pickup the phone) Anyone feel free to correct me if I'm way off on this -- its been many years since I coded with a modem.
        I have a recollection of some Linux drivers for winmodems going to the effort of faking a Hayes command set within the driver, and then faking a ttyS device so it would look exactly like a normal modem.

        That's making the big assumption that he uses Linux. Under windows you probably have to call some silly "get_win_handle_for_serial_devices_no_not those_,_the_other_ones()". That's just a guess, of course.

        ___________________
        Jeremy
        I didn't believe in evil until I dated it.

Re: Module to talk to modem?
by bart (Canon) on Jul 05, 2004 at 06:25 UTC
    Check out Win32::SerialPort if on Windows, and Device::SerialPort if on Linux. It doesn't do the modem commands for you, but I'm pretty sure it allows you to send them yourself to an attached modem. The demo code that comes with the latter seems like a nice starting point, to me.

      Well, I found out that Device::Modem has a requirement for Device::SerialPort... so I should be able to play with either one.

      -- Jamie Payne

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://371680]
Approved by davido
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-16 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found