Imported Upstream version 2.7.1

This commit is contained in:
Laurent Bigonville 2013-11-24 16:00:12 +01:00
parent a1fa151fc7
commit 0121794af9
451 changed files with 41339 additions and 10887 deletions

View file

@ -1,51 +0,0 @@
# directory definitions
INSTALLSH = ../../install-sh
CONFIGPATH = /etc/rc.config.d
SCRIPTPATH = /sbin/init.d
LINKPATH = /sbin/rc3.d
LINKPREFIX = 991
OWNER = root
GROUP = root
SCRIPTS = nut-upsd.sh nut-drvctl.sh nut-upsmon.sh
CONFIGS = nut-drvctl nut-upsd nut-upsmon
INSTALLPERMS = 0755
INSTALLCMD = $(INSTALLSH) -c
all: install
install:
@if (test ! -d $(CONFIGPATH)) then \
echo "NO $(CONFIGPATH)"; exit 1; \
fi
@if (test ! -d $(SCRIPTPATH)) then \
echo "NO $(SCRIPTPATH)"; exit 1; \
fi
@if (test ! -d $(LINKPATH)) then \
echo "NO $(LINKPATH)"; exit 1; \
fi
@for script in $(SCRIPTS); do\
name=`basename $$script .sh` ; \
$(INSTALLSH) -c -o $(OWNER) -g $(GROUP) $$script $(SCRIPTPATH)/$$name || exit 1; \
ln -s $(SCRIPTPATH)/$$name $(LINKPATH)/K$(LINKPREFIX)$$name \
|| echo "Unable to link $(SCRIPTPATH)/$$name to $(LINKPATH)/K$(LINKPREFIX)$$name"; \
ln -s $(SCRIPTPATH)/$$name $(LINKPATH)/S$(LINKPREFIX)$$name \
|| echo "Unable to link $(SCRIPTPATH)/$$name to $(LINKPATH)/S$(LINKPREFIX)$$name"; \
done
@for config in $(CONFIGS); do\
$(INSTALLSH) -c -o $(OWNER) -g $(GROUP) $$config $(CONFIGPATH) || exit 1 ; \
done
remove:
@for config in $(CONFIGS); do\
rm -f $(CONFIGPATH)/$$config;\
done
@for script in $(SCRIPTS); do\
name=`basename $$script .sh` ; \
rm -f $(SCRIPTPATH)/$$name || exit 1; \
rm -f $(LINKPATH)/K$(LINKPREFIX)$$name \
|| echo "Unable to remove $(LINKPATH)/K$(LINKPREFIX)$$name"; \
rm -f $(LINKPATH)/S$(LINKPREFIX)$$name \
|| echo "Unable to remove $(LINKPATH)/S$(LINKPREFIX)$$name"; \
done

View file

@ -1,4 +1,5 @@
# PSF file for Network UPS Tools /usr/local/ups 11/2/2011
B/
# PSF file for Network UPS Tools 11/2/2011
#
# Useful commands:
#
@ -50,219 +51,38 @@ product
tag Server
title "nut-server"
revision @PACKAGE_VERSION@
postinstall ./postinstall
#Including "conf" files under "/usr/local/ups/etc/nut".
file -u 644 -g bin -o bin ../../conf/ups.conf.sample /usr/local/ups/etc/ups.conf
file -u 644 -g bin -o bin ../../conf/upsd.conf.sample /usr/local/ups/etc/upsd.conf
file -u 644 -g bin -o bin ../../conf/upsd.users.sample /usr/local/ups/etc/upsd.users
#Including "conf" files under "/usr/local/ups/etc/".
file -u 644 -g bin -o bin ./nut_install@prefix@/etc/ups.conf.sample @prefix@/etc/ups.conf.sample
file -u 644 -g bin -o bin ./nut_install@prefix@/etc/upsd.conf.sample @prefix@/etc/upsd.conf.sample
file -u 644 -g bin -o bin ./nut_install@prefix@/etc/upsd.users.sample @prefix@/etc/upsd.users.sample
#Including "server" files under "/usr/local/ups/sbin".
file -u 755 -g bin -o bin ../../server/upsd /usr/local/ups/sbin/upsd
file -u 755 -g bin -o bin ../../drivers/upsdrvctl /usr/local/ups/sbin/upsdrvctl
file -u 755 -g bin -o bin ./nut_install@prefix@/sbin/upsd @prefix@/sbin/upsd
#Including "share" files under "/usr/local/ups/share".
file -u 644 -g bin -o bin ../../data/cmdvartab /usr/local/ups/share/cmdvartab
file -u 644 -g bin -o bin ../../data/driver.list /usr/local/ups/share/driver.list
file -u 644 -g bin -o bin ./nut_install@prefix@/share/cmdvartab @prefix@/share/cmdvartab
file -u 644 -g bin -o bin ./nut_install@prefix@/share/driver.list @prefix@/share/driver.list
#Including required "libupsclient1" under "/usr/local/ups/lib"
file -u 755 -g bin -o bin ../../clients/.libs/libupsclient.so.1 /usr/local/ups/lib/libupsclient.so.1
file -u 555 -g bin -o bin ../../clients/.libs/libupsclient.so.1.0 /usr/local/ups/lib/libupsclient.so.1.0
file -u 755 -g bin -o bin ./nut_install@prefix@/lib/libupsclient.sl.3 @prefix@/lib/libupsclient.sl.3
file -u 555 -g bin -o bin ./nut_install@prefix@/lib/libupsclient.sl.3.1 @prefix@/lib/libupsclient.sl.3.1
#Including nut service script to "usr/local/ups/script"
file -u 744 -g bin -o bin @top_srcdir@/scripts/HP-UX/nut-upsd.sh @prefix@/script/nut-upsd.sh
file -u 744 -g bin -o bin @top_srcdir@/scripts/HP-UX/nut-drvctl.sh @prefix@/script/nut-drvctl.sh
file -u 744 -g bin -o bin @top_srcdir@/scripts/HP-UX/nut-upsmon.sh @prefix@/script/nut-upsmon.sh
file -u 444 -g bin -o bin @top_srcdir@/scripts/HP-UX/nut-upsd @prefix@/script/nut-upsd
file -u 444 -g bin -o bin @top_srcdir@/scripts/HP-UX/nut-drvctl @prefix@/script/nut-drvctl
file -u 444 -g bin -o bin @top_srcdir@/scripts/HP-UX/nut-upsmon @prefix@/script/nut-upsmon
#Including required UPS drivers files under "/usr/local/ups/bin/".
#such as "nut-snmp", "nut-xml or netxml-ups"
directory ../../drivers=/usr/local/ups/bin/
directory ./nut_install@prefix@/bin=@prefix@/bin/
#file_permissions -u 755 -g bin -o bin
file *
# Exclude the files from "drivers" folder that are not required in the package.
exclude Makefile
exclude Makefile.am
exclude Makefile.in
exclude apc-hid.c
exclude apc-hid.h
exclude apc-mib.c
exclude apc-mib.h
exclude apcsmart.c
exclude apcsmart.h
exclude apcsmart.o
exclude baytech-mib.c
exclude baytech-mib.h
exclude bcmxcp.c
exclude bcmxcp.h
exclude bcmxcp.o
exclude bcmxcp_io.h
exclude bcmxcp_ser.c
exclude bcmxcp_ser.o
exclude bcmxcp_usb.c
exclude belkin-hid.c
exclude belkin-hid.h
exclude belkin.c
exclude belkin.h
exclude belkin.o
exclude belkinunv.c
exclude belkinunv.o
exclude bestfcom.c
exclude bestfcom.o
exclude bestfortress.c
exclude bestfortress.o
exclude bestpower-mib.c
exclude bestpower-mib.h
exclude bestuferrups.c
exclude bestuferrups.o
exclude bestups.c
exclude bestups.o
exclude blazer.c
exclude blazer.h
exclude blazer.o
exclude blazer_ser.c
exclude blazer_ser.o
exclude blazer_usb.c
exclude clone-outlet.c
exclude clone-outlet.o
exclude clone.c
exclude clone.o
exclude compaq-mib.c
exclude compaq-mib.h
exclude cps-hid.c
exclude cps-hid.h
exclude dstate-hal.c
exclude dstate-hal.h
exclude dstate.c
exclude dstate.h
exclude dstate.o
exclude dummy-ups.c
exclude dummy-ups.h
exclude dummy_ups-dummy-ups.o
exclude eaton-mib.c
exclude eaton-mib.h
exclude etapro.c
exclude etapro.o
exclude everups.c
exclude everups.o
exclude explore-hid.c
exclude explore-hid.h
exclude gamatronic.c
exclude gamatronic.h
exclude gamatronic.o
exclude genericups.c
exclude genericups.h
exclude genericups.o
exclude hidparser.c
exclude hidparser.h
exclude hidparser.o
exclude hidtypes.h
exclude ietf-mib.c
exclude ietf-mib.h
exclude isbmex.c
exclude isbmex.o
exclude ivtscd.c
exclude ivtscd.o
exclude libhid.c
exclude libhid.h
exclude libshut.c
exclude libshut.h
exclude libusb.c
exclude libusb.h
exclude liebert-esp2.c
exclude liebert-esp2.o
exclude liebert-hid.c
exclude liebert-hid.h
exclude liebert.c
exclude liebert.o
exclude main-hal.c
exclude main-hal.h
exclude main.c
exclude main.h
exclude main.o
exclude masterguard.c
exclude masterguard.o
exclude metasys.c
exclude metasys.o
exclude mge-hid.c
exclude mge-hid.h
exclude mge-mib.c
exclude mge-mib.h
exclude mge-shut.c
exclude mge-shut.h
exclude mge-shut.o
exclude mge-utalk.c
exclude mge-utalk.h
exclude mge-utalk.o
exclude mge-xml.c
exclude mge-xml.h
exclude microdowell.c
exclude microdowell.h
exclude microdowell.o
exclude netvision-mib.c
exclude netvision-mib.h
exclude netxml-ups.c
exclude netxml-ups.h
exclude newmge_shut-hidparser.o
exclude newmge_shut-libhid.o
exclude newmge_shut-libshut.o
exclude newmge_shut-mge-hid.o
exclude newmge_shut-usbhid-ups.o
exclude oneac.c
exclude oneac.h
exclude oneac.o
exclude optiups
exclude optiups.c
exclude optiups.o
exclude powercom-hid.c
exclude powercom-hid.h
exclude powercom.c
exclude powercom.h
exclude powercom.o
exclude powerman-pdu.c
exclude powerp-bin.c
exclude powerp-bin.h
exclude powerp-bin.o
exclude powerp-txt.c
exclude powerp-txt.h
exclude powerp-txt.o
exclude powerpanel.c
exclude powerpanel.h
exclude powerpanel.o
exclude powerware-mib.c
exclude powerware-mib.h
exclude raritan-pdu-mib.c
exclude raritan-pdu-mib.h
exclude rhino.c
exclude rhino.o
exclude richcomm_usb.c
exclude safenet.c
exclude safenet.h
exclude safenet.o
exclude serial.c
exclude serial.h
exclude serial.o
exclude skel.c
exclude skel.o
exclude snmp-ups.c
exclude snmp-ups.h
exclude solis.c
exclude solis.h
exclude solis.o
exclude tripplite-hid.c
exclude tripplite-hid.h
exclude tripplite.c
exclude tripplite.h
exclude tripplite.o
exclude tripplite_usb.c
exclude tripplitesu.c
exclude tripplitesu.o
exclude upscode2.c
exclude upscode2.o
exclude upsdrvctl.c
exclude upsdrvctl.o
exclude upshandler.h
exclude usb-common.c
exclude usb-common.h
exclude usbhid-ups.c
exclude usbhid-ups.h
exclude victronups.c
exclude victronups.o
#TBD files to be added under "/usr/share/doc/nut-server/*.gz"
#TBD files to be added under "/usr/share/man/man5/*.gz"
#TBD files to be added under "/usr/share/man/man8/*.gz"
@ -275,21 +95,21 @@ product
title "nut-client"
revision @PACKAGE_VERSION@
file -u 755 -g bin -o bin ../../clients/upsc /usr/local/ups/bin/upsc
file -u 755 -g bin -o bin ../../clients/upscmd /usr/local/ups/bin/upscmd
file -u 755 -g bin -o bin ../../clients/upslog /usr/local/ups/bin/upslog
file -u 755 -g bin -o bin ../../clients/upsrw /usr/local/ups/bin/upsrw
file -u 755 -g bin -o bin ../../clients/upsmon /usr/local/ups/sbin/upsmon
file -u 755 -g bin -o bin ../../clients/upssched /usr/local/ups/sbin/upssched
file -u 755 -g bin -o bin ./nut_install@prefix@/bin/upsc @prefix@/bin/upsc
file -u 755 -g bin -o bin ./nut_install@prefix@/bin/upscmd @prefix@/bin/upscmd
file -u 755 -g bin -o bin ./nut_install@prefix@/bin/upslog @prefix@/bin/upslog
file -u 755 -g bin -o bin ./nut_install@prefix@/bin/upsrw @prefix@/bin/upsrw
file -u 755 -g bin -o bin ./nut_install@prefix@/sbin/upsmon @prefix@/sbin/upsmon
file -u 755 -g bin -o bin ./nut_install@prefix@/sbin/upssched @prefix@/sbin/upssched
#Including "conf" files under "/usr/local/ups/etc".
file -u 644 -g bin -o bin ../../conf/nut.conf.sample /usr/local/ups/etc/nut.conf
file -u 644 -g bin -o bin ../../conf/upsmon.conf.sample /usr/local/ups/etc/upsmon.conf
file -u 644 -g bin -o bin ../../conf/upssched.conf.sample /usr/local/ups/etc/upssched.conf
file -u 644 -g bin -o bin ./nut_install@prefix@/etc/nut.conf.sample @prefix@/etc/nut.conf.sample
file -u 644 -g bin -o bin ./nut_install@prefix@/etc/upsmon.conf.sample @prefix@/etc/upsmon.conf.sample
file -u 644 -g bin -o bin ./nut_install@prefix@/etc/upssched.conf.sample @prefix@/etc/upssched.conf.sample
#Need to check if "libupsclient1" required for Client again.
#file -u 755 -g bin -o bin ../../clients/.libs/libupsclient.so.1 /usr/local/ups/lib/libupsclient.so.1
#file -u 555 -g bin -o bin ../../clients/.libs/libupsclient.so.1.0 /usr/local/ups/lib/libupsclient.so.1.0
#file -u 755 -g bin -o bin ./nut_install@prefix@/lib/libupsclient.sl.3 @prefix@/lib/libupsclient.sl.3
#file -u 555 -g bin -o bin ./nut_install@prefix@/lib/libupsclient.sl.3.1 @prefix@/lib/libupsclient.sl.3.1
end
# ----------------------------------------
#Including "libupsclient1-dev" files.
@ -298,74 +118,24 @@ product
title "libupsclient1-dev"
revision @PACKAGE_VERSION@
file -u 755 -g bin -o bin ../../clients/.libs/libupsclient.a /usr/local/ups/lib/libupsclient.a
file -u 755 -g bin -o bin ../../clients/.libs/libupsclient.la /usr/local/ups/lib/libupsclient.la
file -u 755 -g bin -o bin ../../clients/.libs/libupsclient.so /usr/local/ups/lib/libupsclient.so
file -u 644 -g bin -o bin ../../include/parseconf.h /usr/include/parseconf.h
file -u 644 -g bin -o bin ../../clients/upsclient.h /usr/include/upsclient.h
#file -u 755 -g bin -o bin ../../clients/.libs/libupsclient.so /usr/lib/libupsclient.so
file -u 755 -g bin -o bin ../../lib/libupsclient.pc /usr/lib/pkgconfig/libupsclient.pc
file -u 755 -g bin -o bin ./nut_install@prefix@/lib/libupsclient.a @prefix@/lib/libupsclient.a
file -u 755 -g bin -o bin ./nut_install@prefix@/lib/libupsclient.la @prefix@/lib/libupsclient.la
file -u 755 -g bin -o bin ./nut_install@prefix@/lib/libupsclient.sl @prefix@/lib/libupsclient.sl
file -u 644 -g bin -o bin @top_srcdir@/include/parseconf.h @prefix@/include/parseconf.h
file -u 644 -g bin -o bin @top_srcdir@/clients/upsclient.h @prefix@/include/upsclient.h
file -u 755 -g bin -o bin ./nut_install@prefix@/lib/pkgconfig/libupsclient.pc @prefix@/lib/pkgconfig/libupsclient.pc
end
# ----------------------------------------
#Including "nut-cgi " files.
fileset
tag cgi
title "nut-cgi"
revision @PACKAGE_VERSION@
file -u 644 -g bin -o bin ../../conf/hosts.conf.sample /etc/nut/hosts.conf
file -u 644 -g bin -o bin ../../conf/upsset.conf.sample /etc/nut/upsset.conf
#file -u 644 -g bin -o bin ../../conf/upsstats-single.html.sample /etc/nut/upsstats-single.html
#file -u 644 -g bin -o bin ../../conf/upsstats.html.sample /etc/nut/upsstats.html
#file -u 644 -g bin -o bin ../../data/html/bottom.html /usr/share/nut/www/bottom.html
#file -u 644 -g bin -o bin ../../data/html/header.html /usr/share/nut/www/header.html
#file -u 644 -g bin -o bin ../../data/html/index.html /usr/share/nut/www/index.html
#file -u 644 -g bin -o bin ../../data/html/nut-banner.png /usr/share/nut/www/nut-banner.png
end
# ----------------------------------------
#Including "nut-doc" files.
#TBD
#fileset
# tag doc
# title "nut-doc"
# revision @PACKAGE_VERSION@
#Need to check from the following location for the required files
# /usr/local/share/doc/libxml2-2.7.7/html/tutorial/
#end
# ----------------------------------------
#Including "libups-nut-perl" files.
fileset
tag libups-nut-perl
tag libups-nut-perl
title "libups-nut-perl"
revision @PACKAGE_VERSION@
file -u 644 -g bin -o bin ../../scripts/perl/Nut.pm /usr/share/perl5/UPS/Nut.pm
file -u 644 -g bin -o bin @top_srcdir@/scripts/perl/Nut.pm @prefix@/share/perl5/UPS/Nut.pm
end
# ----------------------------------------
#Including "nut-monitor" files
fileset
tag nut-monitor
title "nut-monitor"
revision @PACKAGE_VERSION@
file -u 644 -g bin -o bin ../../scripts/python/app/NUT-Monitor /usr/bin/NUT-Monitor
file -u 644 -g bin -o bin ../../scripts/python/app/nut-monitor.desktop /usr/share/applications/nut-monitor.desktop
file -u 644 -g bin -o bin ../../scripts/python/app/locale/fr/LC_MESSAGES/NUT-Monitor.mo /usr/share/locale/fr/LC_MESSAGES/NUT-Monitor.mo
file -u 644 -g bin -o bin ../../scripts/python/app/gui-1.3.glade /usr/share/nut-monitor/gui-1.3.glade
file -u 644 -g bin -o bin ../../scripts/python/app/pixmaps/on_battery.png /usr/share/nut-monitor/pixmaps/on_battery.png
file -u 644 -g bin -o bin ../../scripts/python/app/pixmaps/on_line.png /usr/share/nut-monitor/pixmaps/on_line.png
file -u 644 -g bin -o bin ../../scripts/python/app/pixmaps/var-ro.png /usr/share/nut-monitor/pixmaps/var-ro.png
file -u 644 -g bin -o bin ../../scripts/python/app/pixmaps/var-rw.png /usr/share/nut-monitor/pixmaps/var-rw.png
file -u 644 -g bin -o bin ../../scripts/python/app/pixmaps/warning.png /usr/share/nut-monitor/pixmaps/warning.png
file -u 644 -g bin -o bin ../../scripts/python/app/nut-monitor.png /usr/share/pixmaps/nut-monitor.png
end
# ----------------------------------------
end #End product

View file

@ -0,0 +1,81 @@
#!/bin/sh
# directory definitions
NUT_DIR="@prefix@"
INSTALLPATH=$NUT_DIR/script
CONFIGPATH=/etc/rc.config.d
SCRIPTPATH=/sbin/init.d
LINKPATH=/sbin/rc3.d
LINKPREFIX=991
OWNER=root
GROUP=root
SCRIPTS="nut-upsd.sh nut-drvctl.sh nut-upsmon.sh"
CONFIGS="nut-drvctl nut-upsd nut-upsmon"
SCRIPTPERMS=0744
CONFIGPERMS=0444
# make sure the nut user exists and has correct memberships
res=`grget -n nut`
if [ -z "$res" ]; then
groupadd nut
fi
res=`pwget -n nut`
if [ -z "$res" ]; then
useradd -g nut -G root -d ${NUT_DIR}/bin nut
fi
# make sure that conffiles are secured and have the correct ownerships
if [ -d @CONFPATH@ ] ; then
chown root:nut @CONFPATH@
fi
for file in nut.conf ups.conf upsd.conf upsmon.conf upsd.users upssched.conf; do
if [ -f @CONFPATH@/$file ] ; then
chown root:nut @CONFPATH@/$file
chmod 640 @CONFPATH@/$file
fi
done
# make sure that /var/run/nut exists and has the correct ownerships
if [ ! -d @PIDPATH@/nut ] ; then
mkdir -p @PIDPATH@/nut
fi
if [ -d @PIDPATH@/nut ] ; then
chown root:nut @PIDPATH@/nut
chmod 770 @PIDPATH@/nut
fi
# make sure that /var/state/ups exists and has the correct ownerships
if [ ! -d @STATEPATH@ ] ; then
mkdir -p @STATEPATH@
fi
if [ -d /var/state/ups ] ; then
chown root:nut @STATEPATH@
chmod 770 @STATEPATH@
fi
#Set-up automatic start-up
if [ ! -d $CONFIGPATH ]; then
echo "NO $CONFIGPATH"; exit 1;
fi
if [ ! -d $SCRIPTPATH ]; then
echo "NO $SCRIPTPATH"; exit 1;
fi
if [ ! -d $LINKPATH ]; then
echo "NO $LINKPATH"; exit 1;
fi
for script in $SCRIPTS; do
name=`basename ${script} .sh` ;
cp $INSTALLPATH/$script $SCRIPTPATH/$name
chown $OWNER:$GROUP $SCRIPTPATH/$name
chmod $SCRIPTPERMS $SCRIPTPATH/$name
ln -f -s $SCRIPTPATH/$name $LINKPATH/K$LINKPREFIX$name
ln -f -s $SCRIPTPATH/$name $LINKPATH/S$LINKPREFIX$name
done
for config in $CONFIGS; do
cp $INSTALLPATH/$config $CONFIGPATH
chown $OWNER:$GROUP $CONFIGPATH
chmod $CONFIGPERMS $CONFIGPATH
done

View file

@ -1,6 +1,5 @@
EXTRA_DIST = README \
avahi/nut.service.in \
HP-UX/Makefile \
HP-UX/nut-drvctl \
HP-UX/nut-drvctl.sh \
HP-UX/nut-upsd \
@ -19,10 +18,10 @@ RedHat/upsd.in \
RedHat/upsmon \
RedHat/upsmon.in \
Solaris8/S99upsmon \
subdriver/path-to-subdriver.sh \
subdriver/gen-usbhid-subdriver.sh \
ufw/README \
upower/95-upower-hid.rules \
Windows/halt.c \
Windows/Makefile
SUBDIRS = augeas hal hotplug java python systemd udev
SUBDIRS = augeas hal hotplug python systemd udev Solaris

View file

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -15,6 +15,23 @@
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -50,8 +67,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libssl.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
@ -74,6 +92,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@ -113,6 +136,7 @@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -139,6 +163,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -293,7 +318,6 @@ top_srcdir = @top_srcdir@
udevdir = @udevdir@
EXTRA_DIST = README \
avahi/nut.service.in \
HP-UX/Makefile \
HP-UX/nut-drvctl \
HP-UX/nut-drvctl.sh \
HP-UX/nut-upsd \
@ -312,13 +336,13 @@ RedHat/upsd.in \
RedHat/upsmon \
RedHat/upsmon.in \
Solaris8/S99upsmon \
subdriver/path-to-subdriver.sh \
subdriver/gen-usbhid-subdriver.sh \
ufw/README \
upower/95-upower-hid.rules \
Windows/halt.c \
Windows/Makefile
SUBDIRS = augeas hal hotplug java python systemd udev
SUBDIRS = augeas hal hotplug python systemd udev Solaris
all: all-recursive
.SUFFIXES:
@ -526,13 +550,10 @@ distdir: $(DISTFILES)
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
@ -567,10 +588,15 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:

View file

@ -8,7 +8,6 @@ specific USB devices,
- Python Client module and application,
- Perl client module,
- Augeas support lenses and modules for NUT,
- Java client library and test application,
- systemd support files.
They have either been contributed by users of the software, or by the NUT Team

View file

@ -0,0 +1,17 @@
EXTRA_DIST = makelocal.sh
package: makelocal.sh pkginfo
$ cd @prefix@; $ find . -print | pkgproto > prototype1
$ cp makelocal.sh precheck.py pkginfo nut preinstall postinstall preremove postremove preproto.pl @prefix@
$ cd @prefix@; perl preproto.pl
$ cd @prefix@; python precheck.py
$ cd @prefix@; rm -f prototype1
$ cd @prefix@; ./makelocal.sh
$ cp @prefix@/*.gz $(srcdir)
if test `uname -p` = "i386"; then \
mv NUT_solaris_package.local.gz NUT_solaris_i386_package@PACKAGE_VERSION@.local.gz; \
else \
if test `uname -p` = "sparc"; then \
mv NUT_solaris_package.local.gz NUT_solaris_sparc_package@PACKAGE_VERSION@.local.gz; \
fi; \
fi;

View file

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -14,9 +14,24 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
# TODO: Java / Maven build integration
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -36,8 +51,10 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = scripts/java
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
subdir = scripts/Solaris
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/nut.in $(srcdir)/pkginfo.in $(srcdir)/postinstall.in \
$(srcdir)/preremove.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
@ -52,8 +69,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libssl.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
@ -65,16 +83,22 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = pkginfo postinstall preremove nut
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -101,6 +125,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -253,20 +278,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udevdir = @udevdir@
EXTRA_DIST = README \
jNut/pom.xml \
jNut/README \
jNut/src/main/java/org/networkupstools/jnut/Client.java \
jNut/src/main/java/org/networkupstools/jnut/Command.java \
jNut/src/main/java/org/networkupstools/jnut/Device.java \
jNut/src/main/java/org/networkupstools/jnut/NutException.java \
jNut/src/main/java/org/networkupstools/jnut/StringLineSocket.java \
jNut/src/main/java/org/networkupstools/jnut/Variable.java \
jNut/src/test/java/org/networkupstools/jnut/ClientTest.java \
jNutList/pom.xml \
jNutList/README \
jNutList/src/main/java/org/networkupstools/jnutlist/AppList.java
EXTRA_DIST = makelocal.sh
all: all-am
.SUFFIXES:
@ -279,9 +291,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/java/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Solaris/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu scripts/java/Makefile
$(AUTOMAKE) --gnu scripts/Solaris/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@ -300,6 +312,14 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
pkginfo: $(top_builddir)/config.status $(srcdir)/pkginfo.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
postinstall: $(top_builddir)/config.status $(srcdir)/postinstall.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
preremove: $(top_builddir)/config.status $(srcdir)/preremove.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nut: $(top_builddir)/config.status $(srcdir)/nut.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
@ -357,10 +377,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
@ -452,6 +477,22 @@ uninstall-am:
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
package: makelocal.sh pkginfo
$ cd @prefix@; $ find . -print | pkgproto > prototype1
$ cp makelocal.sh precheck.py pkginfo nut preinstall postinstall preremove postremove preproto.pl @prefix@
$ cd @prefix@; perl preproto.pl
$ cd @prefix@; python precheck.py
$ cd @prefix@; rm -f prototype1
$ cd @prefix@; ./makelocal.sh
$ cp @prefix@/*.gz $(srcdir)
if test `uname -p` = "i386"; then \
mv NUT_solaris_package.local.gz NUT_solaris_i386_package@PACKAGE_VERSION@.local.gz; \
else \
if test `uname -p` = "sparc"; then \
mv NUT_solaris_package.local.gz NUT_solaris_sparc_package@PACKAGE_VERSION@.local.gz; \
fi; \
fi;
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

5
scripts/Solaris/makelocal.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
pkgmk -o -d `pwd`
pkgtrans `pwd` `pwd`/NUT_solaris_package.local
gzip `pwd`/NUT_solaris_package.local

63
scripts/Solaris/nut.in Normal file
View file

@ -0,0 +1,63 @@
#!/sbin/sh
#init.d script to start nut services
NUT_DIR="@prefix@"
CONFIG=$NUT_DIR/etc/nut.conf
if [ -f $CONFIG ] ; then
. $CONFIG
fi
ups_stop () {
pkill -n upsmon
pkill -n upsd
${NUT_DIR}/bin/upsdrvctl stop > /dev/null 2>&1
}
ups_start () {
if [ "$MODE" = "none" ];then
echo No mode set
exit 1
fi
if [ ! "$MODE" = "netclient" ];then
$NUT_DIR/bin/upsdrvctl start #> /dev/null 2>&1
$NUT_DIR/sbin/upsd #> /dev/null 2>&1
fi
$NUT_DIR/sbin/upsmon #> /dev/null 2>&1
}
case $1 in
'start')
ups_start
;;
'stop')
ups_stop
;;
'restart')
ups_stop
while pgrep upsd > /dev/null
do
sleep 1
done
ups_start
;;
'poweroff')
$NUT_DIR/sbin/upsmon -K >/dev/null 2>&1
if [ $? = 0 ]; then
echo "Shutting down the UPS ..."
#$NUT_DIR/bin/upsdrvctl shutdown
fi
;;
*)
echo ""
echo "Usage: '$0' {start | stop | restart }"
echo ""
exit 64
;;
esac
exit $?

View file

@ -0,0 +1,11 @@
PKG="NUT"
NAME="Network UPS Tools"
ARCH="@OS_NAME@"
VERSION="@PACKAGE_VERSION@"
CATEGORY="application"
VENDOR="http://www.networkupstools.org"
EMAIL=" "
PSTAMP=" "
DESCRIPTION="Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and power distribution unit (PDU) hardware. Clients access the hardware through the server, and are notified whenever the power status changes."
BASEDIR="@prefix@"
CLASSES="none"

View file

@ -0,0 +1,65 @@
#!/bin/sh
#Postinstall script
NUT_DIR="@prefix@"
# make sure the nut user exists and has correct memberships
res=`getent group nut`
if [ -z "$res" ]; then
groupadd nut
fi
res=`getent passwd nut`
if [ -z "$res" ]; then
useradd -g nut -G root -d ${NUT_DIR}/bin nut
fi
res=`groups nut | grep -w nut`
if [ -z "$res" ]; then
usermod -g nut -G root nut
fi
# make sure that conffiles are secured and have the correct ownerships
if [ -d @CONFPATH@ ] ; then
chown root:nut @CONFPATH@
fi
for file in nut.conf ups.conf upsd.conf upsmon.conf upsd.users upssched.conf; do
if [ -f @CONFPATH@/$file ] ; then
chown root:nut @CONFPATH@/$file
chmod 640 @CONFPATH@/$file
fi
done
# make sure that /var/run/nut exists and has the correct ownerships
if [ ! -d @PIDPATH@/nut ] ; then
mkdir -p @PIDPATH@/nut
fi
if [ -d @PIDPATH@/nut ] ; then
chown root:nut @PIDPATH@/nut
chmod 770 @PIDPATH@/nut
fi
# make sure that /var/state/ups exists and has the correct ownerships
if [ ! -d @STATEPATH@ ] ; then
mkdir -p @STATEPATH@
fi
if [ -d @STATEPATH@ ] ; then
chown root:nut @STATEPATH@
chmod 770 @STATEPATH@
fi
# Put init script in /etc/init.d
cp $NUT_DIR/nut /etc/init.d
chmod 744 /etc/init.d/nut
ln -s /etc/init.d/nut /etc/rc3.d/S100nut > /dev/null 2>&1
ln -s /etc/init.d/nut /etc/rc3.d/K100nut > /dev/null 2>&1
# Start nut services
#echo "Starting nut services"
#$NUT_DIR/bin/upsdrvctl start #> /dev/null 2>&1
#$NUT_DIR/sbin/upsd #> /dev/null 2>&1
#$NUT_DIR/sbin/upsmon #> /dev/null 2>&1

View file

@ -0,0 +1,8 @@
#!bin/sh
# Stop all nut services
NUT_DIR="@prefix@"
#$NUT_DIR/bin/upsdrvctl stop

View file

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -15,6 +15,23 @@
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -55,8 +72,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libssl.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
@ -74,12 +92,18 @@ CONFIG_CLEAN_FILES = nutnutconf.aug nutupsconf.aug nutupsdconf.aug \
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -106,6 +130,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -370,10 +395,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:

View file

@ -51,24 +51,35 @@ let ups_fields = "driver"
| "OffDelay"
| "OnDelay"
| "SD"
| "advanced_eco_mode"
| "advorder"
| "alarm_control"
| "authPassword"
| "authProtocol"
| "authtype"
| "awd"
| "batteryPercentage"
| "battery_alarm"
| "battery_number"
| "battery_open_status_check"
| "battext"
| "battvoltmult"
| "baud_rate"
| "baudrate"
| "bus"
| "bypass_alarm"
| "bypass_forbidding"
| "bypass_when_off"
| "cable"
| "cablepower"
| "chargetime"
| "community"
| "constant_phase_angle"
| "converter_mode"
| "daysoff"
| "daysweek"
| "dumbterm"
| "eco_mode"
| "explore"
| "fake_lowbatt"
| "flash"
@ -80,6 +91,7 @@ let ups_fields = "driver"
| "idleload"
| "input_timeout"
| "langid_fix"
| "limited_runtime_on_battery"
| "linevoltage"
| "load.off"
| "load.on"
@ -88,10 +100,15 @@ let ups_fields = "driver"
| "login"
| "lowbatt"
| "manufacturer"
| "max_bypass_freq"
| "max_bypass_volt"
| "max_load"
| "maxreport"
| "methodOfFlowControl"
| "mfr"
| "mibs"
| "min_bypass_freq"
| "min_bypass_volt"
| "mincharge"
| "minruntime"
| "model"
@ -108,6 +125,7 @@ let ups_fields = "driver"
| "oldmac"
| "ondelay"
| "output_pace"
| "output_phase_angle"
| "password"
| "pollfreq"
| "pollonly"
@ -120,24 +138,30 @@ let ups_fields = "driver"
| "productid"
| "protocol"
| "rebootdelay"
| "reset_to_default"
| "runtimecal"
| "sdtime"
| "sdtype"
| "secLevel"
| "secName"
| "sensorid"
| "serial"
| "serialnumber"
| "shutdownArguments"
| "shutdown_delay"
| "shutdown_duration"
| "shutdown_timer"
| "silent"
| "site_fault_detection"
| "snmp_version"
| "startdelay"
| "status_only"
| "stayoff"
| "subdriver"
| "subscribe"
| "testing"
| "testtime"
| "timeout"
| "ttymode"
| "type"
| "ups.delay.shutdown"
| "ups.delay.start"
@ -151,6 +175,7 @@ let ups_fields = "driver"
| "vendorid"
| "voltage"
| "wait"
| "work_range_type"
| "wugrace"

View file

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -52,8 +69,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libssl.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
@ -69,6 +87,11 @@ CONFIG_CLEAN_FILES = ups-nut-device.fdi
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -90,6 +113,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(halfdidir)"
DATA = $(halfdi_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -98,6 +127,7 @@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -124,6 +154,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -326,8 +357,11 @@ clean-libtool:
-rm -rf .libs _libs
install-halfdiDATA: $(halfdi_DATA)
@$(NORMAL_INSTALL)
test -z "$(halfdidir)" || $(MKDIR_P) "$(DESTDIR)$(halfdidir)"
@list='$(halfdi_DATA)'; test -n "$(halfdidir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(halfdidir)'"; \
$(MKDIR_P) "$(DESTDIR)$(halfdidir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@ -341,9 +375,7 @@ uninstall-halfdiDATA:
@$(NORMAL_UNINSTALL)
@list='$(halfdi_DATA)'; test -n "$(halfdidir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(halfdidir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(halfdidir)" && rm -f $$files
dir='$(DESTDIR)$(halfdidir)'; $(am__uninstall_files_from_dir)
tags: TAGS
TAGS:
@ -398,10 +430,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:

View file

@ -150,6 +150,28 @@
</match>
</match>
<!-- Riello (Cypress Semiconductor Corp.) -->
<match key="usb_device.vendor_id" int="0x04b4">
<!-- various models -->
<match key="usb_device.product_id" int="0x5500">
<append key="info.category" type="string">battery</append>
<merge key="info.capabilities" type="strlist">battery</merge>
<merge key="info.addons" type="strlist">hald-addon-riello_usb</merge>
<merge key="battery.type" type="string">ups</merge>
</match>
</match>
<!-- Minibox -->
<match key="usb_device.vendor_id" int="0x04d8">
<!-- openUPS Intelligent UPS (minimum required firmware 1.4) -->
<match key="usb_device.product_id" int="0xd004">
<append key="info.category" type="string">battery</append>
<merge key="info.capabilities" type="strlist">battery</merge>
<merge key="info.addons" type="strlist">hald-addon-usbhid-ups</merge>
<merge key="battery.type" type="string">ups</merge>
</match>
</match>
<!-- Belkin -->
<match key="usb_device.vendor_id" int="0x050d">
<!-- F6H375-USB -->
@ -532,6 +554,13 @@
<merge key="info.addons" type="strlist">hald-addon-usbhid-ups</merge>
<merge key="battery.type" type="string">ups</merge>
</match>
<!-- e.g. TrippLite Smart1500LCD (newer unit) -->
<match key="usb_device.product_id" int="0x3016">
<append key="info.category" type="string">battery</append>
<merge key="info.capabilities" type="strlist">battery</merge>
<merge key="info.addons" type="strlist">hald-addon-usbhid-ups</merge>
<merge key="battery.type" type="string">ups</merge>
</match>
<!-- e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) -->
<match key="usb_device.product_id" int="0x4001">
<append key="info.category" type="string">battery</append>

View file

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -17,6 +17,23 @@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -54,8 +71,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libssl.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
@ -90,11 +108,22 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(hotplugusbdir)" \
"$(DESTDIR)$(hotplugusbdir)"
SCRIPTS = $(hotplugusb_SCRIPTS)
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__dist_hotplugusb_DATA_DIST = libhid.usermap
DATA = $(dist_hotplugusb_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -103,6 +132,7 @@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -129,6 +159,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -323,8 +354,11 @@ libhidups: $(top_builddir)/config.status $(srcdir)/libhidups.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-hotplugusbSCRIPTS: $(hotplugusb_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(hotplugusbdir)" || $(MKDIR_P) "$(DESTDIR)$(hotplugusbdir)"
@list='$(hotplugusb_SCRIPTS)'; test -n "$(hotplugusbdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(hotplugusbdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(hotplugusbdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
@ -352,9 +386,7 @@ uninstall-hotplugusbSCRIPTS:
@list='$(hotplugusb_SCRIPTS)'; test -n "$(hotplugusbdir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(hotplugusbdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(hotplugusbdir)" && rm -f $$files
dir='$(DESTDIR)$(hotplugusbdir)'; $(am__uninstall_files_from_dir)
mostlyclean-libtool:
-rm -f *.lo
@ -363,8 +395,11 @@ clean-libtool:
-rm -rf .libs _libs
install-dist_hotplugusbDATA: $(dist_hotplugusb_DATA)
@$(NORMAL_INSTALL)
test -z "$(hotplugusbdir)" || $(MKDIR_P) "$(DESTDIR)$(hotplugusbdir)"
@list='$(dist_hotplugusb_DATA)'; test -n "$(hotplugusbdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(hotplugusbdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(hotplugusbdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@ -378,9 +413,7 @@ uninstall-dist_hotplugusbDATA:
@$(NORMAL_UNINSTALL)
@list='$(dist_hotplugusb_DATA)'; test -n "$(hotplugusbdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(hotplugusbdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(hotplugusbdir)" && rm -f $$files
dir='$(DESTDIR)$(hotplugusbdir)'; $(am__uninstall_files_from_dir)
tags: TAGS
TAGS:
@ -435,10 +468,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:

View file

@ -49,6 +49,14 @@ libhidups 0x0003 0x0463 0xffff 0x0000 0x0000 0x00
# various models
libhidups 0x0003 0x047c 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Riello (Cypress Semiconductor Corp.)
# various models
libhidups 0x0003 0x04b4 0x5500 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Minibox
# openUPS Intelligent UPS (minimum required firmware 1.4)
libhidups 0x0003 0x04d8 0xd004 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# Belkin
# F6H375-USB
libhidups 0x0003 0x050d 0x0375 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
@ -162,6 +170,8 @@ libhidups 0x0003 0x09ae 0x3013 0x0000 0x0000 0x00
libhidups 0x0003 0x09ae 0x3014 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. ?
libhidups 0x0003 0x09ae 0x3015 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite Smart1500LCD (newer unit)
libhidups 0x0003 0x09ae 0x3016 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?)
libhidups 0x0003 0x09ae 0x4001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
# e.g. TrippLite SmartOnline SU6000RT4U?

View file

@ -1,15 +0,0 @@
# TODO: Java / Maven build integration
EXTRA_DIST = README \
jNut/pom.xml \
jNut/README \
jNut/src/main/java/org/networkupstools/jnut/Client.java \
jNut/src/main/java/org/networkupstools/jnut/Command.java \
jNut/src/main/java/org/networkupstools/jnut/Device.java \
jNut/src/main/java/org/networkupstools/jnut/NutException.java \
jNut/src/main/java/org/networkupstools/jnut/StringLineSocket.java \
jNut/src/main/java/org/networkupstools/jnut/Variable.java \
jNut/src/test/java/org/networkupstools/jnut/ClientTest.java \
jNutList/pom.xml \
jNutList/README \
jNutList/src/main/java/org/networkupstools/jnutlist/AppList.java

View file

@ -1,19 +0,0 @@
Java NUT Client files
~~~~~~~~~~~~~~~~~~~~~
This directory contains various NUT Client related java source files, written by
Emilien Kia, sponsored by Eaton, and released under GPL v2.
* "jNut": this directory contains maven project and source files for jNut,
which is a Java abstraction bundle to access NUT server(s).
You can use it in Java programs to access NUT's upsd data server in a simple
way, without having to know the NUT protocol.
* "jNutList": this directory contains maven project and source files for
jNutList, a simple Java example program using jNut which connect to an UPSD,
lists its ups and their variables and commands.
* "jNutWebAPI": this directory contains maven project and source files for
jNutWebAPI, a simple Java web archive to access nut informations via REST
web services.

View file

@ -1,77 +0,0 @@
jNut library
~~~~~~~~~~~~
This directory contains source files for the jNut library,
which is a Java abstraction bundle to access NUT server(s).
You can use it in Java programs to access NUT's upsd data server in a simple
way, without having to know the NUT protocol.
jNut building requirements
^^^^^^^^^^^^^^^^^^^^^^^^^^
jNut requires to be build :
- A Java JDK 6 correctly set in environment (ie bin folder in path)
- A Maven 3 installation set in environment (ie bin folder in path) with
sufficient configuration (internet connection, local repository) to let maven
get all plugins to make processes.
jNut is written in Java SE 1.4 and is tuned to be compiled to Java 1.4 code
level so most of environment can use it.
jNut building
^^^^^^^^^^^^^
Once JDK and Maven installed and configured, just go into the jNut directory
and type:
mvn install
The produced package called 'jNut-x.x-xxx.jar' is located in 'target'
subdirectory.
jNut javadoc
^^^^^^^^^^^^
You can generate jNut javadoc by typing:
mvn javadoc:javadoc
Documentation will be generated in 'target/site/apidocs' subdirectory and its
entry point is located at 'target/site/apidocs/index.html'.
Workspace cleaning
^^^^^^^^^^^^^^^^^^
The jNut workspace can be cleaned by removing the 'target' subdirectory or by
typing:
mvn clean
Unit test notes
^^^^^^^^^^^^^^^
jNut sources embed some unit tests in the 'src/test/java' subdirectory.
These tests are based on JUnit and are executed between compilation and
packaging phases at each build.
Implementation notes
^^^^^^^^^^^^^^^^^^^^
Currently, jNut is not thread safe. It is not protected against concurrent
queries but queries to different clients can be done in parallel as there are
done on different sockets.
Moreover, jNut have no connection preservation system so servers can break down
connections due to timeout.
Application using retrieved data must forget them when a disconnection occurs.
If the application want to maintain the connection, it must implement a
ping-pong mecanism itself.
At present time, jNut do not support SSL connection. It is planned for near
future.
Changelog
^^^^^^^^^
* "0.2": Add nut-scanner.
* "0.1": Initial version with basic dialog with UPSD.

View file

@ -1,40 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.networkupstools</groupId>
<artifactId>jNut</artifactId>
<version>0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jNut</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,619 +0,0 @@
/* Client.java
Copyright (C) 2011 Eaton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.networkupstools.jnut;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList;
/**
* A jNut client is start point to dialog to UPSD.
* It can connect to an UPSD then retrieve its device list.
* It support authentication by login/password.
* <p>
* You can directly create and connect a client by using the
* Client(String host, int port, String login, String passwd) constructor
* or use a three phase construction:
* <ul>
* <li>empty constructor
* <li>setting host, port, login and password with setters
* <li>call empty connect()
* </ul>
* <p>
* Objects retrieved by Client are attached (directly or indirectly) to it.
* If the connection is closed, attached objects must not be used anymore (GC).
* <p>
* Note: The jNut Client does not support any reconnection nor ping mechanism,
* so the calling application must know the UPSD can timeout the connection.
* <p>
* Note: Retrieved values are not valid along the time, they are valid at the
* precise moment they are retrieved.
*
* @author <a href="mailto:EmilienKia@eaton.com">Emilien Kia</a>
*/
public class Client {
/**
* Host to which connect.
* Network name or IP.
* Default to "127.0.0.1"
*/
private String host = "127.0.0.1";
/**
* IP port.
* Default to 3493
*/
private int port = 3493;
/**
* Login to use to connect to UPSD.
*/
private String login = null;
/**
* Password to use to connect to UPSD.
*/
private String passwd = null;
/**
* Communication socket
*/
private StringLineSocket socket = null;
/**
* Get the host name or address to which client is (or will be) connected.
* @return Host name or address.
*/
public String getHost() {
return host;
}
/**
* Set the host name (or address) to which the client will intend to connect to at next connection.
* @param host New host name or address.
*/
public void setHost(String host) {
this.host = host;
}
/**
* Get the login with which the client is (or will be connected).
* @return The login.
*/
public String getLogin() {
return login;
}
/**
* Set the login with which the client will intend to connect.
* @param login New login.
*/
public void setLogin(String login) {
this.login = login;
}
/**
* Get the password with which the client is (or will be connected).
* @return The password.
*/
public String getPasswd() {
return passwd;
}
/**
* Set the password with which the client will intend to connect.
* @param passwd New password.
*/
public void setPasswd(String passwd) {
this.passwd = passwd;
}
/**
* Get the port to which client is (or will be) connected.
* @return Port number.
*/
public int getPort() {
return port;
}
/**
* Set the port to which client is (or will be) connected.
* @param port Port number.
*/
public void setPort(int port) {
this.port = port;
}
/**
* Default constructor.
*/
public Client()
{
}
/**
* Connection constructor.
* Construct the Client object and intend to connect.
* Throw an exception if cannot connect.
* @param host Host to which connect.
* @param port IP port.
* @param login Login to use to connect to UPSD.
* @param passwd Password to use to connect to UPSD.
*/
public Client(String host, int port, String login, String passwd) throws IOException, UnknownHostException, NutException
{
connect(host, port, login, passwd);
}
/**
* Intent to connect and authenticate to an UPSD with specified parameters.
* Throw an exception if cannot connect.
* @param host Host to which connect.
* @param port IP port.
* @param login Login to use to connect to UPSD.
* @param passwd Password to use to connect to UPSD.
*/
public void connect(String host, int port, String login, String passwd) throws IOException, UnknownHostException, NutException
{
this.host = host;
this.port = port;
this.login = login;
this.passwd = passwd;
connect();
}
/**
* Intent to connect to an UPSD with specified parameters without authentication.
* Throw an exception if cannot connect.
* @param host Host to which connect.
* @param port IP port.
*/
public void connect(String host, int port) throws IOException, UnknownHostException, NutException
{
this.host = host;
this.port = port;
connect();
}
/**
* Connection to UPSD with already specified parameters.
* Throw an exception if cannot connect.
*/
public void connect() throws IOException, UnknownHostException, NutException
{
// Force disconnect if another connection is alive.
if(socket!=null)
disconnect();
socket = new StringLineSocket(host, port);
authenticate();
}
/**
* Intend to authenticate with specified login and password, overriding
* already defined ones.
* @param login
* @param passwd
* @throws IOException
* @throws NutException
*/
public void authenticate(String login, String passwd) throws IOException, NutException
{
this.login = login;
this.passwd = passwd;
authenticate();
}
/**
* Intend to authenticate with alread set login and password.
* @throws IOException
* @throws NutException
*/
public void authenticate() throws IOException, NutException
{
// Send login
if(login!=null && !login.isEmpty())
{
String res = query("USERNAME", login);
if(!res.startsWith("OK"))
{
// Normaly response should be OK or ERR and nothing else.
throw new NutException(NutException.UnknownResponse, "Unknown response in Client.connect (USERNAME) : " + res);
}
}
// Send password
if(passwd!=null && !passwd.isEmpty())
{
String res = query("PASSWORD", passwd);
if(!res.startsWith("OK"))
{
// Normaly response should be OK or ERR and nothing else.
throw new NutException(NutException.UnknownResponse, "Unknown response in Client.connect (PASSWORD) : " + res);
}
}
}
/**
* Test if the client is connected to the UPSD.
* Note: it does not detect if the connection have been closed by server.
* @return True if connected.
*/
public boolean isConnected()
{
return socket!=null && socket.isConnected();
}
/**
* Disconnect.
*/
public void disconnect()
{
if(socket!=null)
{
try
{
if(socket.isConnected())
socket.close();
}
catch(IOException e)
{
e.printStackTrace();
}
socket = null;
}
}
/**
* Log out.
*/
public void logout()
{
if(socket!=null)
{
try
{
if(socket.isConnected())
{
socket.write("LOGOUT");
socket.close();
}
}
catch(IOException e)
{
e.printStackTrace();
}
socket = null;
}
}
/**
* Merge an array of stings into on string, with a space ' ' separator.
* @param str First string to merge
* @param strings Additionnal strings to merge
* @param sep Separator.
* @return The merged string, empty if no source string.
*/
static String merge(String str, String[] strings)
{
String res = str;
if(strings!=null)
{
for(int n=0; n<strings.length; n++)
{
res += " " + strings[n];
}
}
return res;
}
/**
* Intend to split a name/value string of the form '<name> "<value>"'.
* @param source String source to split.
* @return String couple with name and value.
*/
static String[] splitNameValueString(String source)
{
int pos = source.indexOf(' ');
if(pos<1)
return null;
String name = source.substring(0, pos);
String value = extractDoublequotedValue(source.substring(pos+1));
if(value==null)
return null;
String[] res = new String[2];
res[0] = name;
res[1] = value;
return res;
}
/**
* Intend to extract a value from its doublequoted and escaped representation.
* @param source Source string to convert.
* @return Extracted value
*/
static String extractDoublequotedValue(String source)
{
// Test doublequote at begin and end of string, then remove them.
if(!(source.startsWith("\"") && source.endsWith("\"")))
return null;
source = source.substring(1, source.length()-1);
// Unescape it.
return unescape(source);
}
/**
* Escape string with backslashes.
* @param str String to escape.
* @return Escaped string.
*/
static String escape(String str)
{
// Replace a backslash by two backslash (regexp)
str = str.replaceAll("\\\\", "\\\\\\\\");
// Replace a doublequote by backslash-doublequote (regexp)
str = str.replaceAll("\"", "\\\\\"");
return str;
}
/**
* Unescape string with backslashes.
* @param str String to unescape.
* @return Unescaped string.
*/
static String unescape(String str)
{
// Replace a backslash-doublequote by doublequote (regexp)
str = str.replaceAll("\\\\\"", "\"");
// Replace two backslash by a backslash (regexp)
str = str.replaceAll("\\\\\\\\", "\\\\");
return str;
}
/**
* Detect an UPSD ERR line.
* If found, parse it, construct and throw an NutException
* @param str Line to analyse.
* @throws NutException
*/
private void detectError(String str) throws NutException
{
if(str.startsWith("ERR "))
{
String[] arr = str.split(" ", 3);
switch(arr.length)
{
case 2:
throw new NutException(arr[1]);
case 3:
throw new NutException(arr[1], arr[2]);
default:
throw new NutException();
}
}
}
/**
* Send a query line then read the response.
* Helper around query(String).
* @param query Query to send.
* @param subquery Sub query to send.
* @return The reply.
* @throws IOException
*/
protected String query(String query, String subquery) throws IOException, NutException
{
return query(query + " " + subquery);
}
/**
* Send a query line then read the response.
* Helper around query(String, String ...).
* @param query Query to send.
* @param subquery Sub query to send.
* @param params Optionnal additionnal parameters.
* @return The reply.
* @throws IOException
*/
protected String query(String query, String subquery, String[] params) throws IOException, NutException
{
return query(query + " " + subquery, params);
}
/**
* Send a query line then read the response.
* @param query Query to send.
* @param params Optionnal additionnal parameters.
* @return The reply.
* @throws IOException
*/
protected String query(String query, String [] params) throws IOException, NutException
{
query = merge(query, params);
return query(query);
}
/**
* Send a query line then read the response.
* @param query Query to send.
* @return The reply.
* @throws IOException
*/
protected String query(String query) throws IOException, NutException
{
if(!isConnected())
return null;
socket.write(query);
String res = socket.read();
detectError(res);
return res;
}
/**
* Send a GET query line then read the reply and validate the response.
* @param subcmd GET subcommand to send.
* @param param Extra parameters
* @return GET result return by UPSD, without the subcommand and param prefix.
* @throws IOException
*/
protected String get(String subcmd, String param) throws IOException, NutException
{
String[] params = {param};
return get(subcmd, params);
}
/**
* Send a GET query line then read the reply and validate the response.
* @param subcmd GET subcommand to send.
* @param params Eventual extra parameters.
* @return GET result return by UPSD, without the subcommand and param prefix.
* @throws IOException
*/
protected String get(String subcmd, String [] params) throws IOException, NutException
{
if(!isConnected())
return null;
subcmd = merge(subcmd, params);
socket.write("GET " + subcmd);
String res = socket.read();
if(res==null)
return null;
detectError(res);
if(res.startsWith(subcmd + " "))
{
return res.substring(subcmd.length()+1);
}
else
{
return null;
}
}
/**
* Send a LIST query line then read replies and validate them.
* @param subcmd LIST subcommand to send.
* @return LIST results return by UPSD, without the subcommand and param prefix.
* @throws IOException
*/
protected String[] list(String subcmd) throws IOException, NutException
{
return list(subcmd, (String[])null);
}
/**
* Send a LIST query line then read replies and validate them.
* @param subcmd LIST subcommand to send.
* @param param Extra parameters.
* @return LIST results return by UPSD, without the subcommand and param prefix.
* @throws IOException
*/
protected String[] list(String subcmd, String param) throws IOException, NutException
{
String[] params = {param};
return list(subcmd, params);
}
/**
* Send a LIST query line then read replies and validate them.
* @param subcmd LIST subcommand to send.
* @param params Eventual extra parameters.
* @return LIST results return by UPSD, without the subcommand and param prefix.
* @throws IOException
*/
protected String[] list(String subcmd, String [] params) throws IOException, NutException
{
if(!isConnected())
return null;
subcmd = merge(subcmd, params);
socket.write("LIST " + subcmd);
String res = socket.read();
if(res==null)
return null;
detectError(res);
if(!res.startsWith("BEGIN LIST " + subcmd))
return null;
ArrayList/*<String>*/ list = new ArrayList/*<String>*/();
int sz = subcmd.length()+1;
while(true)
{
res = socket.read();
detectError(res);
if(!res.startsWith(subcmd + " "))
break;
list.add(res.substring(sz));
}
if(!res.equals("END LIST " + subcmd))
return null;
return (String[])list.toArray(new String[list.size()]);
}
/**
* Returns the list of available devices from the NUT server.
* @return List of devices, empty if nothing,
* null if not connected or failed.
*
*/
public Device[] getDeviceList() throws IOException, NutException
{
String[] res = list("UPS");
if(res==null)
return null;
ArrayList/*<Device>*/ list = new ArrayList/*<Device>*/();
for(int i=0; i<res.length; i++)
{
String[] arr = splitNameValueString(res[i]);
if(arr!=null)
{
list.add(new Device(arr[0], this));
}
}
return (Device[])list.toArray(new Device[list.size()]);
}
/**
* Intend to retrieve a device by its name.
* @param name Name of the device to look at.
* @return Device
* @throws IOException
* @throws NutException
*/
public Device getDevice(String name)throws IOException, NutException
{
// Note: an exception "DRIVER-NOT-CONNECT" should not prevent Device creation.
try{
get("UPSDESC", name);
}catch(NutException ex){
if(!ex.is(NutException.DriverNotConnected)){
throw ex;
}
}
return new Device(name, this);
}
}

View file

@ -1,100 +0,0 @@
/* Command.java
Copyright (C) 2011 Eaton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.networkupstools.jnut;
import java.io.IOException;
/**
* Class representing a command of a device.
* <p>
* It can be used to retrieve description and execute commands.
* A Command object can be retrieved from Device instance and can not be constructed directly.
*
* @author <a href="mailto:EmilienKia@eaton.com">Emilien Kia</a>
*/
public class Command {
/**
* Device to which command is attached
*/
Device device = null;
/**
* Command name
*/
String name = null;
/**
* Internally create a command.
* @param name Command name.
* @param device Device to which the command is attached.
*/
protected Command(String name, Device device)
{
this.device = device;
this.name = name;
}
/**
* Return the device to which the command can be executed.
* @return Attached device.
*/
public Device getDevice() {
return device;
}
/**
* Return the command name.
* @return Command name.
*/
public String getName() {
return name;
}
/**
* Retrieve the command description from UPSD and store it in cache.
* @return Command description
* @throws IOException
*/
public String getDescription() throws IOException, NutException {
if(device!=null && device.getClient()!=null)
{
String[] params = {device.getName(), name};
String res = device.getClient().get("CMDDESC", params);
return res!=null?Client.extractDoublequotedValue(res):null;
}
return null;
}
/**
* Execute the instant command.
* @throws IOException
*/
public void execute() throws IOException, NutException {
if(device!=null && device.getClient()!=null)
{
String[] params = {device.getName(), name};
String res = device.getClient().query("INSTCMD", params);
if(!res.equals("OK"))
{
// Normaly response should be OK or ERR and nothing else.
throw new NutException(NutException.UnknownResponse, "Unknown response in Command.execute : " + res);
}
}
}
}

View file

@ -1,279 +0,0 @@
/* Device.java
Copyright (C) 2011 Eaton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.networkupstools.jnut;
import java.io.IOException;
import java.util.ArrayList;
/**
* Class representing a device attached to a Client.
* <p>
* It can retrieve its description, its number of logins, its variable and command lists.
* A Device object can be retrieved from Client instance and can not be constructed directly.
*
* @author <a href="mailto:EmilienKia@eaton.com">Emilien Kia</a>
*/
public class Device {
/**
* Client to which device is attached
*/
Client client = null;
/**
* Device name
*/
String name = null;
/**
* Internally create a device.
* @param name Device name.
* @param client Client to which the device is attached.
*/
protected Device(String name, Client client)
{
this.client = client;
this.name = name;
}
/**
* Return the client to which the device is connected.
* @return Attached client.
*/
public Client getClient() {
return client;
}
/**
* Return the device name.
* @return Device name.
*/
public String getName() {
return name;
}
/**
* Retrieve the device description from UPSD and store it in cache.
* @return Device description
* @throws IOException
*/
public String getDescription() throws IOException, NutException {
if(client!=null)
{
return client.get("UPSDESC", name);
}
return null;
}
/**
* Log in to the ups.
* <p>
* Use this to log the fact that a system is drawing power from this UPS.
* The <i>upsmon</i> master will wait until the count of attached systems reaches
* 1 - itself. This allows the slaves to shut down first.
* <p>
* NOTE: You probably shouldn't send this command unless you are upsmon,
* or a upsmon replacement.
* @throws IOException
* @throws NutException
*/
public void login() throws IOException, NutException {
if(client!=null)
{
String res = client.query("LOGIN", name);
if(!res.startsWith("OK"))
{
// Normaly response should be OK or ERR and nothing else.
throw new NutException(NutException.UnknownResponse, "Unknown response in Device.login : " + res);
}
}
}
/**
* This function doesn't do much by itself. It is used by <i>upsmon</i> to make
* sure that master-level functions like FSD are available if necessary
* @throws IOException
* @throws NutException
*/
public void master() throws IOException, NutException {
if(client!=null)
{
String res = client.query("MASTER", name);
if(!res.startsWith("OK"))
{
// Normaly response should be OK or ERR and nothing else.
throw new NutException(NutException.UnknownResponse, "Unknown response in Device.master : " + res);
}
}
}
/**
* Set the "forced shutdown" flag.
* <p>
* <i>upsmon</i> in master mode is the primary user of this function. It sets this
* "forced shutdown" flag on any UPS when it plans to power it off. This is
* done so that slave systems will know about it and shut down before the
* power disappears.
* <p>
* Setting this flag makes "FSD" appear in a STATUS request for this UPS.
* Finding "FSD" in a status request should be treated just like a "OB LB".
* <p>
* It should be noted that FSD is currently a latch - once set, there is
* no way to clear it short of restarting upsd or dropping then re-adding
* it in the ups.conf. This may cause issues when upsd is running on a
* system that is not shut down due to the UPS event.
* @throws IOException
* @throws NutException
*/
public void setForcedShutdown() throws IOException, NutException {
if(client!=null)
{
String res = client.query("FSD", name);
if(!res.startsWith("OK"))
{
// Normaly response should be OK or ERR and nothing else.
throw new NutException(NutException.UnknownResponse, "Unknown response in Device.setForcedShutdown : " + res);
}
}
}
/**
* Return the number of clients which have done LOGIN for this UPS.
* Force to retrieve it from UPSD and store it in cache.
* @return Number of clients, -1 if error.
* @throws IOException
*/
public int getNumLogin() throws IOException, NutException {
if(client!=null)
{
String res = client.get("NUMLOGINS", name);
return res!=null?Integer.parseInt(res):-1;
}
return -1;
}
/**
* Return the list of device variables from the NUT server.
* @return List of variables, empty if nothing,
* null if not connected or failed.
* @throws IOException
*/
public Variable[] getVariableList() throws IOException, NutException {
if(client==null)
return null;
String[] res = client.list("VAR", name);
if(res==null)
return null;
ArrayList/*<Variable>*/ list = new ArrayList/*<Variable>*/();
for(int i=0; i<res.length; i++)
{
String[] arr = Client.splitNameValueString(res[i]);
if(arr!=null)
{
list.add(new Variable(arr[0], this));
}
}
return (Variable[])list.toArray(new Variable[list.size()]);
}
/**
* Return the list of device RW variables from the NUT server.
* @return List of variables, empty if nothing,
* null if not connected or failed.
* @throws IOException
*/
public Variable[] getRWVariableList() throws IOException, NutException {
if(client==null)
return null;
String[] res = client.list("RW", name);
if(res==null)
return null;
ArrayList/*<Variable>*/ list = new ArrayList/*<Variable>*/();
for(int i=0; i<res.length; i++)
{
String[] arr = Client.splitNameValueString(res[i]);
if(arr!=null)
{
list.add(new Variable(arr[0], this));
}
}
return (Variable[])list.toArray(new Variable[list.size()]);
}
/**
* Return a variable from its name.
* @param name Name of the queried variable.
* @return The corresponding variable object if exists.
* @throws IOException
* @throws NutException
*/
public Variable getVariable(String name) throws IOException, NutException {
if(client==null)
return null;
String[] params = {this.name, name};
client.get("VAR", params);
return new Variable(name, this);
}
/**
* Return the list of device commands from the NUT server.
* @return List of commands, empty if nothing,
* null if not connected or failed.
* @throws IOException
*/
public Command[] getCommandList() throws IOException, NutException {
if(client==null)
return null;
String[] res = client.list("CMD", name);
if(res==null)
return null;
ArrayList/*<Command>*/ list = new ArrayList/*<Command>*/();
for(int i=0; i<res.length; i++)
{
list.add(new Command(res[i], this));
}
return (Command[])list.toArray(new Command[list.size()]);
}
/**
* Return a command from its name.
* @param name Name of the queried command.
* @return The corresponding command object if exists.
* @throws IOException
* @throws NutException
*/
public Command getCommand(String name)throws IOException, NutException {
if(client==null)
return null;
String[] params = {this.name, name};
String res = client.get("CMDDESC", params);
// Note: there is no way to test if the command is really available or not
// because a GET CMDDESC ups badcmdname does not return an error.
return new Command(name, this);
}
}

View file

@ -1,107 +0,0 @@
/* NutException.java
Copyright (C) 2011 Eaton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.networkupstools.jnut;
/**
* Class representing a NUT exception.
* <p>
* Instance are thrown when an UPSD returns an error with an "ERR" directive.
* Moreover it can ben thrown with some extra errors like:
* <ul>
* <li>UNKNOWN-RESPONSE : The response is not understood
* </ul>
* <p>
* A Nut exception has a (standard java exception message) message which correspond
* to error code returns by UPSD (like 'ACCESS-DENIED', 'UNKNOWN-UPS' ...).
* An extra string embed a more descriptive english message.
*
* @author <a href="mailto:EmilienKia@eaton.com">Emilien Kia</a>
*/
public class NutException extends java.lang.Exception{
public static String UnknownResponse = "UNKNOWN-RESPONSE";
public static String DriverNotConnected = "DRIVER-NOT-CONNECTED";
public String extra = "";
public NutException()
{
}
public NutException(String message)
{
super(message);
}
public NutException(String message, String extra)
{
super(message);
this.extra = extra;
}
public NutException(Throwable cause)
{
super(cause);
}
public NutException(String message, Throwable cause)
{
super(message, cause);
}
public NutException(String message, String extra, Throwable cause)
{
super(message, cause);
this.extra = extra;
}
/**
* Returns the extra message.
* @return Extra message if any.
*/
public String getExtra() {
return extra;
}
/**
* Set the extra message.
* @param extra The new extra message.
*/
public void setExtra(String extra) {
this.extra = extra;
}
/**
* Test is the exception corresponds to the specified name.
* @param name Name to test
* @return True if exception corresponds.
*/
public boolean is(String name) {
return getMessage()!=null&&getMessage().equals(name);
}
/**
* Format an exception message.
* @return Exception message
*/
public String toString() {
return "[" + getClass().getSimpleName() + "]" + getMessage() + " : " + getExtra();
}
}

View file

@ -1,137 +0,0 @@
/* StringLineSocket.java
Copyright (C) 2011 Eaton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.networkupstools.jnut;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;
/**
* Class representing a socket, internally used to communicate with UPSD.
* Abstract some stream mechanisms.
*
* @author <a href="mailto:EmilienKia@eaton.com">Emilien Kia</a>
*/
class StringLineSocket {
/**
* Real internal TCP socket.
*/
Socket socket = null;
/**
* Writer to the socket.
*/
private OutputStreamWriter writer = null;
/**
* Reader from the socket.
*/
private BufferedReader reader = null;
/**
* Create a new line socket.
*/
public StringLineSocket(){
}
/**
* Create a new line socket and connect it.
* @param host Host to connect to
* @param port Port to connect to
* @throws UnknownHostException
* @throws IOException
*/
public StringLineSocket(String host, int port) throws UnknownHostException, IOException{
connect(host, port);
}
/**
* Connect a new line socket.
* @param host Host to connect to
* @param port Port to connect to
* @throws UnknownHostException
* @throws IOException
*/
public void connect(String host, int port) throws UnknownHostException, IOException{
socket = new Socket(host, port);
if(socket!=null)
{
reader = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
writer = new OutputStreamWriter(socket.getOutputStream());
}
}
/**
* Close the socket.
*/
public void close() throws IOException{
if(socket!=null){
writer.close();
reader.close();
socket.close();
socket = null;
writer = null;
reader = null;
}
}
/**
* Test if the soecket is connected.
* @return True if connected.
*/
public boolean isConnected() {
return socket!=null && socket.isConnected() && !socket.isClosed();
}
/**
* Write a line follow by a '\n' character.
* @param line
* @throws IOException
*/
public void write(String line) throws IOException
{
if(isConnected())
{
writer.write(line + "\n");
writer.flush();
}
}
/**
* Read a line terminated by a '\n'.
* @return The line without the ending '\n'
* @throws IOException
*/
public String read() throws IOException
{
if(isConnected())
{
String res = reader.readLine();
return res;
}
return "";
}
}

View file

@ -1,120 +0,0 @@
/* Variable.java
Copyright (C) 2011 Eaton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.networkupstools.jnut;
import java.io.IOException;
/**
* Class representing a variable of a device.
* <p>
* It can be used to get and set its value (if possible).
* A Variable object can be retrieved from Device instance and can not be constructed directly.
*
* @author <a href="mailto:EmilienKia@eaton.com">Emilien Kia</a>
*/
public class Variable {
/**
* Device to which variable is attached
*/
Device device = null;
/**
* Variable name
*/
String name = null;
/**
* Internally create a variable.
* @param name Variable name.
* @param device Device to which the variable is attached.
*/
protected Variable(String name, Device device)
{
this.device = device;
this.name = name;
}
/**
* Return the device to which the variable is related.
* @return Attached device.
*/
public Device getDevice() {
return device;
}
/**
* Return the variable name.
* @return Command name.
*/
public String getName() {
return name;
}
/**
* Retrieve the variable value from UPSD and store it in cache.
* @return Variable value
* @throws IOException
*/
public String getValue() throws IOException, NutException {
if(device!=null && device.getClient()!=null)
{
String[] params = {device.getName(), name};
String res = device.getClient().get("VAR", params);
return res!=null?Client.extractDoublequotedValue(res):null;
}
return null;
}
/**
* Retrieve the variable description from UPSD and store it in cache.
* @return Variable description
* @throws IOException
*/
public String getDescription() throws IOException, NutException {
if(device!=null && device.getClient()!=null)
{
String[] params = {device.getName(), name};
String res = device.getClient().get("DESC", params);
return res!=null?Client.extractDoublequotedValue(res):null;
}
return null;
}
/**
* Set the variable value.
* Note the new value can be applied with a little delay depending of UPSD and connection.
* @param value New value for the variable
* @throws IOException
*/
public void setValue(String value) throws IOException, NutException {
if(device!=null && device.getClient()!=null)
{
String[] params = {"VAR", device.getName(),
name, " \"" + Client.escape(value) + "\""};
String res = device.getClient().query("SET", params);
if(!res.equals("OK"))
{
// Normaly response should be OK or ERR and nothing else.
throw new NutException(NutException.UnknownResponse, "Unknown response in Variable.setValue : " + res);
}
}
}
// TODO Add query for type, enum and range values
}

View file

@ -1,113 +0,0 @@
/* ClientTest.java
Copyright (C) 2011 Eaton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.networkupstools.jnut;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class ClientTest extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public ClientTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( ClientTest.class );
}
/**
* Escape function test.
*/
public void testEscape()
{
assertEquals("Empty string", "", Client.escape(""));
assertEquals("Simple string", "hello", Client.escape("hello"));
assertEquals("Internal doublequote", "he\\\"llo", Client.escape("he\"llo"));
assertEquals("Internal backslash", "he\\\\llo", Client.escape("he\\llo"));
assertEquals("Internal backslash and doublequote", "he\\\\\\\"llo", Client.escape("he\\\"llo"));
assertEquals("Initial and final doublequote", "\\\"hello\\\"", Client.escape("\"hello\""));
}
/**
* Unescape function test.
*/
public void testUnescape()
{
assertEquals("Empty string", "", Client.unescape(""));
assertEquals("Simple string", "hello", Client.unescape("hello"));
assertEquals("Internal doublequote", "he\"llo", Client.unescape("he\\\"llo"));
assertEquals("Internal backslash", "he\\llo", Client.unescape("he\\\\llo"));
assertEquals("Internal backslash and doublequote", "he\\\"llo", Client.unescape("he\\\\\\\"llo"));
assertEquals("Initial and final doublequote", "\"hello\"", Client.unescape("\\\"hello\\\""));
}
/**
* extractDoublequotedValue function test.
*/
public void testExtractDoublequotedValue()
{
assertNull("Empty string", Client.extractDoublequotedValue(""));
assertNull("Non doublequoted string", Client.extractDoublequotedValue("hello"));
assertNull("No begining doublequote", Client.extractDoublequotedValue("hello\""));
assertNull("No ending doublequote", Client.extractDoublequotedValue("\"hello"));
assertEquals("Simple string", "hello", Client.extractDoublequotedValue("\"hello\""));
assertEquals("String with doublequote", "he\"llo", Client.extractDoublequotedValue("\"he\\\"llo\""));
assertEquals("String with backslash", "he\\llo", Client.extractDoublequotedValue("\"he\\\\llo\""));
assertEquals("String with backslash and doublequote", "he\\\"llo", Client.extractDoublequotedValue("\"he\\\\\\\"llo\""));
}
/**
* splitNameValueString function test.
*/
public void testSplitNameValueString()
{
String[] res;
assertNull("Empty string", Client.splitNameValueString(""));
assertNull("One word string", Client.splitNameValueString("name"));
assertNull("Non doublequoted string", Client.extractDoublequotedValue("name value"));
assertNull("No begining doublequote", Client.extractDoublequotedValue("name value\""));
assertNull("No ending doublequote", Client.extractDoublequotedValue("name \"value"));
res = Client.splitNameValueString("name \"value\"");
assertEquals("Simple name/value (name)", "name", res[0]);
assertEquals("Simple name/value (value)", "value", res[1]);
res = Client.splitNameValueString("name \"complex value\"");
assertEquals("Simple name / complex value (name)", "name", res[0]);
assertEquals("Simple name / complex value (value)", "complex value", res[1]);
res = Client.splitNameValueString("name \"complex\\\\value\"");
assertEquals("Simple name / backslash value (name)", "name", res[0]);
assertEquals("Simple name / backslash value (value)", "complex\\value", res[1]);
res = Client.splitNameValueString("name \"complex\\\"value\"");
assertEquals("Simple name / doublequote value (name)", "name", res[0]);
assertEquals("Simple name / doublequote value (value)", "complex\"value", res[1]);
}
}

View file

@ -1,30 +0,0 @@
jNutList example application
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This directory contains source files for the jNutList application.
It allows to connect to an UPSD then retrieve devices and their variables.
It is a little example application to show how to use jNut.
jNutList building
^^^^^^^^^^^^^^^^^
As jNut, jNutList is a maven project so a maven environment must be set.
Please reffer to jNut building notes.
jNutList running
^^^^^^^^^^^^^^^^
jNutList can be run launching it in a console:
java -jar jNutList-x.x-xxx-jar-with-dependencies.jar
Some parameters can be passed :
java -jar jNutList-x.x-jar-with-dependencies.jar host port login password
For example:
java -jar jNutList-x.x-jar-with-dependencies.jar localhost 3493 admin passwd
By default, host is localhost, port is 3493 and login and password are not
specified.

View file

@ -1,62 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.networkupstools</groupId>
<artifactId>jNutList</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jNutList</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jNut</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- NOTE: We don't need a groupId specification because the group is
org.apache.maven.plugins ...which is assumed by default.
-->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>org.networkupstools.jnutlist.AppList</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,112 +0,0 @@
/* AppList.java
Copyright (C) 2011 Eaton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.networkupstools.jnutlist;
import java.io.IOException;
import java.net.UnknownHostException;
import org.networkupstools.jnut.*;
public class AppList
{
public static void main( String[] args )
{
String host = args.length>=1?args[0]:"localhost";
int port = args.length>=2?Integer.valueOf(args[1]).intValue():3493;
String login = args.length>=3?args[2]:"";
String pass = args.length>=4?args[3]:"";
System.out.println( "jNutList connecting to " + login+":"+pass+"@"+host+":"+port );
Client client = new Client();
try {
client.connect(host, port, login, pass);
Device[] devs = client.getDeviceList();
if(devs!=null)
{
for(int d=0; d<devs.length; d++)
{
Device dev = devs[d];
String desc = "";
try {
desc = " : " + dev.getDescription();
} catch(NutException e) {
e.printStackTrace();
}
System.out.println("DEV " + dev.getName() + desc);
try {
Variable[] vars = dev.getVariableList();
if(vars!=null)
{
if(vars.length==0)
System.out.println(" NO VAR");
for(int v=0; v<vars.length; v++)
{
Variable var = vars[v];
String res = "";
try {
res = " = " + var.getValue() + " (" + var.getDescription() + ")";
} catch(NutException e) {
e.printStackTrace();
}
System.out.println(" VAR " + var.getName() + res );
}
}
else
System.out.println(" NULL VAR");
} catch(NutException e) {
e.printStackTrace();
}
try {
Command[] cmds = dev.getCommandList();
if(cmds!=null)
{
if(cmds.length==0)
System.out.println(" NO CMD");
for(int c=0; c<cmds.length; c++)
{
Command cmd = cmds[c];
String res = "";
try {
res = " : " + cmd.getDescription();
} catch(NutException e) {
e.printStackTrace();
}
System.out.println(" CMD " + cmd.getName() + res);
}
}
else
System.out.println(" NULL CMD");
} catch(NutException e) {
e.printStackTrace();
}
}
}
client.disconnect();
}catch(Exception e){
e.printStackTrace();
}
}
}

View file

@ -12,6 +12,7 @@ EXTRA_DIST = README \
app/pixmaps/on_battery.png \
app/pixmaps/var-ro.png \
app/locale/fr/LC_MESSAGES/NUT-Monitor.mo \
app/locale/it/LC_MESSAGES/NUT-Monitor.mo \
module/PyNUT.py \
module/test_nutclient.py

View file

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -17,6 +17,23 @@
# Network UPS Tools: data/html
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -52,8 +69,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libssl.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
@ -69,12 +87,18 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -101,6 +125,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -265,6 +290,7 @@ EXTRA_DIST = README \
app/pixmaps/on_battery.png \
app/pixmaps/var-ro.png \
app/locale/fr/LC_MESSAGES/NUT-Monitor.mo \
app/locale/it/LC_MESSAGES/NUT-Monitor.mo \
module/PyNUT.py \
module/test_nutclient.py
@ -358,10 +384,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:

View file

@ -856,7 +856,7 @@ class gui_updater( threading.Thread ) :
self.__parent_class._interface__widgets["progress_battery_load"].set_text( _("Not available") )
if ( vars.has_key( "battery.runtime" ) ) :
autonomy = int(vars.get("battery.runtime",0))
autonomy = int( float( vars.get( "battery.runtime", 0 ) ) )
if ( autonomy >= 3600 ) :
info = time.strftime( _("<b>%H hours %M minutes %S seconds</b>"), time.gmtime( autonomy ) )

View file

@ -1047,7 +1047,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</property>
<property name="authors">David Goncalves &lt;david@lestat.st&gt;</property>
<property name="translator_credits">David Goncalves &lt;david@lestat.st&gt; - Français</property>
<property name="translator_credits">David Goncalves &lt;david@lestat.st&gt; - Français
Daniele Pezzini &lt;hyouko@gmail.com&gt; - Italiano</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox6">
<property name="visible">True</property>

View file

@ -3,6 +3,7 @@ Name=NUT Monitor
Name[fr]=Moniteur NUT
Comment=Network UPS Tools GUI client
Comment[fr]=Client graphique pour NUT (Network UPS Tools)
Comment[it]=Client grafico per NUT (Network UPS Tools)
Categories=Application;Network;
Encoding=UTF-8
Exec=NUT-Monitor

View file

@ -5,7 +5,7 @@
#
# drivers/usbhid-ups -DD -u root -x generic -x vendorid=XXXX auto
#
# Usage: cat debuginfo | path-to-subdriver.sh
# Usage: cat debuginfo | gen-usbhid-subdriver.sh
#
# See also: docs/hid-subdrivers.txt
@ -58,7 +58,7 @@ if [ -z "$KEEP" ]; then
trap cleanup EXIT
fi
NAME=path-to-subdriver
NAME=gen-usbhid-subdriver
TMPDIR="${TEMPDIR:-/tmp}"
DEBUG=`mktemp "$TMPDIR/$NAME-DEBUG.XXXXXX"`
UTABLE=`mktemp "$TMPDIR/$NAME-UTABLE.XXXXXX"`
@ -86,8 +86,8 @@ natural (upper- and lowercase) capitalization, e.g., 'Belkin', 'APC'."
done
# try to determine product and vendor id
VENDORID=`cat "$FILE" | sed -n 's/[> ]*- VendorID: \([0-9a-fA-F]*\).*/\1/p' | tail -1`
PRODUCTID=`cat "$FILE" | sed -n 's/[> ]*- ProductID: \([0-9a-fA-F]*\).*/\1/p' | tail -1`
VENDORID=`cat "$FILE" | sed -n 's/.*- VendorID: \([0-9a-fA-F]*\).*/\1/p' | tail -1`
PRODUCTID=`cat "$FILE" | sed -n 's/.*- ProductID: \([0-9a-fA-F]*\).*/\1/p' | tail -1`
# prompt for productid, vendorid if necessary
if [ -z "$VENDORID" ]; then
@ -103,7 +103,7 @@ CFILE="$LDRIVER-hid.c"
HFILE="$LDRIVER-hid.h"
# extract Usage Table
cat "$FILE" | sed -n 's/[> ]*Path: \([^,][^,]*\), Type:.*/\1/p' > "$UTABLE"
cat "$FILE" | sed -n 's/.*Path: \([^,][^,]*\), Type:.*/\1/p' > "$UTABLE"
# extract Usage codes
cat "$UTABLE" | tr '.' $'\n' | sort -u > "$USAGES"
@ -163,12 +163,12 @@ cat > "$CFILE" <<EOF
/* ${CFILE} - subdriver to monitor ${DRIVER} USB/HID devices with NUT
*
* Copyright (C)
* 2003 - 2009 Arnaud Quette <ArnaudQuette@Eaton.com>
* 2003 - 2012 Arnaud Quette <ArnaudQuette@Eaton.com>
* 2005 - 2006 Peter Selinger <selinger@users.sourceforge.net>
* 2008 - 2009 Arjen de Korte <adkorte-guest@alioth.debian.org>
*
* Note: this subdriver was initially generated as a "stub" by the
* path-to-subdriver script. It must be customized.
* gen-usbhid-subdriver script. It must be customized.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -17,6 +17,23 @@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -58,8 +75,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libssl.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
@ -95,11 +113,22 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(systemdsystemshutdowndir)" \
"$(DESTDIR)$(systemdsystemunitdir)"
SCRIPTS = $(systemdsystemshutdown_SCRIPTS)
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DATA = $(systemdsystemunit_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
A2X = @A2X@
@ -107,6 +136,7 @@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -133,6 +163,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -335,8 +366,11 @@ nutshutdown: $(top_builddir)/config.status $(srcdir)/nutshutdown.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-systemdsystemshutdownSCRIPTS: $(systemdsystemshutdown_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(systemdsystemshutdowndir)" || $(MKDIR_P) "$(DESTDIR)$(systemdsystemshutdowndir)"
@list='$(systemdsystemshutdown_SCRIPTS)'; test -n "$(systemdsystemshutdowndir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(systemdsystemshutdowndir)'"; \
$(MKDIR_P) "$(DESTDIR)$(systemdsystemshutdowndir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
@ -364,9 +398,7 @@ uninstall-systemdsystemshutdownSCRIPTS:
@list='$(systemdsystemshutdown_SCRIPTS)'; test -n "$(systemdsystemshutdowndir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(systemdsystemshutdowndir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(systemdsystemshutdowndir)" && rm -f $$files
dir='$(DESTDIR)$(systemdsystemshutdowndir)'; $(am__uninstall_files_from_dir)
mostlyclean-libtool:
-rm -f *.lo
@ -375,8 +407,11 @@ clean-libtool:
-rm -rf .libs _libs
install-systemdsystemunitDATA: $(systemdsystemunit_DATA)
@$(NORMAL_INSTALL)
test -z "$(systemdsystemunitdir)" || $(MKDIR_P) "$(DESTDIR)$(systemdsystemunitdir)"
@list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(systemdsystemunitdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(systemdsystemunitdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@ -390,9 +425,7 @@ uninstall-systemdsystemunitDATA:
@$(NORMAL_UNINSTALL)
@list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(systemdsystemunitdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(systemdsystemunitdir)" && rm -f $$files
dir='$(DESTDIR)$(systemdsystemunitdir)'; $(am__uninstall_files_from_dir)
tags: TAGS
TAGS:
@ -447,10 +480,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:

View file

@ -4,7 +4,7 @@ After=local-fs.target network.target
StopWhenUnneeded=yes
[Service]
ExecStart=@driverexecdir@/upsdrvctl start
ExecStop=@driverexecdir@/upsdrvctl stop
ExecStart=@DRVPATH@/upsdrvctl start
ExecStop=@DRVPATH@/upsdrvctl stop
Type=forking

View file

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -54,8 +71,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/nut_check_libltdl.m4 \
$(top_srcdir)/m4/nut_check_libneon.m4 \
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
$(top_srcdir)/m4/nut_check_libnss.m4 \
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
$(top_srcdir)/m4/nut_check_libssl.m4 \
$(top_srcdir)/m4/nut_check_libusb.m4 \
$(top_srcdir)/m4/nut_check_libwrap.m4 \
$(top_srcdir)/m4/nut_check_os.m4 \
@ -71,6 +89,11 @@ CONFIG_CLEAN_FILES = nut-ipmipsu.rules nut-usbups.rules
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -92,6 +115,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(udevrulesdir)"
DATA = $(udevrules_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -100,6 +129,7 @@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ASCIIDOC = @ASCIIDOC@
ASPELL = @ASPELL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -126,6 +156,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
DRVPATH = @DRVPATH@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -328,8 +359,11 @@ clean-libtool:
-rm -rf .libs _libs
install-udevrulesDATA: $(udevrules_DATA)
@$(NORMAL_INSTALL)
test -z "$(udevrulesdir)" || $(MKDIR_P) "$(DESTDIR)$(udevrulesdir)"
@list='$(udevrules_DATA)'; test -n "$(udevrulesdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(udevrulesdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(udevrulesdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@ -343,9 +377,7 @@ uninstall-udevrulesDATA:
@$(NORMAL_UNINSTALL)
@list='$(udevrules_DATA)'; test -n "$(udevrulesdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(udevrulesdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(udevrulesdir)" && rm -f $$files
dir='$(DESTDIR)$(udevrulesdir)'; $(am__uninstall_files_from_dir)
tags: TAGS
TAGS:
@ -400,10 +432,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:

View file

@ -51,6 +51,14 @@ ATTR{idVendor}=="0463", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROU
# various models - usbhid-ups
ATTR{idVendor}=="047c", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@"
# Riello (Cypress Semiconductor Corp.)
# various models - riello_usb
ATTR{idVendor}=="04b4", ATTR{idProduct}=="5500", MODE="664", GROUP="@RUN_AS_GROUP@"
# Minibox
# openUPS Intelligent UPS (minimum required firmware 1.4) - usbhid-ups
ATTR{idVendor}=="04d8", ATTR{idProduct}=="d004", MODE="664", GROUP="@RUN_AS_GROUP@"
# Belkin
# F6H375-USB - usbhid-ups
ATTR{idVendor}=="050d", ATTR{idProduct}=="0375", MODE="664", GROUP="@RUN_AS_GROUP@"
@ -164,6 +172,8 @@ ATTR{idVendor}=="09ae", ATTR{idProduct}=="3013", MODE="664", GROUP="@RUN_AS_GROU
ATTR{idVendor}=="09ae", ATTR{idProduct}=="3014", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. ? - usbhid-ups
ATTR{idVendor}=="09ae", ATTR{idProduct}=="3015", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite Smart1500LCD (newer unit) - usbhid-ups
ATTR{idVendor}=="09ae", ATTR{idProduct}=="3016", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) - usbhid-ups
ATTR{idVendor}=="09ae", ATTR{idProduct}=="4001", MODE="664", GROUP="@RUN_AS_GROUP@"
# e.g. TrippLite SmartOnline SU6000RT4U? - usbhid-ups

View file

@ -15,6 +15,7 @@ ENV{DEVTYPE}=="usb_interface", GOTO="up_hid_end"
ATTRS{idVendor}=="03f0", ENV{UPOWER_VENDOR}="Hewlett Packard"
ATTRS{idVendor}=="0463", ENV{UPOWER_VENDOR}="Eaton"
ATTRS{idVendor}=="047c", ENV{UPOWER_VENDOR}="Dell"
ATTRS{idVendor}=="04d8", ENV{UPOWER_VENDOR}="Minibox"
ATTRS{idVendor}=="050d", ENV{UPOWER_VENDOR}="Belkin"
ATTRS{idVendor}=="051d", ENV{UPOWER_VENDOR}="APC"
ATTRS{idVendor}=="0592", ENV{UPOWER_VENDOR}="Powerware"
@ -47,6 +48,9 @@ ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups
# Dell
ATTRS{idVendor}=="047c", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups"
# Minibox
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="d004", ENV{UPOWER_BATTERY_TYPE}="ups"
# Belkin
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{UPOWER_BATTERY_TYPE}="ups"
@ -99,6 +103,7 @@ ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3012", ENV{UPOWER_BATTERY_TYPE}="ups
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3013", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3014", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3015", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3016", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4001", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4002", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4003", ENV{UPOWER_BATTERY_TYPE}="ups"