I also recently ported apcupsd to openbsd.  I sent a patch
upstream but got no reply.   (I'm new enough to openbsd that
I didn't even consider volunteering to maintain a port.  I'm
glad you are!)

Here is what I patched to get it working (this is for 4.2-CURRENT,
supporting a Back-UPS RS 1500).

--- patch begins ---

diff -ru apcupsd-3.14.3_openbsd_fix/src/drivers/usb/bsd/bsd-usb.c 
apcupsd-3.14.3/src/drivers/usb/bsd/bsd-usb.c
--- apcupsd-3.14.3_openbsd_fix/src/drivers/usb/bsd/bsd-usb.c    Sat Feb  9 
08:49:05 2008
+++ apcupsd-3.14.3/src/drivers/usb/bsd/bsd-usb.c        Sat Oct 27 10:15:14 2007
@@ -351,11 +351,10 @@
 
 int pusb_ups_get_capabilities(UPSINFO *ups, const struct s_known_info 
*known_info)
 {
-   int i, rc, ci, phys, input, feature;
+   int i, rc, ci, phys;
    USB_DATA *my_data = (USB_DATA *)ups->driver_internal_data;
    hid_item_t item;
    USB_INFO *info;
-   hid_item_t witem; 
 
    write_lock(ups);
 
@@ -776,7 +775,7 @@
    return true;
 }
 
-int pusb_write_int_to_ups(UPSINFO *ups, int ci, int value, const char *name)
+int pusb_write_int_to_ups(UPSINFO *ups, int ci, int value, char *name)
 {
    USB_DATA *my_data = (USB_DATA *)ups->driver_internal_data;
    USB_INFO *info;

--- patch ends ---

 After that change, everything works fine for me as well:

    % /etc/rc.apcupsd status
    APC      : 001,039,1025
    DATE     : Wed Feb 13 20:50:12 PST 2008
    HOSTNAME : ogoun.ironfist.org
    RELEASE  : 3.14.3
    VERSION  : 3.14.3 (20 January 2008) openbsd
    UPSNAME  : ogoun.ironfist.org
    CABLE    : Custom Cable Smart
    MODEL    : Back-UPS RS 1500
    UPSMODE  : Stand Alone
    STARTTIME: Sat Feb 09 08:55:40 PST 2008
    STATUS   : ONLINE
    LINEV    : 117.0 Volts
    LOADPCT  :  22.0 Percent Load Capacity
    BCHARGE  : 100.0 Percent
    TIMELEFT :  41.9 Minutes
    MBATTCHG : 5 Percent
    MINTIMEL : 3 Minutes
    MAXTIME  : 0 Seconds
    SENSE    : High
    LOTRANS  : 097.0 Volts
    HITRANS  : 132.0 Volts
    ALARMDEL : Always
    BATTV    : 26.8 Volts
    LASTXFER : Low line voltage
    NUMXFERS : 2
    XONBATT  : Wed Feb 13 06:22:48 PST 2008
    TONBATT  : 0 seconds
    CUMONBATT: 5 seconds
    XOFFBATT : Wed Feb 13 06:22:50 PST 2008
    SELFTEST : NO
    STATFLAG : 0x07000008 Status Flag
    MANDATE  : 2005-08-22
    SERIALNO : JB0535003610
    BATTDATE : 2001-09-25
    NOMINV   : 120 Volts
    NOMBATTV :  24.0 Volts
    NOMPOWER : 865 Watts
    FIRMWARE : 8.g9 .D USB FW:g9
    APCMODEL : Back-UPS RS 1500
    END APC  : Wed Feb 13 20:50:22 PST 2008




On Tue, Feb 12, 2008 at 11:28:29AM +0300, Kirill S. Bychkov wrote:
> Hi [EMAIL PROTECTED]
> I have made an effort to make a port of apcupsd. It is daemon for controlling
> APC UPSes. It also have CGI scripts for monitoring and graphical monitor for
> multiple UPSes.
> 
> DESCR:
> Apcupsd can be used for power mangement and controlling most of APC's
> UPS models. Apcupsd works with most of APC's Smart-UPS models as well as
> most simple signalling models such a Back-UPS, and BackUPS-Office.
> During a power failure, apcupsd will inform the users about the power
> failure and that a shutdown may occur. If power is not restored, a
> system shutdown will follow when the battery is exhausted, a timeout
> (seconds) expires, or runtime expires based on internal APC calculations
> determined by power consumption rates.
> 
> Needs testing, cause I have no hardware to test on. Any comments?
> 
> 
> -- 
> ()  ascii ribbon campaign - against html e-mail
> /\  www.asciiribbon.org   - against proprietary attachments

Reply via email to