Subject: Re: Connecting UPS to a mac....
To: David A. Gatwood <marsmail@globegate.utm.edu>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: port-mac68k
Date: 06/12/1997 09:48:43
> 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.

I've run into this policy before, and it's really stupid. Not only can't
someone outside of ANY of the lists reply to a note, but when a message
is posted to multiple lists, you have to be on all of them to reply!

It's a frustration which makes me want to buy from Power Computing
or Motorola, rather than Apple.

> 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".

Your best bet (under either OS, I think) is to hook the two minute
warning to DTR, and the line fail to CTS. DTR changes will get
propogated to sleeping processes while CTS changes won't. I.E. a
process should be able (I think) to sleep on a DTR change.

mac68k/NetBSD can't report the state of the input lines at the moment.
I have patches which will add it (and will hopefully make the tree
before 1.3).

> 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?

NO! RS-232 signals have V > +3Volts == "0" and V < -3Volts == "1".
Ground isn't a defined state. The Mac uses comparators tied to ground
to buffer the signal, so you need to generate a negative voltage for
"OK", and a positive voltage for "trouble". Remember that the signals
are /CTS and /DCD - they are "active low," which translates to > 3V
== true. :-)

Take care, and good luck!

Bill