Need help reading RS-232 control signals

Dave Axness wor-mein!dave at uunet.uu.net
Sun Dec 9 09:07:00 AEST 1990


I recently installed an uninterruptable power supply that has an RS-232
interface.  Several pins on RS-232 connector are assigned to indicate the
status of the UPS ( ex. AC power fail, battery low, etc. ).  I'm trying to
write a program to monitor this so that I can force an automatic shutdown
when the battery starts to run out.

It seems like I should be able to use ioctl to accomplish this but have
had no luck so far.  I'm using the ttya port on the back of a 3/60.  I'm
still running SUNOS 3.5 if that's an issue.  Here's a code fragment:

	int   tty_status
	FILE *ip;

	ip = fopen("/dev/ttya","rw");

	ioctl ( ip, TIOCMODG, &tty_status );

	printf ("ttys status = 0x%x\n", tty_status );

I've tried to change the state of pin 20 (DTR) be connecting it to pin 7
(GND) or pin 25 (-5V) but the value of tty_status is always 0.  Am I
trying to do this the right way or am I missing something here.  Any help
would be appreciated.

Dave Axness
Quantum Medical Systems, Inc.
Issaquah, WA
uunet!wor-mein!dave



More information about the Comp.sys.sun mailing list