[mdlug] Serial port monitoring

Aaron Kulkis akulkis3 at hotpop.com
Thu Jan 31 11:09:18 EST 2008


Drew wrote:
>      I wish to write a script that returns a TRUE value if and only if
> (1) VMware is running, AND (2) the serial port (/dev/ttyS0) is actually
> connected through the modem and phone line to a remote host. To this
> end:
> 
> * How may the state of Carrier Detect be read?

By reading the status register of the port.
you might be able to get from the output of

$ stty -a < /dev/ttyS0

[This anamolous command line form means "give me the stty
information from /dev/ttyS0".  Note: must be root to do this]



> 
> * If there is no actual modem, but just a straight serial connection
>    using pins 2, 3, and ground, can reading Carrier Detect in that
>    manner be relied upon to return an OFF status?

If you're using only pins 2,3 and ground, then CD/ is not
connected, and therefore, attempts to read it are non-sensical.

If there's no modem, then CD/ has no meaning.

> 
> 
>      Then, I want to set up a permanent cron task that runs once a
> minute, executes the above script, and increments a counter (to be
> reset at the beginning of each month) on each TRUE return. How does
> one set this up?
> 
>      I am running Fedora Core 4.
> 
> ----
> 
>    - Drew.
> 
> _______________________________________________
> mdlug mailing list
> mdlug at mdlug.org
> http://mdlug.org/mailman/listinfo/mdlug
> 






More information about the mdlug mailing list