----------------------------------------------------------------------------
The "trust-energy" cable defined in genpowerd.h corresponds to the cable
that is described in the UPS HOWTO.  I have appended the data that enabled
me to build that cable and enter this new definition.

Note that I don't actually use a Trust Energy Protector UPS.  However the
documentation that comes with my UPS happens to define the pin signals
precisely as described in the 8.3.1.1 section.  Call me lucky!

I hope this will prove useful for other people, but please, note that I
do not bear any responsibility for any potential damage the cable or the
"trust-energy" configuration could cause you.  It comes on a "use-at-your-
own-risks" basis, but if you're a Linux user, you should already be familiar
with that concept. ;-)

Enjoy anyway!

Raphael Manfredi <Raphael_Manfredi@pobox.com>
October 6th, 1999
Grenoble, France
----------------------------------------------------------------------------

>>>>>>> From the UPS HOWTO on my Debian 2.1 system -- RAM <<<<<<<<

8.3.1.  The computer to UPS connection

The Trust Energy Protector 400/650 is equipped with a remote signal
port.  Using a properly designed cable, it is possible to connect the
UPS port to the serial port of a computer, thus making it aware of
power failure events.

8.3.1.1.  The UPS signal port

These are the pin assignments for the DB-9 signal port of the Trust
Energy Protector 400/650, as described in the user's manual:

   pin 2
      The relay will close when input power fails.

   pin 4
      Common for pins 2 and 5.

   pin 5
      The relay will close when the battery inside the Trust Energy
      Protector 400/650 has less than 1.5 minutes of backup time left.

   pin 6
      The user may send a high level signal (+5V - +12V) for over 1ms
      to turn off the Trust Energy Protector 400/650. However this
      option can only be activated when the input power fails.

   pin 7
      Common for pin 6.

8.3.1.2.  The Cable

This is the cable I used to connect the UPS to the serial port of my
computer:

computer side (DB-25)               UPS side (DB-9)
===================================================

 6 DSR --+             [R] = 10 kilo-Ohm resistor
         |
20 DTR --+----+
         |    |
        [R]  [R]                           +--- 7
         |    |                            |
 8 DCD --+----|-----------        ---------|--- 2
              |                            |
 7 GND -------|-----------        ---------+--- 4
              |             ....
 5 CTS -------+-----------        ------------- 5

 2 TX  -------------------        ------------- 6

===================================================

In the case of a DB-9 serial port, the pins 6,20,8,7,5,2 are mapped to
pins 6,4,1,5,8,3.

8.3.1.3.  How the cable works

The computer raises DTR and checks whether DSR is high, to ensure that
the cable is connected to the computer. While the power is good, DCD
and CTS are both high (because of the pull-up resistors).

When the power fails, the relay between pins 2 and 4 of the UPS port
closes, and DCD becomes low, signalling the failure condition.

Similarly, when the UPS batteries are getting low, the relay between
pins 5 and 4 closes, thus lowering CTS.

During a power failure the computer is able to turn off the UPS by
raising TX for over 1ms. This can be easily accomplished sending a
0xFF byte to the serial port, at a low baud rate.
