Subject: Re: serial port control
To: None <current-users@NetBSD.ORG>
From: Wolfgang Rupprecht <>
List: current-users
Date: 02/10/1998 08:55:28 (Jaromir Dolecek) writes:
> I would like to write a small utility to control UPS, connected
> through RC232C cabel to serial port (/dev/tty00). Can some kind
> soul say what all I must care of ?

Last week something bad happened to the power in Fremont and my netbsd
box has gotten bounced hard a couple times.  I had several pages of
fsck errors and it took two loops over "fsck -y" to get all the errors
cleaned up.  I'm now ready for a UPS too. ;-)

This is what I've been able to find out: There two several different
types of UPS interfaces.  Sometimes both are even available on the
same UPS.  The 9-pin connector on the UPS is never a wired up as a
normal PC-style rs-232.  At best its a three-wire rs-232 interface,
with the pins rearanged just to keep things interesting.  At worst its
a contact closure signal that is not even at the rs-232 signalling
voltages and one must use a funny cable with level-translators in it
to convert the voltages to something the rs-232 port can even see
transitions on.  The signal from the latter type of interface can only
send out a one-bit (normal / powerfail) signal.  It must be run into
some modem-control line such as DCD and is then detected via a program
that checks the status of that modem control line.  Unless one is
careful, its possible to confuse the modem-control-line-only cable
that come with some UPS's as a real rs-232 cable.

Poking around APC web page, and a few promising altavista hits
revealed that they have 3 basic interfaces.  Low end UPS's ("back
UPS") have only the modem-control line type interface.  The two high
end lines ("Back UPS Pro", "Smart UPS") have both combination modem
control line and 3-wire rs-232 signals available.  In both cases one
needs to use one of two special cables.  The cable for the modem
control line interface has transistors and diodes in it to do the
level shifting (and power grabbing from some of the other wires).  Its
a real kludge, with the word UGLY comming to mind as the correct
modifier.  The second type of cable will get the UPS talking serially,
but some of the 3-rd party docs indicated that the UPS will only talk
if you send 2 stop bits.  The protocols don't appear to be officially
documented and the back-UPS pro and smart UPS appear to talk different
serial line protocols.  Only the back-UPS pro line appears to have any
3-rd party support, and many of the details of the protocol are only
guessed at.

The competetors all seem to have similar offerings (modem control line
only, and proprietary serial line protocols with special cables).  In
no case could I find someone with an openly documented standard.  All
in all I'm pretty disgusted with the fact that they all want you to
buy something that they won't give you the propper documentation for.
I'm just about ready to buy a hundred nicads from radio shack and make
my own UPS using a normal ATX power supply. ;-)