Without the patch, apcupsd will not compile the usb support: % configure --enable-usb [deletia]
% make [deletia] gmake[3]: Entering directory `/usr/home/bruce/src/openbsd/apcupsd-3.14.3/src/drivers/usb/bsd' g++ -c -fno-exceptions -fno-rtti -g -O2 -Wall -pthread -I/usr/home/bruce/src/openbsd/apcupsd-3.14.3/include -I.. -I/usr/home/bruce/src/openbsd/apcupsd-3.14.3/src/libusbhid bsd-usb.c bsd-usb.c: In function `int pusb_ups_get_capabilities(UPSINFO*, const s_known_info*)': bsd-usb.c:367: error: `input' undeclared (first use this function) bsd-usb.c:367: error: (Each undeclared identifier is reported only once for each function it appears in.) bsd-usb.c:377: error: `feature' undeclared (first use this function) bsd-usb.c:384: error: `witem' undeclared (first use this function) bsd-usb.c:354: warning: unused variable `int rc' bsd-usb.c: In function `bool populate_uval(UPSINFO*, USB_INFO*, unsigned char*, USB_VALUE*)': bsd-usb.c:509: warning: converting to `int' from `double' gmake[3]: *** [bsd-usb.o] Error 1 gmake[3]: Leaving directory `/usr/home/bruce/src/openbsd/apcupsd-3.14.3/src/drivers/usb/bsd' gmake[2]: *** [all-subdirs] Error 2 gmake[2]: Leaving directory `/usr/home/bruce/src/openbsd/apcupsd-3.14.3/src/drivers/usb' gmake[1]: *** [all-subdirs] Error 2 gmake[1]: Leaving directory `/usr/home/bruce/src/openbsd/apcupsd-3.14.3/src/drivers' gmake: *** [all-subdirs] Error 2 *** Error code 2 On Thu, Feb 14, 2008 at 08:13:13AM +0300, Kirill S. Bychkov wrote: > Hi. And what was wrong without this patch? > Well, all you can see in current patches/patch-src_drivers_usb_bsd_bsd-usb_c > was wriiten by Adam Kropelin, the developer of apcupsd. At least I have no > problems with my RS 500 (while it was alive). > > On Thu, February 14, 2008 07:52, bruce wrote: > > 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 >