From 1ab82e2f305bc65a99261e576d1b53baa5d14200 Mon Sep 17 00:00:00 2001 From: Othmar Truniger Date: Tue, 24 Feb 2015 22:41:53 +0100 Subject: [PATCH] apcupsd: add driver modbus-usb Signed-off-by: Othmar Truniger --- net/apcupsd/Makefile | 12 ++--- net/apcupsd/files/multimon.conf | 63 +++++++++++++++++++++++++++ net/apcupsd/patches/010-fix-usb.patch | 8 ++++ 3 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 net/apcupsd/files/multimon.conf create mode 100644 net/apcupsd/patches/010-fix-usb.patch diff --git a/net/apcupsd/Makefile b/net/apcupsd/Makefile index 65b318e44..fd8236d8c 100644 --- a/net/apcupsd/Makefile +++ b/net/apcupsd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=apcupsd PKG_VERSION:=3.14.13 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MAINTAINER:=Othmar Truniger PKG_LICENSE:=GPL-2.0 @@ -26,7 +26,7 @@ include $(INCLUDE_DIR)/package.mk define Package/apcupsd SECTION:=net CATEGORY:=Network - DEPENDS:=+libpthread + DEPENDS:=+libpthread +libusb-compat TITLE:=UPS control software URL:=http://www.apcupsd.org/ endef @@ -46,6 +46,7 @@ define Build/Configure --sysconfdir=/etc/apcupsd \ --enable-cgi \ --enable-usb \ + --enable-modbus-usb \ --without-x \ ) endef @@ -78,13 +79,11 @@ endef define Package/apcupsd-cgi/install $(INSTALL_DIR) $(1)/www/cgi-bin/apcupsd - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/multimon.cgi $(1)/www/cgi-bin/apcupsd - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsfstats.cgi $(1)/www/cgi-bin/apcupsd - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsimage.cgi $(1)/www/cgi-bin/apcupsd - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsstats.cgi $(1)/www/cgi-bin/apcupsd + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/*.cgi $(1)/www/cgi-bin/apcupsd $(INSTALL_DIR) $(1)/etc/apcupsd $(INSTALL_CONF) ./files/apcupsd.css $(1)/etc/apcupsd/ $(INSTALL_CONF) ./files/hosts.conf $(1)/etc/apcupsd/ + $(INSTALL_CONF) ./files/multimon.conf $(1)/etc/apcupsd/ endef define Package/apcupsd/conffiles @@ -100,6 +99,7 @@ endef define Package/apcupsd-cgi/conffiles /etc/apcupsd/apcupsd.css /etc/apcupsd/hosts.conf +/etc/apcupsd/multimon.conf endef $(eval $(call BuildPackage,apcupsd)) diff --git a/net/apcupsd/files/multimon.conf b/net/apcupsd/files/multimon.conf new file mode 100644 index 000000000..4cdf9b06a --- /dev/null +++ b/net/apcupsd/files/multimon.conf @@ -0,0 +1,63 @@ +# Sample multimon configuration file +# +# This file is not required. Without it, multimon will use the default +# field layout. +# +# Temperature selection +# +# Pick "TEMPC" for Celsius or "TEMPF" for Fahrenheit. This will override +# the --enable-celsius setting from the compile. UPSTEMP (below) will +# use this setting by default. + +TEMPC + +# Format: +# FIELD "" "" +# +# is either a word from the UPS protocol like battchg (see the +# table in src/cgi/upsfetch.c) or a special word in uppercase. +# +# Special words are: +# MODEL - Show the model name for this system in cyan +# +# STATUS - Parse the status for this system using the appropriate color +# +# UPSTEMP and AMBTEMP use the default scale. This is set to C if you use +# --enable-celsius at compile time *or* if you use "TEMPC" above. +# +# UPSTEMP - Show the UPS temperature in the default scale (suffix ignored) +# AMBTEMP - Show the ambient temperature in the default scale (suffix ignored) +# +# UPSTEMPC - Show the UPS temperature in degrees C (suffix ignored) +# UPSTEMPF - Show the UPS temperature in degrees F (suffix ignored) +# AMBTEMPC - Show the ambient temperature in degrees C (suffix ignored) +# AMBTEMPF - Show the ambient temperature in degrees F (suffix ignored) +# +# They're called "special" since they actually understand the content +# being printed and do other things based on what's in there. +# +# is what you'd like this column to be called on the page. +# Remember that this is HTML, so you can actually embed markup in here. +# This means you can even include images here. You can include quotes +# (and backslashes!) in the string by escaping them with a backslash (\). +# +# is typically something like % or VAC. It's useful if +# you want to convey the units that apply to a value. +# +# Example config + +FIELD SYSTEM "System" "" +FIELD MODEL "Model" "" +FIELD STATUS "Status" "" +FIELD battpct "Battery Chg" "%" +FIELD utility "Utility" "VAC" +FIELD loadpct "UPS Load" "%" +FIELD UPSTEMP "UPS Temp" "" +FIELD runtime "Batt. Run Time" "min." +FIELD DATA "Data" "All data" + +# These are only useful if you have a Smart-UPS model with the Measure-UPS II +# measurement card. No other models presently support these features. +# +# FIELD AMBTEMP "Ambient Temp" "" +# FIELD HUMIDITY "Ambient Humidity" "%" diff --git a/net/apcupsd/patches/010-fix-usb.patch b/net/apcupsd/patches/010-fix-usb.patch new file mode 100644 index 000000000..b313bb22f --- /dev/null +++ b/net/apcupsd/patches/010-fix-usb.patch @@ -0,0 +1,8 @@ +--- a/include/libusb.h.in.orig 2015-02-21 18:53:51.023682068 +0100 ++++ a/include/libusb.h.in 2015-02-21 18:54:14.722788757 +0100 +@@ -6,4 +6,4 @@ + * path at configure time and various apcupsd bits include this + * when they need libusb's usb.h. + */ +-#include "@LIBUSBH@" ++#include "usb.h"