(Answer) (Category) SCO comp.unix.sco.programmer FAQ. : (Category) Hardware related programming :
How can I read or set modem signals on a serial port?
If your goal is simply to block an open until DCD comes high (i.e, you're writing a dialer) just open the uppercase device like /dev/tty1A or /dev/ttyA01.

If your goal is to get hardware flow control to work, look at the man pages for termio(M) and pay attention to the RTSFLOW and CTSFLOW bits.

If your goal is to detect when DCD goes away, use the uppercase device as described above and be sure that CLOCAL is clear. This will deliver a SIGHUP to you when DCD drops.
If your goal is to be able to wiggle DTR (not RTS), you might look at the description of B0 in termio. In my experience, this is poorly implemented in a number of serial drivers becuase it's poorly specified. For example, it's only implied that DTR gets raise again once a non-zero bit rate is specified. It's similarly unclear what the bitrate actually _is_ while you're in this mode, so if you need to process characters while DTR is low in this mode, it can be somewhat of a crapshoot.
If you really, really, want to directly read and write the modem control lines on a serial port, you have two options.

Many third party serial boards provide drivers that support the TIOCMGET and TIOCMSET ioctls. Most of the Digi intelligent serial board provide these ioctls.

Gert Doering has modified the FAS serial driver to add support for the TIOCMGET and TIOCMSET ioctls. This patch can be found at: ftp://ftp.leo.org/pub/comp/os/unix/networking/mgetty/fas-2.12-TIOCMGET.patch
Don't be fooled by the presence of these ioctls in <sys/termio.h> or be tempted to futz with -D_SVID3. They are unsupported in any SCO provided serial driver through and including the OpenServer 5.0.4 products.



robertlipe@usa.net

[Append to This Answer]
Previous: (Answer) How can I write my own device driver for SCO?
Next: (Answer) How can I directly read or write the parallel port to use it for input or to control my non-printer devices?
This document is: http://www.zenez.com/cgi-bin/scoprogfaq/faq?file=28
[Search] [Appearance]
This is a Faq-O-Matic 2.721.