Imported Upstream version 2.6.5
This commit is contained in:
parent
fefe62b2bd
commit
a1fa151fc7
201 changed files with 7974 additions and 709 deletions
|
@ -36,7 +36,7 @@ endif
|
|||
SERIAL_DRIVERLIST = bcmxcp belkin belkinunv bestfcom \
|
||||
bestfortress bestuferrups bestups dummy-ups etapro everups \
|
||||
gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \
|
||||
mge-shut mge-utalk microdowell newmge-shut oneac optiups powercom rhino \
|
||||
oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino \
|
||||
safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \
|
||||
blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old
|
||||
SNMP_DRIVERLIST = snmp-ups
|
||||
|
@ -46,9 +46,10 @@ USB_DRIVERLIST = $(USB_LIBUSB_DRIVERLIST)
|
|||
HAL_DRIVERLIST = hald-addon-usbhid-ups hald-addon-bcmxcp_usb \
|
||||
hald-addon-tripplite_usb hald-addon-blazer_usb
|
||||
NEONXML_DRIVERLIST = netxml-ups
|
||||
MACOSX_DRIVERLIST = macosx-ups
|
||||
|
||||
# distribute all drivers, even ones that are not built by default
|
||||
EXTRA_PROGRAMS = $(SERIAL_DRIVERLIST) $(SNMP_DRIVERLIST) $(USB_DRIVERLIST) $(NEONXML_DRIVERLIST)
|
||||
EXTRA_PROGRAMS = $(SERIAL_DRIVERLIST) $(SNMP_DRIVERLIST) $(USB_DRIVERLIST) $(NEONXML_DRIVERLIST) $(MACOSX_DRIVERLIST)
|
||||
|
||||
# construct the list of drivers to build
|
||||
if SOME_DRIVERS
|
||||
|
@ -77,6 +78,9 @@ endif
|
|||
if WITH_IPMI
|
||||
driverexec_PROGRAMS += nut-ipmipsu
|
||||
endif
|
||||
if WITH_MACOSX
|
||||
driverexec_PROGRAMS += $(MACOSX_DRIVERLIST)
|
||||
endif
|
||||
else
|
||||
driverexec_PROGRAMS += skel
|
||||
endif
|
||||
|
@ -114,7 +118,7 @@ liebert_SOURCES = liebert.c
|
|||
liebert_esp2_SOURCES = liebert-esp2.c
|
||||
masterguard_SOURCES = masterguard.c
|
||||
metasys_SOURCES = metasys.c
|
||||
mge_shut_SOURCES = mge-shut.c hidparser.c
|
||||
oldmge_shut_SOURCES = mge-shut.c hidparser.c
|
||||
mge_utalk_SOURCES = mge-utalk.c
|
||||
microdowell_SOURCES = microdowell.c
|
||||
oneac_SOURCES = oneac.c
|
||||
|
@ -174,10 +178,10 @@ richcomm_usb_SOURCES = richcomm_usb.c usb-common.c
|
|||
richcomm_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
|
||||
|
||||
# HID-over-serial
|
||||
newmge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c
|
||||
mge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c
|
||||
# per-target CFLAGS are necessary here
|
||||
newmge_shut_CFLAGS = $(AM_CFLAGS) -DSHUT_MODE
|
||||
newmge_shut_LDADD = $(LDADD)
|
||||
mge_shut_CFLAGS = $(AM_CFLAGS) -DSHUT_MODE
|
||||
mge_shut_LDADD = $(LDADD)
|
||||
|
||||
# SNMP
|
||||
snmp_ups_SOURCES = snmp-ups.c apc-mib.c baytech-mib.c compaq-mib.c eaton-mib.c \
|
||||
|
@ -214,6 +218,11 @@ if WITH_FREEIPMI
|
|||
endif
|
||||
nut_ipmipsu_LDADD = $(LDADD) $(LIBIPMI_LIBS)
|
||||
|
||||
# Mac OS X metadriver
|
||||
macosx_ups_LDADD = $(LDADD_DRIVERS)
|
||||
macosx_ups_LDFLAGS = $(LDFLAGS) -framework IOKit -framework CoreFoundation
|
||||
macosx_ups_SOURCES = macosx-ups.c
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# List of header files. The purpose of this list is not dependency
|
||||
# tracking (which is automatic), but to ensure these files are
|
||||
|
|
|
@ -45,27 +45,30 @@ target_triplet = @target@
|
|||
@WITH_LIBPOWERMAN_TRUE@am__append_5 = $(LIBPOWERMAN_CFLAGS)
|
||||
@WITH_IPMI_TRUE@am__append_6 = $(LIBIPMI_CFLAGS)
|
||||
EXTRA_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_4) \
|
||||
$(am__EXEEXT_5)
|
||||
@SOME_DRIVERS_FALSE@driverexec_PROGRAMS = $(am__EXEEXT_6) \
|
||||
@SOME_DRIVERS_FALSE@ $(am__EXEEXT_7) $(am__EXEEXT_8) \
|
||||
@SOME_DRIVERS_FALSE@ $(am__EXEEXT_9) $(am__EXEEXT_10) \
|
||||
@SOME_DRIVERS_FALSE@ $(am__EXEEXT_11) upsdrvctl$(EXEEXT)
|
||||
$(am__EXEEXT_5) $(am__EXEEXT_6)
|
||||
@SOME_DRIVERS_FALSE@driverexec_PROGRAMS = $(am__EXEEXT_7) \
|
||||
@SOME_DRIVERS_FALSE@ $(am__EXEEXT_8) $(am__EXEEXT_9) \
|
||||
@SOME_DRIVERS_FALSE@ $(am__EXEEXT_10) $(am__EXEEXT_11) \
|
||||
@SOME_DRIVERS_FALSE@ $(am__EXEEXT_12) $(am__EXEEXT_13) \
|
||||
@SOME_DRIVERS_FALSE@ upsdrvctl$(EXEEXT)
|
||||
@SOME_DRIVERS_TRUE@driverexec_PROGRAMS = $(DRIVER_BUILD_LIST) \
|
||||
@SOME_DRIVERS_TRUE@ $(am__EXEEXT_6) $(am__EXEEXT_7) \
|
||||
@SOME_DRIVERS_TRUE@ $(am__EXEEXT_8) $(am__EXEEXT_9) \
|
||||
@SOME_DRIVERS_TRUE@ $(am__EXEEXT_10) $(am__EXEEXT_11) \
|
||||
@SOME_DRIVERS_TRUE@ skel$(EXEEXT) upsdrvctl$(EXEEXT)
|
||||
@SOME_DRIVERS_TRUE@ $(am__EXEEXT_7) $(am__EXEEXT_8) \
|
||||
@SOME_DRIVERS_TRUE@ $(am__EXEEXT_9) $(am__EXEEXT_10) \
|
||||
@SOME_DRIVERS_TRUE@ $(am__EXEEXT_11) $(am__EXEEXT_12) \
|
||||
@SOME_DRIVERS_TRUE@ $(am__EXEEXT_13) skel$(EXEEXT) \
|
||||
@SOME_DRIVERS_TRUE@ upsdrvctl$(EXEEXT)
|
||||
@SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__append_7 = $(SERIAL_DRIVERLIST)
|
||||
@SOME_DRIVERS_FALSE@@WITH_SNMP_TRUE@am__append_8 = $(SNMP_DRIVERLIST)
|
||||
@SOME_DRIVERS_FALSE@@WITH_USB_TRUE@am__append_9 = $(USB_LIBUSB_DRIVERLIST)
|
||||
@SOME_DRIVERS_FALSE@@WITH_HAL_TRUE@halexec_PROGRAMS = \
|
||||
@SOME_DRIVERS_FALSE@@WITH_HAL_TRUE@ $(am__EXEEXT_12)
|
||||
@SOME_DRIVERS_FALSE@@WITH_HAL_TRUE@ $(am__EXEEXT_14)
|
||||
@SOME_DRIVERS_FALSE@@WITH_NEON_TRUE@am__append_10 = $(NEONXML_DRIVERLIST)
|
||||
@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__append_11 = powerman-pdu
|
||||
@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@am__append_12 = nut-ipmipsu
|
||||
@WITH_SSL_TRUE@am__append_13 = $(LIBSSL_CFLAGS)
|
||||
@WITH_SSL_TRUE@am__append_14 = $(LIBSSL_LIBS)
|
||||
@WITH_FREEIPMI_TRUE@am__append_15 = nut-libfreeipmi.c
|
||||
@SOME_DRIVERS_FALSE@@WITH_MACOSX_TRUE@am__append_13 = $(MACOSX_DRIVERLIST)
|
||||
@WITH_SSL_TRUE@am__append_14 = $(LIBSSL_CFLAGS)
|
||||
@WITH_SSL_TRUE@am__append_15 = $(LIBSSL_LIBS)
|
||||
@WITH_FREEIPMI_TRUE@am__append_16 = nut-libfreeipmi.c
|
||||
subdir = drivers
|
||||
DIST_COMMON = $(dist_noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
|
@ -114,8 +117,8 @@ am__EXEEXT_1 = bcmxcp$(EXEEXT) belkin$(EXEEXT) belkinunv$(EXEEXT) \
|
|||
bestups$(EXEEXT) dummy-ups$(EXEEXT) etapro$(EXEEXT) \
|
||||
everups$(EXEEXT) gamatronic$(EXEEXT) genericups$(EXEEXT) \
|
||||
isbmex$(EXEEXT) liebert$(EXEEXT) liebert-esp2$(EXEEXT) \
|
||||
masterguard$(EXEEXT) metasys$(EXEEXT) mge-shut$(EXEEXT) \
|
||||
mge-utalk$(EXEEXT) microdowell$(EXEEXT) newmge-shut$(EXEEXT) \
|
||||
masterguard$(EXEEXT) metasys$(EXEEXT) oldmge-shut$(EXEEXT) \
|
||||
mge-utalk$(EXEEXT) microdowell$(EXEEXT) mge-shut$(EXEEXT) \
|
||||
oneac$(EXEEXT) optiups$(EXEEXT) powercom$(EXEEXT) \
|
||||
rhino$(EXEEXT) safenet$(EXEEXT) skel$(EXEEXT) solis$(EXEEXT) \
|
||||
tripplite$(EXEEXT) tripplitesu$(EXEEXT) upscode2$(EXEEXT) \
|
||||
|
@ -128,16 +131,18 @@ am__EXEEXT_3 = usbhid-ups$(EXEEXT) bcmxcp_usb$(EXEEXT) \
|
|||
richcomm_usb$(EXEEXT)
|
||||
am__EXEEXT_4 = $(am__EXEEXT_3)
|
||||
am__EXEEXT_5 = netxml-ups$(EXEEXT)
|
||||
@SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__EXEEXT_6 = $(am__EXEEXT_1)
|
||||
@SOME_DRIVERS_FALSE@@WITH_SNMP_TRUE@am__EXEEXT_7 = $(am__EXEEXT_2)
|
||||
@SOME_DRIVERS_FALSE@@WITH_USB_TRUE@am__EXEEXT_8 = $(am__EXEEXT_3)
|
||||
@SOME_DRIVERS_FALSE@@WITH_NEON_TRUE@am__EXEEXT_9 = $(am__EXEEXT_5)
|
||||
@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__EXEEXT_10 = powerman-pdu$(EXEEXT)
|
||||
@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@am__EXEEXT_11 = \
|
||||
am__EXEEXT_6 = macosx-ups$(EXEEXT)
|
||||
@SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__EXEEXT_7 = $(am__EXEEXT_1)
|
||||
@SOME_DRIVERS_FALSE@@WITH_SNMP_TRUE@am__EXEEXT_8 = $(am__EXEEXT_2)
|
||||
@SOME_DRIVERS_FALSE@@WITH_USB_TRUE@am__EXEEXT_9 = $(am__EXEEXT_3)
|
||||
@SOME_DRIVERS_FALSE@@WITH_NEON_TRUE@am__EXEEXT_10 = $(am__EXEEXT_5)
|
||||
@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__EXEEXT_11 = powerman-pdu$(EXEEXT)
|
||||
@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@am__EXEEXT_12 = \
|
||||
@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@ nut-ipmipsu$(EXEEXT)
|
||||
@SOME_DRIVERS_FALSE@@WITH_MACOSX_TRUE@am__EXEEXT_13 = $(am__EXEEXT_6)
|
||||
am__installdirs = "$(DESTDIR)$(driverexecdir)" \
|
||||
"$(DESTDIR)$(halexecdir)"
|
||||
am__EXEEXT_12 = hald-addon-usbhid-ups$(EXEEXT) \
|
||||
am__EXEEXT_14 = hald-addon-usbhid-ups$(EXEEXT) \
|
||||
hald-addon-bcmxcp_usb$(EXEEXT) \
|
||||
hald-addon-tripplite_usb$(EXEEXT) \
|
||||
hald-addon-blazer_usb$(EXEEXT)
|
||||
|
@ -264,6 +269,12 @@ am_liebert_esp2_OBJECTS = liebert-esp2.$(OBJEXT)
|
|||
liebert_esp2_OBJECTS = $(am_liebert_esp2_OBJECTS)
|
||||
liebert_esp2_LDADD = $(LDADD)
|
||||
liebert_esp2_DEPENDENCIES = $(am__DEPENDENCIES_2)
|
||||
am_macosx_ups_OBJECTS = macosx-ups.$(OBJEXT)
|
||||
macosx_ups_OBJECTS = $(am_macosx_ups_OBJECTS)
|
||||
macosx_ups_DEPENDENCIES = $(LDADD_DRIVERS)
|
||||
macosx_ups_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(macosx_ups_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_masterguard_OBJECTS = masterguard.$(OBJEXT)
|
||||
masterguard_OBJECTS = $(am_masterguard_OBJECTS)
|
||||
masterguard_LDADD = $(LDADD)
|
||||
|
@ -272,10 +283,14 @@ am_metasys_OBJECTS = metasys.$(OBJEXT)
|
|||
metasys_OBJECTS = $(am_metasys_OBJECTS)
|
||||
metasys_LDADD = $(LDADD)
|
||||
metasys_DEPENDENCIES = $(am__DEPENDENCIES_2)
|
||||
am_mge_shut_OBJECTS = mge-shut.$(OBJEXT) hidparser.$(OBJEXT)
|
||||
am_mge_shut_OBJECTS = mge_shut-usbhid-ups.$(OBJEXT) \
|
||||
mge_shut-libshut.$(OBJEXT) mge_shut-libhid.$(OBJEXT) \
|
||||
mge_shut-hidparser.$(OBJEXT) mge_shut-mge-hid.$(OBJEXT)
|
||||
mge_shut_OBJECTS = $(am_mge_shut_OBJECTS)
|
||||
mge_shut_LDADD = $(LDADD)
|
||||
mge_shut_DEPENDENCIES = $(am__DEPENDENCIES_2)
|
||||
mge_shut_DEPENDENCIES = $(am__DEPENDENCIES_3)
|
||||
mge_shut_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(mge_shut_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
am_mge_utalk_OBJECTS = mge-utalk.$(OBJEXT)
|
||||
mge_utalk_OBJECTS = $(am_mge_utalk_OBJECTS)
|
||||
mge_utalk_LDADD = $(LDADD)
|
||||
|
@ -287,19 +302,15 @@ microdowell_DEPENDENCIES = $(am__DEPENDENCIES_2)
|
|||
am_netxml_ups_OBJECTS = netxml-ups.$(OBJEXT) mge-xml.$(OBJEXT)
|
||||
netxml_ups_OBJECTS = $(am_netxml_ups_OBJECTS)
|
||||
netxml_ups_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1)
|
||||
am_newmge_shut_OBJECTS = newmge_shut-usbhid-ups.$(OBJEXT) \
|
||||
newmge_shut-libshut.$(OBJEXT) newmge_shut-libhid.$(OBJEXT) \
|
||||
newmge_shut-hidparser.$(OBJEXT) newmge_shut-mge-hid.$(OBJEXT)
|
||||
newmge_shut_OBJECTS = $(am_newmge_shut_OBJECTS)
|
||||
newmge_shut_DEPENDENCIES = $(am__DEPENDENCIES_3)
|
||||
newmge_shut_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(newmge_shut_CFLAGS) \
|
||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am__nut_ipmipsu_SOURCES_DIST = nut-ipmipsu.c nut-libfreeipmi.c
|
||||
@WITH_FREEIPMI_TRUE@am__objects_2 = nut-libfreeipmi.$(OBJEXT)
|
||||
am_nut_ipmipsu_OBJECTS = nut-ipmipsu.$(OBJEXT) $(am__objects_2)
|
||||
nut_ipmipsu_OBJECTS = $(am_nut_ipmipsu_OBJECTS)
|
||||
nut_ipmipsu_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1)
|
||||
am_oldmge_shut_OBJECTS = mge-shut.$(OBJEXT) hidparser.$(OBJEXT)
|
||||
oldmge_shut_OBJECTS = $(am_oldmge_shut_OBJECTS)
|
||||
oldmge_shut_LDADD = $(LDADD)
|
||||
oldmge_shut_DEPENDENCIES = $(am__DEPENDENCIES_2)
|
||||
am_oneac_OBJECTS = oneac.$(OBJEXT)
|
||||
oneac_OBJECTS = $(am_oneac_OBJECTS)
|
||||
oneac_LDADD = $(LDADD)
|
||||
|
@ -394,11 +405,11 @@ SOURCES = $(libdummy_a_SOURCES) $(libnuthalmain_a_SOURCES) \
|
|||
$(hald_addon_tripplite_usb_SOURCES) \
|
||||
$(hald_addon_usbhid_ups_SOURCES) $(isbmex_SOURCES) \
|
||||
$(ivtscd_SOURCES) $(liebert_SOURCES) $(liebert_esp2_SOURCES) \
|
||||
$(masterguard_SOURCES) $(metasys_SOURCES) $(mge_shut_SOURCES) \
|
||||
$(mge_utalk_SOURCES) $(microdowell_SOURCES) \
|
||||
$(netxml_ups_SOURCES) $(newmge_shut_SOURCES) \
|
||||
$(nut_ipmipsu_SOURCES) $(oneac_SOURCES) $(optiups_SOURCES) \
|
||||
$(powercom_SOURCES) $(powerman_pdu_SOURCES) \
|
||||
$(macosx_ups_SOURCES) $(masterguard_SOURCES) \
|
||||
$(metasys_SOURCES) $(mge_shut_SOURCES) $(mge_utalk_SOURCES) \
|
||||
$(microdowell_SOURCES) $(netxml_ups_SOURCES) \
|
||||
$(nut_ipmipsu_SOURCES) $(oldmge_shut_SOURCES) $(oneac_SOURCES) \
|
||||
$(optiups_SOURCES) $(powercom_SOURCES) $(powerman_pdu_SOURCES) \
|
||||
$(powerpanel_SOURCES) $(rhino_SOURCES) $(richcomm_usb_SOURCES) \
|
||||
$(safenet_SOURCES) $(skel_SOURCES) $(snmp_ups_SOURCES) \
|
||||
$(solis_SOURCES) $(tripplite_SOURCES) $(tripplite_usb_SOURCES) \
|
||||
|
@ -417,16 +428,16 @@ DIST_SOURCES = $(libdummy_a_SOURCES) $(libnuthalmain_a_SOURCES) \
|
|||
$(hald_addon_tripplite_usb_SOURCES) \
|
||||
$(hald_addon_usbhid_ups_SOURCES) $(isbmex_SOURCES) \
|
||||
$(ivtscd_SOURCES) $(liebert_SOURCES) $(liebert_esp2_SOURCES) \
|
||||
$(masterguard_SOURCES) $(metasys_SOURCES) $(mge_shut_SOURCES) \
|
||||
$(mge_utalk_SOURCES) $(microdowell_SOURCES) \
|
||||
$(netxml_ups_SOURCES) $(newmge_shut_SOURCES) \
|
||||
$(am__nut_ipmipsu_SOURCES_DIST) $(oneac_SOURCES) \
|
||||
$(optiups_SOURCES) $(powercom_SOURCES) $(powerman_pdu_SOURCES) \
|
||||
$(powerpanel_SOURCES) $(rhino_SOURCES) $(richcomm_usb_SOURCES) \
|
||||
$(safenet_SOURCES) $(skel_SOURCES) $(snmp_ups_SOURCES) \
|
||||
$(solis_SOURCES) $(tripplite_SOURCES) $(tripplite_usb_SOURCES) \
|
||||
$(tripplitesu_SOURCES) $(upscode2_SOURCES) \
|
||||
$(upsdrvctl_SOURCES) $(usbhid_ups_SOURCES) \
|
||||
$(macosx_ups_SOURCES) $(masterguard_SOURCES) \
|
||||
$(metasys_SOURCES) $(mge_shut_SOURCES) $(mge_utalk_SOURCES) \
|
||||
$(microdowell_SOURCES) $(netxml_ups_SOURCES) \
|
||||
$(am__nut_ipmipsu_SOURCES_DIST) $(oldmge_shut_SOURCES) \
|
||||
$(oneac_SOURCES) $(optiups_SOURCES) $(powercom_SOURCES) \
|
||||
$(powerman_pdu_SOURCES) $(powerpanel_SOURCES) $(rhino_SOURCES) \
|
||||
$(richcomm_usb_SOURCES) $(safenet_SOURCES) $(skel_SOURCES) \
|
||||
$(snmp_ups_SOURCES) $(solis_SOURCES) $(tripplite_SOURCES) \
|
||||
$(tripplite_usb_SOURCES) $(tripplitesu_SOURCES) \
|
||||
$(upscode2_SOURCES) $(upsdrvctl_SOURCES) $(usbhid_ups_SOURCES) \
|
||||
$(victronups_SOURCES)
|
||||
HEADERS = $(dist_noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
|
@ -448,6 +459,12 @@ CFLAGS = @CFLAGS@
|
|||
CONFPATH = @CONFPATH@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
|
||||
CPPUNIT_LIBS = @CPPUNIT_LIBS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DBLATEX = @DBLATEX@
|
||||
DEFS = @DEFS@
|
||||
|
@ -551,6 +568,7 @@ abs_top_builddir = @abs_top_builddir@
|
|||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
|
@ -628,7 +646,7 @@ AM_CFLAGS = -I$(top_srcdir)/include $(am__append_1) $(am__append_2) \
|
|||
SERIAL_DRIVERLIST = bcmxcp belkin belkinunv bestfcom \
|
||||
bestfortress bestuferrups bestups dummy-ups etapro everups \
|
||||
gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \
|
||||
mge-shut mge-utalk microdowell newmge-shut oneac optiups powercom rhino \
|
||||
oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino \
|
||||
safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \
|
||||
blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old
|
||||
|
||||
|
@ -641,6 +659,7 @@ HAL_DRIVERLIST = hald-addon-usbhid-ups hald-addon-bcmxcp_usb \
|
|||
hald-addon-tripplite_usb hald-addon-blazer_usb
|
||||
|
||||
NEONXML_DRIVERLIST = netxml-ups
|
||||
MACOSX_DRIVERLIST = macosx-ups
|
||||
@SOME_DRIVERS_FALSE@@WITH_HAL_TRUE@halexecdir = $(HAL_CALLOUTS_PATH)
|
||||
|
||||
# ==========================================================================
|
||||
|
@ -673,7 +692,7 @@ liebert_SOURCES = liebert.c
|
|||
liebert_esp2_SOURCES = liebert-esp2.c
|
||||
masterguard_SOURCES = masterguard.c
|
||||
metasys_SOURCES = metasys.c
|
||||
mge_shut_SOURCES = mge-shut.c hidparser.c
|
||||
oldmge_shut_SOURCES = mge-shut.c hidparser.c
|
||||
mge_utalk_SOURCES = mge-utalk.c
|
||||
microdowell_SOURCES = microdowell.c
|
||||
oneac_SOURCES = oneac.c
|
||||
|
@ -698,9 +717,9 @@ victronups_SOURCES = victronups.c
|
|||
# dummy
|
||||
dummy_ups_SOURCES = dummy-ups.c
|
||||
dummy_ups_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/clients \
|
||||
$(am__append_13)
|
||||
dummy_ups_LDADD = $(LDADD_DRIVERS) ../clients/libupsclient.la \
|
||||
$(am__append_14)
|
||||
dummy_ups_LDADD = $(LDADD_DRIVERS) ../clients/libupsclient.la \
|
||||
$(am__append_15)
|
||||
|
||||
# Clone drivers
|
||||
clone_SOURCES = clone.c
|
||||
|
@ -728,10 +747,10 @@ richcomm_usb_SOURCES = richcomm_usb.c usb-common.c
|
|||
richcomm_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
|
||||
|
||||
# HID-over-serial
|
||||
newmge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c
|
||||
mge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c
|
||||
# per-target CFLAGS are necessary here
|
||||
newmge_shut_CFLAGS = $(AM_CFLAGS) -DSHUT_MODE
|
||||
newmge_shut_LDADD = $(LDADD)
|
||||
mge_shut_CFLAGS = $(AM_CFLAGS) -DSHUT_MODE
|
||||
mge_shut_LDADD = $(LDADD)
|
||||
|
||||
# SNMP
|
||||
snmp_ups_SOURCES = snmp-ups.c apc-mib.c baytech-mib.c compaq-mib.c eaton-mib.c \
|
||||
|
@ -761,9 +780,14 @@ powerman_pdu_SOURCES = powerman-pdu.c
|
|||
powerman_pdu_LDADD = $(LDADD) $(LIBPOWERMAN_LIBS)
|
||||
|
||||
# IPMI PSU
|
||||
nut_ipmipsu_SOURCES = nut-ipmipsu.c $(am__append_15)
|
||||
nut_ipmipsu_SOURCES = nut-ipmipsu.c $(am__append_16)
|
||||
nut_ipmipsu_LDADD = $(LDADD) $(LIBIPMI_LIBS)
|
||||
|
||||
# Mac OS X metadriver
|
||||
macosx_ups_LDADD = $(LDADD_DRIVERS)
|
||||
macosx_ups_LDFLAGS = $(LDFLAGS) -framework IOKit -framework CoreFoundation
|
||||
macosx_ups_SOURCES = macosx-ups.c
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# List of header files. The purpose of this list is not dependency
|
||||
# tracking (which is automatic), but to ensure these files are
|
||||
|
@ -1001,6 +1025,9 @@ liebert$(EXEEXT): $(liebert_OBJECTS) $(liebert_DEPENDENCIES)
|
|||
liebert-esp2$(EXEEXT): $(liebert_esp2_OBJECTS) $(liebert_esp2_DEPENDENCIES)
|
||||
@rm -f liebert-esp2$(EXEEXT)
|
||||
$(LINK) $(liebert_esp2_OBJECTS) $(liebert_esp2_LDADD) $(LIBS)
|
||||
macosx-ups$(EXEEXT): $(macosx_ups_OBJECTS) $(macosx_ups_DEPENDENCIES)
|
||||
@rm -f macosx-ups$(EXEEXT)
|
||||
$(macosx_ups_LINK) $(macosx_ups_OBJECTS) $(macosx_ups_LDADD) $(LIBS)
|
||||
masterguard$(EXEEXT): $(masterguard_OBJECTS) $(masterguard_DEPENDENCIES)
|
||||
@rm -f masterguard$(EXEEXT)
|
||||
$(LINK) $(masterguard_OBJECTS) $(masterguard_LDADD) $(LIBS)
|
||||
|
@ -1009,7 +1036,7 @@ metasys$(EXEEXT): $(metasys_OBJECTS) $(metasys_DEPENDENCIES)
|
|||
$(LINK) $(metasys_OBJECTS) $(metasys_LDADD) $(LIBS)
|
||||
mge-shut$(EXEEXT): $(mge_shut_OBJECTS) $(mge_shut_DEPENDENCIES)
|
||||
@rm -f mge-shut$(EXEEXT)
|
||||
$(LINK) $(mge_shut_OBJECTS) $(mge_shut_LDADD) $(LIBS)
|
||||
$(mge_shut_LINK) $(mge_shut_OBJECTS) $(mge_shut_LDADD) $(LIBS)
|
||||
mge-utalk$(EXEEXT): $(mge_utalk_OBJECTS) $(mge_utalk_DEPENDENCIES)
|
||||
@rm -f mge-utalk$(EXEEXT)
|
||||
$(LINK) $(mge_utalk_OBJECTS) $(mge_utalk_LDADD) $(LIBS)
|
||||
|
@ -1019,12 +1046,12 @@ microdowell$(EXEEXT): $(microdowell_OBJECTS) $(microdowell_DEPENDENCIES)
|
|||
netxml-ups$(EXEEXT): $(netxml_ups_OBJECTS) $(netxml_ups_DEPENDENCIES)
|
||||
@rm -f netxml-ups$(EXEEXT)
|
||||
$(LINK) $(netxml_ups_OBJECTS) $(netxml_ups_LDADD) $(LIBS)
|
||||
newmge-shut$(EXEEXT): $(newmge_shut_OBJECTS) $(newmge_shut_DEPENDENCIES)
|
||||
@rm -f newmge-shut$(EXEEXT)
|
||||
$(newmge_shut_LINK) $(newmge_shut_OBJECTS) $(newmge_shut_LDADD) $(LIBS)
|
||||
nut-ipmipsu$(EXEEXT): $(nut_ipmipsu_OBJECTS) $(nut_ipmipsu_DEPENDENCIES)
|
||||
@rm -f nut-ipmipsu$(EXEEXT)
|
||||
$(LINK) $(nut_ipmipsu_OBJECTS) $(nut_ipmipsu_LDADD) $(LIBS)
|
||||
oldmge-shut$(EXEEXT): $(oldmge_shut_OBJECTS) $(oldmge_shut_DEPENDENCIES)
|
||||
@rm -f oldmge-shut$(EXEEXT)
|
||||
$(LINK) $(oldmge_shut_OBJECTS) $(oldmge_shut_LDADD) $(LIBS)
|
||||
oneac$(EXEEXT): $(oneac_OBJECTS) $(oneac_DEPENDENCIES)
|
||||
@rm -f oneac$(EXEEXT)
|
||||
$(LINK) $(oneac_OBJECTS) $(oneac_LDADD) $(LIBS)
|
||||
|
@ -1130,6 +1157,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liebert-esp2.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liebert-hid.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liebert.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/macosx-ups.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main-hal.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/masterguard.Po@am__quote@
|
||||
|
@ -1139,14 +1167,14 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-shut.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-utalk.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-xml.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-hidparser.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-libhid.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-libshut.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-mge-hid.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-usbhid-ups.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/microdowell.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netvision-mib.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netxml-ups.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newmge_shut-hidparser.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newmge_shut-libhid.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newmge_shut-libshut.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newmge_shut-mge-hid.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newmge_shut-usbhid-ups.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nut-ipmipsu.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nut-libfreeipmi.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oneac.Po@am__quote@
|
||||
|
@ -1211,75 +1239,75 @@ dummy_ups-dummy-ups.obj: dummy-ups.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dummy_ups_CFLAGS) $(CFLAGS) -c -o dummy_ups-dummy-ups.obj `if test -f 'dummy-ups.c'; then $(CYGPATH_W) 'dummy-ups.c'; else $(CYGPATH_W) '$(srcdir)/dummy-ups.c'; fi`
|
||||
|
||||
newmge_shut-usbhid-ups.o: usbhid-ups.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-usbhid-ups.o -MD -MP -MF $(DEPDIR)/newmge_shut-usbhid-ups.Tpo -c -o newmge_shut-usbhid-ups.o `test -f 'usbhid-ups.c' || echo '$(srcdir)/'`usbhid-ups.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-usbhid-ups.Tpo $(DEPDIR)/newmge_shut-usbhid-ups.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usbhid-ups.c' object='newmge_shut-usbhid-ups.o' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-usbhid-ups.o: usbhid-ups.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-usbhid-ups.o -MD -MP -MF $(DEPDIR)/mge_shut-usbhid-ups.Tpo -c -o mge_shut-usbhid-ups.o `test -f 'usbhid-ups.c' || echo '$(srcdir)/'`usbhid-ups.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-usbhid-ups.Tpo $(DEPDIR)/mge_shut-usbhid-ups.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usbhid-ups.c' object='mge_shut-usbhid-ups.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-usbhid-ups.o `test -f 'usbhid-ups.c' || echo '$(srcdir)/'`usbhid-ups.c
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-usbhid-ups.o `test -f 'usbhid-ups.c' || echo '$(srcdir)/'`usbhid-ups.c
|
||||
|
||||
newmge_shut-usbhid-ups.obj: usbhid-ups.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-usbhid-ups.obj -MD -MP -MF $(DEPDIR)/newmge_shut-usbhid-ups.Tpo -c -o newmge_shut-usbhid-ups.obj `if test -f 'usbhid-ups.c'; then $(CYGPATH_W) 'usbhid-ups.c'; else $(CYGPATH_W) '$(srcdir)/usbhid-ups.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-usbhid-ups.Tpo $(DEPDIR)/newmge_shut-usbhid-ups.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usbhid-ups.c' object='newmge_shut-usbhid-ups.obj' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-usbhid-ups.obj: usbhid-ups.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-usbhid-ups.obj -MD -MP -MF $(DEPDIR)/mge_shut-usbhid-ups.Tpo -c -o mge_shut-usbhid-ups.obj `if test -f 'usbhid-ups.c'; then $(CYGPATH_W) 'usbhid-ups.c'; else $(CYGPATH_W) '$(srcdir)/usbhid-ups.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-usbhid-ups.Tpo $(DEPDIR)/mge_shut-usbhid-ups.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usbhid-ups.c' object='mge_shut-usbhid-ups.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-usbhid-ups.obj `if test -f 'usbhid-ups.c'; then $(CYGPATH_W) 'usbhid-ups.c'; else $(CYGPATH_W) '$(srcdir)/usbhid-ups.c'; fi`
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-usbhid-ups.obj `if test -f 'usbhid-ups.c'; then $(CYGPATH_W) 'usbhid-ups.c'; else $(CYGPATH_W) '$(srcdir)/usbhid-ups.c'; fi`
|
||||
|
||||
newmge_shut-libshut.o: libshut.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-libshut.o -MD -MP -MF $(DEPDIR)/newmge_shut-libshut.Tpo -c -o newmge_shut-libshut.o `test -f 'libshut.c' || echo '$(srcdir)/'`libshut.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-libshut.Tpo $(DEPDIR)/newmge_shut-libshut.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libshut.c' object='newmge_shut-libshut.o' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-libshut.o: libshut.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libshut.o -MD -MP -MF $(DEPDIR)/mge_shut-libshut.Tpo -c -o mge_shut-libshut.o `test -f 'libshut.c' || echo '$(srcdir)/'`libshut.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-libshut.Tpo $(DEPDIR)/mge_shut-libshut.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libshut.c' object='mge_shut-libshut.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-libshut.o `test -f 'libshut.c' || echo '$(srcdir)/'`libshut.c
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libshut.o `test -f 'libshut.c' || echo '$(srcdir)/'`libshut.c
|
||||
|
||||
newmge_shut-libshut.obj: libshut.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-libshut.obj -MD -MP -MF $(DEPDIR)/newmge_shut-libshut.Tpo -c -o newmge_shut-libshut.obj `if test -f 'libshut.c'; then $(CYGPATH_W) 'libshut.c'; else $(CYGPATH_W) '$(srcdir)/libshut.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-libshut.Tpo $(DEPDIR)/newmge_shut-libshut.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libshut.c' object='newmge_shut-libshut.obj' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-libshut.obj: libshut.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libshut.obj -MD -MP -MF $(DEPDIR)/mge_shut-libshut.Tpo -c -o mge_shut-libshut.obj `if test -f 'libshut.c'; then $(CYGPATH_W) 'libshut.c'; else $(CYGPATH_W) '$(srcdir)/libshut.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-libshut.Tpo $(DEPDIR)/mge_shut-libshut.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libshut.c' object='mge_shut-libshut.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-libshut.obj `if test -f 'libshut.c'; then $(CYGPATH_W) 'libshut.c'; else $(CYGPATH_W) '$(srcdir)/libshut.c'; fi`
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libshut.obj `if test -f 'libshut.c'; then $(CYGPATH_W) 'libshut.c'; else $(CYGPATH_W) '$(srcdir)/libshut.c'; fi`
|
||||
|
||||
newmge_shut-libhid.o: libhid.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-libhid.o -MD -MP -MF $(DEPDIR)/newmge_shut-libhid.Tpo -c -o newmge_shut-libhid.o `test -f 'libhid.c' || echo '$(srcdir)/'`libhid.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-libhid.Tpo $(DEPDIR)/newmge_shut-libhid.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libhid.c' object='newmge_shut-libhid.o' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-libhid.o: libhid.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libhid.o -MD -MP -MF $(DEPDIR)/mge_shut-libhid.Tpo -c -o mge_shut-libhid.o `test -f 'libhid.c' || echo '$(srcdir)/'`libhid.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-libhid.Tpo $(DEPDIR)/mge_shut-libhid.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libhid.c' object='mge_shut-libhid.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-libhid.o `test -f 'libhid.c' || echo '$(srcdir)/'`libhid.c
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libhid.o `test -f 'libhid.c' || echo '$(srcdir)/'`libhid.c
|
||||
|
||||
newmge_shut-libhid.obj: libhid.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-libhid.obj -MD -MP -MF $(DEPDIR)/newmge_shut-libhid.Tpo -c -o newmge_shut-libhid.obj `if test -f 'libhid.c'; then $(CYGPATH_W) 'libhid.c'; else $(CYGPATH_W) '$(srcdir)/libhid.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-libhid.Tpo $(DEPDIR)/newmge_shut-libhid.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libhid.c' object='newmge_shut-libhid.obj' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-libhid.obj: libhid.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libhid.obj -MD -MP -MF $(DEPDIR)/mge_shut-libhid.Tpo -c -o mge_shut-libhid.obj `if test -f 'libhid.c'; then $(CYGPATH_W) 'libhid.c'; else $(CYGPATH_W) '$(srcdir)/libhid.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-libhid.Tpo $(DEPDIR)/mge_shut-libhid.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libhid.c' object='mge_shut-libhid.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-libhid.obj `if test -f 'libhid.c'; then $(CYGPATH_W) 'libhid.c'; else $(CYGPATH_W) '$(srcdir)/libhid.c'; fi`
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libhid.obj `if test -f 'libhid.c'; then $(CYGPATH_W) 'libhid.c'; else $(CYGPATH_W) '$(srcdir)/libhid.c'; fi`
|
||||
|
||||
newmge_shut-hidparser.o: hidparser.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-hidparser.o -MD -MP -MF $(DEPDIR)/newmge_shut-hidparser.Tpo -c -o newmge_shut-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-hidparser.Tpo $(DEPDIR)/newmge_shut-hidparser.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hidparser.c' object='newmge_shut-hidparser.o' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-hidparser.o: hidparser.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-hidparser.o -MD -MP -MF $(DEPDIR)/mge_shut-hidparser.Tpo -c -o mge_shut-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-hidparser.Tpo $(DEPDIR)/mge_shut-hidparser.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hidparser.c' object='mge_shut-hidparser.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c
|
||||
|
||||
newmge_shut-hidparser.obj: hidparser.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-hidparser.obj -MD -MP -MF $(DEPDIR)/newmge_shut-hidparser.Tpo -c -o newmge_shut-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-hidparser.Tpo $(DEPDIR)/newmge_shut-hidparser.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hidparser.c' object='newmge_shut-hidparser.obj' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-hidparser.obj: hidparser.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-hidparser.obj -MD -MP -MF $(DEPDIR)/mge_shut-hidparser.Tpo -c -o mge_shut-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-hidparser.Tpo $(DEPDIR)/mge_shut-hidparser.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hidparser.c' object='mge_shut-hidparser.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi`
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi`
|
||||
|
||||
newmge_shut-mge-hid.o: mge-hid.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-mge-hid.o -MD -MP -MF $(DEPDIR)/newmge_shut-mge-hid.Tpo -c -o newmge_shut-mge-hid.o `test -f 'mge-hid.c' || echo '$(srcdir)/'`mge-hid.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-mge-hid.Tpo $(DEPDIR)/newmge_shut-mge-hid.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mge-hid.c' object='newmge_shut-mge-hid.o' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-mge-hid.o: mge-hid.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-mge-hid.o -MD -MP -MF $(DEPDIR)/mge_shut-mge-hid.Tpo -c -o mge_shut-mge-hid.o `test -f 'mge-hid.c' || echo '$(srcdir)/'`mge-hid.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-mge-hid.Tpo $(DEPDIR)/mge_shut-mge-hid.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mge-hid.c' object='mge_shut-mge-hid.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-mge-hid.o `test -f 'mge-hid.c' || echo '$(srcdir)/'`mge-hid.c
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-mge-hid.o `test -f 'mge-hid.c' || echo '$(srcdir)/'`mge-hid.c
|
||||
|
||||
newmge_shut-mge-hid.obj: mge-hid.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-mge-hid.obj -MD -MP -MF $(DEPDIR)/newmge_shut-mge-hid.Tpo -c -o newmge_shut-mge-hid.obj `if test -f 'mge-hid.c'; then $(CYGPATH_W) 'mge-hid.c'; else $(CYGPATH_W) '$(srcdir)/mge-hid.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-mge-hid.Tpo $(DEPDIR)/newmge_shut-mge-hid.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mge-hid.c' object='newmge_shut-mge-hid.obj' libtool=no @AMDEPBACKSLASH@
|
||||
mge_shut-mge-hid.obj: mge-hid.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-mge-hid.obj -MD -MP -MF $(DEPDIR)/mge_shut-mge-hid.Tpo -c -o mge_shut-mge-hid.obj `if test -f 'mge-hid.c'; then $(CYGPATH_W) 'mge-hid.c'; else $(CYGPATH_W) '$(srcdir)/mge-hid.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-mge-hid.Tpo $(DEPDIR)/mge_shut-mge-hid.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mge-hid.c' object='mge_shut-mge-hid.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -c -o newmge_shut-mge-hid.obj `if test -f 'mge-hid.c'; then $(CYGPATH_W) 'mge-hid.c'; else $(CYGPATH_W) '$(srcdir)/mge-hid.c'; fi`
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-mge-hid.obj `if test -f 'mge-hid.c'; then $(CYGPATH_W) 'mge-hid.c'; else $(CYGPATH_W) '$(srcdir)/mge-hid.c'; fi`
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* apc-mib.c - data to monitor APC SNMP devices (Powernet MIB) with NUT
|
||||
*
|
||||
* Copyright (C) 2002-2003
|
||||
* Dmitry Frolov <frolov@riss-telecom.ru>
|
||||
* Arnaud Quette <arnaud.quette@free.fr>
|
||||
* Copyright (C)
|
||||
* 2002-2003 - Dmitry Frolov <frolov@riss-telecom.ru>
|
||||
* 2002-2012 - Arnaud Quette <arnaud.quette@free.fr>
|
||||
* 2012 - Chew Hong Gunn <hglinux@gunnet.org> (high precision values)
|
||||
*
|
||||
* Sponsored by MGE UPS SYSTEMS <http://www.mgeups.com>
|
||||
*
|
||||
|
@ -25,7 +26,7 @@
|
|||
|
||||
#include "apc-mib.h"
|
||||
|
||||
#define APCC_MIB_VERSION "1.1"
|
||||
#define APCC_MIB_VERSION "1.2"
|
||||
|
||||
/* Other APC sysOID:
|
||||
*
|
||||
|
@ -45,6 +46,15 @@
|
|||
/* TODO: find the right sysOID for this MIB
|
||||
* Ie ".1.3.6.1.4.1.318.1.1.1" or ".1.3.6.1.4.1.318" or? */
|
||||
|
||||
/* .1.3.6.1.4.1.318.1.1.1
|
||||
* enterprise^
|
||||
* apc ---------^
|
||||
* products ------^
|
||||
* hardware --------^
|
||||
* ups ---------------^
|
||||
* ref: ftp://ftp.apc.com/apc/public/software/pnetmib/mib/404/powernet404.mib
|
||||
*/
|
||||
|
||||
/* info elements */
|
||||
|
||||
#define APCC_OID_BATT_STATUS ".1.3.6.1.4.1.318.1.1.1.2.1.1.0"
|
||||
|
@ -107,6 +117,19 @@ static info_lkp_t apcc_sensitivity_modes[] = {
|
|||
{ 0, "NULL" }
|
||||
};
|
||||
|
||||
#define APCC_OID_TRANSFERREASON "1.3.6.1.4.1.318.1.1.1.3.2.5.0"
|
||||
static info_lkp_t apcc_transfer_reasons[] = {
|
||||
{ 1, "noTransfer" },
|
||||
{ 2, "highLineVoltage" },
|
||||
{ 3, "brownout" },
|
||||
{ 4, "blackout" },
|
||||
{ 5, "smallMomentarySag" },
|
||||
{ 6, "deepMomentarySag" },
|
||||
{ 7, "smallMomentarySpike" },
|
||||
{ 8, "largeMomentarySpike" },
|
||||
{ 9, "selfTest" },
|
||||
{ 10, "rateOfVoltageChange" }
|
||||
};
|
||||
|
||||
/* --- */
|
||||
|
||||
|
@ -130,7 +153,12 @@ static snmp_info_t apcc_mib[] = {
|
|||
{ "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.1.1.1.1.0", "Generic Powernet SNMP device", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.1.1.2.3.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "ups.mfr.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.1.1.2.2.0", "", SU_FLAG_OK | SU_FLAG_STATIC, NULL },
|
||||
{ "input.voltage", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.3.3.1.0", "", SU_FLAG_OK | SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE, NULL },
|
||||
{ "input.voltage.maximum", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.3.3.2.0", "", SU_FLAG_OK | SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE, NULL },
|
||||
{ "input.voltage.minimum", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.3.3.3.0", "", SU_FLAG_OK | SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE, NULL },
|
||||
{ "input.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.1.3.2.1.0", "", SU_FLAG_OK, NULL },
|
||||
{ "input.voltage.maximum", 0, 1, ".1.3.6.1.4.1.318.1.1.1.3.2.2.0", "", SU_FLAG_OK, NULL },
|
||||
{ "input.voltage.minimum", 0, 1, ".1.3.6.1.4.1.318.1.1.1.3.2.3.0", "", SU_FLAG_OK, NULL },
|
||||
{ "input.phases", ST_FLAG_STRING, 2, ".1.3.6.1.4.1.318.1.1.1.9.2.2.1.2.1", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "input.L1-L2.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.1.9.2.3.1.3.1.1.1", "", SU_FLAG_OK|SU_FLAG_NEGINVALID, NULL },
|
||||
{ "input.L2-L3.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.1.9.2.3.1.3.1.1.2", "", SU_FLAG_OK|SU_FLAG_NEGINVALID, NULL },
|
||||
|
@ -151,9 +179,11 @@ static snmp_info_t apcc_mib[] = {
|
|||
{ "input.L2.current.minimum", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.9.2.3.1.8.1.1.2", "", SU_FLAG_OK|SU_FLAG_NEGINVALID, NULL },
|
||||
{ "input.L3.current.minimum", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.9.2.3.1.8.1.1.3", "", SU_FLAG_OK|SU_FLAG_NEGINVALID, NULL },
|
||||
{ "input.frequency", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.9.2.2.1.4.1", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL },
|
||||
{ "input.frequency", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.3.3.4.0", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL },
|
||||
{ "input.frequency", 0, 1, ".1.3.6.1.4.1.318.1.1.1.3.2.4.0", "", SU_FLAG_OK, NULL },
|
||||
{ "input.transfer.low", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.3.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL },
|
||||
{ "input.transfer.high", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.2.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL },
|
||||
{ "input.transfer.reason", ST_FLAG_STRING, 1, APCC_OID_TRANSFERREASON, "", SU_TYPE_INT | SU_FLAG_OK, apcc_transfer_reasons },
|
||||
{ "input.sensitivity", ST_FLAG_STRING | ST_FLAG_RW, 1, APCC_OID_SENSITIVITY, "", SU_TYPE_INT | SU_FLAG_OK, apcc_sensitivity_modes },
|
||||
{ "ups.status", ST_FLAG_STRING, SU_INFOSIZE, APCC_OID_POWER_STATUS, "OFF",
|
||||
SU_FLAG_OK | SU_STATUS_PWR, apcc_pwr_info },
|
||||
|
@ -163,27 +193,37 @@ static snmp_info_t apcc_mib[] = {
|
|||
SU_FLAG_OK | SU_STATUS_CAL, apcc_cal_info },
|
||||
{ "ups.status", ST_FLAG_STRING, SU_INFOSIZE, APCC_OID_NEEDREPLBATT, "",
|
||||
SU_FLAG_OK | SU_STATUS_RB, apcc_battrepl_info },
|
||||
{ "ups.temperature", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.2.3.2.0", "", SU_FLAG_OK|SU_FLAG_UNIQUE, NULL },
|
||||
{ "ups.temperature", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.2.0", "", SU_FLAG_OK, NULL },
|
||||
{ "ups.load", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.4.3.3.0", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL },
|
||||
{ "ups.load", 0, 1, ".1.3.6.1.4.1.318.1.1.1.4.2.3.0", "", SU_FLAG_OK, NULL },
|
||||
{ "ups.firmware", ST_FLAG_STRING, 16, ".1.3.6.1.4.1.318.1.1.1.1.2.1.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.10.0", "", SU_FLAG_OK, NULL },
|
||||
{ "ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.9.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.charge", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.2.3.1.0", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL },
|
||||
{ "battery.charge", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.1.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.charge.restart", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.6.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL },
|
||||
{ "battery.runtime", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.3.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.runtime.low", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.8.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.voltage", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.2.3.4.0", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL },
|
||||
{ "battery.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.8.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.voltage.nominal", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.7.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.current", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.2.3.5.0", "", SU_FLAG_OK|SU_FLAG_UNIQUE, NULL },
|
||||
{ "battery.current", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.9.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.current.total", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.2.3.6.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.packs", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.5.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.packs.bad", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.6.0", "", SU_FLAG_OK, NULL },
|
||||
{ "battery.date", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.318.1.1.1.2.1.3.0", "", SU_FLAG_OK | SU_FLAG_STATIC | SU_TYPE_STRING, NULL },
|
||||
{ "ups.id", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.318.1.1.1.1.1.2.0", "", SU_FLAG_OK | SU_FLAG_STATIC | SU_TYPE_STRING, NULL },
|
||||
{ "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, APCC_OID_TESTDIAGRESULTS, "", SU_FLAG_OK, apcc_testdiag_results },
|
||||
{ "ups.test.date", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.318.1.1.1.7.2.4.0", "", SU_FLAG_OK | SU_FLAG_STATIC | SU_TYPE_STRING, NULL },
|
||||
{ "output.voltage", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.4.3.1.0", "", SU_FLAG_OK | SU_FLAG_UNIQUE, NULL },
|
||||
{ "output.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.1.4.2.1.0", "", SU_FLAG_OK, NULL },
|
||||
{ "output.phases", ST_FLAG_STRING, 2, ".1.3.6.1.4.1.318.1.1.1.9.3.2.1.2.1", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "output.frequency", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.9.3.2.1.4.1", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL },
|
||||
{ "output.frequency", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.4.3.2.0", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL },
|
||||
{ "output.frequency", 0, 1, ".1.3.6.1.4.1.318.1.1.1.4.2.2.0", "", SU_FLAG_OK, NULL },
|
||||
{ "output.current", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.4.3.4.0", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL },
|
||||
{ "output.current", 0, 1, ".1.3.6.1.4.1.318.1.1.1.4.2.4.0", "", SU_FLAG_OK, NULL },
|
||||
{ "output.L1-L2.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.1.9.3.3.1.3.1.1.1", "", SU_FLAG_OK|SU_FLAG_NEGINVALID, NULL },
|
||||
{ "output.L2-L3.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.1.9.3.3.1.3.1.1.2", "", SU_FLAG_OK|SU_FLAG_NEGINVALID, NULL },
|
||||
|
@ -220,11 +260,11 @@ static snmp_info_t apcc_mib[] = {
|
|||
/* Measure-UPS ambient variables */
|
||||
/* Environmental sensors (AP9612TH and others) */
|
||||
{ "ambient.temperature", 0, 1, ".1.3.6.1.4.1.318.1.1.2.1.1.0", "", SU_FLAG_OK, NULL },
|
||||
{ "ambient.temperature.high", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.3.1", "", SU_FLAG_OK, NULL },
|
||||
{ "ambient.temperature.low", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.4.1", "", SU_FLAG_OK, NULL },
|
||||
{ "ambient.1.temperature.alarm.high", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.3.1", "", SU_FLAG_OK, NULL },
|
||||
{ "ambient.1.temperature.alarm.low", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.4.1", "", SU_FLAG_OK, NULL },
|
||||
{ "ambient.humidity", 0, 1, ".1.3.6.1.4.1.318.1.1.2.1.2.0", "", SU_FLAG_OK, NULL },
|
||||
{ "ambient.humidity.high", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.6.1", "", SU_FLAG_OK, NULL },
|
||||
{ "ambient.humidity.low", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.7.1", "", SU_FLAG_OK, NULL },
|
||||
{ "ambient.1.humidity.alarm.high", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.6.1", "", SU_FLAG_OK, NULL },
|
||||
{ "ambient.1.humidity.alarm.low", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.7.1", "", SU_FLAG_OK, NULL },
|
||||
|
||||
/* IEM ambient variables */
|
||||
/* IEM: integrated environment monitor probe */
|
||||
|
|
|
@ -56,11 +56,10 @@ static int ups_status = 0;
|
|||
#define VDISCARD VDISCRD
|
||||
#endif /* VDISCRD && !VDISCARD */
|
||||
|
||||
|
||||
#ifndef CTRL
|
||||
#define CONTROL(x) (x&037)
|
||||
#define CONTROL(x) (x&037)
|
||||
#else
|
||||
#define CONTROL CTRL
|
||||
#define CONTROL CTRL
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -71,55 +70,54 @@ static int ups_status = 0;
|
|||
#define CDISCARD CONTROL('O')
|
||||
#endif
|
||||
#ifndef CDSUSP
|
||||
#define CDSUSP CONTROL('Y')
|
||||
#define CDSUSP CONTROL('Y')
|
||||
#endif
|
||||
#ifndef CEOF
|
||||
#define CEOF CONTROL('D')
|
||||
#define CEOF CONTROL('D')
|
||||
#endif
|
||||
#ifndef CEOL
|
||||
#define CEOL 0xff /* was 0 */
|
||||
#endif
|
||||
#ifndef CERASE
|
||||
#define CERASE 0177
|
||||
#define CERASE 0177
|
||||
#endif
|
||||
#ifndef CINTR
|
||||
#define CINTR CONTROL('C')
|
||||
#define CINTR CONTROL('C')
|
||||
#endif
|
||||
#ifndef CKILL
|
||||
#define CKILL CONTROL('U') /* was '@' */
|
||||
#endif
|
||||
#ifndef CLNEXT
|
||||
#define CLNEXT CONTROL('V')
|
||||
#define CLNEXT CONTROL('V')
|
||||
#endif
|
||||
#ifndef CMIN
|
||||
#define CMIN CEOF
|
||||
#define CMIN CEOF
|
||||
#endif
|
||||
#ifndef CQUIT
|
||||
#define CQUIT CONTROL('\\')
|
||||
#define CQUIT CONTROL('\\')
|
||||
#endif
|
||||
#ifndef CRPRNT
|
||||
#define CRPRNT CONTROL('R')
|
||||
#define CRPRNT CONTROL('R')
|
||||
#endif
|
||||
#ifndef CREPRINT
|
||||
#define CREPRINT CRPRNT
|
||||
#endif
|
||||
#ifndef CSTART
|
||||
#define CSTART CONTROL('Q')
|
||||
#define CSTART CONTROL('Q')
|
||||
#endif
|
||||
#ifndef CSTOP
|
||||
#define CSTOP CONTROL('S')
|
||||
#define CSTOP CONTROL('S')
|
||||
#endif
|
||||
#ifndef CSUSP
|
||||
#define CSUSP CONTROL('Z')
|
||||
#define CSUSP CONTROL('Z')
|
||||
#endif
|
||||
#ifndef CTIME
|
||||
#define CTIME CEOL
|
||||
#define CTIME CEOL
|
||||
#endif
|
||||
#ifndef CWERASE
|
||||
#define CWERASE CONTROL('W')
|
||||
#endif
|
||||
|
||||
|
||||
/* some forwards */
|
||||
|
||||
static int sdcmd_S(const void *);
|
||||
|
@ -141,7 +139,7 @@ static int (*sdlist[])(const void *) = {
|
|||
#define SDIDX_K 2
|
||||
#define SDIDX_Z 3
|
||||
#define SDIDX_CS 4
|
||||
#define SDCNT ((int)(sizeof(sdlist)/sizeof(sdlist[0])))
|
||||
#define SDCNT ((int)(sizeof(sdlist)/sizeof(sdlist[0])))
|
||||
|
||||
static apc_vartab_t *vartab_lookup_char(char cmdchar)
|
||||
{
|
||||
|
@ -241,6 +239,84 @@ static const char *convert_data(apc_vartab_t *cmd_entry, const char *upsval)
|
|||
return temp;
|
||||
}
|
||||
|
||||
/* report differences if tcsetattr != tcgetattr, return otherwise */
|
||||
static void apc_ser_diff(struct termios *tioset, struct termios *tioget)
|
||||
{
|
||||
size_t i;
|
||||
const char dir[] = { 's', 'g' };
|
||||
struct termios *tio[] = { tioset, tioget };
|
||||
struct cchar {
|
||||
const char *name;
|
||||
int sub;
|
||||
u_char def;
|
||||
};
|
||||
const struct cchar cchars1[] = {
|
||||
#ifdef VDISCARD
|
||||
{ "discard", VDISCARD, CDISCARD },
|
||||
#endif
|
||||
#ifdef VDSUSP
|
||||
{ "dsusp", VDSUSP, CDSUSP },
|
||||
#endif
|
||||
{ "eof", VEOF, CEOF },
|
||||
{ "eol", VEOL, CEOL },
|
||||
{ "eol2", VEOL2, CEOL },
|
||||
{ "erase", VERASE, CERASE },
|
||||
#ifdef VINTR
|
||||
{ "intr", VINTR, CINTR },
|
||||
#endif
|
||||
{ "kill", VKILL, CKILL },
|
||||
{ "lnext", VLNEXT, CLNEXT },
|
||||
{ "min", VMIN, CMIN },
|
||||
{ "quit", VQUIT, CQUIT },
|
||||
#ifdef VREPRINT
|
||||
{ "reprint", VREPRINT, CREPRINT },
|
||||
#endif
|
||||
{ "start", VSTART, CSTART },
|
||||
#ifdef VSTATUS
|
||||
{ "status", VSTATUS, CSTATUS },
|
||||
#endif
|
||||
{ "stop", VSTOP, CSTOP },
|
||||
{ "susp", VSUSP, CSUSP },
|
||||
{ "time", VTIME, CTIME },
|
||||
{ "werase", VWERASE, CWERASE },
|
||||
{ NULL },
|
||||
}, *cp;
|
||||
|
||||
/* clear status flags so that they don't affect our binary compare */
|
||||
#if defined(PENDIN) || defined(FLUSHO)
|
||||
for (i = 0; i < sizeof(tio)/sizeof(tio[0]); i++) {
|
||||
#ifdef PENDIN
|
||||
tio[i]->c_lflag &= ~PENDIN;
|
||||
#endif
|
||||
#ifdef FLUSHO
|
||||
tio[i]->c_lflag &= ~FLUSHO;
|
||||
#endif
|
||||
}
|
||||
#endif /* defined(PENDIN) || defined(FLUSHO) */
|
||||
|
||||
if (!memcmp(tio[0], tio[1], sizeof(*tio[0])))
|
||||
return;
|
||||
|
||||
upslogx(LOG_NOTICE, "%s: device reports different attributes than what were set", device_path);
|
||||
|
||||
/*
|
||||
* According to the manual the most common problem is mis-matched
|
||||
* combinations of input and output baud rates. If the combination is
|
||||
* not supported then neither are changed. This should not be a
|
||||
* problem here since we set them both to the same extremely common
|
||||
* rate of 2400.
|
||||
*/
|
||||
|
||||
for (i = 0; i < sizeof(tio)/sizeof(tio[0]); i++) {
|
||||
upsdebugx(1, "tc%cetattr(): gfmt1:cflag=%x:iflag=%x:lflag=%x:oflag=%x:", dir[i],
|
||||
(unsigned int) tio[i]->c_cflag, (unsigned int) tio[i]->c_iflag,
|
||||
(unsigned int) tio[i]->c_lflag, (unsigned int) tio[i]->c_oflag);
|
||||
for (cp = cchars1; cp->name; ++cp)
|
||||
upsdebugx(1, "\t%s=%x:", cp->name, tio[i]->c_cc[cp->sub]);
|
||||
upsdebugx(1, "\tispeed=%d:ospeed=%d", (int) cfgetispeed(tio[i]), (int) cfgetospeed(tio[i]));
|
||||
}
|
||||
}
|
||||
|
||||
static void apc_ser_set(void)
|
||||
{
|
||||
struct termios tio, tio_chk;
|
||||
|
@ -298,92 +374,11 @@ static void apc_ser_set(void)
|
|||
if (tcsetattr(upsfd, TCSANOW, &tio))
|
||||
fatal_with_errno(EXIT_FAILURE, "tcsetattr(%s)", device_path);
|
||||
|
||||
/* clear status flags so that they don't affect our binary compare */
|
||||
#ifdef PENDIN
|
||||
tio.c_lflag &= ~PENDIN;
|
||||
#endif
|
||||
#ifdef FLUSHO
|
||||
tio.c_lflag &= ~FLUSHO;
|
||||
#endif
|
||||
|
||||
memset(&tio_chk, 0, sizeof(tio_chk));
|
||||
if (tcgetattr(upsfd, &tio_chk))
|
||||
fatal_with_errno(EXIT_FAILURE, "tcgetattr(%s)", device_path);
|
||||
|
||||
/* clear status flags so that they don't affect our binary compare */
|
||||
#ifdef PENDIN
|
||||
tio_chk.c_lflag &= ~PENDIN;
|
||||
#endif
|
||||
#ifdef FLUSHO
|
||||
tio_chk.c_lflag &= ~FLUSHO;
|
||||
#endif
|
||||
|
||||
if (memcmp(&tio_chk, &tio, sizeof(tio))) {
|
||||
struct cchar {
|
||||
const char *name;
|
||||
int sub;
|
||||
u_char def;
|
||||
};
|
||||
const struct cchar cchars1[] = {
|
||||
#ifdef VDISCARD
|
||||
{ "discard", VDISCARD, CDISCARD },
|
||||
#endif
|
||||
#ifdef VDSUSP
|
||||
{ "dsusp", VDSUSP, CDSUSP },
|
||||
#endif
|
||||
{ "eof", VEOF, CEOF },
|
||||
{ "eol", VEOL, CEOL },
|
||||
{ "eol2", VEOL2, CEOL },
|
||||
{ "erase", VERASE, CERASE },
|
||||
#ifdef VINTR
|
||||
{ "intr", VINTR, CINTR },
|
||||
#endif
|
||||
{ "kill", VKILL, CKILL },
|
||||
{ "lnext", VLNEXT, CLNEXT },
|
||||
{ "min", VMIN, CMIN },
|
||||
{ "quit", VQUIT, CQUIT },
|
||||
#ifdef VREPRINT
|
||||
{ "reprint", VREPRINT, CREPRINT },
|
||||
#endif
|
||||
{ "start", VSTART, CSTART },
|
||||
#ifdef VSTATUS
|
||||
{ "status", VSTATUS, CSTATUS },
|
||||
#endif
|
||||
{ "stop", VSTOP, CSTOP },
|
||||
{ "susp", VSUSP, CSUSP },
|
||||
{ "time", VTIME, CTIME },
|
||||
{ "werase", VWERASE, CWERASE },
|
||||
{ .name = NULL },
|
||||
};
|
||||
const struct cchar *cp;
|
||||
struct termios *tp;
|
||||
|
||||
upslogx(LOG_NOTICE, "%s: device reports different attributes than what were set", device_path);
|
||||
|
||||
/*
|
||||
* According to the manual the most common problem is
|
||||
* mis-matched combinations of input and output baud rates. If
|
||||
* the combination is not supported then neither are changed.
|
||||
* This should not be a problem here since we set them both to
|
||||
* the same extremely common rate of 2400.
|
||||
*/
|
||||
|
||||
tp = &tio;
|
||||
upsdebugx(1, "tcsetattr(): gfmt1:cflag=%x:iflag=%x:lflag=%x:oflag=%x:",
|
||||
(unsigned int) tp->c_cflag, (unsigned int) tp->c_iflag,
|
||||
(unsigned int) tp->c_lflag, (unsigned int) tp->c_oflag);
|
||||
for (cp = cchars1; cp->name; ++cp)
|
||||
upsdebugx(1, "\t%s=%x:", cp->name, tp->c_cc[cp->sub]);
|
||||
upsdebugx(1, "\tispeed=%d:ospeed=%d", (int) cfgetispeed(tp), (int) cfgetospeed(tp));
|
||||
|
||||
tp = &tio_chk;
|
||||
upsdebugx(1, "tcgetattr(): gfmt1:cflag=%x:iflag=%x:lflag=%x:oflag=%x:",
|
||||
(unsigned int) tp->c_cflag, (unsigned int) tp->c_iflag,
|
||||
(unsigned int) tp->c_lflag, (unsigned int) tp->c_oflag);
|
||||
for (cp = cchars1; cp->name; ++cp)
|
||||
upsdebugx(1, "\t%s=%x:", cp->name, tp->c_cc[cp->sub]);
|
||||
upsdebugx(1, "\tispeed=%d:ospeed=%d", (int) cfgetispeed(tp), (int) cfgetospeed(tp));
|
||||
}
|
||||
apc_ser_diff(&tio, &tio_chk);
|
||||
|
||||
cable = getval("cable");
|
||||
if (cable && !strcasecmp(cable, ALT_CABLE_1)) {
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
battery.runtime
|
||||
battery.voltage
|
||||
battery.voltage.nominal
|
||||
driver.version.internal
|
||||
input.frequency
|
||||
input.frequency.nominal e.g. 60 for 60Hz
|
||||
input.sensitivity (RW) normal/medium/low
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "blazer.h"
|
||||
|
||||
#define DRIVER_NAME "Megatec/Q1 protocol USB driver"
|
||||
#define DRIVER_VERSION "0.08"
|
||||
#define DRIVER_VERSION "0.09"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
@ -351,6 +351,7 @@ static usb_device_id_t blazer_usb_id[] = {
|
|||
{ USB_DEVICE(0x06da, 0x0004), &cypress_subdriver }, /* Phoenixtec Innova 3/1 T */
|
||||
{ USB_DEVICE(0x06da, 0x0005), &cypress_subdriver }, /* Phoenixtec Innova RT */
|
||||
{ USB_DEVICE(0x06da, 0x0201), &cypress_subdriver }, /* Phoenixtec Innova T */
|
||||
{ USB_DEVICE(0x06da, 0x0601), &phoenix_subdriver }, /* Online Zinto A */
|
||||
{ USB_DEVICE(0x0f03, 0x0001), &cypress_subdriver }, /* Unitek Alpha 1200Sx */
|
||||
{ USB_DEVICE(0x14f0, 0x00c9), &phoenix_subdriver }, /* GE EP series */
|
||||
/* end of list */
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/* eaton-mib.c - data to monitor Eaton Aphel PDUs (Basic and Complex)
|
||||
*
|
||||
* Copyright (C) 2008 - 2010
|
||||
* Arnaud Quette <ArnaudQuette@Eaton.com>
|
||||
* Copyright (C) 2008 - 2012
|
||||
* Arnaud Quette <arnaud.quette@gmail.com>
|
||||
* Arnaud Quette <ArnaudQuette@Eaton.com>
|
||||
*
|
||||
* Sponsored by Eaton <http://www.eaton.com>
|
||||
* and MGE Office Protection Systems <http://www.mgeops.com>
|
||||
* Supported by Eaton <http://www.eaton.com>
|
||||
* and previously MGE Office Protection Systems <http://www.mgeops.com>
|
||||
*
|
||||
* 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
|
||||
|
@ -348,7 +349,112 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
{ NULL, 0, 0, NULL, NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
/* Pulizzi Monitored ePDU (Basic model, SNMP only)
|
||||
* FIXME: to be completed
|
||||
*
|
||||
* Warning: there are 2 versions:
|
||||
* - SA built MI.mib (old MIB)
|
||||
* #define PULIZZI1_OID_MIB ".1.3.6.1.4.1.20677.3.1.1"
|
||||
* #define PULIZZI1_OID_MODEL_NAME ".1.3.6.1.4.1.20677.3.1.1.1.2.0"
|
||||
* - Eaton-Powerware-Monitored-ePDU_1.0.E.mib (new MIB) Vertical SW
|
||||
*/
|
||||
|
||||
|
||||
/* Pulizzi Switched ePDU */
|
||||
|
||||
#define EATON_PULIZZI_SW_MIB_VERSION "0.1"
|
||||
|
||||
#define PULIZZI_SW_OID_MIB ".1.3.6.1.4.1.20677.3.1.1"
|
||||
#define PULIZZI_SW_OID_MODEL_NAME ".1.3.6.1.4.1.20677.2.1.1.0"
|
||||
|
||||
/* Some buggy FW also report sysOID = ".1.3.6.1.4.1.20677.1" */
|
||||
#define EATON_PULIZZI_SWITCHED1_SYSOID ".1.3.6.1.4.1.20677.1"
|
||||
#define EATON_PULIZZI_SWITCHED2_SYSOID ".1.3.6.1.4.1.20677.2"
|
||||
|
||||
|
||||
static info_lkp_t pulizzi_sw_outlet_status_info[] = {
|
||||
{ 1, "on" },
|
||||
{ 2, "off" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* simply remap the above status to "yes" */
|
||||
static info_lkp_t pulizzi_sw_outlet_switchability_info[] = {
|
||||
{ 1, "yes" },
|
||||
{ 2, "yes" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Snmp2NUT lookup table for Eaton Pulizzi Switched ePDU MIB */
|
||||
static snmp_info_t eaton_pulizzi_switched_mib[] = {
|
||||
/* Device page */
|
||||
{ "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
{ "device.model", ST_FLAG_STRING, SU_INFOSIZE, PULIZZI_SW_OID_MODEL_NAME,
|
||||
"Switched ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
{ "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* UPS page */
|
||||
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.model", ST_FLAG_STRING, SU_INFOSIZE, PULIZZI_SW_OID_MODEL_NAME,
|
||||
"Switched ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
/* FIXME: to be moved to the device collection! */
|
||||
{ "ups.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.1.4.0",
|
||||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.time", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.1.3.0",
|
||||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.2.6.0",
|
||||
"unknown", 0, NULL, NULL },
|
||||
|
||||
/* Outlet page */
|
||||
/* Note: outlet.count is deduced, with guestimate_outlet_count() */
|
||||
{ "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
|
||||
{ "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
|
||||
|
||||
{ "outlet.current", 0, 1.0, ".1.3.6.1.4.1.20677.2.8.6.4.2.0", NULL, 0, NULL, NULL },
|
||||
{ "outlet.voltage", 0, 1.0, ".1.3.6.1.4.1.20677.2.8.6.4.1.0", NULL, 0, NULL, NULL },
|
||||
{ "outlet.power", 0, 1.0, ".1.3.6.1.4.1.20677.2.8.6.4.3.0", NULL, 0, NULL, NULL },
|
||||
|
||||
/* outlet template definition
|
||||
* Notes:
|
||||
* - indexes start from 1, ie outlet.1 => <OID>.1
|
||||
* - the first definition is used to determine the base index (ie 0 or 1)
|
||||
* - outlet.count is estimated, based on the below OID iteration capabilities */
|
||||
{ "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.1.%i.1.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.3.%i.0",
|
||||
NULL, SU_FLAG_OK | SU_OUTLET, &pulizzi_sw_outlet_status_info[0], NULL },
|
||||
{ "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL, NULL },
|
||||
/* we use the same OID as outlet.n.status..., to expose switchability */
|
||||
{ "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.3.%i.0", "yes", SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET, &pulizzi_sw_outlet_switchability_info[0], NULL },
|
||||
/* FIXME: need to be added to the namespace! */
|
||||
{ "outlet.%i.delay.reboot", ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.1.%i.5.0", NULL, SU_OUTLET, NULL, NULL },
|
||||
/* "outlet1SequenceTime" is used for global sequence */
|
||||
{ "outlet.%i.delay.start", ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.1.%i.4.0", NULL, SU_OUTLET, NULL, NULL },
|
||||
|
||||
/* instant commands. */
|
||||
/* FIXME: not exposed as "outlet.load...", or otherwise specific processing applies (template instanciation) */
|
||||
{ "load.on", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.1.0", NULL, SU_TYPE_CMD, NULL, NULL },
|
||||
{ "load.off", 0, 2, ".1.3.6.1.4.1.20677.2.6.2.1.0", NULL, SU_TYPE_CMD, NULL, NULL },
|
||||
{ "load.on.delay", 0, 3, ".1.3.6.1.4.1.20677.2.6.2.1.0", NULL, SU_TYPE_CMD, NULL, NULL },
|
||||
{ "load.off.delay", 0, 4, ".1.3.6.1.4.1.20677.2.6.2.1.0", NULL, SU_TYPE_CMD, NULL, NULL },
|
||||
|
||||
/* WARNING: outlet 1 => index 2! */
|
||||
{ "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.%i.0", NULL, SU_TYPE_CMD | SU_OUTLET | SU_CMD_OFFSET, NULL, NULL },
|
||||
{ "outlet.%i.load.off", 0, 2, ".1.3.6.1.4.1.20677.2.6.2.%i.0", NULL, SU_TYPE_CMD | SU_OUTLET | SU_CMD_OFFSET, NULL, NULL },
|
||||
{ "outlet.%i.load.cycle", 0, 3, ".1.3.6.1.4.1.20677.2.6.2.%i.0", NULL, SU_TYPE_CMD | SU_OUTLET | SU_CMD_OFFSET, NULL, NULL },
|
||||
|
||||
/* end of structure. */
|
||||
{ NULL, 0, 0, NULL, NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
mib2nut_info_t aphel_genesisII = { "aphel_genesisII", EATON_APHEL_MIB_VERSION, "", APHEL1_OID_MODEL_NAME, eaton_aphel_genesisII_mib, APHEL1_SYSOID };
|
||||
mib2nut_info_t aphel_revelation = { "aphel_revelation", EATON_APHEL_MIB_VERSION, "", APHEL2_OID_MODEL_NAME, eaton_aphel_revelation_mib, APHEL2_SYSOID };
|
||||
mib2nut_info_t eaton_marlin = { "eaton_epdu", EATON_MARLIN_MIB_VERSION, "", EATON_MARLIN_OID_MODEL_NAME, eaton_marlin_mib, EATON_MARLIN_SYSOID };
|
||||
|
||||
/*mib2nut_info_t pulizzi_monitored = { "pulizzi_monitored", EATON_PULIZZI_MIB_VERSION, "", PULIZZI1_OID_MODEL_NAME, eaton_pulizzi_monitored_mib, PULIZZI1_OID_MIB };*/
|
||||
mib2nut_info_t pulizzi_switched1 = { "pulizzi_switched1", EATON_PULIZZI_SW_MIB_VERSION, "", EATON_PULIZZI_SWITCHED1_SYSOID, eaton_pulizzi_switched_mib, EATON_PULIZZI_SWITCHED1_SYSOID };
|
||||
mib2nut_info_t pulizzi_switched2 = { "pulizzi_switched2", EATON_PULIZZI_SW_MIB_VERSION, "", EATON_PULIZZI_SWITCHED1_SYSOID, eaton_pulizzi_switched_mib, EATON_PULIZZI_SWITCHED2_SYSOID };
|
||||
|
|
|
@ -7,5 +7,7 @@
|
|||
extern mib2nut_info_t aphel_genesisII;
|
||||
extern mib2nut_info_t aphel_revelation;
|
||||
extern mib2nut_info_t eaton_marlin;
|
||||
extern mib2nut_info_t pulizzi_switched1;
|
||||
extern mib2nut_info_t pulizzi_switched2;
|
||||
|
||||
#endif /* EATON_MIB_H */
|
||||
|
|
440
drivers/macosx-ups.c
Normal file
440
drivers/macosx-ups.c
Normal file
|
@ -0,0 +1,440 @@
|
|||
/* Bridge driver to read Mac OS X UPS status (as displayed in Energy Saver control panel)
|
||||
*
|
||||
* Copyright (C) 2011-2012 Charles Lepple <clepple+nut@gmail.com>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
#include "CoreFoundation/CoreFoundation.h"
|
||||
#include "IOKit/ps/IOPowerSources.h"
|
||||
#include "IOKit/ps/IOPSKeys.h"
|
||||
|
||||
#define DRIVER_NAME "Mac OS X UPS meta-driver"
|
||||
#define DRIVER_VERSION "1.0"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
DRIVER_NAME,
|
||||
DRIVER_VERSION,
|
||||
"Charles Lepple <clepple+nut@gmail.com>",
|
||||
DRV_EXPERIMENTAL,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
#if 0
|
||||
#define CFRelease(ref) do { upsdebugx(3, "%s:%d: CFRelease(%p)", __FILE__, __LINE__, ref); CFRelease(ref); } while(0)
|
||||
#endif
|
||||
|
||||
static CFStringRef g_power_key = NULL;
|
||||
static double max_capacity_value = 100.0;
|
||||
|
||||
/*! Copy the current power dictionary.
|
||||
*
|
||||
* Caller must release power dictionary when finished with it.
|
||||
*/
|
||||
static CFDictionaryRef copy_power_dictionary(CFTypeRef power_key)
|
||||
{
|
||||
CFTypeRef power_blob;
|
||||
CFDictionaryRef power_dictionary;
|
||||
|
||||
power_blob = IOPSCopyPowerSourcesInfo();
|
||||
|
||||
assert(power_blob);
|
||||
upsdebugx(6, "%s: Got power_blob:", __func__);
|
||||
if(nut_debug_level >= 6) CFShow(power_blob);
|
||||
|
||||
upsdebugx(5, "power_key = ");
|
||||
if(nut_debug_level >= 5) CFShow(power_key);
|
||||
upsdebugx(6, "end power_key");
|
||||
|
||||
power_dictionary = IOPSGetPowerSourceDescription(power_blob, power_key);
|
||||
|
||||
upsdebugx(5, "Asserting 'power_dictionary': %p", power_dictionary);
|
||||
assert(power_dictionary);
|
||||
upsdebugx(5, "CFShowing 'power_dictionary'");
|
||||
if(nut_debug_level >= 5) CFShow(power_dictionary);
|
||||
|
||||
CFRetain(power_dictionary);
|
||||
|
||||
/* Get a new power_blob next time: */
|
||||
CFRelease(power_blob);
|
||||
|
||||
return power_dictionary;
|
||||
}
|
||||
|
||||
void upsdrv_initinfo(void)
|
||||
{
|
||||
/* try to detect the UPS here - call fatal_with_errno(EXIT_FAILURE, ) if it fails */
|
||||
|
||||
char device_name[80] = "";
|
||||
CFStringRef device_type_cfstr, device_name_cfstr;
|
||||
CFPropertyListRef power_dictionary;
|
||||
CFNumberRef max_capacity;
|
||||
|
||||
upsdebugx(1, "upsdrv_initinfo()");
|
||||
|
||||
dstate_setinfo("device.mfr", "(unknown)");
|
||||
|
||||
power_dictionary = copy_power_dictionary(g_power_key);
|
||||
|
||||
device_type_cfstr = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSTypeKey));
|
||||
if(device_type_cfstr && !CFStringCompare(device_type_cfstr, CFSTR(kIOPSInternalBatteryType), 0)) {
|
||||
dstate_setinfo("device.type", "battery");
|
||||
}
|
||||
|
||||
upsdebugx(2, "Getting 'Name' key");
|
||||
|
||||
device_name_cfstr = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSNameKey));
|
||||
|
||||
if (!device_name_cfstr) {
|
||||
fatalx(EXIT_FAILURE, "Couldn't retrieve 'Name' key from power dictionary.");
|
||||
}
|
||||
|
||||
CFRetain(device_name_cfstr);
|
||||
|
||||
CFStringGetCString(device_name_cfstr, device_name, sizeof(device_name), kCFStringEncodingUTF8);
|
||||
upsdebugx(2, "Got name: %s", device_name);
|
||||
|
||||
CFRelease(device_name_cfstr);
|
||||
|
||||
dstate_setinfo("device.model", "%s", device_name);
|
||||
|
||||
max_capacity = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSMaxCapacityKey));
|
||||
if(max_capacity) {
|
||||
CFRetain(max_capacity);
|
||||
|
||||
CFNumberGetValue(max_capacity, kCFNumberDoubleType, &max_capacity_value);
|
||||
CFRelease(max_capacity);
|
||||
|
||||
upsdebugx(3, "Max Capacity = %.f units (usually 100)", max_capacity_value);
|
||||
if(max_capacity_value != 100) {
|
||||
upsdebugx(1, "Max Capacity: %f != 100", max_capacity_value);
|
||||
}
|
||||
}
|
||||
|
||||
/* upsh.instcmd = instcmd; */
|
||||
CFRelease(power_dictionary);
|
||||
}
|
||||
|
||||
void upsdrv_updateinfo(void)
|
||||
{
|
||||
CFPropertyListRef power_dictionary;
|
||||
CFStringRef power_source_state;
|
||||
CFNumberRef battery_voltage, battery_runtime;
|
||||
CFNumberRef current_capacity;
|
||||
CFBooleanRef is_charging;
|
||||
double max_capacity_value = 100.0, current_capacity_value;
|
||||
|
||||
upsdebugx(1, "upsdrv_updateinfo()");
|
||||
|
||||
power_dictionary = copy_power_dictionary( g_power_key );
|
||||
assert(power_dictionary); /* TODO: call dstate_datastale()? */
|
||||
|
||||
status_init();
|
||||
|
||||
/* Retrieve OL/OB state */
|
||||
power_source_state = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSPowerSourceStateKey));
|
||||
assert(power_source_state);
|
||||
CFRetain(power_source_state);
|
||||
|
||||
upsdebugx(3, "Power Source State:");
|
||||
if(nut_debug_level >= 3) CFShow(power_source_state);
|
||||
|
||||
if(!CFStringCompare(power_source_state, CFSTR(kIOPSACPowerValue), 0)) {
|
||||
status_set("OL");
|
||||
} else {
|
||||
status_set("OB");
|
||||
}
|
||||
|
||||
CFRelease(power_source_state);
|
||||
|
||||
/* Retrieve CHRG state */
|
||||
is_charging = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSIsChargingKey));
|
||||
if(is_charging) {
|
||||
Boolean is_charging_value;
|
||||
|
||||
is_charging_value = CFBooleanGetValue(is_charging);
|
||||
if(is_charging_value) {
|
||||
status_set("CHRG");
|
||||
}
|
||||
}
|
||||
|
||||
status_commit();
|
||||
|
||||
/* Retrieve battery voltage */
|
||||
|
||||
battery_voltage = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSVoltageKey));
|
||||
if(battery_voltage) {
|
||||
int battery_voltage_value;
|
||||
|
||||
CFNumberGetValue(battery_voltage, kCFNumberIntType, &battery_voltage_value);
|
||||
upsdebugx(2, "battery_voltage = %d mV", battery_voltage_value);
|
||||
dstate_setinfo("battery.voltage", "%.3f", battery_voltage_value/1000.0);
|
||||
}
|
||||
|
||||
/* Retrieve battery runtime */
|
||||
battery_runtime = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSTimeToEmptyKey));
|
||||
if(battery_runtime) {
|
||||
double battery_runtime_value;
|
||||
|
||||
CFNumberGetValue(battery_runtime, kCFNumberDoubleType, &battery_runtime_value);
|
||||
|
||||
upsdebugx(2, "battery_runtime = %.f minutes", battery_runtime_value);
|
||||
if(battery_runtime_value > 0) {
|
||||
dstate_setinfo("battery.runtime", "%d", (int)(battery_runtime_value*60));
|
||||
} else {
|
||||
dstate_delinfo("battery.runtime");
|
||||
}
|
||||
} else {
|
||||
dstate_delinfo("battery.runtime");
|
||||
}
|
||||
|
||||
/* Retrieve current capacity */
|
||||
current_capacity = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSCurrentCapacityKey));
|
||||
if(current_capacity) {
|
||||
CFNumberGetValue(current_capacity, kCFNumberDoubleType, ¤t_capacity_value);
|
||||
|
||||
upsdebugx(2, "Current Capacity = %.f/%.f units", current_capacity_value, max_capacity_value);
|
||||
if(max_capacity_value > 0) {
|
||||
dstate_setinfo("battery.charge", "%.f", 100.0 * current_capacity_value / max_capacity_value);
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: it should be possible to set poll_interval (and maxage in the
|
||||
* server) to an absurdly large value, and use notify(3) to get
|
||||
* updates.
|
||||
*/
|
||||
|
||||
/*
|
||||
* poll_interval = 2;
|
||||
*/
|
||||
|
||||
dstate_dataok();
|
||||
CFRelease(power_dictionary);
|
||||
}
|
||||
|
||||
void upsdrv_shutdown(void)
|
||||
{
|
||||
/* tell the UPS to shut down, then return - DO NOT SLEEP HERE */
|
||||
|
||||
/* maybe try to detect the UPS here, but try a shutdown even if
|
||||
it doesn't respond at first if possible */
|
||||
|
||||
/* NOTE: Mac OS X already has shutdown routines - this driver is more
|
||||
for monitoring and notification purposes. Still, there is a key that
|
||||
might be useful to set in SystemConfiguration land. */
|
||||
fatalx(EXIT_FAILURE, "shutdown not supported");
|
||||
|
||||
/* you may have to check the line status since the commands
|
||||
for toggling power are frequently different for OL vs. OB */
|
||||
|
||||
/* OL: this must power cycle the load if possible */
|
||||
|
||||
/* OB: the load must remain off until the power returns */
|
||||
}
|
||||
|
||||
/*
|
||||
static int instcmd(const char *cmdname, const char *extra)
|
||||
{
|
||||
if (!strcasecmp(cmdname, "test.battery.stop")) {
|
||||
ser_send_buf(upsfd, ...);
|
||||
return STAT_INSTCMD_HANDLED;
|
||||
}
|
||||
|
||||
upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname);
|
||||
return STAT_INSTCMD_UNKNOWN;
|
||||
}
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
There is a configuration file here:
|
||||
/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist
|
||||
with several keys under UPSDefaultThresholds:
|
||||
|
||||
* UPSShutdownAfterMinutes
|
||||
* UPSShutdownAtLevel
|
||||
* UPSShutdownAtMinutesLeft
|
||||
|
||||
It is not likely that these keys can be written, but they might be good values for NUT variables.
|
||||
|
||||
In conjunction with 'ignorelb' and a delta, this could be used to synthesize a
|
||||
LB status right before the computer shuts down.
|
||||
*/
|
||||
|
||||
/*
|
||||
static int setvar(const char *varname, const char *val)
|
||||
{
|
||||
if (!strcasecmp(varname, "ups.test.interval")) {
|
||||
ser_send_buf(upsfd, ...);
|
||||
return STAT_SET_HANDLED;
|
||||
}
|
||||
|
||||
upslogx(LOG_NOTICE, "setvar: unknown variable [%s]", varname);
|
||||
return STAT_SET_UNKNOWN;
|
||||
}
|
||||
*/
|
||||
|
||||
void upsdrv_help(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* list flags and values that you want to receive via -x */
|
||||
void upsdrv_makevartable(void)
|
||||
{
|
||||
/* allow '-x xyzzy' */
|
||||
/* addvar(VAR_FLAG, "xyzzy", "Enable xyzzy mode"); */
|
||||
|
||||
/* allow '-x foo=<some value>' */
|
||||
/* addvar(VAR_VALUE, "foo", "Override foo setting"); */
|
||||
|
||||
addvar(VAR_VALUE, "model", "Regular Expression to match power source model name");
|
||||
}
|
||||
|
||||
void upsdrv_initups(void)
|
||||
{
|
||||
CFArrayRef power_source_key_list;
|
||||
CFIndex num_keys, index;
|
||||
CFDictionaryRef power_dictionary;
|
||||
CFTypeRef power_blob;
|
||||
CFStringRef potential_key, potential_model;
|
||||
char *device_name = device_path, *model_name; /* regex(3) */
|
||||
char potential_device_name[80], potential_model_name[80];
|
||||
regex_t name_regex, model_regex;
|
||||
int ret;
|
||||
|
||||
upsdebugx(3, "upsdrv_initups(): Power Sources blob:");
|
||||
/* upsfd = ser_open(device_path); */
|
||||
/* ser_set_speed(upsfd, device_path, B1200); */
|
||||
power_blob = IOPSCopyPowerSourcesInfo();
|
||||
if(!power_blob) {
|
||||
fatalx(EXIT_FAILURE, "Couldn't retrieve Power Sources blob");
|
||||
}
|
||||
|
||||
if(nut_debug_level >= 3) CFShow(power_blob);
|
||||
|
||||
if(!strcmp(device_name, "auto")) {
|
||||
device_name = "/UPS";
|
||||
}
|
||||
|
||||
upsdebugx(2, "Matching power supply key names against regex '%s'", device_name);
|
||||
|
||||
ret = regcomp(&name_regex, device_name, REG_EXTENDED|REG_NOSUB|REG_ICASE);
|
||||
|
||||
if(ret) {
|
||||
fatalx(EXIT_FAILURE,
|
||||
"Failed to compile regex from 'port' parameter: '%s'.",
|
||||
device_name);
|
||||
}
|
||||
|
||||
if((model_name = getval("model"))) {
|
||||
upsdebugx(2, "Matching power supply model names against regex '%s'", model_name);
|
||||
ret = regcomp(&model_regex, model_name, REG_EXTENDED|REG_NOSUB|REG_ICASE);
|
||||
|
||||
if(ret) {
|
||||
fatalx(EXIT_FAILURE,
|
||||
"Failed to compile regex from 'model' parameter: '%s'.",
|
||||
model_name);
|
||||
}
|
||||
}
|
||||
|
||||
power_source_key_list = IOPSCopyPowerSourcesList(power_blob);
|
||||
|
||||
num_keys = CFArrayGetCount(power_source_key_list);
|
||||
upsdebugx(1, "Number of power supplies found: %d", (int)num_keys);
|
||||
|
||||
if(nut_debug_level >= 3) CFShow(power_source_key_list);
|
||||
|
||||
if(num_keys < 1) {
|
||||
/* bail */
|
||||
fatalx(EXIT_FAILURE, "Couldn't find any UPS or battery");
|
||||
}
|
||||
|
||||
for(index=0; index < num_keys; index++) {
|
||||
potential_key = CFArrayGetValueAtIndex(power_source_key_list, index);
|
||||
CFStringGetCString(potential_key, potential_device_name,
|
||||
sizeof(potential_device_name), kCFStringEncodingUTF8);
|
||||
upsdebugx(1, " Power supply: %s", potential_device_name);
|
||||
|
||||
ret = regexec(&name_regex, potential_device_name, 0,0,0);
|
||||
|
||||
power_dictionary = copy_power_dictionary(potential_key);
|
||||
|
||||
upsdebugx(2, "Getting 'Name' key (UPS model)");
|
||||
|
||||
potential_model = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSNameKey));
|
||||
CFStringGetCString(potential_model, potential_model_name, sizeof(potential_model_name), kCFStringEncodingUTF8);
|
||||
upsdebugx(1, " model name: %s", potential_model_name);
|
||||
|
||||
CFRelease(power_dictionary);
|
||||
|
||||
/* Does key match? Check model: */
|
||||
if (!ret) {
|
||||
if(model_name) {
|
||||
ret = regexec(&model_regex, potential_model_name, 0,0,0);
|
||||
if(!ret) {
|
||||
upsdebugx(2, "Matched model name");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
upsdebugx(2, "Matched key name");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
regfree(&name_regex);
|
||||
if(model_name) {
|
||||
regfree(&model_regex);
|
||||
}
|
||||
|
||||
if(ret) {
|
||||
fatalx(EXIT_FAILURE, "Couldn't find UPS or battery matching both 'port' (%s) and 'model' (%s)",
|
||||
device_name, model_name);
|
||||
}
|
||||
|
||||
g_power_key = potential_key;
|
||||
CFRetain(g_power_key);
|
||||
upsdebugx(2, "g_power_key = ");
|
||||
if(nut_debug_level >= 2) CFShow(g_power_key);
|
||||
upsdebugx(2, "end g_power_key.");
|
||||
|
||||
power_dictionary = copy_power_dictionary(g_power_key);
|
||||
assert(power_dictionary);
|
||||
if(nut_debug_level >= 3) CFShow(power_dictionary);
|
||||
|
||||
/* the upsh handlers can't be done here, as they get initialized
|
||||
* shortly after upsdrv_initups returns to main.
|
||||
*/
|
||||
|
||||
/* don't try to detect the UPS here */
|
||||
|
||||
/* do stuff */
|
||||
|
||||
CFRelease(power_dictionary);
|
||||
}
|
||||
|
||||
void upsdrv_cleanup(void)
|
||||
{
|
||||
upsdebugx(1, "Cleanup: release references");
|
||||
CFRelease(g_power_key);
|
||||
|
||||
/* free(dynamic_mem); */
|
||||
/* ser_close(upsfd, device_path); */
|
||||
}
|
|
@ -623,7 +623,7 @@ int main(int argc, char **argv)
|
|||
* when its a pdu! */
|
||||
dstate_setinfo("device.type", "ups");
|
||||
|
||||
/* publish the top-level data: version number, driver name */
|
||||
/* publish the top-level data: version numbers, driver name */
|
||||
dstate_setinfo("driver.version", "%s", UPS_VERSION);
|
||||
dstate_setinfo("driver.version.internal", "%s", upsdrv_info.version);
|
||||
dstate_setinfo("driver.name", "%s", progname);
|
||||
|
|
|
@ -469,8 +469,6 @@ void upsdrv_initinfo(void)
|
|||
dstate_setinfo("ups.model", "%s", name);
|
||||
if( strlen( firmware ) > 0 )
|
||||
dstate_setinfo("ups.firmware", "%s", firmware);
|
||||
|
||||
dstate_setinfo("driver.version.internal", "%s", DRIVER_VERSION);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
|
|
|
@ -316,8 +316,6 @@ void upsdrv_initinfo(void)
|
|||
dstate_setflags("ups.test.result", ST_FLAG_STRING | ST_FLAG_RW);
|
||||
dstate_setaux("ups.test.result", 20);
|
||||
|
||||
/* Fixed variables */
|
||||
dstate_setinfo("driver.version.internal", "%s", DRIVER_VERSION);
|
||||
/* UPS INFO READ */
|
||||
res = command_read_sequence(UPS_INFO, my_answer);
|
||||
if (res < 0) fatal_with_errno(EXIT_FAILURE, "Could not communicate with the ups");
|
||||
|
|
|
@ -235,7 +235,6 @@ void upsdrv_initinfo(void)
|
|||
|
||||
/* manufacturer -------------------------------------------- */
|
||||
dstate_setinfo("ups.mfr", "MGE UPS SYSTEMS");
|
||||
dstate_setinfo("driver.version.internal", "%s", DRIVER_VERSION);
|
||||
|
||||
/* loop until we have at status */
|
||||
tries = 0;
|
||||
|
|
|
@ -848,8 +848,6 @@ void upsdrv_initinfo(void)
|
|||
dstate_setinfo("ups.mfr.date", "%04d/%02d/%02d", ups.YearOfProd, ups.MonthOfProd, ups.DayOfProd) ;
|
||||
dstate_setinfo("battery.packs", "%d", ups.BatteryNumber) ;
|
||||
|
||||
dstate_setinfo("driver.version.internal", "%s", DRIVER_VERSION) ;
|
||||
|
||||
/* Register the available variables. */
|
||||
dstate_setinfo("ups.delay.start", "%d", ups.WakeUpDelay);
|
||||
dstate_setflags("ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <ne_socket.h>
|
||||
|
||||
#define DRIVER_NAME "network XML UPS"
|
||||
#define DRIVER_VERSION "0.30"
|
||||
#define DRIVER_VERSION "0.31"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
@ -92,7 +92,7 @@ void upsdrv_initinfo(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
dstate_setinfo("driver.version.internal", "%s", subdriver->version);
|
||||
dstate_setinfo("driver.version.data", "%s", subdriver->version);
|
||||
|
||||
if (testvar("subscribe") && (netxml_alarm_subscribe(subdriver->subscribe) == NE_OK)) {
|
||||
extrafd = ne_sock_fd(sock);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* nut-ipmipsu.c - Driver for IPMI Power Supply Units (PSU)
|
||||
*
|
||||
* Copyright (C) 2011 - Arnaud Quette <arnaud.quette@free.fr>
|
||||
* Copyright (C)
|
||||
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
@ -26,7 +27,7 @@
|
|||
#include "nut-ipmi.h"
|
||||
|
||||
#define DRIVER_NAME "IPMI PSU driver"
|
||||
#define DRIVER_VERSION "0.06"
|
||||
#define DRIVER_VERSION "0.07"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
@ -62,9 +63,6 @@ void upsdrv_initinfo(void)
|
|||
ipmi_dev.manufacturer ? ipmi_dev.manufacturer : "unknown",
|
||||
ipmi_dev.product ? ipmi_dev.product : "unknown");
|
||||
|
||||
dstate_setinfo("driver.version.data", "%s", DRIVER_NAME);
|
||||
dstate_setinfo("driver.version.internal", DRIVER_VERSION);
|
||||
|
||||
dstate_setinfo ("device.type", "psu");
|
||||
|
||||
/* Publish information from the IPMI structure */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* nut-libfreeipmi.c - NUT IPMI backend, using FreeIPMI
|
||||
*
|
||||
* Copyright (C)
|
||||
* 2011 - Arnaud Quette <arnaud.quette@free.fr>
|
||||
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
|
||||
* 2011 - Albert Chu <chu11@llnl.gov>
|
||||
*
|
||||
* Based on the sample codes 'ipmi-fru-example.c', 'frulib.c' and
|
||||
|
@ -58,10 +58,18 @@
|
|||
/* FreeIPMI contexts and configuration*/
|
||||
ipmi_ctx_t ipmi_ctx = NULL;
|
||||
ipmi_fru_parse_ctx_t fru_parse_ctx = NULL;
|
||||
ipmi_sdr_cache_ctx_t sdr_cache_ctx = NULL;
|
||||
ipmi_sdr_parse_ctx_t sdr_parse_ctx = NULL;
|
||||
ipmi_monitoring_ctx_t mon_ctx = NULL;
|
||||
struct ipmi_monitoring_ipmi_config ipmi_config;
|
||||
/* SDR management API has changed with 1.1.X and later */
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
ipmi_sdr_ctx_t sdr_ctx = NULL;
|
||||
#else
|
||||
ipmi_sdr_cache_ctx_t sdr_cache_ctx = NULL;
|
||||
ipmi_sdr_parse_ctx_t sdr_parse_ctx = NULL;
|
||||
#ifndef IPMI_SDR_MAX_RECORD_LENGTH
|
||||
#define IPMI_SDR_MAX_RECORD_LENGTH IPMI_SDR_CACHE_MAX_SDR_RECORD_LENGTH
|
||||
#endif
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
/* FIXME: freeipmi auto selects a cache based on the hostname you are
|
||||
* connecting too, but this is probably fine for you
|
||||
|
@ -276,6 +284,11 @@ static void libfreeipmi_cleanup()
|
|||
ipmi_fru_parse_ctx_destroy (fru_parse_ctx);
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
if (sdr_ctx) {
|
||||
ipmi_sdr_ctx_destroy (sdr_ctx);
|
||||
}
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
if (sdr_cache_ctx) {
|
||||
ipmi_sdr_cache_ctx_destroy (sdr_cache_ctx);
|
||||
}
|
||||
|
@ -283,6 +296,7 @@ static void libfreeipmi_cleanup()
|
|||
if (sdr_parse_ctx) {
|
||||
ipmi_sdr_parse_ctx_destroy (sdr_parse_ctx);
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
if (ipmi_ctx) {
|
||||
ipmi_ctx_close (ipmi_ctx);
|
||||
|
@ -467,7 +481,7 @@ static int libfreeipmi_get_board_info (const void *areabuf,
|
|||
* Return -1 on error, or the number of sensors found otherwise */
|
||||
static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
||||
{
|
||||
uint8_t sdr_record[IPMI_SDR_CACHE_MAX_SDR_RECORD_LENGTH];
|
||||
uint8_t sdr_record[IPMI_SDR_MAX_RECORD_LENGTH];
|
||||
uint8_t record_type, logical_physical_fru_device, logical_fru_device_device_slave_address;
|
||||
uint8_t tmp_entity_id, tmp_entity_instance;
|
||||
int sdr_record_len;
|
||||
|
@ -484,6 +498,23 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
ipmi_dev->sensors_count = 0;
|
||||
memset(ipmi_dev->sensors_id_list, 0, sizeof(ipmi_dev->sensors_id_list));
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
if (!(sdr_ctx = ipmi_sdr_ctx_create ()))
|
||||
{
|
||||
libfreeipmi_cleanup();
|
||||
fatal_with_errno(EXIT_FAILURE, "ipmi_sdr_ctx_create()");
|
||||
}
|
||||
|
||||
if (ipmi_sdr_cache_open (sdr_ctx, ipmi_ctx, CACHE_LOCATION) < 0)
|
||||
{
|
||||
if (ipmi_sdr_ctx_errnum (sdr_ctx) != IPMI_SDR_ERR_CACHE_READ_CACHE_DOES_NOT_EXIST)
|
||||
{
|
||||
libfreeipmi_cleanup();
|
||||
fatal_with_errno(EXIT_FAILURE, "ipmi_sdr_cache_open: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
}
|
||||
}
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
if (!(sdr_cache_ctx = ipmi_sdr_cache_ctx_create ()))
|
||||
{
|
||||
libfreeipmi_cleanup();
|
||||
|
@ -505,7 +536,32 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
ipmi_sdr_cache_ctx_errormsg (sdr_cache_ctx));
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
if (ipmi_sdr_ctx_errnum (sdr_ctx) == IPMI_SDR_ERR_CACHE_READ_CACHE_DOES_NOT_EXIST)
|
||||
{
|
||||
if (ipmi_sdr_cache_create (sdr_ctx,
|
||||
ipmi_ctx, CACHE_LOCATION,
|
||||
IPMI_SDR_CACHE_CREATE_FLAGS_DEFAULT,
|
||||
NULL, NULL) < 0)
|
||||
{
|
||||
libfreeipmi_cleanup();
|
||||
fatal_with_errno(EXIT_FAILURE, "ipmi_sdr_cache_create: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
}
|
||||
if (ipmi_sdr_cache_open (sdr_ctx,
|
||||
ipmi_ctx, CACHE_LOCATION) < 0)
|
||||
{
|
||||
if (ipmi_sdr_ctx_errnum (sdr_ctx) != IPMI_SDR_ERR_CACHE_READ_CACHE_DOES_NOT_EXIST)
|
||||
{
|
||||
libfreeipmi_cleanup();
|
||||
fatal_with_errno(EXIT_FAILURE, "ipmi_sdr_cache_open: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
}
|
||||
}
|
||||
}
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
if (ipmi_sdr_cache_ctx_errnum (sdr_cache_ctx) == IPMI_SDR_CACHE_ERR_CACHE_READ_CACHE_DOES_NOT_EXIST)
|
||||
{
|
||||
if (ipmi_sdr_cache_create (sdr_cache_ctx,
|
||||
|
@ -518,7 +574,6 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
fatal_with_errno(EXIT_FAILURE, "ipmi_sdr_cache_create: %s",
|
||||
ipmi_sdr_cache_ctx_errormsg (sdr_cache_ctx));
|
||||
}
|
||||
|
||||
if (ipmi_sdr_cache_open (sdr_cache_ctx,
|
||||
ipmi_ctx, CACHE_LOCATION) < 0)
|
||||
{
|
||||
|
@ -530,7 +585,16 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
if (ipmi_sdr_cache_record_count (sdr_ctx, &record_count) < 0) {
|
||||
fprintf (stderr,
|
||||
"ipmi_sdr_cache_record_count: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#else
|
||||
if (ipmi_sdr_cache_record_count (sdr_cache_ctx, &record_count) < 0)
|
||||
{
|
||||
fprintf (stderr,
|
||||
|
@ -538,19 +602,44 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
ipmi_sdr_cache_ctx_errormsg (sdr_cache_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
for (i = 0; i < record_count; i++, ipmi_sdr_cache_next (sdr_ctx))
|
||||
{
|
||||
memset (sdr_record, '\0', IPMI_SDR_MAX_RECORD_LENGTH);
|
||||
|
||||
if ((sdr_record_len = ipmi_sdr_cache_record_read (sdr_ctx,
|
||||
sdr_record,
|
||||
IPMI_SDR_MAX_RECORD_LENGTH)) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_cache_record_read: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
if (ipmi_sdr_parse_record_id_and_type (sdr_ctx,
|
||||
sdr_record,
|
||||
sdr_record_len,
|
||||
NULL,
|
||||
&record_type) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_parse_record_id_and_type: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#else
|
||||
for (i = 0; i < record_count; i++, ipmi_sdr_cache_next (sdr_cache_ctx))
|
||||
{
|
||||
memset (sdr_record, '\0', IPMI_SDR_CACHE_MAX_SDR_RECORD_LENGTH);
|
||||
memset (sdr_record, '\0', IPMI_SDR_MAX_RECORD_LENGTH);
|
||||
|
||||
if ((sdr_record_len = ipmi_sdr_cache_record_read (sdr_cache_ctx,
|
||||
sdr_record,
|
||||
IPMI_SDR_CACHE_MAX_SDR_RECORD_LENGTH)) < 0)
|
||||
IPMI_SDR_MAX_RECORD_LENGTH)) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_cache_record_read: %s",
|
||||
ipmi_sdr_cache_ctx_errormsg (sdr_cache_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (ipmi_sdr_parse_record_id_and_type (sdr_parse_ctx,
|
||||
sdr_record,
|
||||
sdr_record_len,
|
||||
|
@ -561,10 +650,27 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
ipmi_sdr_parse_ctx_errormsg (sdr_parse_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
if (record_type != IPMI_SDR_FORMAT_FRU_DEVICE_LOCATOR_RECORD)
|
||||
continue;
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
if (ipmi_sdr_parse_fru_device_locator_parameters (sdr_ctx,
|
||||
sdr_record,
|
||||
sdr_record_len,
|
||||
NULL,
|
||||
&logical_fru_device_device_slave_address,
|
||||
NULL,
|
||||
NULL,
|
||||
&logical_physical_fru_device,
|
||||
NULL) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_parse_fru_device_locator_parameters: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
if (ipmi_sdr_parse_fru_device_locator_parameters (sdr_parse_ctx,
|
||||
sdr_record,
|
||||
sdr_record_len,
|
||||
|
@ -579,12 +685,26 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
ipmi_sdr_parse_ctx_errormsg (sdr_parse_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
if (logical_physical_fru_device
|
||||
&& logical_fru_device_device_slave_address == ipmi_dev->ipmi_id)
|
||||
{
|
||||
found_device_id++;
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
if (ipmi_sdr_parse_fru_entity_id_and_instance (sdr_ctx,
|
||||
sdr_record,
|
||||
sdr_record_len,
|
||||
&entity_id,
|
||||
&entity_instance) < 0)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"ipmi_sdr_parse_fru_entity_id_and_instance: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
if (ipmi_sdr_parse_fru_entity_id_and_instance (sdr_parse_ctx,
|
||||
sdr_record,
|
||||
sdr_record_len,
|
||||
|
@ -596,6 +716,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
ipmi_sdr_parse_ctx_errormsg (sdr_parse_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -608,23 +729,60 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
else
|
||||
upsdebugx(1, "Found device id %d", ipmi_dev->ipmi_id);
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
if (ipmi_sdr_cache_first (sdr_ctx) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_cache_first: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
if (ipmi_sdr_cache_first (sdr_cache_ctx) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_cache_first: %s",
|
||||
ipmi_sdr_cache_ctx_errormsg (sdr_cache_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
for (i = 0; i < record_count; i++, ipmi_sdr_cache_next (sdr_ctx))
|
||||
{
|
||||
/* uint8_t sdr_record[IPMI_SDR_CACHE_MAX_SDR_RECORD_LENGTH];
|
||||
uint8_t record_type, tmp_entity_id, tmp_entity_instance;
|
||||
int sdr_record_len; */
|
||||
|
||||
memset (sdr_record, '\0', IPMI_SDR_MAX_RECORD_LENGTH);
|
||||
if ((sdr_record_len = ipmi_sdr_cache_record_read (sdr_ctx,
|
||||
sdr_record,
|
||||
IPMI_SDR_MAX_RECORD_LENGTH)) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_cache_record_read: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (ipmi_sdr_parse_record_id_and_type (sdr_ctx,
|
||||
sdr_record,
|
||||
sdr_record_len,
|
||||
&record_id,
|
||||
&record_type) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_parse_record_id_and_type: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
for (i = 0; i < record_count; i++, ipmi_sdr_cache_next (sdr_cache_ctx))
|
||||
{
|
||||
/* uint8_t sdr_record[IPMI_SDR_CACHE_MAX_SDR_RECORD_LENGTH];
|
||||
uint8_t record_type, tmp_entity_id, tmp_entity_instance;
|
||||
int sdr_record_len; */
|
||||
|
||||
memset (sdr_record, '\0', IPMI_SDR_CACHE_MAX_SDR_RECORD_LENGTH);
|
||||
memset (sdr_record, '\0', IPMI_SDR_MAX_RECORD_LENGTH);
|
||||
if ((sdr_record_len = ipmi_sdr_cache_record_read (sdr_cache_ctx,
|
||||
sdr_record,
|
||||
IPMI_SDR_CACHE_MAX_SDR_RECORD_LENGTH)) < 0)
|
||||
IPMI_SDR_MAX_RECORD_LENGTH)) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_cache_record_read: %s",
|
||||
ipmi_sdr_cache_ctx_errormsg (sdr_cache_ctx));
|
||||
|
@ -641,6 +799,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
ipmi_sdr_parse_ctx_errormsg (sdr_parse_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
upsdebugx (5, "Checking record %i (/%i)", record_id, record_count);
|
||||
|
||||
|
@ -650,6 +809,19 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
continue;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
if (ipmi_sdr_parse_entity_id_instance_type (sdr_ctx,
|
||||
sdr_record,
|
||||
sdr_record_len,
|
||||
&tmp_entity_id,
|
||||
&tmp_entity_instance,
|
||||
NULL) < 0)
|
||||
{
|
||||
fprintf (stderr, "ipmi_sdr_parse_entity_instance_type: %s",
|
||||
ipmi_sdr_ctx_errormsg (sdr_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
if (ipmi_sdr_parse_entity_id_instance_type (sdr_parse_ctx,
|
||||
sdr_record,
|
||||
sdr_record_len,
|
||||
|
@ -661,6 +833,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
ipmi_sdr_parse_ctx_errormsg (sdr_parse_ctx));
|
||||
goto cleanup;
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
if (tmp_entity_id == entity_id
|
||||
&& tmp_entity_instance == entity_instance)
|
||||
|
@ -677,6 +850,11 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
|
||||
cleanup:
|
||||
/* Cleanup */
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
if (sdr_ctx) {
|
||||
ipmi_sdr_ctx_destroy (sdr_ctx);
|
||||
}
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
if (sdr_cache_ctx) {
|
||||
ipmi_sdr_cache_ctx_destroy (sdr_cache_ctx);
|
||||
}
|
||||
|
@ -684,6 +862,7 @@ cleanup:
|
|||
if (sdr_parse_ctx) {
|
||||
ipmi_sdr_parse_ctx_destroy (sdr_parse_ctx);
|
||||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
return ipmi_dev->sensors_count;
|
||||
}
|
||||
|
@ -775,6 +954,8 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev)
|
|||
return -1;
|
||||
}
|
||||
|
||||
upsdebugx (1, "nut_ipmi_get_sensors_status: %i sensors to check", sensor_count);
|
||||
|
||||
for (i = 0; i < sensor_count; i++, ipmi_monitoring_sensor_iterator_next (mon_ctx))
|
||||
{
|
||||
int record_id, sensor_type;
|
||||
|
@ -797,6 +978,8 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev)
|
|||
continue;
|
||||
}
|
||||
|
||||
upsdebugx (1, "checking sensor #%i, type %i", record_id, sensor_type);
|
||||
|
||||
/* should we consider this for ALARM?
|
||||
* IPMI_MONITORING_STATE_NOMINAL
|
||||
* IPMI_MONITORING_STATE_WARNING
|
||||
|
@ -838,16 +1021,19 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev)
|
|||
ipmi_dev->temperature = *((double *)sensor_reading);
|
||||
upsdebugx (3, "Temperature: %.2f", *((double *)sensor_reading));
|
||||
dstate_setinfo("ambient.temperature", "%.2f", *((double *)sensor_reading));
|
||||
retval = 0;
|
||||
break;
|
||||
case IPMI_MONITORING_SENSOR_TYPE_VOLTAGE:
|
||||
ipmi_dev->voltage = *((double *)sensor_reading);
|
||||
upsdebugx (3, "Voltage: %.2f", *((double *)sensor_reading));
|
||||
dstate_setinfo("input.voltage", "%.2f", *((double *)sensor_reading));
|
||||
retval = 0;
|
||||
break;
|
||||
case IPMI_MONITORING_SENSOR_TYPE_CURRENT:
|
||||
ipmi_dev->input_current = *((double *)sensor_reading);
|
||||
upsdebugx (3, "Current: %.2f", *((double *)sensor_reading));
|
||||
dstate_setinfo("input.current", "%.2f", *((double *)sensor_reading));
|
||||
retval = 0;
|
||||
break;
|
||||
|
||||
case IPMI_MONITORING_SENSOR_TYPE_POWER_SUPPLY:
|
||||
|
@ -898,6 +1084,7 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev)
|
|||
str_count++;
|
||||
}
|
||||
break;
|
||||
|
||||
/* Not sure of the values of these, so get as much as possible... */
|
||||
case IPMI_MONITORING_SENSOR_TYPE_POWER_UNIT:
|
||||
upsdebugx (3, "Power Unit: status string");
|
||||
|
@ -938,6 +1125,7 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev)
|
|||
{
|
||||
case PSU_PRESENT:
|
||||
status_set("OL");
|
||||
retval = 0;
|
||||
break;
|
||||
case PSU_ABSENT:
|
||||
status_set("OFF");
|
||||
|
@ -946,6 +1134,7 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev)
|
|||
break;
|
||||
case PSU_POWER_FAILURE:
|
||||
status_set("OFF");
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -955,3 +1144,9 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev)
|
|||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
--chassis-control=CONTROL
|
||||
Control the chassis. This command provides power-up, power-down, and reset control. Supported values: POWER-DOWN, POWER-UP, POWER-CYCLE, HARD-RESET, DIAGNOS‐
|
||||
TIC-INTERRUPT, SOFT-SHUTDOWN.
|
||||
*/
|
||||
|
|
|
@ -95,8 +95,12 @@
|
|||
#define GETX_BATT_REPLACED '+' /* yymmdd */
|
||||
#define GETX_DATE_RESP_SIZE 6
|
||||
|
||||
/* FIXME: Both of the following constants are unused, and the first is not
|
||||
* valid C syntax (breaks LLVM). */
|
||||
#if 0
|
||||
#define GETX_UNIT_KVA '''' /* Read as xxx.xx */
|
||||
#define GETX_UNIT_WATTS "''" /* 2-character string request */
|
||||
#endif
|
||||
#define GETX_LOW_OUT_ALLOW '[' /* Tap up or inverter at this point */
|
||||
#define GETX_HI_OUT_ALLOW ']' /* Tap down or inverter at this point */
|
||||
#define GETX_NOTIFY_DELAY ',' /* Secs of delay for power fail alert */
|
||||
|
|
|
@ -43,7 +43,7 @@ static usb_device_id_t powercom_usb_device_table[] = {
|
|||
{ USB_DEVICE(POWERCOM_VENDORID, 0x00a5), NULL },
|
||||
/* PowerCOM BNT - Black Knight Pro */
|
||||
{ USB_DEVICE(POWERCOM_VENDORID, 0x00a6), NULL },
|
||||
/* PowerCOM BNT-xxxAP */
|
||||
/* PowerCOM Vanguard and BNT-xxxAP */
|
||||
{ USB_DEVICE(POWERCOM_VENDORID, 0x0004), NULL },
|
||||
|
||||
/* Terminating entry */
|
||||
|
|
|
@ -297,8 +297,6 @@ void upsdrv_initinfo(void)
|
|||
int retry = 3;
|
||||
char *v;
|
||||
|
||||
dstate_setinfo("driver.version.internal", "%s", DRIVER_VERSION);
|
||||
|
||||
usleep(100000);
|
||||
|
||||
/*
|
||||
|
|
|
@ -33,7 +33,8 @@ upsdrv_info_t upsdrv_info = {
|
|||
|
||||
void upsdrv_initinfo(void)
|
||||
{
|
||||
/* try to detect the UPS here - call fatal_with_errno(EXIT_FAILURE, ) if it fails */
|
||||
/* try to detect the UPS here - call fatal_with_errno(EXIT_FAILURE, ...)
|
||||
* or fatalx(EXIT_FAILURE, ...) if it fails */
|
||||
|
||||
/* dstate_setinfo("ups.mfr", "skel manufacturer"); */
|
||||
/* dstate_setinfo("ups.model", "longrun 15000"); */
|
||||
|
@ -158,7 +159,7 @@ void upsdrv_initups(void)
|
|||
|
||||
/* to get variables and flags from the command line, use this:
|
||||
*
|
||||
* first populate with upsdrv_buildvartable above, then...
|
||||
* first populate with upsdrv_makevartable() above, then...
|
||||
*
|
||||
* set flag foo : /bin/driver -x foo
|
||||
* set variable 'cable' to '1234' : /bin/driver -x cable=1234
|
||||
|
|
|
@ -60,6 +60,8 @@ static mib2nut_info_t *mib2nut[] = {
|
|||
&aphel_genesisII,
|
||||
&aphel_revelation,
|
||||
&eaton_marlin,
|
||||
&pulizzi_switched1,
|
||||
&pulizzi_switched2,
|
||||
&raritan,
|
||||
&baytech,
|
||||
&compaq,
|
||||
|
@ -91,7 +93,7 @@ const char *mibvers;
|
|||
static void disable_transfer_oids(void);
|
||||
|
||||
#define DRIVER_NAME "Generic SNMP UPS driver"
|
||||
#define DRIVER_VERSION "0.66"
|
||||
#define DRIVER_VERSION "0.68"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
@ -122,13 +124,10 @@ int outlet_index_base = -1;
|
|||
void upsdrv_initinfo(void)
|
||||
{
|
||||
snmp_info_t *su_info_p;
|
||||
char version[128];
|
||||
|
||||
upsdebugx(1, "SNMP UPS driver : entering upsdrv_initinfo()");
|
||||
|
||||
snprintf(version, sizeof version, "%s (mib: %s %s)",
|
||||
DRIVER_VERSION, mibname, mibvers);
|
||||
dstate_setinfo("driver.version.internal", "%s", version);
|
||||
dstate_setinfo("driver.version.data", "%s MIB %s", mibname, mibvers);
|
||||
|
||||
/* add instant commands to the info database.
|
||||
* outlet commands are processed later, during initial walk */
|
||||
|
@ -955,7 +954,7 @@ const char *su_find_infoval(info_lkp_t *oid2info, long value)
|
|||
info_lkp_t *info_lkp;
|
||||
|
||||
for (info_lkp = oid2info; (info_lkp != NULL) &&
|
||||
(strcmp(info_lkp->info_value, "NULL")); info_lkp++) {
|
||||
(strcmp(info_lkp->info_value, "NULL")) && (info_lkp->info_value != NULL); info_lkp++) {
|
||||
|
||||
if (info_lkp->oid_value == value) {
|
||||
upsdebugx(1, "su_find_infoval: found %s (value: %ld)",
|
||||
|
@ -1055,6 +1054,32 @@ int base_nut_outlet_offset(void)
|
|||
return (outlet_index_base==0)?1:0;
|
||||
}
|
||||
|
||||
/* try to determine the number of outlets, using a template definition,
|
||||
* that we walk, until we can't get anymore values */
|
||||
static int guestimate_outlet_count(const char *OID_template)
|
||||
{
|
||||
int base_index = 0;
|
||||
char test_OID[SU_INFOSIZE];
|
||||
int base_count;
|
||||
|
||||
upsdebugx(1, "guestimate_outlet_count(%s)", OID_template);
|
||||
|
||||
/* Determine if OID index starts from 0 or 1? */
|
||||
sprintf(test_OID, OID_template, base_index);
|
||||
if (nut_snmp_get(test_OID) == NULL)
|
||||
base_index++;
|
||||
|
||||
/* Now, actually iterate */
|
||||
for (base_count = 0 ; ; base_count++) {
|
||||
sprintf(test_OID, OID_template, base_index + base_count);
|
||||
if (nut_snmp_get(test_OID) == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
upsdebugx(3, "guestimate_outlet_count: %i", base_count);
|
||||
return base_count;
|
||||
}
|
||||
|
||||
/* process a single data from a walk */
|
||||
bool_t get_and_process_data(int mode, snmp_info_t *su_info_p)
|
||||
{
|
||||
|
@ -1236,10 +1261,20 @@ bool_t snmp_ups_walk(int mode)
|
|||
|
||||
if(dstate_getinfo("outlet.count") == NULL) {
|
||||
/* FIXME: should we disable it?
|
||||
* su_info_p->flags &= ~SU_FLAG_OK; */
|
||||
continue;
|
||||
* su_info_p->flags &= ~SU_FLAG_OK;
|
||||
* or rely on guestimation? */
|
||||
if ((outlet_count = guestimate_outlet_count(su_info_p->OID)) == -1) {
|
||||
/* Failed */
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
/* Publish the count estimation */
|
||||
dstate_setinfo("outlet.count", "%i", outlet_count);
|
||||
}
|
||||
}
|
||||
else {
|
||||
outlet_count = atoi(dstate_getinfo("outlet.count"));
|
||||
}
|
||||
outlet_count = atoi(dstate_getinfo("outlet.count"));
|
||||
|
||||
/* general init of data using the template */
|
||||
instantiate_info(su_info_p, &cur_info_p);
|
||||
|
@ -1495,11 +1530,14 @@ int su_instcmd(const char *cmdname, const char *extradata)
|
|||
snmp_info_t *su_info_p = NULL;
|
||||
int status;
|
||||
int retval = STAT_INSTCMD_FAILED;
|
||||
int cmd_offset = 0;
|
||||
|
||||
upsdebugx(2, "entering su_instcmd(%s, %s)", cmdname, extradata);
|
||||
|
||||
if (strncmp(cmdname, "outlet", 6))
|
||||
/* FIXME: this should only apply if strchr(%)! */
|
||||
if (strncmp(cmdname, "outlet", 6)) {
|
||||
su_info_p = su_find_info(cmdname);
|
||||
}
|
||||
else {
|
||||
snmp_info_t *tmp_info_p;
|
||||
char *outlet_number_ptr = strchr(cmdname, '.');
|
||||
|
@ -1539,8 +1577,15 @@ int su_instcmd(const char *cmdname, const char *extradata)
|
|||
}
|
||||
/* adapt the OID */
|
||||
if (su_info_p->OID != NULL) {
|
||||
/* Workaround buggy Eaton Pulizzi implementation
|
||||
* which have different offsets index for data & commands! */
|
||||
if (su_info_p->flags & SU_CMD_OFFSET) {
|
||||
upsdebugx(3, "Adding command offset");
|
||||
cmd_offset++;
|
||||
}
|
||||
|
||||
sprintf((char *)su_info_p->OID, tmp_info_p->OID,
|
||||
outlet_number - base_nut_outlet_offset());
|
||||
outlet_number - base_nut_outlet_offset() + cmd_offset);
|
||||
} else {
|
||||
free_info(su_info_p);
|
||||
return STAT_INSTCMD_UNKNOWN;
|
||||
|
|
|
@ -132,13 +132,18 @@ typedef struct {
|
|||
* disable the other providers */
|
||||
#define SU_FLAG_SETINT (1 << 6) /* save value */
|
||||
#define SU_OUTLET (1 << 7) /* outlet template definition */
|
||||
#define SU_CMD_OFFSET (1 << 8) /* Add +1 to the OID index */
|
||||
/* Notes on outlet templates usage:
|
||||
* - outlet.count MUST exist and MUST be declared before any outlet template
|
||||
* Otherwise, the driver will try to determine it by itself...
|
||||
* - the first outlet template MUST NOT be a server side variable (ie MUST have
|
||||
* a valid OID) in order to detect the base SNMP index (0 or 1)
|
||||
*/
|
||||
|
||||
/* status string components */
|
||||
/* status string components
|
||||
* FIXME: these should be removed, since there is no added value.
|
||||
* Ie, this can be guessed from info->type! */
|
||||
|
||||
#define SU_STATUS_PWR (0 << 8) /* indicates power status element */
|
||||
#define SU_STATUS_BATT (1 << 8) /* indicates battery status element */
|
||||
#define SU_STATUS_CAL (2 << 8) /* indicates calibration status element */
|
||||
|
|
|
@ -75,7 +75,6 @@
|
|||
battery.temperature
|
||||
battery.voltage
|
||||
battery.voltage.nominal
|
||||
driver.version.internal
|
||||
input.frequency
|
||||
input.sensitivity (RW) (1)
|
||||
input.transfer.high (RW)
|
||||
|
|
|
@ -717,6 +717,10 @@ void upsdrv_makevartable(void)
|
|||
|
||||
upsdebugx(1, "upsdrv_makevartable...");
|
||||
|
||||
snprintf(temp, sizeof(temp), "Set low battery level, in %% (default=%s).", DEFAULT_LOWBATT);
|
||||
addvar (VAR_VALUE, HU_VAR_LOWBATT, temp);
|
||||
|
||||
|
||||
snprintf(temp, sizeof(temp), "Set shutdown delay, in seconds (default=%s)", DEFAULT_OFFDELAY);
|
||||
addvar(VAR_VALUE, HU_VAR_OFFDELAY, temp);
|
||||
|
||||
|
@ -738,6 +742,8 @@ void upsdrv_makevartable(void)
|
|||
addvar(VAR_VALUE, "productid", "Regular expression to match UPS Product numerical ID (4 digits hexadecimal)");
|
||||
addvar(VAR_VALUE, "bus", "Regular expression to match USB bus name");
|
||||
addvar(VAR_FLAG, "explore", "Diagnostic matching of unsupported UPS");
|
||||
#else
|
||||
addvar(VAR_VALUE, "notification", "Set notification type, (ignored, only for backward compatibility)");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -855,7 +861,6 @@ void upsdrv_initinfo(void)
|
|||
upsdebugx(1, "upsdrv_initinfo...");
|
||||
|
||||
dstate_setinfo("driver.version.data", "%s", subdriver->name);
|
||||
dstate_setinfo("driver.version.internal", DRIVER_VERSION);
|
||||
|
||||
/* init polling frequency */
|
||||
val = getval(HU_VAR_POLLFREQ);
|
||||
|
@ -939,6 +944,14 @@ void upsdrv_initups(void)
|
|||
fatalx(EXIT_FAILURE, "Can't initialize data from HID UPS");
|
||||
}
|
||||
|
||||
if (dstate_getinfo("battery.charge.low")) {
|
||||
/* Retrieve user defined battery settings */
|
||||
val = getval(HU_VAR_LOWBATT);
|
||||
if (val) {
|
||||
dstate_setinfo("battery.charge.low", "%ld", strtol(val, NULL, 10));
|
||||
}
|
||||
}
|
||||
|
||||
if (dstate_getinfo("ups.delay.start")) {
|
||||
/* Retrieve user defined delay settings */
|
||||
val = getval(HU_VAR_ONDELAY);
|
||||
|
|
|
@ -37,11 +37,13 @@ extern hid_dev_handle_t udev;
|
|||
extern bool_t use_interrupt_pipe; /* Set to FALSE if interrupt reports should not be used */
|
||||
|
||||
/* Driver's parameters */
|
||||
#define HU_VAR_LOWBATT "lowbatt"
|
||||
#define HU_VAR_ONDELAY "ondelay"
|
||||
#define HU_VAR_OFFDELAY "offdelay"
|
||||
#define HU_VAR_POLLFREQ "pollfreq"
|
||||
|
||||
/* Parameters default values */
|
||||
#define DEFAULT_LOWBATT "30" /* percentage of battery charge to consider the UPS in low battery state */
|
||||
#define DEFAULT_ONDELAY "30" /* Delay between return of utility power */
|
||||
/* and powering up of load, in seconds */
|
||||
/* CAUTION: ondelay > offdelay */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue