dave@uunet.uu.net (Dave Axness) (12/09/90)
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