Subject: Connecting UPS to a mac....
To: NetBSD Mailing List <port-mac68k@NetBSD.ORG>
From: David A. Gatwood <marsmail@globegate.utm.edu>
List: port-mac68k
Date: 06/12/1997 10:53:55
I'm sending this to both NetBSD's mailing list and MkLinux's setup list
because it's really applicable to either.  NetBSD folks, please note that
since mklinux lists are closed, any posts to them from ppl who aren't
subscribed will bounce.


We just got a UPS (finally) for the Foreign Language Department's Linux
box (PowerMac/Linux, technically, but it's a mac), and I'm trying to
configure the cable to hook it up to one of the serial ports.  Unless I'm
thinking about this totally wrong, I need to patch this thing's two
outputs to two handshaking ins, one to trip when the line fail trips, one
to trip at the two minute warning.  I'd like to be able to detect both, if
desired, logging both, then shutting down at the "two minute warning".

First, I'm assuming that the handshaking inputs generate an internal
voltage of 5v or so and wait for that to be pulled low, right?  Assuming
that's valid, the UPS shorts the pin to a second one in order to pull it
low, but it appears that the grounding has to be done in the cable. 
Should there be a resistor on either side to prevent the handshaking pin
from being completely grounded, or is that within spec?

On another (more Linux-specific, probably) note, I need a way to reliably
make sure that my program reliably catches the change in serial
handshaking signal very quickly after that two minute warning, since it
could take ~30 seconds to shut down and... estimates are estimates.  It
obviously can't run checks continuously, or the load would go through the
roof.  Is it safe to put a sleep(1) or sleep(2) or even sleep(5) in the
loop without worrying about whether the process might get swapped out
and not catch the change in status?


TIA,
David