[mdlug] Serial port monitoring
Aaron Kulkis
akulkis3 at hotpop.com
Fri Feb 1 18:50:51 EST 2008
Drew wrote:
> At 10:24 PM 1/31/08, Robert Meier wrote:
>
>> The underlying hardware, if access is supported,
>> should be available via ioctl(2).
>> Start by looking at tty_ioctl(4), including TIOCM_CD.
>> It is probable you will have to load some additional
>> CONFIG_SERIAL_8250 kernel modules.
>> It is possible you will have to recompile your kernel,
>> as IIRC tty_ioctl support is no longer standard.
>>
>> To interpret much of the above man pages you will need to download and
>> understand the spec sheet for the 8251 Universal Asynchronous Receiver
>> Transmitter that is the canonical hardware implementation of RS-232.
>
> I'm looking at the man page for tty_ioctl(4), from which it
> looks like I need
> to write a C program or something which can #include and call the function,
> executing "ioctl(fd, TIOCMGET, &modeminfo);" then "modeminfo &= TIOCM_CAR;"
>
> Most of the info that I need (eg, values for TIOCMGET and TIOCM_CAR)
> should be in the header files, and I could theoretically write the
> program without
> ever knowing what these constants are.
>
> Finding a value for fd (the serial port handle) is a bit more
> problematic: For
> all TRUE returns, it is anticipated (in fact part of the definition
> of a valid TRUE
> return) that the serial port will be in use, grabbed by VMware. I found that
> PalmOS allows multiple programs to open the (same) serial port; but
> I'm not sure
> about whether Linux does.
>
>
>>>> * 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?
>> No.
>
> Then I need to find some other way to determine whether the serial
> port is connected *and* refrain from using it from VMs for any serial work
> (eg, Palm apps)...
>
>
>
>> If your goal is security,
>> then you might consider wiring the carrier detect line to a parallel
>> port pin to monitor it.
>
>
> I might look into the parallel pin method a bit more anyway, but my goal
> doesn't have anything to do with security.
>
> What I'm after is something that will automatically keep count of how many
> minutes I've been connected to Netzero dialup during the month, without my
> having to remember to do anything special before starting it up. I only get 10
> hours a month, and they don't seem willing to provide a way to determine how
> much time is left.
YOu can get DSL for like $13 a month now through Verizon/AOL.
More information about the mdlug
mailing list