Path: utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request From: wor-mein!dave@uunet.uu.net (Dave Axness) Newsgroups: comp.sys.sun Subject: Need help reading RS-232 control signals Keywords: Hardware Message-ID: <700@brchh104.bnr.ca> Date: 8 Dec 90 22:07:00 GMT Sender: news@brchh104.bnr.ca Organization: Sun-Spots Lines: 28 Approved: Sun-Spots@rice.edu X-Original-Date: Tue, 4 Dec 90 09:20:28 pst X-Sun-Spots-Digest: Volume 9, Issue 395, message 9 X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu 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