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

I need to retrieve information about a serial port, and the device connected to it. To be more specific, I need to determine if a modem, used for dial-up has a connection established or not.
If it's possible, could you point me in the right direction.....
cheers.

Replies are listed 'Best First'.
Re: Gain information about serial ports
by cacharbe (Curate) on Jan 09, 2002 at 18:44 UTC
    You didn't mention platform, so I'll have to be generic in my Socratic method. Have you read this and/or this? What exactly have you tried thus far? Maybe we can point you in a better direction.

    C-.

Re: Gain information about serial ports
by Biker (Priest) on Jan 09, 2002 at 19:01 UTC

    To be more specific, I need to determine if a modem, used for dial-up has a connection established or not.

    I'll here assume that you know (or are able to determine) that there is a modem connected to the serial port. If so, this is probably not a Perl problem, but more of a modem problem.

    If this is a "Hayes-compatible" modem, you'll need to read the users manual for the modem in question to determine what 'AT' commands are supported by the modem. You'll have to find out if there is any AT command that will tell you what you want to know.

    "Livet är hårt" sa bonden.
    "Grymt" sa grisen...

Your question has too little information but.....
by metadoktor (Hermit) on Jan 09, 2002 at 19:16 UTC
    If you're working under Solaris you can find out if a port/device is being used by issuing the fuser command.

    Example:

    fuser /dev/cua/a
    
    will return the process id that is using the port if such a process exists.

    metadoktor

    "The doktor is in."

Re: Gain information about serial ports
by theorbtwo (Prior) on Jan 10, 2002 at 04:49 UTC

    If you're on a UNIX system, you're probably best off looking for the lockfile. If you're on a win32 system, I don't really know, but you might want to try opening the port, and see if it fails?

    Thanks,
    James Mastros,
    Just Another Perl Scribe