MikeL's FreeBSD howto - Add a UPS

This is basically a checklist of how to install an Uninteruptable power supply to be monitored by the system. The intent is not to cover everything in detail, merely to point you to each of the tasks that must be performed.

There are several different packages to do this. I tried upsd (directions below), but it doesn't work with my "dumb" UPS (APC 500). upsmon actually has some documentation, but it sounds like it won't either, so I won't even try. The latter mentions pwrfaild, but I can't find anything about it. Somewhere on the web I found reference to bkpupsd, so now I'm trying it (many gory details below).


I had to make a special cable to adapt my APC Back-UPS 500 work with this program. A DB-9 male to female (male is UPS side), with all pins just passing through, except:
pin 4 is left open on both sides, and pins 6 and 7 are shorted. The reason is that the UPS is asserting DTR (pin 4) and DSR. DTR is supposed to be driven by the computer end, thus it is being held low by the computer. This in turn, is holding DSR down as well, thus it is left open.

I also had to modify the program -- immediately before the line ioctl(fd, TIOCMBIS, &dtr_bit);, I had to add dtr_bit = -1; this is the first one inside the while(1) loop. Also, the line else if(lstatus & TIOCM_RNG) { gets the TIOCM_RNG replaced with 0x100.
Diff listing:

> dtr_bit = -1;
>          else if(lstatus & 0x100 /*TIOCM_RNG*/) {
<          else if(lstatus & TIOCM_RNG) {
Protocol notes:
While making the cable work, I had a breakout box plugged into the serial line. I observed the following:
Copyright © 1995-2023 Mike Lempriere (running on host pedicel)