Imported Upstream version 2.7.4
This commit is contained in:
parent
fd413a3168
commit
c9cb2187ee
290 changed files with 7473 additions and 2607 deletions
|
|
@ -129,6 +129,7 @@ rhino_SOURCES = rhino.c
|
|||
rhino_LDADD = $(LDADD) -lm
|
||||
safenet_SOURCES = safenet.c
|
||||
solis_SOURCES = solis.c
|
||||
solis_LDADD = $(LDADD) -lm
|
||||
tripplite_SOURCES = tripplite.c
|
||||
tripplite_LDADD = $(LDADD) -lm
|
||||
tripplitesu_SOURCES = tripplitesu.c
|
||||
|
|
@ -199,8 +200,8 @@ mge_shut_LDADD = $(LDADD)
|
|||
# SNMP
|
||||
snmp_ups_SOURCES = snmp-ups.c apc-mib.c baytech-mib.c compaq-mib.c eaton-mib.c \
|
||||
ietf-mib.c mge-mib.c netvision-mib.c powerware-mib.c raritan-pdu-mib.c \
|
||||
bestpower-mib.c cyberpower-mib.c delta_ups-mib.c \
|
||||
xppc-mib.c
|
||||
bestpower-mib.c cyberpower-mib.c delta_ups-mib.c xppc-mib.c huawei-mib.c \
|
||||
eaton-ats-mib.c apc-ats-mib.c
|
||||
snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS)
|
||||
|
||||
# NEON XML/HTTP
|
||||
|
|
@ -264,7 +265,7 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \
|
|||
delta_ups-mib.h nutdrv_qx.h nutdrv_qx_bestups.h nutdrv_qx_blazer-common.h nutdrv_qx_mecer.h \
|
||||
nutdrv_qx_megatec.h nutdrv_qx_megatec-old.h nutdrv_qx_mustek.h nutdrv_qx_q1.h \
|
||||
nutdrv_qx_voltronic.h nutdrv_qx_voltronic-qs.h nutdrv_qx_voltronic-qs-hex.h nutdrv_qx_zinto.h \
|
||||
xppc-mib.h
|
||||
xppc-mib.h huawei-mib.h eaton-ats-mib.h apc-ats-mib.h
|
||||
|
||||
# Define a dummy library so that Automake builds rules for the
|
||||
# corresponding object files. This library is not actually built,
|
||||
|
|
|
|||
|
|
@ -426,13 +426,14 @@ am_snmp_ups_OBJECTS = snmp-ups.$(OBJEXT) apc-mib.$(OBJEXT) \
|
|||
ietf-mib.$(OBJEXT) mge-mib.$(OBJEXT) netvision-mib.$(OBJEXT) \
|
||||
powerware-mib.$(OBJEXT) raritan-pdu-mib.$(OBJEXT) \
|
||||
bestpower-mib.$(OBJEXT) cyberpower-mib.$(OBJEXT) \
|
||||
delta_ups-mib.$(OBJEXT) xppc-mib.$(OBJEXT)
|
||||
delta_ups-mib.$(OBJEXT) xppc-mib.$(OBJEXT) \
|
||||
huawei-mib.$(OBJEXT) eaton-ats-mib.$(OBJEXT) \
|
||||
apc-ats-mib.$(OBJEXT)
|
||||
snmp_ups_OBJECTS = $(am_snmp_ups_OBJECTS)
|
||||
snmp_ups_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1)
|
||||
am_solis_OBJECTS = solis.$(OBJEXT)
|
||||
solis_OBJECTS = $(am_solis_OBJECTS)
|
||||
solis_LDADD = $(LDADD)
|
||||
solis_DEPENDENCIES = $(am__DEPENDENCIES_2)
|
||||
solis_DEPENDENCIES = $(am__DEPENDENCIES_3)
|
||||
am_tripplite_OBJECTS = tripplite.$(OBJEXT)
|
||||
tripplite_OBJECTS = $(am_tripplite_OBJECTS)
|
||||
tripplite_DEPENDENCIES = $(am__DEPENDENCIES_3)
|
||||
|
|
@ -622,6 +623,7 @@ LD = @LD@
|
|||
LDFLAGS = @LDFLAGS@
|
||||
LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@
|
||||
LIBAVAHI_LIBS = @LIBAVAHI_LIBS@
|
||||
LIBDIR = @LIBDIR@
|
||||
LIBGD_CFLAGS = @LIBGD_CFLAGS@
|
||||
LIBGD_LDFLAGS = @LIBGD_LDFLAGS@
|
||||
LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@
|
||||
|
|
@ -833,6 +835,7 @@ rhino_SOURCES = rhino.c
|
|||
rhino_LDADD = $(LDADD) -lm
|
||||
safenet_SOURCES = safenet.c
|
||||
solis_SOURCES = solis.c
|
||||
solis_LDADD = $(LDADD) -lm
|
||||
tripplite_SOURCES = tripplite.c
|
||||
tripplite_LDADD = $(LDADD) -lm
|
||||
tripplitesu_SOURCES = tripplitesu.c
|
||||
|
|
@ -895,8 +898,8 @@ mge_shut_LDADD = $(LDADD)
|
|||
# SNMP
|
||||
snmp_ups_SOURCES = snmp-ups.c apc-mib.c baytech-mib.c compaq-mib.c eaton-mib.c \
|
||||
ietf-mib.c mge-mib.c netvision-mib.c powerware-mib.c raritan-pdu-mib.c \
|
||||
bestpower-mib.c cyberpower-mib.c delta_ups-mib.c \
|
||||
xppc-mib.c
|
||||
bestpower-mib.c cyberpower-mib.c delta_ups-mib.c xppc-mib.c huawei-mib.c \
|
||||
eaton-ats-mib.c apc-ats-mib.c
|
||||
|
||||
snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS)
|
||||
|
||||
|
|
@ -950,7 +953,7 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \
|
|||
delta_ups-mib.h nutdrv_qx.h nutdrv_qx_bestups.h nutdrv_qx_blazer-common.h nutdrv_qx_mecer.h \
|
||||
nutdrv_qx_megatec.h nutdrv_qx_megatec-old.h nutdrv_qx_mustek.h nutdrv_qx_q1.h \
|
||||
nutdrv_qx_voltronic.h nutdrv_qx_voltronic-qs.h nutdrv_qx_voltronic-qs-hex.h nutdrv_qx_zinto.h \
|
||||
xppc-mib.h
|
||||
xppc-mib.h huawei-mib.h eaton-ats-mib.h apc-ats-mib.h
|
||||
|
||||
|
||||
# Define a dummy library so that Automake builds rules for the
|
||||
|
|
@ -1330,6 +1333,7 @@ distclean-compile:
|
|||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/al175.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apc-ats-mib.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apc-hid.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apc-mib.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcsmart-old.Po@am__quote@
|
||||
|
|
@ -1360,6 +1364,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delta_ups-mib.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dstate.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy_ups-dummy-ups.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaton-ats-mib.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaton-mib.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/etapro.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/everups.Po@am__quote@
|
||||
|
|
@ -1367,6 +1372,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamatronic.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genericups.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hidparser.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/huawei-mib.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idowell-hid.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ietf-mib.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isbmex.Po@am__quote@
|
||||
|
|
|
|||
447
drivers/apc-ats-mib.c
Executable file
447
drivers/apc-ats-mib.c
Executable file
|
|
@ -0,0 +1,447 @@
|
|||
/* apcats-mib.c - subdriver to monitor apcats SNMP devices with NUT
|
||||
*
|
||||
* Copyright (C)
|
||||
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
|
||||
* 2016 Arnaud Quette <ArnaudQuette@Eaton.com>
|
||||
*
|
||||
* Note: this subdriver was initially generated as a "stub" by the
|
||||
* gen-snmp-subdriver script. It must be customized!
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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 "apc-ats-mib.h"
|
||||
|
||||
#define APC_ATS_MIB_VERSION "0.2"
|
||||
|
||||
#define APC_ATS_SYSOID ".1.3.6.1.4.1.318.1.3.11"
|
||||
|
||||
static info_lkp_t ats_sensitivity_info[] = {
|
||||
{ 1, "high" },
|
||||
{ 2, "low" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ats_output_status_info[] = {
|
||||
{ 1, "OFF" }, /* fail */
|
||||
{ 2, "OL" }, /* ok */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ats_outletgroups_name_info[] = {
|
||||
{ 1, "total" },
|
||||
{ 2, "bank1" },
|
||||
{ 3, "bank2" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ats_outletgroups_status_info[] = {
|
||||
{ 1, "OL" }, /* normal */
|
||||
{ 2, "" }, /* lowload */
|
||||
{ 3, "" }, /* nearoverload */
|
||||
{ 4, "OVER" }, /* overload */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* APC ATS Snmp2NUT lookup table */
|
||||
static snmp_info_t apc_ats_mib[] = {
|
||||
|
||||
/* Device collection */
|
||||
{ "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ats", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2IdentManufacturer.0 = STRING: EATON */
|
||||
{ "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "APC", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
/* atsIdentModelNumber.0 = STRING: "AP7724" */
|
||||
{ "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.5.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* FIXME: RFC for device.firmware! */
|
||||
/* atsIdentHardwareRev.0 = STRING: "R01" */
|
||||
{ "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* FIXME: RFC for device.firmware.aux! */
|
||||
/* atsIdentFirmwareRev.0 = STRING: "3.0.5" */
|
||||
{ "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsIdentFirmwareDate.0 = STRING: "09/13/11" */
|
||||
/*{ "unmapped.atsIdentFirmwareDate", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.3.0", NULL, SU_FLAG_OK, NULL, NULL },*/
|
||||
/* atsIdentSerialNumber.0 = STRING: "5A1516T15268" */
|
||||
{ "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.6.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* FIXME: RFC for device.mfr.date! */
|
||||
/* atsIdentDateOfManufacture.0 = STRING: "04/18/2015" */
|
||||
{ "ups.mfr.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.4.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigProductName.0 = STRING: "m-ups-04" */
|
||||
{ "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.4.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* Input collection */
|
||||
/* atsIdentNominalLineVoltage.0 = INTEGER: 230 */
|
||||
{ "input.voltage.nominal", 0, 1, ".1.3.6.1.4.1.318.1.1.8.1.7.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsIdentNominalLineFrequency.0 = INTEGER: 50 */
|
||||
{ "input.frequency.nominal", 0, 1, ".1.3.6.1.4.1.318.1.1.8.1.8.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusSelectedSource.0 = INTEGER: sourceB(2) */
|
||||
{ "input.source", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigPreferredSource.0 = INTEGER: sourceB(2) */
|
||||
{ "input.source.preferred", ST_FLAG_RW, 1, ".1.3.6.1.4.1.318.1.1.8.4.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputVoltage.1.1.1 = INTEGER: 216 */
|
||||
{ "input.1.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputVoltage.2.1.1 = INTEGER: 215 */
|
||||
{ "input.2.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputFrequency.1 = INTEGER: 50 */
|
||||
{ "input.1.frequency", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.4.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputFrequency.2 = INTEGER: 50 */
|
||||
{ "input.2.frequency", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.4.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigVoltageSensitivity.0 = INTEGER: high(1) */
|
||||
{ "input.sensitivity", ST_FLAG_RW, 1, ".1.3.6.1.4.1.318.1.1.8.4.4.0", NULL, SU_FLAG_OK, &ats_sensitivity_info[0], NULL },
|
||||
/* FIXME: RFC for input.count! */
|
||||
/* atsNumInputs.0 = INTEGER: 2 */
|
||||
{ "input.count", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* Output collection */
|
||||
/* atsOutputFrequency.1 = INTEGER: 50 */
|
||||
{ "output.frequency", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.2.1.4.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankOutputVoltage.1 = INTEGER: 215 */
|
||||
{ "output.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.6.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* UPS collection */
|
||||
/* FIXME: RFC for device.status! */
|
||||
/* atsStatusVoltageOutStatus.0 = INTEGER: ok(2) */
|
||||
{ "ups.status", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.15.0", NULL, SU_FLAG_OK, &ats_output_status_info[0], NULL },
|
||||
|
||||
/* Outlet groups collection */
|
||||
/* Note: prefer the OutputBank data to the ConfigBank ones */
|
||||
/* atsConfigBankTableSize.0 = INTEGER: 3 */
|
||||
/*{ "outlet.group.count", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.13.0", NULL, SU_FLAG_OK, NULL, NULL },*/
|
||||
/* atsOutputBankTableSize.0 = INTEGER: 3 */
|
||||
{ "outlet.group.count", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.4.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigBankTableIndex.%i = INTEGER: %i */
|
||||
/*{ "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.4.14.1.1.%i", NULL, SU_FLAG_OK, NULL, NULL },*/
|
||||
/* atsOutputBankTableIndex.%i = INTEGER: %i */
|
||||
{ "outlet.group.%i.id", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.1.%i", NULL, SU_FLAG_OK | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* atsConfigBank.%i = INTEGER: total(1) */
|
||||
/*{ "outlet.group.%i.name", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.2.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP, &ats_group_name_info[0], NULL },*/
|
||||
/* atsOutputBank.1 = INTEGER: total(1) */
|
||||
{ "outlet.group.%i.name", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.3.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP, &ats_outletgroups_name_info[0], NULL },
|
||||
/* atsOutputBankCurrent.%i = Gauge32: 88 */
|
||||
{ "outlet.group.%i.current", 0, 0.1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.4.%i", NULL, SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* atsOutputBankState.%i = INTEGER: normal(1) */
|
||||
{ "outlet.group.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.5.%i", NULL, SU_OUTLET_GROUP, &ats_outletgroups_status_info[0], NULL },
|
||||
/* atsOutputBankOutputVoltage.%i = INTEGER: 215 */
|
||||
{ "outlet.group.%i.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.6.%i", NULL, SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* atsOutputBankPower.1 = INTEGER: 1883 */
|
||||
{ "outlet.group.%i.realpower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.15.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
|
||||
|
||||
#if 0 /* FIXME: Remaining data to be processed */
|
||||
/* atsIdentDeviceRating.0 = INTEGER: 32 */
|
||||
{ "unmapped.atsIdentDeviceRating", 0, 1, ".1.3.6.1.4.1.318.1.1.8.1.9.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationNumInputs.0 = INTEGER: 2 */
|
||||
{ "unmapped.atsCalibrationNumInputs", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationNumInputPhases.0 = INTEGER: 1 */
|
||||
{ "unmapped.atsCalibrationNumInputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationInputTableIndex.1.1.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsCalibrationInputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.1.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationInputTableIndex.2.1.1 = INTEGER: 2 */
|
||||
{ "unmapped.atsCalibrationInputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.1.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationInputPhaseTableIndex.1.1.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsCalibrationInputPhaseTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.2.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationInputPhaseTableIndex.2.1.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsCalibrationInputPhaseTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.2.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsLineVoltageCalibrationFactor.1.1.1 = INTEGER: 487 */
|
||||
{ "unmapped.atsLineVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.3.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsLineVoltageCalibrationFactor.2.1.1 = INTEGER: 488 */
|
||||
{ "unmapped.atsLineVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.3.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltages.0 = INTEGER: 5 */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltages", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltageTableIndex.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltageTableIndex.2 = INTEGER: 2 */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltageTableIndex.3 = INTEGER: 3 */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltageTableIndex.4 = INTEGER: 4 */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.4", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltageTableIndex.5 = INTEGER: 5 */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.5", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltage.1 = INTEGER: powerSupply24V(1) */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltage.2 = INTEGER: powerSupply12V(2) */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltage.3 = INTEGER: powerSupply(3) */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltage.4 = INTEGER: powerSupply24VSourceB(4) */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.4", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationPowerSupplyVoltage.5 = INTEGER: powerSupplyMinus12V(5) */
|
||||
{ "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.5", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsPowerSupplyVoltageCalibrationFactor.1 = INTEGER: 521 */
|
||||
{ "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsPowerSupplyVoltageCalibrationFactor.2 = INTEGER: 1076 */
|
||||
{ "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsPowerSupplyVoltageCalibrationFactor.3 = INTEGER: 2560 */
|
||||
{ "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsPowerSupplyVoltageCalibrationFactor.4 = INTEGER: 521 */
|
||||
{ "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.4", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsPowerSupplyVoltageCalibrationFactor.5 = INTEGER: 975 */
|
||||
{ "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.5", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationNumOutputs.0 = INTEGER: 1 */
|
||||
{ "unmapped.atsCalibrationNumOutputs", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationNumOutputPhases.0 = INTEGER: 1 */
|
||||
{ "unmapped.atsCalibrationNumOutputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationOutputTableIndex.1.phase1.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsCalibrationOutputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.3.1.1.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsCalibrationOutputPhasesTableIndex.1.phase1.1 = INTEGER: phase1(1) */
|
||||
{ "unmapped.atsCalibrationOutputPhasesTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.3.1.2.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputCurrentCalibrationFactor.1.phase1.1 = INTEGER: 487 */
|
||||
{ "unmapped.atsOutputCurrentCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.3.1.3.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsControlResetATS.0 = INTEGER: none(1) */
|
||||
{ "unmapped.atsControlResetATS", 0, 1, ".1.3.6.1.4.1.318.1.1.8.3.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsControlClearAllAlarms.0 = INTEGER: -1 */
|
||||
{ "unmapped.atsControlClearAllAlarms", 0, 1, ".1.3.6.1.4.1.318.1.1.8.3.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsConfigFrontPanelLockout.0 = INTEGER: enableFrontPanel(2) */
|
||||
{ "unmapped.atsConfigFrontPanelLockout", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.3.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsConfigTransferVoltageRange.0 = INTEGER: medium(2) */
|
||||
{ "unmapped.atsConfigTransferVoltageRange", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.5.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigCurrentLimit.0 = INTEGER: 32 */
|
||||
{ "unmapped.atsConfigCurrentLimit", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.6.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigResetValues.0 = INTEGER: -1 */
|
||||
{ "unmapped.atsConfigResetValues", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.7.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigLineVRMS.0 = INTEGER: 230 */
|
||||
{ "unmapped.atsConfigLineVRMS", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.8.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigLineVRMSNarrowLimit.0 = INTEGER: 16 */
|
||||
{ "unmapped.atsConfigLineVRMSNarrowLimit", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.9.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigLineVRMSMediumLimit.0 = INTEGER: 23 */
|
||||
{ "unmapped.atsConfigLineVRMSMediumLimit", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.10.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigLineVRMSWideLimit.0 = INTEGER: 30 */
|
||||
{ "unmapped.atsConfigLineVRMSWideLimit", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.11.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigFrequencyDeviation.0 = INTEGER: two(2) */
|
||||
{ "unmapped.atsConfigFrequencyDeviation", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.12.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* Outlet groups collection */
|
||||
/* atsConfigBankLowLoadThreshold.1 = INTEGER: 0 */
|
||||
{ "unmapped.atsConfigBankLowLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.3.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigBankLowLoadThreshold.2 = INTEGER: 0 */
|
||||
{ "unmapped.atsConfigBankLowLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.3.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigBankLowLoadThreshold.3 = INTEGER: 0 */
|
||||
{ "unmapped.atsConfigBankLowLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.3.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigBankNearOverLoadThreshold.1 = INTEGER: 28 */
|
||||
{ "unmapped.atsConfigBankNearOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.4.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigBankNearOverLoadThreshold.2 = INTEGER: 12 */
|
||||
{ "unmapped.atsConfigBankNearOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.4.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigBankNearOverLoadThreshold.3 = INTEGER: 12 */
|
||||
{ "unmapped.atsConfigBankNearOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.4.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigBankOverLoadThreshold.1 = INTEGER: 32 */
|
||||
{ "unmapped.atsConfigBankOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.5.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigBankOverLoadThreshold.2 = INTEGER: 16 */
|
||||
{ "unmapped.atsConfigBankOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.5.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigBankOverLoadThreshold.3 = INTEGER: 16 */
|
||||
{ "unmapped.atsConfigBankOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.5.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsConfigPhaseTableSize.0 = INTEGER: 0 */
|
||||
{ "unmapped.atsConfigPhaseTableSize", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.15.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusCommStatus.0 = INTEGER: atsCommEstablished(2) */
|
||||
{ "unmapped.atsStatusCommStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsStatusRedundancyState.0 = INTEGER: atsFullyRedundant(2) */
|
||||
{ "unmapped.atsStatusRedundancyState", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.3.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusOverCurrentState.0 = INTEGER: atsCurrentOK(2) */
|
||||
{ "unmapped.atsStatusOverCurrentState", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.4.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatus5VPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */
|
||||
{ "unmapped.atsStatus5VPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.5.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatus24VPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */
|
||||
{ "unmapped.atsStatus24VPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.6.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatus24VSourceBPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */
|
||||
{ "unmapped.atsStatus24VSourceBPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.7.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusPlus12VPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */
|
||||
{ "unmapped.atsStatusPlus12VPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.8.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusMinus12VPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */
|
||||
{ "unmapped.atsStatusMinus12VPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.9.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusSwitchStatus.0 = INTEGER: ok(2) */
|
||||
{ "unmapped.atsStatusSwitchStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.10.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusFrontPanel.0 = INTEGER: unlocked(2) */
|
||||
{ "unmapped.atsStatusFrontPanel", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.11.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusSourceAStatus.0 = INTEGER: ok(2) */
|
||||
{ "unmapped.atsStatusSourceAStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.12.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusSourceBStatus.0 = INTEGER: ok(2) */
|
||||
{ "unmapped.atsStatusSourceBStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.13.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusPhaseSyncStatus.0 = INTEGER: inSync(1) */
|
||||
{ "unmapped.atsStatusPhaseSyncStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.14.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsStatusHardwareStatus.0 = INTEGER: ok(2) */
|
||||
{ "unmapped.atsStatusHardwareStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.16.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsStatusResetMaxMinValues.0 = INTEGER: -1 */
|
||||
{ "unmapped.atsStatusResetMaxMinValues", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.2.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsInputTableIndex.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsInputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputTableIndex.2 = INTEGER: 2 */
|
||||
{ "unmapped.atsInputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.1.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsNumInputPhases.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsNumInputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.2.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsNumInputPhases.2 = INTEGER: 1 */
|
||||
{ "unmapped.atsNumInputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.2.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputVoltageOrientation.1 = INTEGER: singlePhase(2) */
|
||||
{ "unmapped.atsInputVoltageOrientation", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.3.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputVoltageOrientation.2 = INTEGER: singlePhase(2) */
|
||||
{ "unmapped.atsInputVoltageOrientation", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.3.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsInputType.1 = INTEGER: main(2) */
|
||||
{ "unmapped.atsInputType", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.5.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputType.2 = INTEGER: main(2) */
|
||||
{ "unmapped.atsInputType", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.5.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputName.1 = STRING: "Source A" */
|
||||
{ "unmapped.atsInputName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.6.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputName.2 = STRING: "Source B" */
|
||||
{ "unmapped.atsInputName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.6.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputPhaseTableIndex.1.1.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsInputPhaseTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.1.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputPhaseTableIndex.2.1.1 = INTEGER: 2 */
|
||||
{ "unmapped.atsInputPhaseTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.1.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputPhaseIndex.1.1.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsInputPhaseIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.2.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputPhaseIndex.2.1.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsInputPhaseIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.2.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsInputMaxVoltage.1.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMaxVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.4.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMaxVoltage.2.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMaxVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.4.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMinVoltage.1.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMinVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.5.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMinVoltage.2.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMinVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.5.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputCurrent.1.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.6.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputCurrent.2.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.6.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMaxCurrent.1.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.7.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMaxCurrent.2.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.7.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMinCurrent.1.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.8.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMinCurrent.2.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.8.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputPower.1.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.9.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputPower.2.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.9.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMaxPower.1.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.10.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMaxPower.2.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.10.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMinPower.1.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.11.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsInputMinPower.2.1.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsInputMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.11.2.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsNumOutputs.0 = INTEGER: 1 */
|
||||
{ "unmapped.atsNumOutputs", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputTableIndex.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsOutputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.2.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsNumOutputPhases.1 = INTEGER: 1 */
|
||||
{ "unmapped.atsNumOutputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.2.1.2.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputVoltageOrientation.1 = INTEGER: singlePhase(2) */
|
||||
{ "unmapped.atsOutputVoltageOrientation", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.2.1.3.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsOutputPhase.1 = INTEGER: phase1(1) */
|
||||
{ "unmapped.atsOutputPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.2.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputPhase.2 = INTEGER: phase1(1) */
|
||||
{ "unmapped.atsOutputPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.2.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputPhase.3 = INTEGER: phase1(1) */
|
||||
{ "unmapped.atsOutputPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.2.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsOutputBankMaxCurrent.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.7.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxCurrent.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.7.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxCurrent.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.7.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinCurrent.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.8.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinCurrent.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.8.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinCurrent.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.8.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankLoad.1 = INTEGER: 1883 */
|
||||
{ "unmapped.atsOutputBankLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.9.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankLoad.2 = INTEGER: 984 */
|
||||
{ "unmapped.atsOutputBankLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.9.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankLoad.3 = INTEGER: 898 */
|
||||
{ "unmapped.atsOutputBankLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.9.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxLoad.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.10.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxLoad.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.10.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxLoad.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.10.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinLoad.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.11.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinLoad.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.11.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinLoad.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.11.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsOutputBankPercentLoad.1 = INTEGER: 25 */
|
||||
{ "unmapped.atsOutputBankPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.12.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankPercentLoad.2 = INTEGER: 13 */
|
||||
{ "unmapped.atsOutputBankPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.12.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankPercentLoad.3 = INTEGER: 12 */
|
||||
{ "unmapped.atsOutputBankPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.12.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsOutputBankMaxPercentLoad.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.13.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxPercentLoad.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.13.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxPercentLoad.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.13.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinPercentLoad.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.14.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinPercentLoad.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.14.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinPercentLoad.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.14.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsOutputBankMaxPower.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.16.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxPower.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.16.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxPower.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.16.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinPower.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.17.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinPower.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.17.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinPower.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.17.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* atsOutputBankPercentPower.1 = INTEGER: 25 */
|
||||
{ "unmapped.atsOutputBankPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.18.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankPercentPower.2 = INTEGER: 13 */
|
||||
{ "unmapped.atsOutputBankPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.18.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankPercentPower.3 = INTEGER: 12 */
|
||||
{ "unmapped.atsOutputBankPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.18.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxPercentPower.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.19.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxPercentPower.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.19.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMaxPercentPower.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMaxPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.19.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinPercentPower.1 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.20.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinPercentPower.2 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.20.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* atsOutputBankMinPercentPower.3 = INTEGER: -1 */
|
||||
{ "unmapped.atsOutputBankMinPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.20.3", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
#endif /* 0 */
|
||||
|
||||
/* end of structure. */
|
||||
{ NULL, 0, 0, NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
mib2nut_info_t apc_ats = { "apc_ats", APC_ATS_MIB_VERSION, NULL, NULL, apc_ats_mib, APC_ATS_SYSOID };
|
||||
29
drivers/apc-ats-mib.h
Executable file
29
drivers/apc-ats-mib.h
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
/* apcats-mib.h - subdriver to monitor apcats SNMP devices with NUT
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef APCATS_MIB_H
|
||||
#define APCATS_MIB_H
|
||||
|
||||
#include "main.h"
|
||||
#include "snmp-ups.h"
|
||||
|
||||
extern mib2nut_info_t apc_ats;
|
||||
|
||||
#endif /* APCATS_MIB_H */
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
#include "apc-hid.h"
|
||||
#include "usb-common.h"
|
||||
|
||||
#define APC_HID_VERSION "APC HID 0.95"
|
||||
#define APC_HID_VERSION "APC HID 0.96"
|
||||
|
||||
/* APC */
|
||||
#define APC_VENDORID 0x051d
|
||||
|
|
@ -62,6 +62,11 @@ static void *general_apc_check(USBDevice_t *device)
|
|||
{
|
||||
int i = 0;
|
||||
|
||||
if (!device->Product) {
|
||||
upslogx(LOG_WARNING, "device->Product is NULL so it is not possible to determine whether to activate max_report_size workaround");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Some models of Back-UPS overflow on some ReportID.
|
||||
* This results in some data not being exposed and IO errors on
|
||||
* WIN32, causing endless reconnection or driver's failure */
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ static info_lkp_t apcc_batt_info[] = {
|
|||
{ 1, "" }, /* unknown */
|
||||
{ 2, "" }, /* batteryNormal */
|
||||
{ 3, "LB" }, /* batteryLow */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
#define APCC_OID_POWER_STATUS ".1.3.6.1.4.1.318.1.1.1.4.1.1.0"
|
||||
|
|
@ -81,7 +81,7 @@ static info_lkp_t apcc_pwr_info[] = {
|
|||
{ 10, "BYPASS" }, /* hardwareFailureBypass */
|
||||
{ 11, "OFF" }, /* sleepingUntilPowerReturn */
|
||||
{ 12, "OL TRIM" }, /* onSmartTrim */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
#define APCC_OID_CAL_RESULTS ".1.3.6.1.4.1.318.1.1.1.7.2.6.0"
|
||||
|
|
@ -89,14 +89,14 @@ static info_lkp_t apcc_cal_info[] = {
|
|||
{ 1, "" }, /* Calibration Successful */
|
||||
{ 2, "" }, /* Calibration not done, battery capacity below 100% */
|
||||
{ 3, "CAL" }, /* Calibration in progress */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define APCC_OID_NEEDREPLBATT ".1.3.6.1.4.1.318.1.1.1.2.2.4.0"
|
||||
static info_lkp_t apcc_battrepl_info[] = {
|
||||
{ 1, "" }, /* No battery needs replacing */
|
||||
{ 2, "RB" }, /* Batteries need to be replaced */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define APCC_OID_TESTDIAGRESULTS ".1.3.6.1.4.1.318.1.1.1.7.2.3.0"
|
||||
|
|
@ -105,7 +105,7 @@ static info_lkp_t apcc_testdiag_results[] = {
|
|||
{ 2, "Failed" },
|
||||
{ 3, "InvalidTest" },
|
||||
{ 4, "TestInProgress"},
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define APCC_OID_SENSITIVITY ".1.3.6.1.4.1.318.1.1.1.5.2.7.0"
|
||||
|
|
@ -114,7 +114,7 @@ static info_lkp_t apcc_sensitivity_modes[] = {
|
|||
{ 2, "low" },
|
||||
{ 3, "medium" },
|
||||
{ 4, "high" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define APCC_OID_TRANSFERREASON "1.3.6.1.4.1.318.1.1.1.3.2.5.0"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "baytech-mib.h"
|
||||
|
||||
#define BAYTECH_MIB_VERSION "4031"
|
||||
#define BAYTECH_MIB_VERSION "4032"
|
||||
|
||||
/* Baytech MIB */
|
||||
#define BAYTECH_OID_MIB ".1.3.6.1.4.1.4779"
|
||||
|
|
@ -48,6 +48,8 @@ static snmp_info_t baytech_mib[] = {
|
|||
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 },
|
||||
{ "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2",
|
||||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* UPS page */
|
||||
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Baytech",
|
||||
|
|
@ -62,8 +64,6 @@ static snmp_info_t baytech_mib[] = {
|
|||
SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2",
|
||||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.temperature", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.10.2.1", NULL, 0, NULL, NULL },
|
||||
|
||||
/* Outlet page */
|
||||
|
|
@ -88,4 +88,4 @@ static snmp_info_t baytech_mib[] = {
|
|||
{ NULL, 0, 0, NULL, NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
mib2nut_info_t baytech = { "baytech", BAYTECH_MIB_VERSION, "", BAYTECH_OID_MODEL_NAME, baytech_mib };
|
||||
mib2nut_info_t baytech = { "baytech", BAYTECH_MIB_VERSION, NULL, BAYTECH_OID_MODEL_NAME, baytech_mib };
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ TODO List:
|
|||
#include "bcmxcp.h"
|
||||
|
||||
#define DRIVER_NAME "BCMXCP UPS driver"
|
||||
#define DRIVER_VERSION "0.30"
|
||||
#define DRIVER_VERSION "0.31"
|
||||
|
||||
#define MAX_NUT_NAME_LENGTH 128
|
||||
#define NUT_OUTLET_POSITION 7
|
||||
|
|
@ -1413,7 +1413,7 @@ void upsdrv_initinfo(void)
|
|||
if (strstr(pTmp, power_rating) == NULL) {
|
||||
snprintfcat(pTmp, len+10, " %s", power_rating);
|
||||
}
|
||||
dstate_setinfo("ups.model", "%s", rtrim(pTmp, ' '));
|
||||
dstate_setinfo("ups.model", "%s", str_rtrim(pTmp, ' '));
|
||||
free(pTmp);
|
||||
|
||||
/* Get meter map info from ups, and init our map */
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#define PW_COMMAND_START_BYTE (unsigned char)0xAB
|
||||
#define PW_LAST_SEQ (unsigned char)0x80 /* bit flag to indicate final sequence */
|
||||
#define PW_SEQ_MASK (unsigned char)0x7F /* bit mask to extract just the sequence # */
|
||||
#define PW_HEADER_LENGTH 4 /* Size of response header */
|
||||
|
||||
#define PW_ANSWER_MAX_SIZE 256
|
||||
|
||||
|
|
|
|||
|
|
@ -128,18 +128,21 @@ void send_write_command(unsigned char *command, int command_length)
|
|||
}
|
||||
}
|
||||
|
||||
#define PW_HEADER_SIZE (PW_HEADER_LENGTH + 1)
|
||||
#define PW_CMD_BUFSIZE 256
|
||||
/* get the answer of a command from the ups. And check that the answer is for this command */
|
||||
int get_answer(unsigned char *data, unsigned char command)
|
||||
{
|
||||
unsigned char buf[1024], *my_buf = buf;
|
||||
int length, end_length, res, endblock, bytes_read, ellapsed_time;
|
||||
unsigned char buf[PW_CMD_BUFSIZE], *my_buf = buf;
|
||||
int length, end_length, res, endblock, bytes_read, ellapsed_time, need_data;
|
||||
int tail;
|
||||
unsigned char block_number, sequence, seq_num;
|
||||
struct timeval start_time, now;
|
||||
|
||||
if (upsdev == NULL)
|
||||
return -1;
|
||||
|
||||
length = 1; /* non zero to enter the read loop */
|
||||
need_data = PW_HEADER_SIZE; /* 4 - cmd response header length, 1 for csum */
|
||||
end_length = 0; /* total length of sequence(s), not counting header(s) */
|
||||
endblock = 0; /* signal the last sequence in the block */
|
||||
bytes_read = 0; /* total length of data read, including XCP header */
|
||||
|
|
@ -151,14 +154,14 @@ int get_answer(unsigned char *data, unsigned char command)
|
|||
|
||||
/* Store current time */
|
||||
gettimeofday(&start_time, NULL);
|
||||
memset(&buf, 0x0, PW_CMD_BUFSIZE);
|
||||
|
||||
while ( (!endblock) && ((XCP_USB_TIMEOUT - ellapsed_time) > 0) ) {
|
||||
|
||||
/* Get (more) data if needed */
|
||||
if ((length - (bytes_read - 5)) > 0) {
|
||||
res = usb_interrupt_read(upsdev, 0x81,
|
||||
(char *)&buf[bytes_read],
|
||||
(PW_ANSWER_MAX_SIZE - bytes_read),
|
||||
if (need_data > 0) {
|
||||
res = usb_interrupt_read(upsdev, 0x81, (char *) buf + bytes_read,
|
||||
128,
|
||||
(XCP_USB_TIMEOUT - ellapsed_time));
|
||||
|
||||
/* Update time */
|
||||
|
|
@ -181,54 +184,41 @@ int get_answer(unsigned char *data, unsigned char command)
|
|||
/* FIXME: */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Else, we got some input bytes */
|
||||
/* Else, we got some input bytes */
|
||||
bytes_read += res;
|
||||
need_data -= res;
|
||||
upsdebug_hex(1, "get_answer", buf, bytes_read);
|
||||
}
|
||||
|
||||
if (need_data > 0) /* We need more data */
|
||||
continue;
|
||||
|
||||
/* Now validate XCP frame */
|
||||
/* Check header */
|
||||
if ( my_buf[0] != 0xAB ) {
|
||||
upsdebugx(2, "get_answer: wrong header");
|
||||
return -1;
|
||||
if ( my_buf[0] != PW_COMMAND_START_BYTE ) {
|
||||
upsdebugx(2, "get_answer: wrong header 0xab vs %02x", my_buf[0]);
|
||||
/* Sometime we read something wrong. bad cables? bad ports? */
|
||||
my_buf = memchr(my_buf, PW_COMMAND_START_BYTE, bytes_read);
|
||||
if (!my_buf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* These validations seem not needed! */
|
||||
/* Read block number byte */
|
||||
block_number = my_buf[1];
|
||||
upsdebugx(1, "get_answer: block_number = %x", block_number);
|
||||
#if 0
|
||||
if (command <= 0x43) {
|
||||
if ((command - 0x30) != block_number){
|
||||
nutusb_comm_fail("Receive error (Request command): BLOCK: %x (instead of %x), COMMAND: %x!\n",
|
||||
block_number, (command - 0x30), command);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (command >= 0x89) {
|
||||
if ((command == 0xA0) && (block_number != 0x01)){
|
||||
nutusb_comm_fail("Receive error (Request command): BLOCK: %x (instead of 0x01), COMMAND: %x!\n", block_number, command);
|
||||
return -1;
|
||||
}
|
||||
else if ((command != 0xA0) && (block_number != 0x09)){
|
||||
nutusb_comm_fail("Receive error (Request command): BLOCK: %x (instead of 0x09), COMMAND: %x!\n", block_number, command);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif /* if 0 */
|
||||
|
||||
/* Check data length byte (remove the header length) */
|
||||
length = my_buf[2];
|
||||
upsdebugx(3, "get_answer: data length = %d", length);
|
||||
if ((bytes_read - 5) < length) {
|
||||
upsdebugx(2, "get_answer: need to read %d more data", length - (bytes_read - 5));
|
||||
if (bytes_read - (length + PW_HEADER_SIZE) < 0) {
|
||||
if (need_data < 0) --need_data; /* count zerro byte too */
|
||||
need_data += length + 1; /* packet lenght + checksum */
|
||||
upsdebugx(2, "get_answer: need to read %d more data", need_data);
|
||||
continue;
|
||||
}
|
||||
/* Check if Length conforms to XCP (121 for normal, 140 for Test mode) */
|
||||
/* Use the more generous length for testing */
|
||||
if (length > 140 ) {
|
||||
if (length > 140) {
|
||||
upsdebugx(2, "get_answer: bad length");
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -260,13 +250,19 @@ int get_answer(unsigned char *data, unsigned char command)
|
|||
}
|
||||
else {
|
||||
seq_num++;
|
||||
upsdebugx(2, "get_answer: next sequence is %d", seq_num);
|
||||
}
|
||||
|
||||
/* copy the current valid XCP frame back */
|
||||
memcpy(data+end_length, my_buf+4, length);
|
||||
memcpy(data+end_length, my_buf + 4, length);
|
||||
/* increment pointers to process the next sequence */
|
||||
end_length += length;
|
||||
my_buf += length + 5;
|
||||
tail = bytes_read - (length + PW_HEADER_SIZE);
|
||||
if (tail > 0)
|
||||
my_buf = memmove(&buf[0], my_buf + length + PW_HEADER_SIZE, tail);
|
||||
else if (tail == 0)
|
||||
my_buf = &buf[0];
|
||||
bytes_read = tail;
|
||||
}
|
||||
|
||||
upsdebug_hex (5, "get_answer", data, end_length);
|
||||
|
|
@ -431,6 +427,10 @@ usb_dev_handle *nutusb_open(const char *port)
|
|||
if (usb_clear_halt(dev_h, 0x81) < 0)
|
||||
{
|
||||
upsdebugx(1, "Can't reset POWERWARE USB endpoint: %s", usb_strerror());
|
||||
if (dev_claimed)
|
||||
usb_release_interface(dev_h, 0);
|
||||
usb_reset(dev_h);
|
||||
sleep(5); /* Wait reconnect */
|
||||
errout = 1;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
static info_lkp_t bestpower_power_status[] = {
|
||||
{ 1, "OL" },
|
||||
{ 2, "OB" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
/* Snmp2NUT lookup table for Best Power MIB */
|
||||
|
|
@ -80,5 +80,5 @@ static snmp_info_t bestpower_mib[] = {
|
|||
{ NULL, 0, 0, NULL, NULL, 0, NULL, NULL }
|
||||
} ;
|
||||
|
||||
mib2nut_info_t bestpower = { "bestpower", BESTPOWER_MIB_VERSION, "",
|
||||
mib2nut_info_t bestpower = { "bestpower", BESTPOWER_MIB_VERSION, NULL,
|
||||
BESTPOWER_OID_MODEL_NAME, bestpower_mib };
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ static int blazer_vendor(const char *cmd)
|
|||
|
||||
snprintf(val, sizeof(val), "%.*s", information[i].len, &buf[index]);
|
||||
|
||||
dstate_setinfo(information[i].var, "%s", rtrim(val, ' '));
|
||||
dstate_setinfo(information[i].var, "%s", str_rtrim(val, ' '));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include "blazer.h"
|
||||
|
||||
#define DRIVER_NAME "Megatec/Q1 protocol serial driver"
|
||||
#define DRIVER_VERSION "1.56"
|
||||
#define DRIVER_VERSION "1.57"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "blazer.h"
|
||||
|
||||
#define DRIVER_NAME "Megatec/Q1 protocol USB driver"
|
||||
#define DRIVER_VERSION "0.11"
|
||||
#define DRIVER_VERSION "0.12"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
|
|
|||
|
|
@ -86,14 +86,14 @@
|
|||
/* Not used, as no longer supported by MIB ver. 1.76 (Github issue 118)
|
||||
static info_lkp_t cpqpower_alarm_ob[] = {
|
||||
{ 1, "OB" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
*/
|
||||
|
||||
/* Not used, as no longer supported by MIB ver. 1.76 (Github issue 118)
|
||||
static info_lkp_t cpqpower_alarm_lb[] = {
|
||||
{ 1, "LB" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
*/
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ static info_lkp_t cpqpower_pwr_info[] = {
|
|||
{ 8, "OL" /* parallelCapacity */ },
|
||||
{ 9, "OL" /* parallelRedundant */ },
|
||||
{ 10, "OL" /* HighEfficiencyMode */ },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
static info_lkp_t cpqpower_mode_info[] = {
|
||||
|
|
@ -123,7 +123,7 @@ static info_lkp_t cpqpower_mode_info[] = {
|
|||
{ 8, "parallel capacity" },
|
||||
{ 9, "parallel redundancy" },
|
||||
{10, "high efficiency" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t cpqpower_battery_abm_status[] = {
|
||||
|
|
@ -132,7 +132,7 @@ static info_lkp_t cpqpower_battery_abm_status[] = {
|
|||
/* { 3, "Floating" }, */
|
||||
/* { 4, "Resting" }, */
|
||||
/* { 5, "Unknown" }, */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
/* Defines for CPQPOWER_OID_UPS_TEST_RES */
|
||||
|
|
@ -144,7 +144,7 @@ static info_lkp_t cpqpower_test_res_info[] = {
|
|||
{ 5, "Not supported" },
|
||||
{ 6, "Inhibited" },
|
||||
{ 7, "Scheduled" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
#define CPQPOWER_START_TEST 1
|
||||
|
|
@ -328,5 +328,5 @@ static snmp_info_t cpqpower_mib[] = {
|
|||
{ NULL, 0, 0, NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
mib2nut_info_t compaq = { "cpqpower", CPQPOWER_MIB_VERSION, "", CPQPOWER_OID_MFR_NAME, cpqpower_mib, CPQPOWER_SYSOID };
|
||||
mib2nut_info_t compaq = { "cpqpower", CPQPOWER_MIB_VERSION, NULL, CPQPOWER_OID_MFR_NAME, cpqpower_mib, CPQPOWER_SYSOID };
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ static info_lkp_t cyberpower_power_status[] = {
|
|||
{ 7, "OL" },
|
||||
{ 1, "NULL" },
|
||||
{ 6, "NULL" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
/* Snmp2NUT lookup table for CyberPower MIB */
|
||||
|
|
@ -77,5 +77,5 @@ static snmp_info_t cyberpower_mib[] = {
|
|||
{ NULL, 0, 0, NULL, NULL, 0, NULL, NULL }
|
||||
} ;
|
||||
|
||||
mib2nut_info_t cyberpower = { "cyberpower", CYBERPOWER_MIB_VERSION, "",
|
||||
mib2nut_info_t cyberpower = { "cyberpower", CYBERPOWER_MIB_VERSION, NULL,
|
||||
CYBERPOWER_OID_MODEL_NAME, cyberpower_mib, CYBERPOWER_SYSOID };
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
* static info_lkp_t onbatt_info[] = {
|
||||
* { 1, "OB" },
|
||||
* { 2, "OL" },
|
||||
* { 0, "NULL" }
|
||||
* { 0, NULL }
|
||||
* };
|
||||
*/
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ static info_lkp_t delta_ups_upstype_info[] = {
|
|||
{ 3, "line-interactive" },
|
||||
{ 4, "3phase" },
|
||||
{ 5, "splite-phase" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t delta_ups_pwr_info[] = {
|
||||
|
|
@ -56,7 +56,7 @@ static info_lkp_t delta_ups_pwr_info[] = {
|
|||
{ 5, "BYPASS" }, /* manualBypass */
|
||||
/*{ 6, "NULL" },*/ /* other */
|
||||
{ 7, "OFF" }, /* none */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
/* DELTA_UPS Snmp2NUT lookup table */
|
||||
|
|
@ -84,7 +84,7 @@ static snmp_info_t delta_ups_mib[] = {
|
|||
* static info_lkp_t onbatt_info[] = {
|
||||
* { 1, "OB" },
|
||||
* { 2, "OL" },
|
||||
* { 0, "NULL" }
|
||||
* { 0, NULL }
|
||||
* };
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
static int sockfd = -1, stale = 1, alarm_active = 0, ignorelb = 0;
|
||||
static char *sockfn = NULL;
|
||||
static char status_buf[ST_MAX_VALUE_LEN], alarm_buf[ST_MAX_VALUE_LEN];
|
||||
static char status_buf[ST_MAX_VALUE_LEN], alarm_buf[LARGEBUF];
|
||||
static st_tree_t *dtree_root = NULL;
|
||||
static conn_t *connhead = NULL;
|
||||
static cmdlist_t *cmdhead = NULL;
|
||||
|
|
@ -185,7 +185,7 @@ static void send_to_all(const char *fmt, ...)
|
|||
ret = write(conn->fd, buf, strlen(buf));
|
||||
|
||||
if (ret != (int)strlen(buf)) {
|
||||
upsdebugx(2, "write %d bytes to socket %d failed", (int)strlen(buf), conn->fd);
|
||||
upsdebugx(1, "write %d bytes to socket %d failed", (int)strlen(buf), conn->fd);
|
||||
sock_disconnect(conn);
|
||||
}
|
||||
}
|
||||
|
|
@ -211,7 +211,7 @@ static int send_to_one(conn_t *conn, const char *fmt, ...)
|
|||
ret = write(conn->fd, buf, strlen(buf));
|
||||
|
||||
if (ret != (int)strlen(buf)) {
|
||||
upsdebugx(2, "write %d bytes to socket %d failed", (int)strlen(buf), conn->fd);
|
||||
upsdebugx(1, "write %d bytes to socket %d failed", (int)strlen(buf), conn->fd);
|
||||
sock_disconnect(conn);
|
||||
return 0; /* failed */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* dummy-ups.c - NUT simulation and device repeater driver
|
||||
|
||||
Copyright (C)
|
||||
2005 - 2010 Arnaud Quette <http://arnaud.quette.free.fr/contact.html>
|
||||
2005 - 2015 Arnaud Quette <http://arnaud.quette.free.fr/contact.html>
|
||||
|
||||
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
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
#include "dummy-ups.h"
|
||||
|
||||
#define DRIVER_NAME "Device simulation and repeater driver"
|
||||
#define DRIVER_VERSION "0.13"
|
||||
#define DRIVER_VERSION "0.14"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info =
|
||||
|
|
@ -309,6 +309,12 @@ static int setvar(const char *varname, const char *val)
|
|||
if (item->info_flags & ST_FLAG_STRING)
|
||||
dstate_setaux(item->info_type, item->info_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
upsdebugx(2, "setvar: unknown variable (%s), using default flags", varname);
|
||||
dstate_setflags(varname, ST_FLAG_STRING | ST_FLAG_RW);
|
||||
dstate_setaux(varname, 32);
|
||||
}
|
||||
}
|
||||
return STAT_SET_HANDLED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ battery.packs.bad
|
|||
{ "ambient.humidity.high", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL },
|
||||
{ "ambient.humidity.low", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL },
|
||||
/*
|
||||
FIXME: how to manage these?
|
||||
FIXME: how to manage these? (i.e. index <n>)
|
||||
outlet.n.id
|
||||
outlet.n.desc
|
||||
outlet.n.switch
|
||||
|
|
@ -195,6 +195,7 @@ outlet.n.switchable
|
|||
outlet.n.autoswitch.charge.low
|
||||
outlet.n.delay.shutdown
|
||||
outlet.n.delay.start
|
||||
...
|
||||
|
||||
driver.name
|
||||
driver.version
|
||||
|
|
|
|||
245
drivers/eaton-ats-mib.c
Normal file
245
drivers/eaton-ats-mib.c
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
/* eaton_ats-mib.c - subdriver to monitor eaton_ats SNMP devices with NUT
|
||||
*
|
||||
* Copyright (C)
|
||||
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
|
||||
* 2016 Arnaud Quette <ArnaudQuette@Eaton.com>
|
||||
*
|
||||
* Note: this subdriver was initially generated as a "stub" by the
|
||||
* gen-snmp-subdriver script. It must be customized!
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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 "eaton-ats-mib.h"
|
||||
|
||||
#define EATON_ATS_MIB_VERSION "0.11"
|
||||
|
||||
#define EATON_ATS_SYSOID ".1.3.6.1.4.1.534.10"
|
||||
#define EATON_ATS_MODEL ".1.3.6.1.4.1.534.10.2.1.2.0"
|
||||
|
||||
static info_lkp_t ats_source_info[] = {
|
||||
{ 1, "init" },
|
||||
{ 2, "diagnosis" },
|
||||
{ 3, "off" },
|
||||
{ 4, "1" },
|
||||
{ 5, "2" },
|
||||
{ 6, "safe" },
|
||||
{ 7, "fault" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ats_sensitivity_info[] = {
|
||||
{ 1, "normal" },
|
||||
{ 2, "high" },
|
||||
{ 3, "low" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ats_input_frequency_status_info[] = {
|
||||
{ 1, "good" }, /* No threshold triggered */
|
||||
{ 2, "out-of-range" }, /* Frequency out of range triggered */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ats_input_voltage_status_info[] = {
|
||||
{ 1, "good" }, /* No threshold triggered */
|
||||
{ 2, "derated-range" }, /* Voltage derated */
|
||||
{ 3, "out-of-range" }, /* Voltage out of range triggered */
|
||||
{ 4, "unknown" }, /* "missing" */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ats_test_result_info[] = {
|
||||
{ 1, "done and passed" },
|
||||
{ 2, "done and warning" },
|
||||
{ 3, "done and error" },
|
||||
{ 4, "aborted" },
|
||||
{ 5, "in progress" },
|
||||
{ 6, "no test initiated" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ats_output_status_info[] = {
|
||||
{ 1, "OFF" }, /* Output not powered */
|
||||
{ 2, "OL" }, /* Output powered */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* EATON_ATS Snmp2NUT lookup table */
|
||||
static snmp_info_t eaton_ats_mib[] = {
|
||||
|
||||
/* Device collection */
|
||||
{ "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ats", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2IdentManufacturer.0 = STRING: EATON */
|
||||
{ "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.1.0", "Eaton", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2IdentModel.0 = STRING: Eaton ATS */
|
||||
{ "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.2.0", "ATS", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
/* FIXME: RFC for device.firmware! */
|
||||
/* ats2IdentFWVersion.0 = STRING: 00.00.0009 */
|
||||
{ "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.3.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
/* FIXME: RFC for device.firmware.aux! */
|
||||
/* ats2IdentRelease.0 = STRING: JF */
|
||||
{ "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.4.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2IdentSerialNumber.0 = STRING: GA04F23009 */
|
||||
{ "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.5.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2IdentPartNumber.0 = STRING: EATS16N */
|
||||
{ "device.part", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.6.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2IdentAgentVersion.0 = STRING: 301F23C28 */
|
||||
/* { "unmapped.ats2IdentAgentVersion", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.7.0", NULL, SU_FLAG_OK, NULL, NULL }, */
|
||||
/* ats2InputDephasing.0 = INTEGER: 2 degrees */
|
||||
/* { "unmapped.ats2InputDephasing", 0, 1, ".1.3.6.1.4.1.534.10.2.2.1.1.0", NULL, SU_FLAG_OK, NULL, NULL }, */
|
||||
|
||||
/* Input collection */
|
||||
/* ats2InputIndex.source1 = INTEGER: source1(1) */
|
||||
{ "input.1.id", 0, 1, ".1.3.6.1.4.1.534.10.2.2.2.1.1.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputIndex.source2 = INTEGER: source2(2) */
|
||||
{ "input.2.id", 0, 1, ".1.3.6.1.4.1.534.10.2.2.2.1.1.2", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputVoltage.source1 = INTEGER: 2292 0.1 V */
|
||||
{ "input.1.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.2.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputVoltage.source2 = INTEGER: 2432 0.1 V */
|
||||
{ "input.2.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.2.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputStatusVoltage.source1 = INTEGER: normalRange(1) */
|
||||
{ "input.1.voltage.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.5.1", NULL, SU_FLAG_OK, ats_input_voltage_status_info, NULL },
|
||||
/* ats2InputStatusVoltage.source2 = INTEGER: normalRange(1) */
|
||||
{ "input.2.voltage.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.5.2", NULL, SU_FLAG_OK, ats_input_voltage_status_info, NULL },
|
||||
/* ats2InputFrequency.source1 = INTEGER: 500 0.1 Hz */
|
||||
{ "input.1.frequency", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.3.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputFrequency.source2 = INTEGER: 500 0.1 Hz */
|
||||
{ "input.2.frequency", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.3.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputStatusFrequency.source1 = INTEGER: good(1) */
|
||||
{ "input.1.frequency.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.2.1", NULL, SU_FLAG_OK, ats_input_frequency_status_info, NULL },
|
||||
/* ats2InputStatusFrequency.source2 = INTEGER: good(1) */
|
||||
{ "input.2.frequency.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.2.2", NULL, SU_FLAG_OK, ats_input_frequency_status_info, NULL },
|
||||
/* ats2ConfigSensitivity.0 = INTEGER: normal(1) */
|
||||
{ "input.sensitivity", ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.4.6.0", NULL, SU_FLAG_OK, &ats_sensitivity_info[0], NULL },
|
||||
/* ats2OperationMode.0 = INTEGER: source1(4) */
|
||||
{ "input.source", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.2.4.0", NULL, SU_FLAG_OK, ats_source_info, NULL },
|
||||
/* ats2ConfigPreferred.0 = INTEGER: source1(1) */
|
||||
{ "input.source.preferred", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.4.5.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* Output collection */
|
||||
/* ats2OutputVoltage.0 = INTEGER: 2304 0.1 V */
|
||||
{ "output.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.3.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ConfigOutputVoltage.0 = INTEGER: 230 1 V */
|
||||
{ "output.voltage.nominal", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.4.4.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2OutputCurrent.0 = INTEGER: 5 0.1 A */
|
||||
{ "output.current", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.3.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* UPS collection */
|
||||
/* FIXME: RFC for device.test.result! */
|
||||
/* ats2ConfigTransferTest.0 = INTEGER: noTestInitiated(6) */
|
||||
{ "ups.test.result", 0, 1, ".1.3.6.1.4.1.534.10.2.4.8.0", NULL, SU_FLAG_OK, ats_test_result_info, NULL },
|
||||
/* FIXME: RFC for device.status! */
|
||||
/* ats2StatusOutput.0 = INTEGER: outputPowered(2) */
|
||||
{ "ups.status", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.2.0", NULL, SU_FLAG_OK, ats_output_status_info, NULL },
|
||||
|
||||
/* Ambient collection */
|
||||
/* ats2EnvRemoteTemp.0 = INTEGER: 0 degrees Centigrade */
|
||||
{ "ambient.temperature", 0, 1, ".1.3.6.1.4.1.534.10.2.5.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2EnvRemoteTempLowerLimit.0 = INTEGER: 5 degrees Centigrade */
|
||||
{ "ambient.temperature.low", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.5.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2EnvRemoteTempUpperLimit.0 = INTEGER: 40 degrees Centigrade */
|
||||
{ "ambient.temperature.high", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.6.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2EnvRemoteHumidity.0 = INTEGER: 0 percent */
|
||||
{ "ambient.humidity", 0, 1, ".1.3.6.1.4.1.534.10.2.5.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2EnvRemoteHumidityLowerLimit.0 = INTEGER: 5 percent */
|
||||
{ "ambient.humidity.low", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.7.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2EnvRemoteHumidityUpperLimit.0 = INTEGER: 90 percent */
|
||||
{ "ambient.humidity.high", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.8.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
#if 0 /* FIXME: Remaining data to be processed */
|
||||
/* ats2InputStatusDephasing.0 = INTEGER: normal(1) */
|
||||
{ "unmapped.ats2InputStatusDephasing", 0, 1, ".1.3.6.1.4.1.534.10.2.3.1.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputStatusIndex.source1 = INTEGER: source1(1) */
|
||||
{ "unmapped.ats2InputStatusIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputStatusIndex.source2 = INTEGER: source2(2) */
|
||||
{ "unmapped.ats2InputStatusIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.1.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* ats2InputStatusGood.source1 = INTEGER: voltageAndFreqNormalRange(2) */
|
||||
{ "unmapped.ats2InputStatusGood", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.3.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputStatusGood.source2 = INTEGER: voltageAndFreqNormalRange(2) */
|
||||
{ "unmapped.ats2InputStatusGood", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.3.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputStatusInternalFailure.source1 = INTEGER: good(1) */
|
||||
{ "unmapped.ats2InputStatusInternalFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.4.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputStatusInternalFailure.source2 = INTEGER: good(1) */
|
||||
{ "unmapped.ats2InputStatusInternalFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.4.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* ats2InputStatusUsed.source1 = INTEGER: poweringLoad(2) */
|
||||
{ "unmapped.ats2InputStatusUsed", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.6.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2InputStatusUsed.source2 = INTEGER: notPoweringLoad(1) */
|
||||
{ "unmapped.ats2InputStatusUsed", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.6.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2StatusInternalFailure.0 = INTEGER: good(1) */
|
||||
{ "unmapped.ats2StatusInternalFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* ats2StatusOverload.0 = INTEGER: noOverload(1) */
|
||||
{ "unmapped.ats2StatusOverload", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.3.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2StatusOverTemperature.0 = INTEGER: noOverTemperature(1) */
|
||||
{ "unmapped.ats2StatusOverTemperature", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.4.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2StatusShortCircuit.0 = INTEGER: noShortCircuit(1) */
|
||||
{ "unmapped.ats2StatusShortCircuit", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.5.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2StatusCommunicationLost.0 = INTEGER: good(1) */
|
||||
{ "unmapped.ats2StatusCommunicationLost", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.6.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2StatusConfigurationFailure.0 = INTEGER: good(1) */
|
||||
{ "unmapped.ats2StatusConfigurationFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.7.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ConfigTimeRTC.0 = Wrong Type (should be Counter32): Gauge32: 19191036 */
|
||||
{ "unmapped.ats2ConfigTimeRTC", 0, 1, ".1.3.6.1.4.1.534.10.2.4.1.1.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ConfigTimeTextDate.0 = STRING: 08/11/1970 */
|
||||
{ "unmapped.ats2ConfigTimeTextDate", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.4.1.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ConfigTimeTextTime.0 = STRING: 02/50/36 */
|
||||
{ "unmapped.ats2ConfigTimeTextTime", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.4.1.3.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ConfigInputVoltageRating.0 = INTEGER: 1 1 V */
|
||||
{ "unmapped.ats2ConfigInputVoltageRating", 0, 1, ".1.3.6.1.4.1.534.10.2.4.2.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ConfigInputFrequencyRating.0 = INTEGER: 50 Hz */
|
||||
{ "unmapped.ats2ConfigInputFrequencyRating", 0, 1, ".1.3.6.1.4.1.534.10.2.4.3.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* ats2ConfigTransferMode.0 = INTEGER: standard(1) */
|
||||
{ "unmapped.ats2ConfigTransferMode", 0, 1, ".1.3.6.1.4.1.534.10.2.4.7.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* ats2ConfigBrownoutLow.0 = INTEGER: 202 1 V */
|
||||
{ "unmapped.ats2ConfigBrownoutLow", 0, 1, ".1.3.6.1.4.1.534.10.2.4.9.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ConfigBrownoutLowDerated.0 = INTEGER: 189 1 V */
|
||||
{ "unmapped.ats2ConfigBrownoutLowDerated", 0, 1, ".1.3.6.1.4.1.534.10.2.4.10.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ConfigBrownoutHigh.0 = INTEGER: 258 1 V */
|
||||
{ "unmapped.ats2ConfigBrownoutHigh", 0, 1, ".1.3.6.1.4.1.534.10.2.4.11.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ConfigHysteresisVoltage.0 = INTEGER: 5 1 V */
|
||||
{ "unmapped.ats2ConfigHysteresisVoltage", 0, 1, ".1.3.6.1.4.1.534.10.2.4.12.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* Ambient collection */
|
||||
/* ats2EnvNumContacts.0 = INTEGER: 2 */
|
||||
{ "unmapped.ats2EnvNumContacts", 0, 1, ".1.3.6.1.4.1.534.10.2.5.3.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ContactIndex.1 = INTEGER: 1 */
|
||||
{ "unmapped.ats2ContactIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.1.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ContactIndex.2 = INTEGER: 2 */
|
||||
{ "unmapped.ats2ContactIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.1.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ContactType.1 = INTEGER: notUsed(4) */
|
||||
{ "unmapped.ats2ContactType", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.2.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ContactType.2 = INTEGER: notUsed(4) */
|
||||
{ "unmapped.ats2ContactType", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.2.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ContactState.1 = INTEGER: open(1) */
|
||||
{ "unmapped.ats2ContactState", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.3.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ContactState.2 = INTEGER: open(1) */
|
||||
{ "unmapped.ats2ContactState", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.3.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ContactDescr.1 = STRING: Input #1 */
|
||||
{ "unmapped.ats2ContactDescr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.5.4.1.4.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
/* ats2ContactDescr.2 = STRING: Input #2 */
|
||||
{ "unmapped.ats2ContactDescr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.5.4.1.4.2", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
#endif /* if 0 */
|
||||
/* end of structure. */
|
||||
{ NULL, 0, 0, NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
mib2nut_info_t eaton_ats = { "eaton_ats", EATON_ATS_MIB_VERSION, NULL, EATON_ATS_MODEL, eaton_ats_mib, ".1.3.6.1.4.1.705.1" };
|
||||
/* FIXME: Eaton ATS need to be fixed for the sysOID (currently .1.3.6.1.4.1.705.1!) */
|
||||
/* mib2nut_info_t eaton_ats = { "eaton_ats", EATON_ATS_MIB_VERSION, NULL, EATON_ATS_MODEL, eaton_ats_mib, EATON_ATS_SYSOID }; */
|
||||
30
drivers/eaton-ats-mib.h
Normal file
30
drivers/eaton-ats-mib.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* eaton_ats-mib.h - subdriver to monitor eaton_ats SNMP devices with NUT
|
||||
*
|
||||
* Copyright (C)
|
||||
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
|
||||
* 2016 Arnaud Quette <ArnaudQuette@Eaton.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
|
||||
*/
|
||||
|
||||
#ifndef EATON_ATS_MIB_H
|
||||
#define EATON_ATS_MIB_H
|
||||
|
||||
#include "main.h"
|
||||
#include "snmp-ups.h"
|
||||
|
||||
extern mib2nut_info_t eaton_ats;
|
||||
|
||||
#endif /* EATON_ATS_MIB_H */
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "eaton-mib.h"
|
||||
|
||||
#define EATON_APHEL_MIB_VERSION "0.46"
|
||||
#define EATON_APHEL_MIB_VERSION "0.47"
|
||||
|
||||
/* APHEL-GENESIS-II-MIB (monitored ePDU)
|
||||
* *************************************
|
||||
|
|
@ -56,6 +56,8 @@ static snmp_info_t eaton_aphel_genesisII_mib[] = {
|
|||
"Eaton Powerware ePDU Monitored", 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 },
|
||||
{ "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_UNIT_MACADDR, "unknown",
|
||||
0, NULL, NULL },
|
||||
|
||||
/* UPS page */
|
||||
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware",
|
||||
|
|
@ -68,8 +70,6 @@ static snmp_info_t eaton_aphel_genesisII_mib[] = {
|
|||
SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_UNIT_MACADDR, "unknown",
|
||||
0, NULL, NULL },
|
||||
|
||||
/* Outlet page */
|
||||
/* we can't use template since there is no counterpart to outlet.count */
|
||||
|
|
@ -132,7 +132,7 @@ static info_lkp_t outlet_status_info[] = {
|
|||
|
||||
/* Snmp2NUT lookup table for Eaton Revelation MIB */
|
||||
static snmp_info_t eaton_aphel_revelation_mib[] = {
|
||||
/* Device page */
|
||||
/* Device collection */
|
||||
{ "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, AR_OID_MODEL_NAME,
|
||||
|
|
@ -141,8 +141,10 @@ static snmp_info_t eaton_aphel_revelation_mib[] = {
|
|||
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 },
|
||||
{ "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_UNIT_MACADDR, "",
|
||||
SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* UPS page */
|
||||
/* UPS collection */
|
||||
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.model", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_MODEL_NAME,
|
||||
|
|
@ -155,11 +157,9 @@ static snmp_info_t eaton_aphel_revelation_mib[] = {
|
|||
SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_UNIT_MACADDR, "",
|
||||
SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.temperature", 0, 1, AR_OID_UNIT_CPUTEMPERATURE, NULL, 0, NULL, NULL },
|
||||
|
||||
/* Outlet page */
|
||||
/* Outlet collection */
|
||||
{ "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 },
|
||||
|
|
@ -190,7 +190,7 @@ static snmp_info_t eaton_aphel_revelation_mib[] = {
|
|||
* ambient.%i.humidity => .1.3.6.1.4.1.534.6.6.6.2.4.1.3.%i
|
||||
*/
|
||||
|
||||
/* Ambient page */
|
||||
/* Ambient collection */
|
||||
/* We use critical levels, for both temperature and humidity,
|
||||
* since warning levels are also available! */
|
||||
{ "ambient.temperature", 0, 1.0, ".1.3.6.1.4.1.534.6.6.6.2.2.1.3.0", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
|
|
@ -217,7 +217,7 @@ static snmp_info_t eaton_aphel_revelation_mib[] = {
|
|||
/* Eaton PDU-MIB - Marlin MIB
|
||||
* ************************** */
|
||||
|
||||
#define EATON_MARLIN_MIB_VERSION "0.10"
|
||||
#define EATON_MARLIN_MIB_VERSION "0.37"
|
||||
#define EATON_MARLIN_SYSOID ".1.3.6.1.4.1.534.6.6.7"
|
||||
#define EATON_MARLIN_OID_MODEL_NAME ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0"
|
||||
|
||||
|
|
@ -229,6 +229,14 @@ static info_lkp_t marlin_outlet_status_info[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_outletgroups_status_info[] = {
|
||||
{ 0, "off" },
|
||||
{ 1, "on" },
|
||||
{ 2, "rebooting" }, /* transitional status */
|
||||
{ 3, "mixed" }, /* transitional status, not sure what it means! */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Ugly hack: having the matching OID present means that the outlet is
|
||||
* switchable. So, it should not require this value lookup */
|
||||
static info_lkp_t outlet_switchability_info[] = {
|
||||
|
|
@ -237,10 +245,91 @@ static info_lkp_t outlet_switchability_info[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_ambient_presence_info[] = {
|
||||
{ -1, "unknown" },
|
||||
{ 0, "no" }, /* disconnected */
|
||||
{ 1, "yes" }, /* connected */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_threshold_status_info[] = {
|
||||
{ 0, "good" }, /* No threshold triggered */
|
||||
{ 1, "warning-low" }, /* Warning low threshold triggered */
|
||||
{ 2, "critical-low" }, /* Critical low threshold triggered */
|
||||
{ 3, "warning-high" }, /* Warning high threshold triggered */
|
||||
{ 4, "critical-high" }, /* Critical high threshold triggered */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_threshold_frequency_status_info[] = {
|
||||
{ 0, "good" }, /* No threshold triggered */
|
||||
{ 1, "out-of-range" }, /* Frequency out of range triggered */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_ambient_drycontacts_info[] = {
|
||||
{ -1, "unknown" },
|
||||
{ 0, "open" },
|
||||
{ 1, "closed" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_threshold_voltage_alarms_info[] = {
|
||||
{ 0, "" }, /* No threshold triggered */
|
||||
{ 1, "low voltage warning!" }, /* Warning low threshold triggered */
|
||||
{ 2, "low voltage critical!" }, /* Critical low threshold triggered */
|
||||
{ 3, "high voltage warning!" }, /* Warning high threshold triggered */
|
||||
{ 4, "high voltage critical!" }, /* Critical high threshold triggered */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_threshold_current_alarms_info[] = {
|
||||
{ 0, "" }, /* No threshold triggered */
|
||||
{ 1, "low current warning!" }, /* Warning low threshold triggered */
|
||||
{ 2, "low current critical!" }, /* Critical low threshold triggered */
|
||||
{ 3, "high current warning!" }, /* Warning high threshold triggered */
|
||||
{ 4, "high current critical!" }, /* Critical high threshold triggered */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_threshold_frequency_alarm_info[] = {
|
||||
{ 0, "" }, /* No threshold triggered */
|
||||
{ 1, "frequency out of range!" }, /* Frequency out of range triggered */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_threshold_temperature_alarms_info[] = {
|
||||
{ 0, "" }, /* No threshold triggered */
|
||||
{ 1, "low temperature warning!" }, /* Warning low threshold triggered */
|
||||
{ 2, "low temperature critical!" }, /* Critical low threshold triggered */
|
||||
{ 3, "high temperature warning!" }, /* Warning high threshold triggered */
|
||||
{ 4, "high temperature critical!" }, /* Critical high threshold triggered */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_threshold_humidity_alarms_info[] = {
|
||||
{ 0, "" }, /* No threshold triggered */
|
||||
{ 1, "low humidity warning!" }, /* Warning low threshold triggered */
|
||||
{ 2, "low humidity critical!" }, /* Critical low threshold triggered */
|
||||
{ 3, "high humidity warning!" }, /* Warning high threshold triggered */
|
||||
{ 4, "high humidity critical!" }, /* Critical high threshold triggered */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t marlin_outlet_group_type_info[] = {
|
||||
{ 0, "unknown" },
|
||||
{ 1, "breaker1pole" },
|
||||
{ 2, "breaker2pole" },
|
||||
{ 3, "breaker3pole" },
|
||||
{ 4, "outlet-section" },
|
||||
{ 5, "user-defined" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Snmp2NUT lookup table for Eaton Marlin MIB */
|
||||
static snmp_info_t eaton_marlin_mib[] = {
|
||||
|
||||
/* Device page */
|
||||
/* Device collection */
|
||||
{ "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
{ "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0",
|
||||
|
|
@ -249,11 +338,12 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
"", 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 },
|
||||
/* FIXME: need RFC validation on this variable
|
||||
* { "device.part", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.3.0",
|
||||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, */
|
||||
{ "device.part", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.3.0",
|
||||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
{ "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2",
|
||||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* UPS page */
|
||||
/* UPS collection */
|
||||
{ "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, "1.3.6.1.4.1.534.6.6.7.1.2.1.2.0",
|
||||
|
|
@ -268,12 +358,7 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
/* TODO:
|
||||
* The below possibly requires (?) the use of
|
||||
* int snprint_hexstring(char *buf, size_t buf_len, const u_char *, size_t);
|
||||
* { "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2",
|
||||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
* + date reformating callback
|
||||
/* FIXME: needs a date reformating callback
|
||||
* 2011-8-29,16:27:25.0,+1:0
|
||||
* Hex-STRING: 07 DB 08 1D 10 0C 36 00 2B 01 00 00
|
||||
* { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0",
|
||||
|
|
@ -282,12 +367,12 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
*/
|
||||
|
||||
/* Input page */
|
||||
/* Input collection */
|
||||
/* Historically, some of these data were previously published as
|
||||
* outlet.{realpower,...}
|
||||
* However, it's more suitable and logic to have these on input.{...}
|
||||
*/
|
||||
{ "input.phases", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.20.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
{ "input.phases", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.20.0", NULL, SU_FLAG_STATIC | SU_FLAG_SETINT, NULL, &input_phases },
|
||||
/* FIXME: to be implemented
|
||||
* inputType.0.1 iso.3.6.1.4.1.534.6.6.7.3.1.1.2.0.1
|
||||
* singlePhase (1), ... split phase, three phase delta, or three phase wye
|
||||
|
|
@ -295,6 +380,8 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
|
||||
/* Frequency is measured globally */
|
||||
{ "input.frequency", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.0.1", NULL, 0, NULL, NULL },
|
||||
{ "input.frequency.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.0.1", NULL, SU_FLAG_OK, &marlin_threshold_frequency_status_info[0], NULL },
|
||||
{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.0.1", NULL, SU_FLAG_OK, &marlin_threshold_frequency_alarm_info[0], NULL },
|
||||
|
||||
/* inputCurrentPercentLoad (measured globally)
|
||||
* Current percent load, based on the rated current capacity */
|
||||
|
|
@ -305,23 +392,75 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
{ "input.L3.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.0.1.3", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* FIXME:
|
||||
* - Voltage is only mesured per phase, as mV!
|
||||
* - Voltage is only measured per phase, as mV!
|
||||
* so input.voltage == input.L1.voltage for both single and 3phase
|
||||
* - As per NUT namespace (http://www.networkupstools.org/docs/developer-guide.chunked/apas01.html#_valid_contexts)
|
||||
* Voltage has to be expressed either phase-phase or phase-neutral
|
||||
* This is depending on OID inputVoltageMeasType
|
||||
* INTEGER {singlePhase (1),phase1toN (2),phase2toN (3),phase3toN (4),phase1to2 (5),phase2to3 (6),phase3to1 (7)*/
|
||||
* INTEGER {singlePhase (1),phase1toN (2),phase2toN (3),phase3toN (4),phase1to2 (5),phase2to3 (6),phase3to1 (7)
|
||||
* => RFC input.Lx.voltage.context */
|
||||
{ "input.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.0.1.1", NULL, 0, NULL, NULL },
|
||||
{ "input.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.0.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.0.1.1", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL },
|
||||
{ "input.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L1.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.0.1.1", NULL, 0, NULL, NULL },
|
||||
{ "input.L1.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.0.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.0.1.1", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL },
|
||||
{ "input.L1.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L1.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L1.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L1.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L2.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.0.1.2", NULL, 0, NULL, NULL },
|
||||
{ "input.L2.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.0.1.2", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.0.1.2", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL },
|
||||
{ "input.L2.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.0.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L2.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.0.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L2.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.0.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L2.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.0.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L3.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.0.1.3", NULL, 0, NULL, NULL },
|
||||
|
||||
{ "input.L3.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.0.1.3", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.0.1.3", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL },
|
||||
{ "input.L3.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.0.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L3.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.0.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L3.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.0.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L3.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.0.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
/* FIXME:
|
||||
* - input.current is mapped on input.L1.current for both single and 3phase !!! */
|
||||
{ "input.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.1", NULL, 0, NULL, NULL },
|
||||
{ "input.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.0.1.1", NULL, 0, NULL, NULL },
|
||||
{ "input.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.0.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.0.1.1", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL },
|
||||
{ "input.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L1.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.1", NULL, 0, NULL, NULL },
|
||||
{ "input.L1.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.0.1.1", NULL, 0, NULL, NULL },
|
||||
{ "input.L1.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.0.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.0.1.1", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL },
|
||||
{ "input.L1.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L1.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L1.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L1.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.0.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L2.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.2", NULL, 0, NULL, NULL },
|
||||
{ "input.L2.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.0.1.2", NULL, 0, NULL, NULL },
|
||||
{ "input.L2.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.0.1.2", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.0.1.2", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL },
|
||||
{ "input.L2.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.0.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L2.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.0.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L2.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.0.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L2.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.0.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L3.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.3", NULL, 0, NULL, NULL },
|
||||
{ "input.L3.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.0.1.3", NULL, 0, NULL, NULL },
|
||||
{ "input.L3.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.0.1.3", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.0.1.3", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL },
|
||||
{ "input.L3.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.0.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L3.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.0.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L3.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.0.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
{ "input.L3.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.0.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL },
|
||||
/* Sum of all phases realpower, valid for Shark 1ph/3ph only */
|
||||
{ "input.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.5.1.4.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL },
|
||||
/* Fallback 1: Sum of all phases realpower, valid for Marlin 3ph only */
|
||||
|
|
@ -331,25 +470,43 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
{ "input.L1.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.0.1.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "input.L2.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.0.1.2", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "input.L3.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.0.1.3", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
/* Sum of all phases apparent power, valid for 3phase only */
|
||||
/* Sum of all phases apparent power, valid for Shark 1ph/3ph only */
|
||||
{ "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.5.1.3.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL },
|
||||
/* Fallback 1: Sum of all phases realpower, valid for Marlin 3ph only */
|
||||
{ "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.0.1.4", NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL },
|
||||
/* Sum of the phase apparent power, valid for 1phase only (fallback for also publishing) */
|
||||
{ "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.0.1.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
/* Fallback 2: Sum of the phase realpower, valid for Marlin 1ph only */
|
||||
{ "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.0.1.2", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "input.L1.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.0.1.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "input.L2.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.0.1.2", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "input.L3.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.0.1.3", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* Ambient page */
|
||||
/* We use critical levels, for both temperature and humidity,
|
||||
* since warning levels are also available! */
|
||||
/* Ambient collection */
|
||||
{ "ambient.present", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.3.0.1", NULL, SU_FLAG_OK, &marlin_ambient_presence_info[0], NULL },
|
||||
{ "ambient.temperature.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.0.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.0.1", NULL, SU_FLAG_OK, &marlin_threshold_temperature_alarms_info[0], NULL },
|
||||
{ "ambient.temperature", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.4.0.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.temperature.low", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.temperature.high", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
/* Low and high threshold use the respective critical levels */
|
||||
{ "ambient.temperature.low", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.temperature.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.temperature.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.6.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.temperature.high", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.temperature.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.8.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.temperature.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.humidity.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.0.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL },
|
||||
{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.0.1", NULL, SU_FLAG_OK, &marlin_threshold_humidity_alarms_info[0], NULL },
|
||||
{ "ambient.humidity", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.4.0.1", NULL, SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.humidity.low", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.humidity.high", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
/* Low and high threshold use the respective critical levels */
|
||||
{ "ambient.humidity.low", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.humidity.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.6.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.humidity.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.humidity.high", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.humidity.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.8.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ambient.humidity.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL },
|
||||
/* Dry contacts on TH module */
|
||||
{ "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.0.1", NULL, SU_FLAG_OK, &marlin_ambient_drycontacts_info[0], NULL },
|
||||
{ "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.0.2", NULL, SU_FLAG_OK, &marlin_ambient_drycontacts_info[0], NULL },
|
||||
|
||||
/* Outlet page */
|
||||
/* Outlet collection */
|
||||
{ "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
{ "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
|
|
@ -370,18 +527,87 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
NULL, SU_FLAG_OK | SU_OUTLET, &marlin_outlet_status_info[0], NULL },
|
||||
/* FIXME: or use ".1.3.6.1.4.1.534.6.6.7.6.1.1.2.0.1", though it's related to groups! */
|
||||
{ "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL, NULL },
|
||||
/* FIXME: the last part of the OID gives the group number (i.e. %i.1 means "group 1")
|
||||
* Need to address that, without multiple declaration (%i.%i, SU_OUTLET | SU_OUTLET_GROUP)? */
|
||||
{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.0.%i.1", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.0.%i.2", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.0.%i.3", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.0.%i.4", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.0.%i.5", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.0.%i.6", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.3.0.%i", NULL, SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.0.%i", NULL, SU_OUTLET, &marlin_threshold_status_info[0], NULL },
|
||||
{ "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.0.%i", NULL, SU_OUTLET, &marlin_threshold_current_alarms_info[0], NULL },
|
||||
{ "outlet.%i.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.5.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.6.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.7.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.8.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.3.0.%i", NULL, SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.2.0.%i", NULL, SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.0.%i", NULL, SU_OUTLET, &marlin_threshold_status_info[0], NULL },
|
||||
{ "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.0.%i", NULL, SU_OUTLET, &marlin_threshold_voltage_alarms_info[0], NULL },
|
||||
{ "outlet.%i.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.4.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.5.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.6.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.7.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.2.0.%i", NULL, SU_OUTLET, NULL, NULL },
|
||||
/* FIXME: handle non switchable units (only measurements), which do not expose this OID */
|
||||
{ "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.0.%i", "no", SU_FLAG_STATIC | SU_FLAG_OK, &outlet_switchability_info[0], NULL },
|
||||
{ "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.0.%i", "no", SU_FLAG_STATIC | SU_OUTLET | SU_FLAG_OK, &outlet_switchability_info[0], NULL },
|
||||
|
||||
/* TODO: handle statistics
|
||||
* outletWh.0.1
|
||||
* outletWhTimer.0.1
|
||||
*/
|
||||
|
||||
/* Outlet groups collection */
|
||||
{ "outlet.group.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.21.0", "0", SU_FLAG_STATIC, NULL, NULL },
|
||||
/* outlet groups template definition
|
||||
* Indexes start from 1, ie outlet.group.1 => <OID>.1 */
|
||||
/* Note: the first definition is used to determine the base index (ie 0 or 1) */
|
||||
/* groupID.0.1 = OctetString: A */
|
||||
{ "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.0.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupName.0.1 = OctetString: Factory Group 1 */
|
||||
/* FIXME: SU_FLAG_SEMI_STATIC or SU_FLAG_SETTING => refreshed from time to time or upon call to setvar */
|
||||
{ "outlet.group.%i.name", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.3.0.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupType.0.1 = Integer: outletSection (4) */
|
||||
{ "outlet.group.%i.type", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.4.0.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP, &marlin_outlet_group_type_info[0], NULL },
|
||||
/* groupControlStatus.0.1 = Integer: on (1) */
|
||||
{ "outlet.group.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.6.1.2.0.%i",
|
||||
NULL, SU_FLAG_OK | SU_OUTLET_GROUP, &marlin_outletgroups_status_info[0], NULL },
|
||||
/* groupChildCount.0.1 = Integer: 12 */
|
||||
{ "outlet.group.%i.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.5.1.1.6.0.%i", NULL, SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupVoltage.0.1 = Integer: 243080 */
|
||||
{ "outlet.group.%i.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.3.0.%i", NULL, SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupVoltageThStatus.0.1 = Integer: good (0) */
|
||||
{ "outlet.group.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.0.%i", NULL, SU_OUTLET_GROUP, &marlin_threshold_status_info[0], NULL },
|
||||
{ "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.0.%i", NULL, SU_OUTLET_GROUP, &marlin_threshold_voltage_alarms_info[0], NULL },
|
||||
{ "outlet.group.%i.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.5.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
{ "outlet.group.%i.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.6.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
{ "outlet.group.%i.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.7.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
{ "outlet.group.%i.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.8.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupCurrent.0.1 = Integer: 0 */
|
||||
{ "outlet.group.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.3.0.%i", NULL, SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupCurrentCapacity.0.1 = Integer: 16000 */
|
||||
{ "outlet.group.%i.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.2.0.%i", NULL, SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupCurrentThStatus.0.1 = Integer: good (0) */
|
||||
{ "outlet.group.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.0.%i", NULL, SU_OUTLET_GROUP, &marlin_threshold_status_info[0], NULL },
|
||||
{ "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.0.%i", NULL, SU_OUTLET_GROUP, &marlin_threshold_current_alarms_info[0], NULL },
|
||||
/* groupCurrentPercentLoad.0.1 = Integer: 0 */
|
||||
{ "outlet.group.%i.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.4.1.10.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupCurrentThLowerWarning.0.1 = Integer: 0 */
|
||||
{ "outlet.group.%i.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.5.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupCurrentThLowerCritical.0.1 = Integer: -1 */
|
||||
{ "outlet.group.%i.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.6.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupCurrentThUpperWarning.0.1 = Integer: 12800 */
|
||||
{ "outlet.group.%i.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.7.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupCurrentThUpperCritical.0.1 = Integer: 16000 */
|
||||
{ "outlet.group.%i.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.8.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupWatts.0.1 = Integer: 2670 */
|
||||
{ "outlet.group.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.5.1.3.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupVA.0.1 = Integer: 3132 */
|
||||
{ "outlet.group.%i.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.5.1.2.0.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL, NULL },
|
||||
|
||||
|
||||
/* instant commands. */
|
||||
/* Notes:
|
||||
* - load.cycle might be replaced by / mapped on shutdown.reboot
|
||||
|
|
@ -399,6 +625,16 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
{ "outlet.%i.load.on", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.4.0.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL },
|
||||
{ "outlet.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.5.0.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL },
|
||||
|
||||
/* TODO: handle delays
|
||||
* 0-n :Time in seconds until the group command is issued
|
||||
* -1:Cancel a pending group-level Off/On/Reboot command */
|
||||
/* groupControlOffCmd.0.1 = Integer: -1 */
|
||||
{ "outlet.group.%i.load.off", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.3.0.%i", NULL, SU_TYPE_CMD | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupControl0nCmd.0.1 = Integer: -1 */
|
||||
{ "outlet.group.%i.load.on", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.4.0.%i", NULL, SU_TYPE_CMD | SU_OUTLET_GROUP, NULL, NULL },
|
||||
/* groupControlRebootCmd.0.1 = Integer: -1 */
|
||||
{ "outlet.group.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.5.0.%i", NULL, SU_TYPE_CMD | SU_OUTLET_GROUP, NULL, NULL },
|
||||
|
||||
/* end of structure. */
|
||||
{ NULL, 0, 0, NULL, NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
|
@ -416,7 +652,7 @@ static snmp_info_t eaton_marlin_mib[] = {
|
|||
|
||||
/* Pulizzi Switched ePDU */
|
||||
|
||||
#define EATON_PULIZZI_SW_MIB_VERSION "0.1"
|
||||
#define EATON_PULIZZI_SW_MIB_VERSION "0.2"
|
||||
|
||||
#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"
|
||||
|
|
@ -448,6 +684,8 @@ static snmp_info_t eaton_pulizzi_switched_mib[] = {
|
|||
"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 },
|
||||
{ "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.2.6.0",
|
||||
"unknown", 0, NULL, NULL },
|
||||
|
||||
/* UPS page */
|
||||
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON",
|
||||
|
|
@ -459,8 +697,6 @@ static snmp_info_t eaton_pulizzi_switched_mib[] = {
|
|||
"", 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() */
|
||||
|
|
@ -484,9 +720,9 @@ static snmp_info_t eaton_pulizzi_switched_mib[] = {
|
|||
/* 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 },
|
||||
{ "outlet.%i.delay.reboot", ST_FLAG_RW, 1, ".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 },
|
||||
{ "outlet.%i.delay.start", ST_FLAG_RW, 1, ".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) */
|
||||
|
|
@ -505,10 +741,10 @@ static snmp_info_t eaton_pulizzi_switched_mib[] = {
|
|||
};
|
||||
|
||||
|
||||
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 aphel_genesisII = { "aphel_genesisII", EATON_APHEL_MIB_VERSION, NULL, APHEL1_OID_MODEL_NAME, eaton_aphel_genesisII_mib, APHEL1_SYSOID };
|
||||
mib2nut_info_t aphel_revelation = { "aphel_revelation", EATON_APHEL_MIB_VERSION, NULL, APHEL2_OID_MODEL_NAME, eaton_aphel_revelation_mib, APHEL2_SYSOID };
|
||||
mib2nut_info_t eaton_marlin = { "eaton_epdu", EATON_MARLIN_MIB_VERSION, NULL, 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 };
|
||||
/*mib2nut_info_t pulizzi_monitored = { "pulizzi_monitored", EATON_PULIZZI_MIB_VERSION, NULL, PULIZZI1_OID_MODEL_NAME, eaton_pulizzi_monitored_mib, PULIZZI1_OID_MIB };*/
|
||||
mib2nut_info_t pulizzi_switched1 = { "pulizzi_switched1", EATON_PULIZZI_SW_MIB_VERSION, NULL, EATON_PULIZZI_SWITCHED1_SYSOID, eaton_pulizzi_switched_mib, EATON_PULIZZI_SWITCHED1_SYSOID };
|
||||
mib2nut_info_t pulizzi_switched2 = { "pulizzi_switched2", EATON_PULIZZI_SW_MIB_VERSION, NULL, EATON_PULIZZI_SWITCHED1_SYSOID, eaton_pulizzi_switched_mib, EATON_PULIZZI_SWITCHED2_SYSOID };
|
||||
|
|
|
|||
|
|
@ -27,11 +27,8 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "hidparser.h"
|
||||
#include "nut_stdint.h" /* for int8_t, int16_t, int32_t */
|
||||
|
||||
/* to be implemented for DEBUG purpose */
|
||||
/* previously: #define ERROR(x) if(x) __asm { int 3 }; */
|
||||
#define ERROR(x)
|
||||
#include "nut_stdint.h" /* for int8_t, int16_t, int32_t */
|
||||
#include "common.h" /* for fatalx() */
|
||||
|
||||
static const uint8_t ItemSize[4] = { 0, 1, 2, 4 };
|
||||
|
||||
|
|
@ -175,7 +172,7 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData)
|
|||
memcpy(&pParser->Value, &pParser->ReportDesc[pParser->Pos], ItemSize[pParser->Item & SIZE_MASK]);
|
||||
#endif
|
||||
/* Pos on next item */
|
||||
pParser->Pos += ItemSize[pParser->Item & SIZE_MASK];
|
||||
pParser->Pos += ItemSize[pParser->Item & SIZE_MASK];
|
||||
}
|
||||
|
||||
switch (pParser->Item & ITEM_MASK)
|
||||
|
|
@ -249,7 +246,7 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData)
|
|||
if(pParser->Count == 0) {
|
||||
pParser->Count = pParser->ReportCount;
|
||||
}
|
||||
|
||||
|
||||
/* Get UPage/Usage from UsageTab and store them in pParser->Data.Path */
|
||||
pParser->Data.Path.Node[pParser->Data.Path.Size] = pParser->UsageTab[0];
|
||||
pParser->Data.Path.Size++;
|
||||
|
|
@ -341,10 +338,14 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData)
|
|||
}
|
||||
} /* while ((Found < 0) && (pParser->Pos < pParser->ReportDescSize)) */
|
||||
|
||||
ERROR(pParser->Data.Path.Size >= PATH_SIZE);
|
||||
ERROR(pParser->ReportDescSize >= REPORT_DSC_SIZE);
|
||||
ERROR(pParser->UsageSize >= USAGE_TAB_SIZE);
|
||||
ERROR(pParser->Data.ReportID >= MAX_REPORT);
|
||||
if(pParser->Data.Path.Size >= PATH_SIZE)
|
||||
upslogx(LOG_ERR, "%s: HID path too long", __func__);
|
||||
if(pParser->ReportDescSize >= REPORT_DSC_SIZE)
|
||||
upslogx(LOG_ERR, "%s: Report descriptor too big", __func__);
|
||||
if(pParser->UsageSize >= USAGE_TAB_SIZE)
|
||||
upslogx(LOG_ERR, "%s: HID Usage too high", __func__);
|
||||
if(pParser->Data.ReportID >= MAX_REPORT)
|
||||
upslogx(LOG_ERR, "%s: Too many HID reports", __func__);
|
||||
|
||||
return Found;
|
||||
}
|
||||
|
|
@ -594,6 +595,11 @@ HIDDesc_t *Parse_ReportDesc(const unsigned char *ReportDesc, const int n)
|
|||
}
|
||||
}
|
||||
|
||||
/* Sanity check: are there remaining HID objects that can't
|
||||
* be processed? */
|
||||
if ((pDesc->nitems == MAX_REPORT) && (parser->Pos < parser->ReportDescSize))
|
||||
upslogx(LOG_ERR, "ERROR in %s: Too many HID objects", __func__);
|
||||
|
||||
free(parser);
|
||||
|
||||
if (pDesc->nitems == 0) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*
|
||||
* Copyright (C)
|
||||
* 1998-2003 MGE UPS SYSTEMS, Luc Descotils
|
||||
* 2015 Eaton, Arnaud Quette (Update MAX_REPORT)
|
||||
*
|
||||
* 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
|
||||
|
|
@ -38,11 +39,11 @@ extern "C" {
|
|||
/*
|
||||
* Constants
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define PATH_SIZE 10 /* Deep max for Path */
|
||||
#define USAGE_TAB_SIZE 50 /* Size of usage stack */
|
||||
#define MAX_REPORT 300 /* Including FEATURE, INPUT and OUTPUT */
|
||||
#define REPORT_DSC_SIZE 6144 /* Size max of Report Descriptor */
|
||||
#define MAX_REPORT_TS 3 /* Max time validity of a report */
|
||||
#define PATH_SIZE 10 /* Deep max for Path */
|
||||
#define USAGE_TAB_SIZE 50 /* Size of usage stack */
|
||||
#define MAX_REPORT 500 /* Including FEATURE, INPUT and OUTPUT */
|
||||
#define REPORT_DSC_SIZE 6144 /* Size max of Report Descriptor */
|
||||
#define MAX_REPORT_TS 3 /* Max time validity of a report */
|
||||
|
||||
/*
|
||||
* Items
|
||||
|
|
|
|||
234
drivers/huawei-mib.c
Normal file
234
drivers/huawei-mib.c
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
/* huawei-mib.c - subdriver to monitor Huawei SNMP devices with NUT
|
||||
*
|
||||
* Copyright (C)
|
||||
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
|
||||
* 2015 Stuart Henderson <stu@spacehopper.org>
|
||||
*
|
||||
* 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 "huawei-mib.h"
|
||||
|
||||
#define HUAWEI_MIB_VERSION "0.1"
|
||||
|
||||
#define HUAWEI_SYSOID ".1.3.6.1.4.1.8072.3.2.10"
|
||||
#define HUAWEI_UPSMIB ".1.3.6.1.4.1.2011"
|
||||
|
||||
/* To create a value lookup structure (as needed on the 2nd line of the example
|
||||
* below), use the following kind of declaration, outside of the present snmp_info_t[]:
|
||||
* static info_lkp_t onbatt_info[] = {
|
||||
* { 1, "OB" },
|
||||
* { 2, "OL" },
|
||||
* { 0, NULL }
|
||||
* };
|
||||
*/
|
||||
|
||||
static info_lkp_t supplymethod_info[] = {
|
||||
{ 1, "" }, /* no supply */
|
||||
{ 2, "OL BYPASS" },
|
||||
{ 3, "OL" },
|
||||
{ 4, "OB" },
|
||||
{ 5, "" }, /* combined */
|
||||
{ 6, "OL ECO" },
|
||||
{ 7, "OB ECO" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t battstate_info[] = {
|
||||
{ 1, "" }, /* not connected */
|
||||
{ 2, "" }, /* not charging or discharging */
|
||||
{ 3, "" }, /* hibernation */
|
||||
{ 4, "" }, /* float */
|
||||
{ 5, "CHRG" }, /* equalized charging */
|
||||
{ 6, "DISCHRG" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t phase_info[] = {
|
||||
{ 1, "1" },
|
||||
{ 2, "3" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t voltrating_info[] = {
|
||||
{ 1, "200" },
|
||||
{ 2, "208" },
|
||||
{ 3, "220" },
|
||||
{ 4, "380" },
|
||||
{ 5, "400" },
|
||||
{ 6, "415" },
|
||||
{ 7, "480" },
|
||||
{ 8, "600" },
|
||||
{ 9, "690" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t freqrating_info[] = {
|
||||
{ 1, "50" },
|
||||
{ 2, "60" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t pwrrating_info[] = {
|
||||
{ 1, "80000" },
|
||||
{ 2, "100000" },
|
||||
{ 3, "120000" },
|
||||
{ 4, "160000" },
|
||||
{ 5, "200000" },
|
||||
{ 6, "30000" },
|
||||
{ 7, "40000" },
|
||||
{ 8, "60000" },
|
||||
{ 9, "2400000" },
|
||||
{ 10, "2500000" },
|
||||
{ 11, "2800000" },
|
||||
{ 12, "3000000" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_test_result_info[] = {
|
||||
{ 1, "done and passed" },
|
||||
{ 2, "done and warning" },
|
||||
{ 3, "done and error" },
|
||||
{ 4, "aborted" },
|
||||
{ 5, "in progress" },
|
||||
{ 6, "no test initiated" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
/* HUAWEI Snmp2NUT lookup table */
|
||||
static snmp_info_t huawei_mib[] = {
|
||||
|
||||
/* Data format:
|
||||
* { info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar },
|
||||
*
|
||||
* info_type: NUT INFO_ or CMD_ element name
|
||||
* info_flags: flags to set in addinfo
|
||||
* info_len: length of strings if STR
|
||||
* cmd value if CMD, multiplier otherwise
|
||||
* OID: SNMP OID or NULL
|
||||
* dfl: default value
|
||||
* flags: snmp-ups internal flags (FIXME: ...)
|
||||
* oid2info: lookup table between OID and NUT values
|
||||
* setvar: variable to set for SU_FLAG_SETINT
|
||||
*
|
||||
* Example:
|
||||
* { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL },
|
||||
* { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, onbatt_info },
|
||||
*
|
||||
* To create a value lookup structure (as needed on the 2nd line), use the
|
||||
* following kind of declaration, outside of the present snmp_info_t[]:
|
||||
* static info_lkp_t onbatt_info[] = {
|
||||
* { 1, "OB" },
|
||||
* { 2, "OL" },
|
||||
* { 0, NULL }
|
||||
* };
|
||||
*/
|
||||
|
||||
/* UPS page */
|
||||
|
||||
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Huawei", SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
|
||||
{ "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.2.1", "Generic SNMP UPS", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.1.1.2.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
|
||||
{ "ups.time", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.11.1.0", NULL, SU_FLAG_OK, NULL }, /* seconds since epoch */
|
||||
|
||||
{ "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.3.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.5.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
|
||||
{ "ups.status", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.2.101.1.1.1", NULL, SU_FLAG_OK, supplymethod_info },
|
||||
{ "ups.status", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.2.101.1.3.1", NULL, SU_STATUS_BATT | SU_FLAG_OK, battstate_info },
|
||||
|
||||
{ "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.33.1.7.3.0", "", 0, ietf_test_result_info },
|
||||
|
||||
|
||||
/* Input page */
|
||||
|
||||
/* hwUpsCtrlInputStandard listed in MIB but not present on tested UPS5000-E */
|
||||
{ "input.phases", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.102.100.1.8", "3", SU_FLAG_ABSENT | SU_FLAG_OK, phase_info },
|
||||
|
||||
{ "input.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.1.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "input.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.2.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "input.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.3.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "input.frequency", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.4.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "input.L1.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.5.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "input.L2.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.6.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "input.L3.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.7.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "input.L1.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.8.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "input.L2.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.9.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "input.L3.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.10.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "input.bypass.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.1.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "input.bypass.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.2.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "input.bypass.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.3.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "input.bypass.frequency", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.4.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
|
||||
/* Output page */
|
||||
|
||||
/* hwUpsCtrlOutputStandard listed in MIB but not present on tested UPS5000-E */
|
||||
{ "output.phases", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.102.100.1.9", "3", SU_FLAG_ABSENT | SU_FLAG_OK, phase_info },
|
||||
|
||||
{ "output.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.1.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.2.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.3.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "output.L1.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.4.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L2.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.5.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L3.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.6.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "output.frequency", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.7.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "output.L1.realpower", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.8.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L1.realpower", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.9.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L1.realpower", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.10.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "output.L1.power", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.11.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L2.power", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.12.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L3.power", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.13.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "output.L1.power.percent", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.14.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L2.power.percent", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.15.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L3.power.percent", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.16.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
{ "output.voltage.nominal", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.17.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, voltrating_info },
|
||||
{ "output.frequency.nominal", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.18.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, freqrating_info },
|
||||
{ "output.power.nominal", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.6.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, pwrrating_info },
|
||||
|
||||
{ "output.L1.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.19.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L2.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.20.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "output.L2.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.21.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
|
||||
/* Battery page */
|
||||
|
||||
{ "battery.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.1.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "battery.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.2.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "battery.charge", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.3.1", NULL, SU_FLAG_OK, NULL },
|
||||
{ "battery.runtime", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.4.1", NULL, SU_FLAG_OK, NULL },
|
||||
|
||||
|
||||
/* { "unmapped.hwUpsBattTest", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.103.101.1.6.1", NULL, SU_FLAG_OK, NULL }, */
|
||||
|
||||
|
||||
/* end of structure. */
|
||||
{ NULL, 0, 0, NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
mib2nut_info_t huawei = { "huawei", HUAWEI_MIB_VERSION, NULL, NULL, huawei_mib, HUAWEI_SYSOID };
|
||||
9
drivers/huawei-mib.h
Normal file
9
drivers/huawei-mib.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef HUAWEI_MIB_H
|
||||
#define HUAWEI_MIB_H
|
||||
|
||||
#include "main.h"
|
||||
#include "snmp-ups.h"
|
||||
|
||||
extern mib2nut_info_t huawei;
|
||||
|
||||
#endif /* HUAWEI_MIB_H */
|
||||
|
|
@ -26,11 +26,12 @@
|
|||
|
||||
#include "ietf-mib.h"
|
||||
|
||||
#define IETF_MIB_VERSION "1.4"
|
||||
#define IETF_MIB_VERSION "1.5"
|
||||
|
||||
/* SNMP OIDs set */
|
||||
#define IETF_OID_UPS_MIB "1.3.6.1.2.1.33.1."
|
||||
#define IETF_SYSOID ".1.3.6.1.2.1.33"
|
||||
#define TRIPPLITE_SYSOID ".1.3.6.1.4.1.850.1"
|
||||
|
||||
/* #define DEBUG */
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ static info_lkp_t ietf_battery_info[] = {
|
|||
{ 2, "" /* batteryNormal */},
|
||||
{ 3, "LB" /* batteryLow */ },
|
||||
{ 4, "LB" /* batteryDepleted */ },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_power_source_info[] = {
|
||||
|
|
@ -50,12 +51,12 @@ static info_lkp_t ietf_power_source_info[] = {
|
|||
{ 5, "OB" /* battery */ },
|
||||
{ 6, "OL BOOST" /* booster */ },
|
||||
{ 7, "OL TRIM" /* reducer */ },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_overload_info[] = {
|
||||
{ 1, "OVER" }, /* output overload */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_test_active_info[] = {
|
||||
|
|
@ -64,7 +65,7 @@ static info_lkp_t ietf_test_active_info[] = {
|
|||
{ 3, "TEST" }, /* upsTestGeneralSystemsTest */
|
||||
{ 4, "TEST" }, /* upsTestQuickBatteryTest */
|
||||
{ 5, "CAL" }, /* upsTestDeepBatteryCalibration */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_test_result_info[] = {
|
||||
|
|
@ -74,28 +75,28 @@ static info_lkp_t ietf_test_result_info[] = {
|
|||
{ 4, "aborted" },
|
||||
{ 5, "in progress" },
|
||||
{ 6, "no test initiated" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
static info_lkp_t ietf_shutdown_type_info[] = {
|
||||
{ 1, "output" },
|
||||
{ 2, "system" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
#endif
|
||||
|
||||
static info_lkp_t ietf_yes_no_info[] = {
|
||||
{ 1, "yes" },
|
||||
{ 2, "no" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_beeper_status_info[] = {
|
||||
{ 1, "disabled" },
|
||||
{ 2, "enabled" },
|
||||
{ 3, "muted" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Snmp2NUT lookup table info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar */
|
||||
|
|
@ -275,3 +276,4 @@ static snmp_info_t ietf_mib[] = {
|
|||
};
|
||||
|
||||
mib2nut_info_t ietf = { "ietf", IETF_MIB_VERSION, IETF_OID_UPS_MIB "4.1.0", IETF_OID_UPS_MIB "1.1.0", ietf_mib, IETF_SYSOID };
|
||||
mib2nut_info_t tripplite_ietf = { "ietf", IETF_MIB_VERSION, NULL, NULL, ietf_mib, TRIPPLITE_SYSOID };
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@
|
|||
#include "snmp-ups.h"
|
||||
|
||||
extern mib2nut_info_t ietf;
|
||||
extern mib2nut_info_t tripplite_ietf;
|
||||
|
||||
#endif /* IETF_MIB_H */
|
||||
|
|
|
|||
|
|
@ -287,6 +287,8 @@ void HIDDumpTree(hid_dev_handle_t udev, usage_tables_t *utab)
|
|||
return;
|
||||
}
|
||||
|
||||
upsdebugx(1, "%i HID objects found", pDesc->nitems);
|
||||
|
||||
for (i = 0; i < pDesc->nitems; i++)
|
||||
{
|
||||
double value;
|
||||
|
|
@ -407,7 +409,7 @@ char *HIDGetIndexString(hid_dev_handle_t udev, const int Index, char *buf, size_
|
|||
if (comm_driver->get_string(udev, Index, buf, buflen) < 1)
|
||||
buf[0] = '\0';
|
||||
|
||||
return rtrim(buf, '\n');
|
||||
return str_rtrim(buf, '\n');
|
||||
}
|
||||
|
||||
/* Return pointer to indexed string from HID path (empty if not found)
|
||||
|
|
@ -429,7 +431,7 @@ char *HIDGetItemString(hid_dev_handle_t udev, const char *hidpath, char *buf, si
|
|||
*/
|
||||
int HIDSetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double Value)
|
||||
{
|
||||
int i, r;
|
||||
int r;
|
||||
long hValue;
|
||||
|
||||
if (hiddata == NULL) {
|
||||
|
|
@ -456,9 +458,7 @@ int HIDSetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double Value)
|
|||
}
|
||||
|
||||
/* flush the report buffer (data may have changed) */
|
||||
for (i=0; i<256; i++) {
|
||||
reportbuf->ts[i] = 0;
|
||||
}
|
||||
memset(reportbuf->ts, 0, sizeof(reportbuf->ts));
|
||||
|
||||
upsdebugx(4, "Set report succeeded");
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include "common.h" /* for xmalloc, upsdebugx prototypes */
|
||||
|
||||
#define SHUT_DRIVER_NAME "SHUT communication driver"
|
||||
#define SHUT_DRIVER_VERSION "0.84"
|
||||
#define SHUT_DRIVER_VERSION "0.85"
|
||||
|
||||
/* communication driver description structure */
|
||||
upsdrv_info_t comm_upsdrv_info = {
|
||||
|
|
@ -300,6 +300,10 @@ int libshut_open(int *upsfd, SHUTDevice_t *curDevice, char *device_path,
|
|||
/* report descriptor */
|
||||
unsigned char rdbuf[MAX_REPORT_SIZE];
|
||||
int rdlen;
|
||||
/* All devices use HID descriptor at index 0. However, some newer
|
||||
* Eaton units have a light HID descriptor at index 0, and the full
|
||||
* version is at index 1 (in which case, bcdDevice == 0x0202) */
|
||||
int hid_desc_index = 0;
|
||||
|
||||
upsdebugx(2, "libshut_open: using port %s", device_path);
|
||||
|
||||
|
|
@ -361,6 +365,7 @@ int libshut_open(int *upsfd, SHUTDevice_t *curDevice, char *device_path,
|
|||
curDevice->VendorID = dev_descriptor->idVendor;
|
||||
curDevice->ProductID = dev_descriptor->idProduct;
|
||||
curDevice->Bus = strdup("serial");
|
||||
curDevice->bcdDevice = dev_descriptor->bcdDevice;
|
||||
curDevice->Vendor = strdup("Eaton");
|
||||
if (dev_descriptor->iManufacturer) {
|
||||
ret = shut_get_string_simple(*upsfd, dev_descriptor->iManufacturer,
|
||||
|
|
@ -400,11 +405,17 @@ int libshut_open(int *upsfd, SHUTDevice_t *curDevice, char *device_path,
|
|||
upsdebugx(2, "- Product: %s", curDevice->Product);
|
||||
upsdebugx(2, "- Serial Number: %s", curDevice->Serial);
|
||||
upsdebugx(2, "- Bus: %s", curDevice->Bus);
|
||||
upsdebugx(2, "- Device release number: %04x", curDevice->bcdDevice);
|
||||
upsdebugx(2, "Device matches");
|
||||
|
||||
if ((curDevice->VendorID == 0x463) && (curDevice->bcdDevice == 0x0202)) {
|
||||
upsdebugx(1, "Eaton device v2.02. Using full report descriptor");
|
||||
hid_desc_index = 1;
|
||||
}
|
||||
|
||||
/* Get HID descriptor */
|
||||
desc = (struct my_hid_descriptor *)buf;
|
||||
res = shut_get_descriptor(*upsfd, USB_DT_HID, 0, buf, 0x9);
|
||||
res = shut_get_descriptor(*upsfd, USB_DT_HID, hid_desc_index, buf, 0x9);
|
||||
/* res = shut_control_msg(devp, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR,
|
||||
(USB_DT_HID << 8) + 0, 0, buf, 0x9, SHUT_TIMEOUT); */
|
||||
|
||||
|
|
@ -437,7 +448,7 @@ int libshut_open(int *upsfd, SHUTDevice_t *curDevice, char *device_path,
|
|||
}
|
||||
|
||||
/* Get REPORT descriptor */
|
||||
res = shut_get_descriptor(*upsfd, USB_DT_REPORT, 0, rdbuf, rdlen);
|
||||
res = shut_get_descriptor(*upsfd, USB_DT_REPORT, hid_desc_index, rdbuf, rdlen);
|
||||
/* res = shut_control_msg(devp, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR,
|
||||
(USB_DT_REPORT << 8) + 0, 0, ReportDesc,
|
||||
desc->wDescriptorLength, SHUT_TIMEOUT); */
|
||||
|
|
|
|||
|
|
@ -42,12 +42,13 @@ extern upsdrv_info_t comm_upsdrv_info;
|
|||
* corresponding string did not exist or could not be retrieved.
|
||||
*/
|
||||
typedef struct SHUTDevice_s {
|
||||
uint16_t VendorID; /*!< Device's Vendor ID */
|
||||
uint16_t ProductID; /*!< Device's Product ID */
|
||||
char* Vendor; /*!< Device's Vendor Name */
|
||||
char* Product; /*!< Device's Product Name */
|
||||
char* Serial; /* Product serial number */
|
||||
char* Bus; /* Bus name, e.g. "003" */
|
||||
uint16_t VendorID; /*!< Device's Vendor ID */
|
||||
uint16_t ProductID; /*!< Device's Product ID */
|
||||
char* Vendor; /*!< Device's Vendor Name */
|
||||
char* Product; /*!< Device's Product Name */
|
||||
char* Serial; /*!< Product serial number */
|
||||
char* Bus; /*!< Bus name, e.g. "003" */
|
||||
uint16_t bcdDevice; /*!< Device release number */
|
||||
} SHUTDevice_t;
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include "libusb.h"
|
||||
|
||||
#define USB_DRIVER_NAME "USB communication driver"
|
||||
#define USB_DRIVER_VERSION "0.32"
|
||||
#define USB_DRIVER_VERSION "0.33"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t comm_upsdrv_info = {
|
||||
|
|
@ -154,6 +154,10 @@ static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDevice
|
|||
unsigned char *p;
|
||||
char string[256];
|
||||
int i;
|
||||
/* All devices use HID descriptor at index 0. However, some newer
|
||||
* Eaton units have a light HID descriptor at index 0, and the full
|
||||
* version is at index 1 (in which case, bcdDevice == 0x0202) */
|
||||
int hid_desc_index = 0;
|
||||
|
||||
/* report descriptor */
|
||||
unsigned char rdbuf[MAX_REPORT_SIZE];
|
||||
|
|
@ -199,6 +203,7 @@ static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDevice
|
|||
curDevice->VendorID = dev->descriptor.idVendor;
|
||||
curDevice->ProductID = dev->descriptor.idProduct;
|
||||
curDevice->Bus = strdup(bus->dirname);
|
||||
curDevice->bcdDevice = dev->descriptor.bcdDevice;
|
||||
|
||||
if (dev->descriptor.iManufacturer) {
|
||||
ret = usb_get_string_simple(udev, dev->descriptor.iManufacturer,
|
||||
|
|
@ -230,6 +235,11 @@ static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDevice
|
|||
upsdebugx(2, "- Product: %s", curDevice->Product ? curDevice->Product : "unknown");
|
||||
upsdebugx(2, "- Serial Number: %s", curDevice->Serial ? curDevice->Serial : "unknown");
|
||||
upsdebugx(2, "- Bus: %s", curDevice->Bus ? curDevice->Bus : "unknown");
|
||||
upsdebugx(2, "- Device release number: %04x", curDevice->bcdDevice);
|
||||
|
||||
if ((curDevice->VendorID == 0x463) && (curDevice->bcdDevice == 0x0202)) {
|
||||
hid_desc_index = 1;
|
||||
}
|
||||
|
||||
upsdebugx(2, "Trying to match device");
|
||||
for (m = matcher; m; m=m->next) {
|
||||
|
|
@ -293,9 +303,9 @@ static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDevice
|
|||
/* Get HID descriptor */
|
||||
|
||||
/* FIRST METHOD: ask for HID descriptor directly. */
|
||||
/* res = usb_get_descriptor(udev, USB_DT_HID, 0, buf, 0x9); */
|
||||
/* res = usb_get_descriptor(udev, USB_DT_HID, hid_desc_index, buf, 0x9); */
|
||||
res = usb_control_msg(udev, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR,
|
||||
(USB_DT_HID << 8) + 0, 0, buf, 0x9, USB_TIMEOUT);
|
||||
(USB_DT_HID << 8) + hid_desc_index, 0, buf, 0x9, USB_TIMEOUT);
|
||||
|
||||
if (res < 0) {
|
||||
upsdebugx(2, "Unable to get HID descriptor (%s)", usb_strerror());
|
||||
|
|
@ -311,6 +321,7 @@ static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDevice
|
|||
if (rdlen1 < -1) {
|
||||
upsdebugx(2, "Warning: HID descriptor, method 1 failed");
|
||||
}
|
||||
upsdebugx(3, "HID descriptor length (method 1) %d", rdlen1);
|
||||
|
||||
/* SECOND METHOD: find HID descriptor among "extra" bytes of
|
||||
interface descriptor, i.e., bytes tucked onto the end of
|
||||
|
|
@ -336,12 +347,19 @@ static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDevice
|
|||
if (rdlen2 < -1) {
|
||||
upsdebugx(2, "Warning: HID descriptor, method 2 failed");
|
||||
}
|
||||
upsdebugx(3, "HID descriptor length (method 2) %d", rdlen2);
|
||||
|
||||
/* when available, always choose the second value, as it
|
||||
seems to be more reliable (it is the one reported e.g. by
|
||||
lsusb). Note: if the need arises, can change this to use
|
||||
the maximum of the two values instead. */
|
||||
rdlen = rdlen2 >= 0 ? rdlen2 : rdlen1;
|
||||
if ((curDevice->VendorID == 0x463) && (curDevice->bcdDevice == 0x0202)) {
|
||||
upsdebugx(1, "Eaton device v2.02. Using full report descriptor");
|
||||
rdlen = rdlen1;
|
||||
}
|
||||
else {
|
||||
rdlen = rdlen2 >= 0 ? rdlen2 : rdlen1;
|
||||
}
|
||||
|
||||
if (rdlen < 0) {
|
||||
upsdebugx(2, "Unable to retrieve any HID descriptor");
|
||||
|
|
@ -358,9 +376,9 @@ static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDevice
|
|||
goto next_device;
|
||||
}
|
||||
|
||||
/* res = usb_get_descriptor(udev, USB_DT_REPORT, 0, bigbuf, rdlen); */
|
||||
/* res = usb_get_descriptor(udev, USB_DT_REPORT, hid_desc_index, bigbuf, rdlen); */
|
||||
res = usb_control_msg(udev, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR,
|
||||
(USB_DT_REPORT << 8) + 0, 0, rdbuf, rdlen, USB_TIMEOUT);
|
||||
(USB_DT_REPORT << 8) + hid_desc_index, 0, rdbuf, rdlen, USB_TIMEOUT);
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* 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>
|
||||
* Copyright (C) 2011-2012, 2015 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
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
#include "IOKit/ps/IOPSKeys.h"
|
||||
|
||||
#define DRIVER_NAME "Mac OS X UPS meta-driver"
|
||||
#define DRIVER_VERSION "1.0"
|
||||
#define DRIVER_VERSION "1.2"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
|
@ -42,39 +42,63 @@ upsdrv_info_t upsdrv_info = {
|
|||
#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 CFStringRef g_power_source_name = 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)
|
||||
static CFDictionaryRef copy_power_dictionary(CFStringRef power_source_name)
|
||||
{
|
||||
CFTypeRef power_blob;
|
||||
CFDictionaryRef power_dictionary;
|
||||
CFTypeRef power_sources_info, power_source;
|
||||
CFArrayRef sources_list;
|
||||
CFDictionaryRef this_power_dictionary, power_dictionary = NULL;
|
||||
CFStringRef this_power_source_name;
|
||||
CFIndex num_keys, index;
|
||||
|
||||
power_blob = IOPSCopyPowerSourcesInfo();
|
||||
power_sources_info = IOPSCopyPowerSourcesInfo();
|
||||
|
||||
assert(power_blob);
|
||||
upsdebugx(6, "%s: Got power_blob:", __func__);
|
||||
if(nut_debug_level >= 6) CFShow(power_blob);
|
||||
assert(power_sources_info);
|
||||
upsdebugx(6, "%s: Got power_sources_info:", __func__);
|
||||
if(nut_debug_level >= 6) CFShow(power_sources_info);
|
||||
|
||||
upsdebugx(5, "power_key = ");
|
||||
if(nut_debug_level >= 5) CFShow(power_key);
|
||||
upsdebugx(6, "end power_key");
|
||||
upsdebugx(5, "power_source_name = ");
|
||||
if(nut_debug_level >= 5) CFShow(power_source_name);
|
||||
upsdebugx(6, "end power_source_name");
|
||||
|
||||
power_dictionary = IOPSGetPowerSourceDescription(power_blob, power_key);
|
||||
sources_list = IOPSCopyPowerSourcesList(power_sources_info);
|
||||
|
||||
upsdebugx(5, "Asserting 'power_dictionary': %p", power_dictionary);
|
||||
assert(power_dictionary);
|
||||
upsdebugx(5, "CFShowing 'power_dictionary'");
|
||||
if(nut_debug_level >= 5) CFShow(power_dictionary);
|
||||
num_keys = CFArrayGetCount(sources_list);
|
||||
for(index=0; index < num_keys; index++) {
|
||||
upsdebugx(6, "%s: Getting power source %ld/%ld...", __func__, index+1, num_keys);
|
||||
power_source = CFArrayGetValueAtIndex(sources_list, index);
|
||||
assert(power_source);
|
||||
|
||||
CFRetain(power_dictionary);
|
||||
upsdebugx(6, "%s: power source %ld = ", __func__, index+1);
|
||||
if(nut_debug_level >= 6) CFShow(power_source);
|
||||
|
||||
/* Get a new power_blob next time: */
|
||||
CFRelease(power_blob);
|
||||
this_power_dictionary = IOPSGetPowerSourceDescription(power_sources_info, power_source);
|
||||
assert(this_power_dictionary);
|
||||
|
||||
this_power_source_name = CFDictionaryGetValue(this_power_dictionary, CFSTR(kIOPSNameKey));
|
||||
assert(this_power_source_name);
|
||||
|
||||
if(!CFStringCompare(this_power_source_name, power_source_name, 0)) {
|
||||
power_dictionary = this_power_dictionary;
|
||||
CFRetain(power_dictionary);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(power_dictionary) {
|
||||
upsdebugx(5, "CFShowing 'power_dictionary'");
|
||||
if(nut_debug_level >= 5) CFShow(power_dictionary);
|
||||
}
|
||||
|
||||
/* Get a new power_sources_info next time: */
|
||||
CFRelease(power_sources_info);
|
||||
CFRelease(sources_list);
|
||||
|
||||
return power_dictionary;
|
||||
}
|
||||
|
|
@ -92,7 +116,7 @@ void upsdrv_initinfo(void)
|
|||
|
||||
dstate_setinfo("device.mfr", "(unknown)");
|
||||
|
||||
power_dictionary = copy_power_dictionary(g_power_key);
|
||||
power_dictionary = copy_power_dictionary(g_power_source_name);
|
||||
|
||||
device_type_cfstr = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSTypeKey));
|
||||
if(device_type_cfstr && !CFStringCompare(device_type_cfstr, CFSTR(kIOPSInternalBatteryType), 0)) {
|
||||
|
|
@ -144,8 +168,11 @@ void upsdrv_updateinfo(void)
|
|||
|
||||
upsdebugx(1, "upsdrv_updateinfo()");
|
||||
|
||||
power_dictionary = copy_power_dictionary( g_power_key );
|
||||
assert(power_dictionary); /* TODO: call dstate_datastale()? */
|
||||
power_dictionary = copy_power_dictionary( g_power_source_name );
|
||||
if(!power_dictionary) {
|
||||
dstate_datastale();
|
||||
return;
|
||||
}
|
||||
|
||||
status_init();
|
||||
|
||||
|
|
@ -314,9 +341,9 @@ void upsdrv_initups(void)
|
|||
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;
|
||||
char *model_name; /* regex(3) */
|
||||
char potential_model_name[256];
|
||||
regex_t model_regex;
|
||||
int ret;
|
||||
|
||||
upsdebugx(3, "upsdrv_initups(): Power Sources blob:");
|
||||
|
|
@ -329,6 +356,8 @@ void upsdrv_initups(void)
|
|||
|
||||
if(nut_debug_level >= 3) CFShow(power_blob);
|
||||
|
||||
/* The CFDictionary through 10.9 has changed to a CFArray, so this part is no longer applicable: */
|
||||
#if 0
|
||||
if(!strcmp(device_name, "auto")) {
|
||||
device_name = "/UPS";
|
||||
}
|
||||
|
|
@ -342,6 +371,7 @@ void upsdrv_initups(void)
|
|||
"Failed to compile regex from 'port' parameter: '%s'.",
|
||||
device_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
if((model_name = getval("model"))) {
|
||||
upsdebugx(2, "Matching power supply model names against regex '%s'", model_name);
|
||||
|
|
@ -363,61 +393,55 @@ void upsdrv_initups(void)
|
|||
|
||||
if(num_keys < 1) {
|
||||
/* bail */
|
||||
fatalx(EXIT_FAILURE, "Couldn't find any UPS or battery");
|
||||
fatalx(EXIT_FAILURE, "Couldn't find any UPS or battery. Is your UPS shown in the 'Energy Saver' control panel?");
|
||||
}
|
||||
|
||||
for(index=0; index < num_keys; index++) {
|
||||
upsdebugx(2, "Retrieving power source #%ld", index+1);
|
||||
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);
|
||||
upsdebugx(3, "Power source key/index:");
|
||||
if(nut_debug_level >= 3) CFShow(potential_key);
|
||||
|
||||
ret = regexec(&name_regex, potential_device_name, 0,0,0);
|
||||
|
||||
power_dictionary = copy_power_dictionary(potential_key);
|
||||
power_dictionary = IOPSGetPowerSourceDescription(power_blob, potential_key);
|
||||
assert(power_dictionary);
|
||||
CFRetain(power_dictionary);
|
||||
|
||||
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);
|
||||
CFRetain(potential_model);
|
||||
if(CFStringGetCString(potential_model, potential_model_name, sizeof(potential_model_name), kCFStringEncodingUTF8)) {
|
||||
upsdebugx(1, " model name: %s", potential_model_name);
|
||||
} else {
|
||||
upsdebugx(1, " (failed to retrieve '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");
|
||||
if(model_name) {
|
||||
ret = regexec(&model_regex, potential_model_name, 0,0,0);
|
||||
if(!ret) {
|
||||
upsdebugx(2, "Matched model name");
|
||||
break;
|
||||
}
|
||||
}
|
||||
CFRelease(potential_model);
|
||||
}
|
||||
|
||||
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);
|
||||
if(model_name) {
|
||||
fatalx(EXIT_FAILURE, "Couldn't find UPS or battery matching 'model' (%s)",
|
||||
model_name);
|
||||
} else {
|
||||
fatalx(EXIT_FAILURE, "Couldn't find an UPS or battery.");
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
g_power_source_name = potential_model;
|
||||
|
||||
/* the upsh handlers can't be done here, as they get initialized
|
||||
* shortly after upsdrv_initups returns to main.
|
||||
|
|
@ -426,14 +450,12 @@ void upsdrv_initups(void)
|
|||
/* 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);
|
||||
CFRelease(g_power_source_name);
|
||||
|
||||
/* free(dynamic_mem); */
|
||||
/* ser_close(upsfd, device_path); */
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include "usbhid-ups.h"
|
||||
#include "mge-hid.h"
|
||||
|
||||
#define MGE_HID_VERSION "MGE HID 1.38"
|
||||
#define MGE_HID_VERSION "MGE HID 1.39"
|
||||
|
||||
/* (prev. MGE Office Protection Systems, prev. MGE UPS SYSTEMS) */
|
||||
/* Eaton */
|
||||
|
|
@ -52,6 +52,9 @@
|
|||
/* Hewlett Packard */
|
||||
#define HP_VENDORID 0x03f0
|
||||
|
||||
/* AEG */
|
||||
#define AEG_VENDORID 0x2b2d
|
||||
|
||||
#ifndef SHUT_MODE
|
||||
#include "usb-common.h"
|
||||
|
||||
|
|
@ -75,6 +78,9 @@ static usb_device_id_t mge_usb_device_table[] = {
|
|||
{ USB_DEVICE(HP_VENDORID, 0x1fe7), NULL },
|
||||
{ USB_DEVICE(HP_VENDORID, 0x1fe8), NULL },
|
||||
|
||||
/* PROTECT B / NAS */
|
||||
{ USB_DEVICE(AEG_VENDORID, 0xffff), NULL },
|
||||
|
||||
/* Terminating entry */
|
||||
{ -1, -1, NULL }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,50 +40,50 @@
|
|||
static info_lkp_t mge_lowbatt_info[] = {
|
||||
{ 1, "LB" },
|
||||
{ 2, "" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t mge_onbatt_info[] = {
|
||||
{ 1, "OB" },
|
||||
{ 2, "OL" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t mge_bypass_info[] = {
|
||||
{ 1, "BYPASS" },
|
||||
{ 2, "" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t mge_boost_info[] = {
|
||||
{ 1, "BOOST" },
|
||||
{ 2, "" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t mge_trim_info[] = {
|
||||
{ 1, "TRIM" },
|
||||
{ 2, "" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t mge_overload_info[] = {
|
||||
{ 1, "OVER" },
|
||||
{ 2, "" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
static info_lkp_t mge_replacebatt_info[] = {
|
||||
{ 1, "RB" },
|
||||
{ 2, "" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t mge_output_util_off_info[] = {
|
||||
{ 1, "OFF" },
|
||||
{ 2, "" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t mge_transfer_reason_info[] = {
|
||||
|
|
@ -91,7 +91,7 @@ static info_lkp_t mge_transfer_reason_info[] = {
|
|||
{ 2, "input voltage out of range" },
|
||||
{ 3, "input frequency out of range" },
|
||||
{ 4, "utility off" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_test_result_info[] = {
|
||||
|
|
@ -101,20 +101,20 @@ static info_lkp_t ietf_test_result_info[] = {
|
|||
{ 4, "aborted" },
|
||||
{ 5, "in progress" },
|
||||
{ 6, "no test initiated" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_beeper_status_info[] = {
|
||||
{ 1, "disabled" },
|
||||
{ 2, "enabled" },
|
||||
{ 3, "muted" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_yes_no_info[] = {
|
||||
{ 1, "yes" },
|
||||
{ 2, "no" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* FIXME: the below may introduce status redundancy, that needs to be
|
||||
|
|
@ -129,7 +129,7 @@ static info_lkp_t ietf_power_source_info[] = {
|
|||
{ 5, "OB" /* battery */ },
|
||||
{ 6, "BOOST" /* booster */ },
|
||||
{ 7, "TRIM" /* reducer */ },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Parameters default values */
|
||||
|
|
@ -271,4 +271,4 @@ static snmp_info_t mge_mib[] = {
|
|||
{ NULL, 0, 0, NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
mib2nut_info_t mge = { "mge", MGE_MIB_VERSION, "", MGE_OID_MODEL_NAME, mge_mib, MGE_SYSOID };
|
||||
mib2nut_info_t mge = { "mge", MGE_MIB_VERSION, NULL, MGE_OID_MODEL_NAME, mge_mib, MGE_SYSOID };
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "netxml-ups.h"
|
||||
#include "mge-xml.h"
|
||||
|
||||
#define MGE_XML_VERSION "MGEXML/0.23"
|
||||
#define MGE_XML_VERSION "MGEXML/0.25"
|
||||
#define MGE_XML_INITUPS "/"
|
||||
#define MGE_XML_INITINFO "/mgeups/product.xml /product.xml /ws/product.xml"
|
||||
|
||||
|
|
@ -579,6 +579,7 @@ static xml_info_t mge_xml2nut[] = {
|
|||
/* Not used for now; might however be used in future for history & stats collection
|
||||
{ "System.History.Log.Interval", ST_FLAG_RW, 0, "System.History.Log.Interval", 0, 0, NULL },
|
||||
*/
|
||||
#if (0) /* not interresting for NUT */
|
||||
{ "System.Environment.Log.Interval", ST_FLAG_RW, 0, "System.Environment.Log.Interval", 0, 0, NULL },
|
||||
{ "System.Outlet[1].iName", ST_FLAG_RW, 0, "System.Outlet[1].iName", 0, 0, NULL },
|
||||
/* Mapped as ups.delay.shutdown
|
||||
|
|
@ -622,7 +623,6 @@ static xml_info_t mge_xml2nut[] = {
|
|||
{ "System.Password", ST_FLAG_RW, 0, "System.Password", 0, 0, NULL },
|
||||
{ "System.Security", ST_FLAG_RW, 0, "System.Security", 0, 0, NULL },
|
||||
{ "System.FirmwareUpgrade", ST_FLAG_RW, 0, "System.FirmwareUpgrade", 0, 0, NULL },
|
||||
#if (0) /* not interresting for NUT */
|
||||
{ "System.Network.SNMP.ReadCommunity", ST_FLAG_RW, 0, "System.Network.SNMP.ReadCommunity", 0, 0, NULL },
|
||||
{ "System.Network.SNMP.ReadCommunityName", 0, 0, "System.Network.SNMP.ReadCommunityName", 0, 0, NULL },
|
||||
{ "System.Network.SNMP.ReadCommunitySecurityLevel", 0, 0, "System.Network.SNMP.ReadCommunitySecurityLevel", 0, 0, NULL },
|
||||
|
|
@ -813,19 +813,14 @@ static xml_info_t mge_xml2nut[] = {
|
|||
{ "System.ClientCfg.ShutdownDuration", ST_FLAG_RW, 0, "System.ClientCfg.ShutdownDuration", 0, 0, NULL },
|
||||
{ "System.ClientCfg.BroadcastAdmins", ST_FLAG_RW, 0, "System.ClientCfg.BroadcastAdmins", 0, 0, NULL },
|
||||
{ "System.ClientCfg.BroadcastUsers", ST_FLAG_RW, 0, "System.ClientCfg.BroadcastUsers", 0, 0, NULL },
|
||||
#endif /* not interresting for NUT */
|
||||
{ "Environment.iName", ST_FLAG_RW, 0, "Environment.iName", 0, 0, NULL },
|
||||
{ "Environment.Temperature.Unit", ST_FLAG_RW, 0, "Environment.Temperature.Unit", 0, 0, NULL },
|
||||
{ "Environment.Temperature.HighThreshold", ST_FLAG_RW, 0, "Environment.Temperature.HighThreshold", 0, 0, NULL },
|
||||
{ "Environment.Temperature.LowThreshold", ST_FLAG_RW, 0, "Environment.Temperature.LowThreshold", 0, 0, NULL },
|
||||
{ "Environment.Temperature.Hysteresis", ST_FLAG_RW, 0, "Environment.Temperature.Hysteresis", 0, 0, NULL },
|
||||
{ "Environment.Temperature.Offset", ST_FLAG_RW, 0, "Environment.Temperature.Offset", 0, 0, NULL },
|
||||
{ "Environment.Temperature.HighNotify", ST_FLAG_RW, 0, "Environment.Temperature.HighNotify", 0, 0, NULL },
|
||||
{ "Environment.Temperature.LowNotify", ST_FLAG_RW, 0, "Environment.Temperature.LowNotify", 0, 0, NULL },
|
||||
{ "Environment.Temperature.HighShutdown", ST_FLAG_RW, 0, "Environment.Temperature.HighShutdown", 0, 0, NULL },
|
||||
{ "Environment.Temperature.LowShutdown", ST_FLAG_RW, 0, "Environment.Temperature.LowShutdown", 0, 0, NULL },
|
||||
{ "Environment.Humidity.HighThreshold", ST_FLAG_RW, 0, "Environment.Humidity.HighThreshold", 0, 0, NULL },
|
||||
{ "Environment.Humidity.LowThreshold", ST_FLAG_RW, 0, "Environment.Humidity.LowThreshold", 0, 0, NULL },
|
||||
{ "Environment.Humidity.Hysteresis", ST_FLAG_RW, 0, "Environment.Humidity.Hysteresis", 0, 0, NULL },
|
||||
{ "Environment.Humidity.Offset", ST_FLAG_RW, 0, "Environment.Humidity.Offset", 0, 0, NULL },
|
||||
{ "Environment.Humidity.HighNotify", ST_FLAG_RW, 0, "Environment.Humidity.HighNotify", 0, 0, NULL },
|
||||
|
|
@ -850,6 +845,7 @@ static xml_info_t mge_xml2nut[] = {
|
|||
{ "System.TimeNtp", ST_FLAG_RW, 0, "System.TimeNtp", 0, 0, NULL },
|
||||
{ "System.TimeZone", ST_FLAG_RW, 0, "System.TimeZone", 0, 0, NULL },
|
||||
{ "System.TimeDaylight", ST_FLAG_RW, 0, "System.TimeDaylight", 0, 0, NULL },
|
||||
#endif /* not interresting for NUT */
|
||||
|
||||
/* Special case: boolean values that are mapped to ups.status and ups.alarm */
|
||||
{ NULL, 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", 0, 0, online_info },
|
||||
|
|
@ -1013,13 +1009,13 @@ static xml_info_t mge_xml2nut[] = {
|
|||
|
||||
/* Ambient page */
|
||||
{ "ambient.humidity", 0, 0, "Environment.Humidity", 0, 0, NULL },
|
||||
{ "ambient.humidity.high", 0, 0, "Environment.Humidity.HighThreshold", 0, 0, NULL },
|
||||
{ "ambient.humidity.low", 0, 0, "Environment.Humidity.LowThreshold", 0, 0, NULL },
|
||||
{ "ambient.humidity.high", ST_FLAG_RW, 0, "Environment.Humidity.HighThreshold", 0, 0, NULL },
|
||||
{ "ambient.humidity.low", ST_FLAG_RW, 0, "Environment.Humidity.LowThreshold", 0, 0, NULL },
|
||||
{ "ambient.humidity.maximum", 0, 0, "Environment.PresentStatus.HighHumidity", 0, 0, mge_ambient_info },
|
||||
{ "ambient.humidity.minimum", 0, 0, "Environment.PresentStatus.LowHumidity", 0, 0, mge_ambient_info },
|
||||
{ "ambient.temperature", 0, 0, "Environment.Temperature", 0, 0, NULL },
|
||||
{ "ambient.temperature.high", 0, 0, "Environment.Temperature.HighThreshold", 0, 0, NULL },
|
||||
{ "ambient.temperature.low", 0, 0, "Environment.Temperature.LowThreshold", 0, 0, NULL },
|
||||
{ "ambient.temperature.high", ST_FLAG_RW, 0, "Environment.Temperature.HighThreshold", 0, 0, NULL },
|
||||
{ "ambient.temperature.low", ST_FLAG_RW, 0, "Environment.Temperature.LowThreshold", 0, 0, NULL },
|
||||
{ "ambient.temperature.maximum", 0, 0, "Environment.PresentStatus.HighTemperature", 0, 0, mge_ambient_info },
|
||||
{ "ambient.temperature.minimum", 0, 0, "Environment.PresentStatus.LowTemperature", 0, 0, mge_ambient_info },
|
||||
|
||||
|
|
@ -1107,7 +1103,7 @@ static int mge_xml_startelm_cb(void *userdata, int parent, const char *nspace, c
|
|||
snprintfcat(val, sizeof(val), "/%s", atts[i+1]);
|
||||
s = strstr(val, " (SN ");
|
||||
if (s) {
|
||||
dstate_setinfo("ups.serial", "%s", rtrim(s + 5, ')'));
|
||||
dstate_setinfo("ups.serial", "%s", str_rtrim(s + 5, ')'));
|
||||
s[0] = '\0';
|
||||
}
|
||||
dstate_setinfo("ups.firmware.aux", "%s", val);
|
||||
|
|
|
|||
|
|
@ -44,14 +44,14 @@ static info_lkp_t netvision_batt_info[] = {
|
|||
{ 4, "LB" }, /* battery depleted */
|
||||
{ 5, "DISCHRG" }, /* battery discharging */
|
||||
{ 6, "RB" }, /* battery failure */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Battery status: upsAlarmOnBattery */
|
||||
static info_lkp_t netvision_onbatt_info[] = {
|
||||
{ 0, "OL" }, /* Online */
|
||||
{ 1, "OB" }, /* On battery */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define NETVISION_OID_SECONDSONBATTERY ".1.3.6.1.4.1.4555.1.1.1.1.2.2.0"
|
||||
|
|
@ -110,7 +110,7 @@ static info_lkp_t netvision_output_info[] = {
|
|||
{ 7, "OL TRIM" }, /* output source reducer */
|
||||
{ 8, "OL" }, /* output source standby */
|
||||
{ 9, "" }, /* output source ecomode */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Snmp2NUT lookup table */
|
||||
|
|
@ -181,4 +181,4 @@ static snmp_info_t netvision_mib[] = {
|
|||
{ NULL, 0, 0, NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
mib2nut_info_t netvision = { "netvision", NETVISION_MIB_VERSION, "", NETVISION_OID_UPSIDENTMODEL, netvision_mib, NETVISION_SYSOID };
|
||||
mib2nut_info_t netvision = { "netvision", NETVISION_MIB_VERSION, NULL, NETVISION_OID_UPSIDENTMODEL, netvision_mib, NETVISION_SYSOID };
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ struct ipmi_monitoring_ipmi_config ipmi_config;
|
|||
ipmi_sdr_ctx_t sdr_ctx = NULL;
|
||||
ipmi_fru_ctx_t fru_ctx = NULL;
|
||||
#define SDR_PARSE_CTX sdr_ctx
|
||||
#define NUT_IPMI_SDR_CACHE_DEFAULTS IPMI_SDR_CACHE_CREATE_FLAGS_DEFAULT
|
||||
#else
|
||||
ipmi_sdr_cache_ctx_t sdr_ctx = NULL;
|
||||
ipmi_sdr_parse_ctx_t sdr_parse_ctx = NULL;
|
||||
|
|
@ -99,6 +100,7 @@ struct ipmi_monitoring_ipmi_config ipmi_config;
|
|||
#define IPMI_FRU_AREA_TYPE_BOARD_INFO_AREA IPMI_FRU_PARSE_AREA_TYPE_BOARD_INFO_AREA
|
||||
#define IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION
|
||||
#define IPMI_FRU_AREA_STRING_MAX IPMI_FRU_PARSE_AREA_STRING_MAX
|
||||
#define NUT_IPMI_SDR_CACHE_DEFAULTS IPMI_SDR_CACHE_CREATE_FLAGS_DEFAULT, IPMI_SDR_CACHE_VALIDATION_FLAGS_DEFAULT
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
/* FIXME: freeipmi auto selects a cache based on the hostname you are
|
||||
|
|
@ -342,8 +344,8 @@ static int libfreeipmi_get_psu_info (const void *areabuf,
|
|||
{
|
||||
/* FIXME: directly use ipmi_dev fields */
|
||||
unsigned int overall_capacity;
|
||||
unsigned int low_end_input_voltage_range_1;
|
||||
unsigned int high_end_input_voltage_range_1;
|
||||
int low_end_input_voltage_range_1;
|
||||
int high_end_input_voltage_range_1;
|
||||
unsigned int low_end_input_frequency_range;
|
||||
unsigned int high_end_input_frequency_range;
|
||||
unsigned int voltage_1;
|
||||
|
|
@ -352,8 +354,8 @@ static int libfreeipmi_get_psu_info (const void *areabuf,
|
|||
unsigned int peak_va;
|
||||
unsigned int inrush_current;
|
||||
unsigned int inrush_interval;
|
||||
unsigned int low_end_input_voltage_range_2;
|
||||
unsigned int high_end_input_voltage_range_2;
|
||||
int low_end_input_voltage_range_2;
|
||||
int high_end_input_voltage_range_2;
|
||||
unsigned int ac_dropout_tolerance;
|
||||
unsigned int predictive_fail_support;
|
||||
unsigned int power_factor_correction;
|
||||
|
|
@ -554,10 +556,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
|
|||
{
|
||||
if (ipmi_sdr_cache_create (sdr_ctx,
|
||||
ipmi_ctx, CACHE_LOCATION,
|
||||
IPMI_SDR_CACHE_CREATE_FLAGS_DEFAULT,
|
||||
#ifndef HAVE_FREEIPMI_11X_12X
|
||||
IPMI_SDR_CACHE_VALIDATION_FLAGS_DEFAULT,
|
||||
#endif
|
||||
NUT_IPMI_SDR_CACHE_DEFAULTS,
|
||||
NULL, NULL) < 0)
|
||||
{
|
||||
libfreeipmi_cleanup();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define DRIVER_VERSION "0.17"
|
||||
#define DRIVER_VERSION "0.28"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
|
@ -475,6 +475,75 @@ static int cypress_command(const char *cmd, char *buf, size_t buflen)
|
|||
return i;
|
||||
}
|
||||
|
||||
/* SGS communication subdriver */
|
||||
static int sgs_command(const char *cmd, char *buf, size_t buflen)
|
||||
{
|
||||
char tmp[SMALLBUF];
|
||||
int ret;
|
||||
size_t cmdlen, i;
|
||||
|
||||
/* Send command */
|
||||
cmdlen = strlen(cmd);
|
||||
|
||||
for (i = 0; i < cmdlen; i += ret) {
|
||||
|
||||
memset(tmp, 0, sizeof(tmp));
|
||||
|
||||
ret = (cmdlen - i) < 7 ? (cmdlen - i) : 7;
|
||||
|
||||
tmp[0] = ret;
|
||||
memcpy(&tmp[1], &cmd[i], ret);
|
||||
|
||||
/* Write data in 8-byte chunks */
|
||||
ret = usb_control_msg(udev, USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0x09, 0x200, 0, tmp, 8, 5000);
|
||||
|
||||
if (ret <= 0) {
|
||||
upsdebugx(3, "send: %s (%d)", ret ? usb_strerror() : "timeout", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret--;
|
||||
|
||||
}
|
||||
|
||||
upsdebugx(3, "send: %.*s", (int)strcspn(cmd, "\r"), cmd);
|
||||
|
||||
/* Read reply */
|
||||
memset(buf, 0, buflen);
|
||||
|
||||
for (i = 0; i <= buflen - 8; i += ret) {
|
||||
|
||||
memset(tmp, 0, sizeof(tmp));
|
||||
|
||||
/* Read data in 8-byte chunks */
|
||||
ret = usb_interrupt_read(udev, 0x81, tmp, 8, 1000);
|
||||
|
||||
/* No error!!! */
|
||||
if (ret == -110)
|
||||
break;
|
||||
|
||||
/* Any errors here mean that we are unable to read a reply (which will happen after successfully writing a command to the UPS) */
|
||||
if (ret <= 0) {
|
||||
upsdebugx(3, "read: %s (%d)", ret ? usb_strerror() : "timeout", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Every call to read returns 8 bytes
|
||||
* -> actually returned bytes: */
|
||||
ret = tmp[0] <= 7 ? tmp[0] : 7;
|
||||
|
||||
if (ret > 0)
|
||||
memcpy(&buf[i], &tmp[1], ret);
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "read [% 3d]", (int)i);
|
||||
upsdebug_hex(5, tmp, &buf[i], ret);
|
||||
|
||||
}
|
||||
|
||||
upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf);
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Phoenix communication subdriver */
|
||||
static int phoenix_command(const char *cmd, char *buf, size_t buflen)
|
||||
{
|
||||
|
|
@ -693,7 +762,10 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen)
|
|||
}
|
||||
|
||||
/* "UPS No Ack" has a special meaning */
|
||||
if (!strcasecmp(buf, "UPS No Ack")) {
|
||||
if (
|
||||
strcspn(buf, "\r") == 10 &&
|
||||
!strncasecmp(buf, "UPS No Ack", 10)
|
||||
) {
|
||||
upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -799,9 +871,14 @@ static int fabula_command(const char *cmd, char *buf, size_t buflen)
|
|||
upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf);
|
||||
|
||||
/* The UPS always replies "UPS No Ack" when a supported command is issued (either if it fails or if it succeeds).. */
|
||||
if (!strcasecmp(buf, "UPS No Ack"))
|
||||
/* ..because of that, always return 0 (as if it was a timeout): queries will see it as a failure, instant commands ('megatec' protocol) as a success */
|
||||
if (
|
||||
strcspn(buf, "\r") == 10 &&
|
||||
!strncasecmp(buf, "UPS No Ack", 10)
|
||||
) {
|
||||
/* ..because of that, always return 0 (with buf empty, as if it was a timeout): queries will see it as a failure, instant commands ('megatec' protocol) as a success */
|
||||
memset(buf, 0, buflen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -936,6 +1013,12 @@ static void *cypress_subdriver(USBDevice_t *device)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void *sgs_subdriver(USBDevice_t *device)
|
||||
{
|
||||
subdriver_command = &sgs_command;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *ippon_subdriver(USBDevice_t *device)
|
||||
{
|
||||
subdriver_command = &ippon_command;
|
||||
|
|
@ -988,6 +1071,7 @@ static qx_usb_device_id_t qx_usb_id[] = {
|
|||
{ USB_DEVICE(0x06da, 0x0601), NULL, NULL, &phoenix_subdriver }, /* Online Zinto A */
|
||||
{ USB_DEVICE(0x0f03, 0x0001), NULL, NULL, &cypress_subdriver }, /* Unitek Alpha 1200Sx */
|
||||
{ USB_DEVICE(0x14f0, 0x00c9), NULL, NULL, &phoenix_subdriver }, /* GE EP series */
|
||||
{ USB_DEVICE(0x0483, 0x0035), NULL, NULL, &sgs_subdriver }, /* TS Shara UPSes */
|
||||
{ USB_DEVICE(0x0001, 0x0000), "MEC", "MEC0003", &fabula_subdriver }, /* Fideltronik/MEC LUPUS 500 USB */
|
||||
{ USB_DEVICE(0x0001, 0x0000), "ATCL FOR UPS", "ATCL FOR UPS", &fuji_subdriver }, /* Fuji UPSes */
|
||||
{ USB_DEVICE(0x0001, 0x0000), NULL, NULL, &krauler_subdriver }, /* Krauler UP-M500VA */
|
||||
|
|
@ -1056,7 +1140,7 @@ static USBDeviceMatcher_t device_matcher = {
|
|||
|
||||
/* == Driver functions implementations == */
|
||||
|
||||
/* Process instant command and take action. */
|
||||
/* See header file for details. */
|
||||
int instcmd(const char *cmdname, const char *extradata)
|
||||
{
|
||||
item_t *item;
|
||||
|
|
@ -1136,7 +1220,7 @@ int instcmd(const char *cmdname, const char *extradata)
|
|||
return STAT_INSTCMD_INVALID;
|
||||
}
|
||||
|
||||
/* If extradata is empty, use the default value from the QX to NUT table */
|
||||
/* If extradata is empty, use the default value from the QX to NUT table, if any */
|
||||
extradata = extradata ? extradata : item->dfl;
|
||||
snprintf(value, sizeof(value), "%s", extradata ? extradata : "");
|
||||
|
||||
|
|
@ -1180,7 +1264,7 @@ int instcmd(const char *cmdname, const char *extradata)
|
|||
return STAT_INSTCMD_HANDLED;
|
||||
}
|
||||
|
||||
/* Set r/w variable to a value. */
|
||||
/* See header file for details. */
|
||||
int setvar(const char *varname, const char *val)
|
||||
{
|
||||
item_t *item;
|
||||
|
|
@ -1840,6 +1924,7 @@ void upsdrv_initups(void)
|
|||
{ "krauler", &krauler_command },
|
||||
{ "fabula", &fabula_command },
|
||||
{ "fuji", &fuji_command },
|
||||
{ "sgs", &sgs_command },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
|
@ -2168,7 +2253,7 @@ static int qx_command(const char *cmd, char *buf, size_t buflen)
|
|||
#endif /* TESTING */
|
||||
}
|
||||
|
||||
/* Update ups_status to remember this status item.
|
||||
/* See header file for details.
|
||||
* Interpretation is done in ups_status_set(). */
|
||||
void update_status(const char *value)
|
||||
{
|
||||
|
|
@ -2600,9 +2685,7 @@ static void ups_status_set(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Find element definition in qx2nut array by NUT varname optionally filtered by its qxflags:
|
||||
* - 'flag': flags that have to be set in the item, i.e. if one of the flags is absent in the item it won't be returned
|
||||
* - 'noflag': flags that have to be absent in the item, i.e. if at least one of the flags is set in the item it won't be returned */
|
||||
/* See header file for details. */
|
||||
item_t *find_nut_info(const char *varname, const unsigned long flag, const unsigned long noflag)
|
||||
{
|
||||
item_t *item;
|
||||
|
|
@ -2647,6 +2730,12 @@ static int qx_process_answer(item_t *item, const int len)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Check boundaries */
|
||||
if (item->to && item->to < item->from) {
|
||||
upsdebugx(1, "%s: in %s, starting char's position (%d) follows ending char's one (%d)", __func__, item->info_type, item->from, item->to);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get value */
|
||||
if (strlen(item->answer)) {
|
||||
snprintf(item->value, sizeof(item->value), "%.*s", item->to ? 1 + item->to - item->from : (int)strcspn(item->answer, "\r") - item->from, item->answer + item->from);
|
||||
|
|
@ -2657,23 +2746,39 @@ static int qx_process_answer(item_t *item, const int len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Send the command to the UPS and process the reply.
|
||||
* Return -1 on errors, 0 on success */
|
||||
/* See header file for details. */
|
||||
int qx_process(item_t *item, const char *command)
|
||||
{
|
||||
char buf[SMALLBUF] = "";
|
||||
char buf[sizeof(item->answer) - 1] = "",
|
||||
cmd[command ? (strlen(command) >= SMALLBUF ? strlen(command) + 1 : SMALLBUF) : (item->command && strlen(item->command) >= SMALLBUF ? strlen(item->command) + 1 : SMALLBUF)];
|
||||
int len;
|
||||
|
||||
/* Prepare the command to be used */
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
snprintf(cmd, sizeof(cmd), "%s", command ? command : item->command);
|
||||
|
||||
/* Preprocess the command */
|
||||
if (
|
||||
item->preprocess_command != NULL &&
|
||||
item->preprocess_command(item, cmd, sizeof(cmd)) == -1
|
||||
) {
|
||||
upsdebugx(4, "%s: failed to preprocess command [%s]", __func__, item->info_type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Send the command */
|
||||
int len = qx_command(command ? command : item->command, buf, sizeof(buf));
|
||||
len = qx_command(cmd, buf, sizeof(buf));
|
||||
|
||||
memset(item->answer, 0, sizeof(item->answer));
|
||||
memcpy(item->answer, buf, sizeof(item->answer) <= sizeof(buf) ? sizeof(item->answer) - 1 : sizeof(buf));
|
||||
memcpy(item->answer, buf, sizeof(buf));
|
||||
|
||||
/* Preprocess the answer */
|
||||
if (item->preprocess_answer != NULL) {
|
||||
len = item->preprocess_answer(item, len);
|
||||
if (len == -1) {
|
||||
upsdebugx(4, "%s: failed to preprocess answer [%s]", __func__, item->info_type);
|
||||
/* Clear answer, preventing it from being reused by next items with same command */
|
||||
memset(item->answer, 0, sizeof(item->answer));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -2682,10 +2787,7 @@ int qx_process(item_t *item, const char *command)
|
|||
return qx_process_answer(item, len);
|
||||
}
|
||||
|
||||
/* Process the value we got back (set status bits and set the value of other parameters) and execute:
|
||||
* - item-specific preprocessing, if any, otherwise
|
||||
* - the standard preprocessing (including trimming if QX_FLAG_TRIM is set).
|
||||
* Return -1 on failure, 0 for a status update and 1 in all other cases */
|
||||
/* See header file for details. */
|
||||
int ups_infoval_set(item_t *item)
|
||||
{
|
||||
char value[SMALLBUF] = "";
|
||||
|
|
@ -2719,7 +2821,7 @@ int ups_infoval_set(item_t *item)
|
|||
|
||||
/* Cover most of the cases: either left/right filled with hashes, spaces or a mix of both */
|
||||
if (item->qxflags & QX_FLAG_TRIM)
|
||||
rtrim_m(ltrim_m(value, "# "), "# ");
|
||||
str_trim_m(value, "# ");
|
||||
|
||||
if (strcasecmp(item->dfl, "%s")) {
|
||||
|
||||
|
|
@ -2754,7 +2856,7 @@ int ups_infoval_set(item_t *item)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Return actual status */
|
||||
/* See header file for details. */
|
||||
int qx_status(void)
|
||||
{
|
||||
return ups_status;
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ typedef int bool_t;
|
|||
|
||||
/* Structure for rw vars */
|
||||
typedef struct {
|
||||
char value[SMALLBUF]; /* Value for enum/range, or length for ST_FLAG_STRING */
|
||||
int (*preprocess)(char *value, size_t len); /* Optional function to preprocess range/enum value.
|
||||
* This function will be given value and its size_t and must return either 0 if value is supported or -1 if not supported. */
|
||||
char value[SMALLBUF]; /* Value for enum/range, or length for ST_FLAG_STRING */
|
||||
int (*preprocess)(char *value, const size_t len); /* Optional function to preprocess range/enum value.
|
||||
* This function will be given value and its size_t and must return either 0 if value is supported or -1 if not supported. */
|
||||
} info_rw_t;
|
||||
|
||||
/* Structure containing information about how to get/set data from/to the UPS and convert these to/from NUT standard */
|
||||
|
|
@ -88,11 +88,19 @@ typedef struct item_t {
|
|||
|
||||
unsigned long qxflags; /* Driver's own flags */
|
||||
|
||||
int (*preprocess_answer)(struct item_t *item, const int len); /* Function to preprocess the answer we got from the UPS before we do anything else (e.g. for CRC, decoding, ...)
|
||||
int (*preprocess_command)(struct item_t *item, char *command, const size_t commandlen);
|
||||
/* Last chance to preprocess the command to be sent to the UPS (e.g. to add CRC, ...).
|
||||
* This function is given the currently processed item (item), the command to be sent to the UPS (command) and its size_t (commandlen).
|
||||
* Return -1 in case of errors, else 0.
|
||||
* command must be filled with the actual command to be sent to the UPS. */
|
||||
|
||||
int (*preprocess_answer)(struct item_t *item, const int len);
|
||||
/* Function to preprocess the answer we got from the UPS before we do anything else (e.g. for CRC, decoding, ...).
|
||||
* This function is given the currently processed item (item) with the answer we got from the UPS unmolested and already stored in item->answer and the length of that answer (len).
|
||||
* Return -1 in case of errors, else the length of the newly allocated item->answer (from now on, treated as a null-terminated string). */
|
||||
|
||||
int (*preprocess)(struct item_t *item, char *value, size_t valuelen); /* Function to preprocess the data from/to the UPS
|
||||
int (*preprocess)(struct item_t *item, char *value, const size_t valuelen);
|
||||
/* Function to preprocess the data from/to the UPS
|
||||
* This function is given the currently processed item (item), a char array (value) and its size_t (valuelen).
|
||||
* Return -1 in case of errors, else 0.
|
||||
* If QX_FLAG_SETVAR/QX_FLAG_CMD -> process command before it is sent: value must be filled with the command to be sent to the UPS.
|
||||
|
|
@ -149,7 +157,11 @@ typedef struct {
|
|||
} subdriver_t;
|
||||
|
||||
/* The following functions are exported for the benefit of subdrivers */
|
||||
/* Execute an instant command. Return STAT_INSTCMD_INVALID if the command is invalid, STAT_INSTCMD_FAILED if it failed, STAT_INSTCMD_HANDLED on success. */
|
||||
/* Execute an instant command. In detail:
|
||||
* - look up the given 'cmdname' in the qx2nut data structure (if not found, try to fallback to commonly known commands);
|
||||
* - if 'cmdname' is found, call its preprocess function, passing to it 'extradata', if any, otherwise its dfl value, if any;
|
||||
* - send the command to the device and check the reply.
|
||||
* Return STAT_INSTCMD_INVALID if the command is invalid, STAT_INSTCMD_FAILED if it failed, STAT_INSTCMD_HANDLED on success. */
|
||||
int instcmd(const char *cmdname, const char *extradata);
|
||||
/* Set r/w variable to a value after it has been checked against its info_rw structure. Return STAT_SET_HANDLED on success, otherwise STAT_SET_UNKNOWN. */
|
||||
int setvar(const char *varname, const char *val);
|
||||
|
|
@ -157,9 +169,9 @@ int setvar(const char *varname, const char *val);
|
|||
* - 'flag': flags that have to be set in the item, i.e. if one of the flags is absent in the item it won't be returned
|
||||
* - 'noflag': flags that have to be absent in the item, i.e. if at least one of the flags is set in the item it won't be returned */
|
||||
item_t *find_nut_info(const char *varname, const unsigned long flag, const unsigned long noflag);
|
||||
/* Send 'command' or, if it is NULL, send the command stored in the item to the UPS and process the reply. Return -1 on errors, 0 on success. */
|
||||
/* Send 'command' (a null-terminated byte string) or, if it is NULL, send the command stored in the item to the UPS and process the reply, saving it in item->answer. Return -1 on errors, 0 on success. */
|
||||
int qx_process(item_t *item, const char *command);
|
||||
/* Process the value we got back from the UPS (set status bits and set the value of other parameters), calling its preprocess function, if any, otherwise executing the standard preprocessing (including trimming if QX_FLAG_TRIM is set).
|
||||
/* Process the value we got back from the UPS (set status bits and set the value of other parameters), calling the item-specific preprocess function, if any, otherwise executing the standard preprocessing (including trimming if QX_FLAG_TRIM is set).
|
||||
* Return -1 on failure, 0 for a status update and 1 in all other cases. */
|
||||
int ups_infoval_set(item_t *item);
|
||||
/* Return the currently processed status so that it can be checked with one of the status_bit_t passed to the STATUS() macro. */
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include "nutdrv_qx_bestups.h"
|
||||
|
||||
#define BESTUPS_VERSION "BestUPS 0.04"
|
||||
#define BESTUPS_VERSION "BestUPS 0.06"
|
||||
|
||||
/* Support functions */
|
||||
static int bestups_claim(void);
|
||||
|
|
@ -40,14 +40,14 @@ static void bestups_makevartable(void);
|
|||
static int bestups_preprocess_id_answer(item_t *item, const int len);
|
||||
|
||||
/* Preprocess functions */
|
||||
static int bestups_process_setvar(item_t *item, char *value, size_t valuelen);
|
||||
static int bestups_process_bbb_status_bit(item_t *item, char *value, size_t valuelen);
|
||||
static int bestups_manufacturer(item_t *item, char *value, size_t valuelen);
|
||||
static int bestups_model(item_t *item, char *value, size_t valuelen);
|
||||
static int bestups_batt_runtime(item_t *item, char *value, size_t valuelen);
|
||||
static int bestups_batt_packs(item_t *item, char *value, size_t valuelen);
|
||||
static int bestups_get_pins_shutdown_mode(item_t *item, char *value, size_t valuelen);
|
||||
static int bestups_voltage_settings(item_t *item, char *value, size_t valuelen);
|
||||
static int bestups_process_setvar(item_t *item, char *value, const size_t valuelen);
|
||||
static int bestups_process_bbb_status_bit(item_t *item, char *value, const size_t valuelen);
|
||||
static int bestups_manufacturer(item_t *item, char *value, const size_t valuelen);
|
||||
static int bestups_model(item_t *item, char *value, const size_t valuelen);
|
||||
static int bestups_batt_runtime(item_t *item, char *value, const size_t valuelen);
|
||||
static int bestups_batt_packs(item_t *item, char *value, const size_t valuelen);
|
||||
static int bestups_get_pins_shutdown_mode(item_t *item, char *value, const size_t valuelen);
|
||||
static int bestups_voltage_settings(item_t *item, char *value, const size_t valuelen);
|
||||
|
||||
/* ups.conf settings */
|
||||
static int pins_shutdown_mode;
|
||||
|
|
@ -97,22 +97,22 @@ static item_t bestups_qx2nut[] = {
|
|||
* 0 1 2 3 4
|
||||
*/
|
||||
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL },
|
||||
/* Status bits */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
/* { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, blazer_process_status_bits }, *//* Beeper status: not supported; always 0 */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, bestups_process_bbb_status_bit }, /* Bypass/Boost or Buck Active - keep this one at the end as it needs the processed data from the previous items */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
/* { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, *//* Beeper status: not supported; always 0 */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, bestups_process_bbb_status_bit }, /* Bypass/Boost or Buck Active - keep this one at the end as it needs the processed data from the previous items */
|
||||
|
||||
/* Query UPS for ratings and model infos
|
||||
* > [ID\r]
|
||||
|
|
@ -124,13 +124,13 @@ static item_t bestups_qx2nut[] = {
|
|||
* 0 1 2
|
||||
*/
|
||||
|
||||
{ "device.mfr", 0, NULL, "ID\r", "", 28, 0, "", 0, 2, "%s", QX_FLAG_STATIC, bestups_preprocess_id_answer, bestups_manufacturer },
|
||||
{ "device.model", 0, NULL, "ID\r", "", 28, 0, "", 0, 2, "%s", QX_FLAG_STATIC, bestups_preprocess_id_answer, bestups_model },
|
||||
{ "ups.power.nominal", 0, NULL, "ID\r", "", 28, 0, "", 4, 7, "%.0f", QX_FLAG_STATIC, bestups_preprocess_id_answer, NULL },
|
||||
{ "input.voltage.nominal", 0, NULL, "ID\r", "", 28, 0, "", 9, 11, "%.0f", QX_FLAG_STATIC, bestups_preprocess_id_answer, NULL },
|
||||
{ "output.voltage.nominal", 0, NULL, "ID\r", "", 28, 0, "", 13, 15, "%.0f", QX_FLAG_STATIC, bestups_preprocess_id_answer, NULL },
|
||||
{ "battery.voltage.low", 0, NULL, "ID\r", "", 28, 0, "", 17, 20, "%.1f", QX_FLAG_SEMI_STATIC, bestups_preprocess_id_answer, NULL },
|
||||
{ "battery.voltage.high", 0, NULL, "ID\r", "", 28, 0, "", 22, 26, "%.1f", QX_FLAG_SEMI_STATIC, bestups_preprocess_id_answer, NULL },
|
||||
{ "device.mfr", 0, NULL, "ID\r", "", 28, 0, "", 0, 2, "%s", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, bestups_manufacturer },
|
||||
{ "device.model", 0, NULL, "ID\r", "", 28, 0, "", 0, 2, "%s", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, bestups_model },
|
||||
{ "ups.power.nominal", 0, NULL, "ID\r", "", 28, 0, "", 4, 7, "%.0f", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, NULL },
|
||||
{ "input.voltage.nominal", 0, NULL, "ID\r", "", 28, 0, "", 9, 11, "%.0f", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, NULL },
|
||||
{ "output.voltage.nominal", 0, NULL, "ID\r", "", 28, 0, "", 13, 15, "%.0f", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, NULL },
|
||||
{ "battery.voltage.low", 0, NULL, "ID\r", "", 28, 0, "", 17, 20, "%.1f", QX_FLAG_SEMI_STATIC, NULL, bestups_preprocess_id_answer, NULL },
|
||||
{ "battery.voltage.high", 0, NULL, "ID\r", "", 28, 0, "", 22, 26, "%.1f", QX_FLAG_SEMI_STATIC, NULL, bestups_preprocess_id_answer, NULL },
|
||||
|
||||
/* Query UPS for battery runtime (not available on the Patriot Pro/Sola 320 model series)
|
||||
* > [RT\r]
|
||||
|
|
@ -139,7 +139,7 @@ static item_t bestups_qx2nut[] = {
|
|||
* 0
|
||||
*/
|
||||
|
||||
{ "battery.runtime", 0, NULL, "RT\r", "", 4, 0, "", 0, 2, "%.0f", QX_FLAG_SKIP, NULL, bestups_batt_runtime },
|
||||
{ "battery.runtime", 0, NULL, "RT\r", "", 4, 0, "", 0, 2, "%.0f", QX_FLAG_SKIP, NULL, NULL, bestups_batt_runtime },
|
||||
|
||||
/* Query UPS for number of battery packs (available only on the Axxium/Sola 620 model series)
|
||||
* > [BP?\r]
|
||||
|
|
@ -148,14 +148,14 @@ static item_t bestups_qx2nut[] = {
|
|||
* 0
|
||||
*/
|
||||
|
||||
{ "battery.packs", ST_FLAG_RW, bestups_r_batt_packs, "BP?\r", "", 3, 0, "", 0, 1, "%d", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, bestups_batt_packs },
|
||||
{ "battery.packs", ST_FLAG_RW, bestups_r_batt_packs, "BP?\r", "", 3, 0, "", 0, 1, "%d", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, bestups_batt_packs },
|
||||
|
||||
/* Set number of battery packs to n (integer, 0-5) (available only on the Axxium/Sola 620 model series)
|
||||
* > [BPn\r]
|
||||
* < []
|
||||
*/
|
||||
|
||||
{ "battery.packs", 0, bestups_r_batt_packs, "BP%.0f\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, bestups_process_setvar },
|
||||
{ "battery.packs", 0, bestups_r_batt_packs, "BP%.0f\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, bestups_process_setvar },
|
||||
|
||||
/* Query UPS for shutdown mode functionality of Pin 1 and Pin 7 on the UPS DB9 communication port (Per Best Power’s EPS-0059)
|
||||
* > [SS?\r]
|
||||
|
|
@ -164,14 +164,14 @@ static item_t bestups_qx2nut[] = {
|
|||
* 0
|
||||
*/
|
||||
|
||||
{ "pins_shutdown_mode", ST_FLAG_RW, bestups_r_pins_shutdown_mode, "SS?\r", "", 2, 0, "", 0, 0, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT, NULL, bestups_get_pins_shutdown_mode },
|
||||
{ "pins_shutdown_mode", ST_FLAG_RW, bestups_r_pins_shutdown_mode, "SS?\r", "", 2, 0, "", 0, 0, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT, NULL, NULL, bestups_get_pins_shutdown_mode },
|
||||
|
||||
/* Set shutdown mode functionality of Pin 1 and Pin 7 on the UPS DB9 communication port (Per Best Power’s EPS-0059) to n (integer, 0-6)
|
||||
* > [SSn\r]
|
||||
* < []
|
||||
*/
|
||||
|
||||
{ "pins_shutdown_mode", 0, bestups_r_pins_shutdown_mode, "SS%.0f\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, bestups_process_setvar },
|
||||
{ "pins_shutdown_mode", 0, bestups_r_pins_shutdown_mode, "SS%.0f\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, bestups_process_setvar },
|
||||
|
||||
/* Query UPS for voltage settings
|
||||
* > [M\r]
|
||||
|
|
@ -180,32 +180,32 @@ static item_t bestups_qx2nut[] = {
|
|||
* 0
|
||||
*/
|
||||
|
||||
{ "input.transfer.low", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.boost.low", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.boost.high", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, bestups_voltage_settings },
|
||||
{ "input.voltage.nominal", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, bestups_voltage_settings },
|
||||
{ "output.voltage.nominal", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.trim.low", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.trim.high", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.high", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.low", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.boost.low", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.boost.high", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings },
|
||||
{ "input.voltage.nominal", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings },
|
||||
{ "output.voltage.nominal", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.trim.low", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.trim.high", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings },
|
||||
{ "input.transfer.high", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings },
|
||||
|
||||
/* Instant commands */
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
|
||||
/* Server-side settable vars */
|
||||
{ "ups.delay.start", ST_FLAG_RW, bestups_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, bestups_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.start", ST_FLAG_RW, bestups_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, bestups_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
|
||||
/* End of structure. */
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL }
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -354,7 +354,7 @@ static int bestups_preprocess_id_answer(item_t *item, const int len)
|
|||
/* == Preprocess functions == */
|
||||
|
||||
/* *SETVAR(/NONUT)* Preprocess setvars */
|
||||
static int bestups_process_setvar(item_t *item, char *value, size_t valuelen)
|
||||
static int bestups_process_setvar(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
if (!strlen(value)) {
|
||||
upsdebugx(2, "%s: value not given for %s", __func__, item->info_type);
|
||||
|
|
@ -378,7 +378,7 @@ static int bestups_process_setvar(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* Bypass/Boost or Buck status */
|
||||
static int bestups_process_bbb_status_bit(item_t *item, char *value, size_t valuelen)
|
||||
static int bestups_process_bbb_status_bit(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
/* Bypass/Boost/Buck bit is not reliable when a battery test, shutdown or on battery condition occurs: always ignore it in these cases */
|
||||
if (!(qx_status() & STATUS(OL)) || (qx_status() & (STATUS(CAL) | STATUS(FSD)))) {
|
||||
|
|
@ -405,7 +405,7 @@ static int bestups_process_bbb_status_bit(item_t *item, char *value, size_t valu
|
|||
}
|
||||
|
||||
/* Identify UPS manufacturer */
|
||||
static int bestups_manufacturer(item_t *item, char *value, size_t valuelen)
|
||||
static int bestups_manufacturer(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
/* Best Power devices */
|
||||
if (
|
||||
|
|
@ -435,7 +435,7 @@ static int bestups_manufacturer(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* Identify UPS model and unskip qx2nut table's items accordingly */
|
||||
static int bestups_model(item_t *item, char *value, size_t valuelen)
|
||||
static int bestups_model(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
item_t *unskip;
|
||||
|
||||
|
|
@ -514,7 +514,7 @@ static int bestups_model(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* Battery runtime */
|
||||
static int bestups_batt_runtime(item_t *item, char *value, size_t valuelen)
|
||||
static int bestups_batt_runtime(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
double runtime;
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ static int bestups_batt_runtime(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* Battery packs */
|
||||
static int bestups_batt_packs(item_t *item, char *value, size_t valuelen)
|
||||
static int bestups_batt_packs(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
item_t *unskip;
|
||||
|
||||
|
|
@ -556,7 +556,7 @@ static int bestups_batt_packs(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* *NONUT* Get shutdown mode functionality of Pin 1 and Pin 7 on the UPS DB9 communication port (Per Best Power’s EPS-0059) as set in the UPS */
|
||||
static int bestups_get_pins_shutdown_mode(item_t *item, char *value, size_t valuelen)
|
||||
static int bestups_get_pins_shutdown_mode(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
item_t *unskip;
|
||||
|
||||
|
|
@ -586,7 +586,7 @@ static int bestups_get_pins_shutdown_mode(item_t *item, char *value, size_t valu
|
|||
}
|
||||
|
||||
/* Voltage settings */
|
||||
static int bestups_voltage_settings(item_t *item, char *value, size_t valuelen)
|
||||
static int bestups_voltage_settings(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
int index, val;
|
||||
const char *nominal_voltage;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ void blazer_initups_light(item_t *qx2nut)
|
|||
/* == Preprocess functions == */
|
||||
|
||||
/* Preprocess setvars */
|
||||
int blazer_process_setvar(item_t *item, char *value, size_t valuelen)
|
||||
int blazer_process_setvar(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
if (!strlen(value)) {
|
||||
upsdebugx(2, "%s: value not given for %s", __func__, item->info_type);
|
||||
|
|
@ -229,7 +229,7 @@ int blazer_process_setvar(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* Preprocess instant commands */
|
||||
int blazer_process_command(item_t *item, char *value, size_t valuelen)
|
||||
int blazer_process_command(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
if (!strcasecmp(item->info_type, "shutdown.return")) {
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ int blazer_process_command(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* Process status bits */
|
||||
int blazer_process_status_bits(item_t *item, char *value, size_t valuelen)
|
||||
int blazer_process_status_bits(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
char *val = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ int blazer_claim(void);
|
|||
int blazer_claim_light(void);
|
||||
|
||||
/* Preprocess functions */
|
||||
int blazer_process_command(item_t *item, char *value, size_t valuelen);
|
||||
int blazer_process_setvar(item_t *item, char *value, size_t valuelen);
|
||||
int blazer_process_status_bits(item_t *item, char *value, size_t valuelen);
|
||||
int blazer_process_command(item_t *item, char *value, const size_t valuelen);
|
||||
int blazer_process_setvar(item_t *item, char *value, const size_t valuelen);
|
||||
int blazer_process_status_bits(item_t *item, char *value, const size_t valuelen);
|
||||
|
||||
/* Ranges */
|
||||
extern info_rw_t blazer_r_ondelay[];
|
||||
|
|
|
|||
|
|
@ -25,15 +25,15 @@
|
|||
|
||||
#include "nutdrv_qx_mecer.h"
|
||||
|
||||
#define MECER_VERSION "Mecer 0.05"
|
||||
#define MECER_VERSION "Mecer 0.07"
|
||||
|
||||
/* Support functions */
|
||||
static int mecer_claim(void);
|
||||
static void mecer_initups(void);
|
||||
|
||||
/* Preprocess functions */
|
||||
static int voltronic_p98_protocol(item_t *item, char *value, size_t valuelen);
|
||||
static int mecer_process_test_battery(item_t *item, char *value, size_t valuelen);
|
||||
static int voltronic_p98_protocol(item_t *item, char *value, const size_t valuelen);
|
||||
static int mecer_process_test_battery(item_t *item, char *value, const size_t valuelen);
|
||||
|
||||
|
||||
/* == qx2nut lookup table == */
|
||||
|
|
@ -46,7 +46,7 @@ static item_t mecer_qx2nut[] = {
|
|||
* 0
|
||||
*/
|
||||
|
||||
{ "ups.firmware.aux", 0, NULL, "QPI\r", "", 6, '(', "", 1, 4, "%s", QX_FLAG_STATIC, NULL, voltronic_p98_protocol },
|
||||
{ "ups.firmware.aux", 0, NULL, "QPI\r", "", 6, '(', "", 1, 4, "%s", QX_FLAG_STATIC, NULL, NULL, voltronic_p98_protocol },
|
||||
|
||||
/*
|
||||
* > [Q1\r]
|
||||
|
|
@ -55,22 +55,22 @@ static item_t mecer_qx2nut[] = {
|
|||
* 0 1 2 3 4
|
||||
*/
|
||||
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL },
|
||||
/* Status bits */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
|
||||
/*
|
||||
* > [F\r]
|
||||
|
|
@ -79,10 +79,10 @@ static item_t mecer_qx2nut[] = {
|
|||
* 0 1 2
|
||||
*/
|
||||
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
|
||||
/*
|
||||
* > [I\r]
|
||||
|
|
@ -91,30 +91,30 @@ static item_t mecer_qx2nut[] = {
|
|||
* 0 1 2 3
|
||||
*/
|
||||
|
||||
{ "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
|
||||
/* Instant commands
|
||||
* The UPS will reply '(ACK\r' in case of success, '(NAK\r' if the command is rejected or invalid */
|
||||
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, mecer_process_test_battery },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, mecer_process_test_battery },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
|
||||
/* Server-side settable vars */
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
|
||||
/* End of structure. */
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL }
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ static void mecer_initups(void)
|
|||
/* == Preprocess functions == */
|
||||
|
||||
/* Protocol used by the UPS */
|
||||
static int voltronic_p98_protocol(item_t *item, char *value, size_t valuelen)
|
||||
static int voltronic_p98_protocol(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
if (strcasecmp(item->value, "PI98")) {
|
||||
upslogx(LOG_ERR, "Protocol [%s] is not supported by this driver", item->value);
|
||||
|
|
@ -221,7 +221,7 @@ static int voltronic_p98_protocol(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* *CMD* Preprocess 'test.battery.start' instant command */
|
||||
static int mecer_process_test_battery(item_t *item, char *value, size_t valuelen)
|
||||
static int mecer_process_test_battery(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
const char *protocol = dstate_getinfo("ups.firmware.aux");
|
||||
char buf[SMALLBUF] = "";
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "nutdrv_qx_megatec-old.h"
|
||||
|
||||
#define MEGATEC_OLD_VERSION "Megatec/old 0.05"
|
||||
#define MEGATEC_OLD_VERSION "Megatec/old 0.07"
|
||||
|
||||
/* qx2nut lookup table */
|
||||
static item_t megatec_old_qx2nut[] = {
|
||||
|
|
@ -37,22 +37,22 @@ static item_t megatec_old_qx2nut[] = {
|
|||
* 0 1 2 3 4
|
||||
*/
|
||||
|
||||
{ "input.voltage", 0, NULL, "D\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "D\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "D\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "D\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "D\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "D\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "D\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage", 0, NULL, "D\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "D\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "D\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "D\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "D\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "D\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "D\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL },
|
||||
/* Status bits */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "D\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "D\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "D\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "D\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "D\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "D\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "D\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
|
||||
/*
|
||||
* > [F\r]
|
||||
|
|
@ -61,10 +61,10 @@ static item_t megatec_old_qx2nut[] = {
|
|||
* 0 1 2
|
||||
*/
|
||||
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
|
||||
/*
|
||||
* > [I\r]
|
||||
|
|
@ -73,28 +73,28 @@ static item_t megatec_old_qx2nut[] = {
|
|||
* 0 1 2 3
|
||||
*/
|
||||
|
||||
{ "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
|
||||
/* Instant commands */
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
|
||||
/* Server-side settable vars */
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
|
||||
/* End of structure. */
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL }
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* Testing table */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "nutdrv_qx_megatec.h"
|
||||
|
||||
#define MEGATEC_VERSION "Megatec 0.04"
|
||||
#define MEGATEC_VERSION "Megatec 0.06"
|
||||
|
||||
/* qx2nut lookup table */
|
||||
static item_t megatec_qx2nut[] = {
|
||||
|
|
@ -37,22 +37,22 @@ static item_t megatec_qx2nut[] = {
|
|||
* 0 1 2 3 4
|
||||
*/
|
||||
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL },
|
||||
/* Status bits */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
|
||||
/*
|
||||
* > [F\r]
|
||||
|
|
@ -61,10 +61,10 @@ static item_t megatec_qx2nut[] = {
|
|||
* 0 1 2
|
||||
*/
|
||||
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
|
||||
/*
|
||||
* > [I\r]
|
||||
|
|
@ -73,28 +73,28 @@ static item_t megatec_qx2nut[] = {
|
|||
* 0 1 2 3
|
||||
*/
|
||||
|
||||
{ "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
|
||||
/* Instant commands */
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
|
||||
/* Server-side settable vars */
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
|
||||
/* End of structure. */
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL }
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* Testing table */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "nutdrv_qx_mustek.h"
|
||||
|
||||
#define MUSTEK_VERSION "Mustek 0.05"
|
||||
#define MUSTEK_VERSION "Mustek 0.07"
|
||||
|
||||
/* qx2nut lookup table */
|
||||
static item_t mustek_qx2nut[] = {
|
||||
|
|
@ -37,22 +37,22 @@ static item_t mustek_qx2nut[] = {
|
|||
* 0 1 2 3 4
|
||||
*/
|
||||
|
||||
{ "input.voltage", 0, NULL, "QS\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "QS\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "QS\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "QS\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "QS\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "QS\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "QS\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage", 0, NULL, "QS\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "QS\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "QS\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "QS\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "QS\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "QS\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "QS\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL },
|
||||
/* Status bits */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "QS\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "QS\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "QS\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "QS\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "QS\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "QS\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
|
||||
/*
|
||||
* > [F\r]
|
||||
|
|
@ -61,10 +61,10 @@ static item_t mustek_qx2nut[] = {
|
|||
* 0 1 2
|
||||
*/
|
||||
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
|
||||
/*
|
||||
* > [I\r]
|
||||
|
|
@ -73,28 +73,28 @@ static item_t mustek_qx2nut[] = {
|
|||
* 0 1 2 3
|
||||
*/
|
||||
|
||||
{ "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
|
||||
/* Instant commands */
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
|
||||
/* Server-side settable vars */
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
|
||||
/* End of structure. */
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL }
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* Testing table */
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include "nutdrv_qx_q1.h"
|
||||
|
||||
#define Q1_VERSION "Q1 0.05"
|
||||
#define Q1_VERSION "Q1 0.07"
|
||||
|
||||
/* qx2nut lookup table */
|
||||
static item_t q1_qx2nut[] = {
|
||||
|
|
@ -47,41 +47,41 @@ static item_t q1_qx2nut[] = {
|
|||
* 0 1 2 3 4
|
||||
*/
|
||||
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL },
|
||||
/* Status bits */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
|
||||
/* Instant commands */
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
|
||||
/* Server-side settable vars */
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
|
||||
/* End of structure. */
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL }
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* Testing table */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "nutdrv_qx_voltronic-qs-hex.h"
|
||||
|
||||
#define VOLTRONIC_QS_HEX_VERSION "Voltronic-QS-Hex 0.03"
|
||||
#define VOLTRONIC_QS_HEX_VERSION "Voltronic-QS-Hex 0.10"
|
||||
|
||||
/* Support functions */
|
||||
static int voltronic_qs_hex_claim(void);
|
||||
|
|
@ -33,15 +33,15 @@ static void voltronic_qs_hex_initups(void);
|
|||
|
||||
/* Answer preprocess functions */
|
||||
static int voltronic_qs_hex_preprocess_qs_answer(item_t *item, const int len);
|
||||
static int voltronic_qs_hex_status_char_to_binary(const unsigned char value);
|
||||
static int voltronic_qs_hex_char_to_binary(const unsigned char value);
|
||||
|
||||
/* Preprocess functions */
|
||||
static int voltronic_qs_hex_protocol(item_t *item, char *value, size_t valuelen);
|
||||
static int voltronic_qs_hex_input_output_voltage(item_t *item, char *value, size_t valuelen);
|
||||
static int voltronic_qs_hex_input_output_voltage(item_t *item, char *value, size_t valuelen);
|
||||
static int voltronic_qs_hex_load(item_t *item, char *value, size_t valuelen);
|
||||
static int voltronic_qs_hex_frequency(item_t *item, char *value, size_t valuelen);
|
||||
static int voltronic_qs_hex_battery_voltage(item_t *item, char *value, size_t valuelen);
|
||||
static int voltronic_qs_hex_protocol(item_t *item, char *value, const size_t valuelen);
|
||||
static int voltronic_qs_hex_input_output_voltage(item_t *item, char *value, const size_t valuelen);
|
||||
static int voltronic_qs_hex_load(item_t *item, char *value, const size_t valuelen);
|
||||
static int voltronic_qs_hex_frequency(item_t *item, char *value, const size_t valuelen);
|
||||
static int voltronic_qs_hex_battery_voltage(item_t *item, char *value, const size_t valuelen);
|
||||
static int voltronic_qs_hex_process_ratings_bits(item_t *item, char *value, const size_t valuelen);
|
||||
|
||||
|
||||
/* == Ranges == */
|
||||
|
|
@ -71,45 +71,52 @@ static item_t voltronic_qs_hex_qx2nut[] = {
|
|||
* 0
|
||||
*/
|
||||
|
||||
{ "ups.firmware.aux", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "PMV-%s", QX_FLAG_STATIC, NULL, voltronic_qs_hex_protocol },
|
||||
{ "ups.firmware.aux", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "PM-%s", QX_FLAG_STATIC, NULL, NULL, voltronic_qs_hex_protocol },
|
||||
|
||||
/* Query UPS for status
|
||||
* > [QS\r]
|
||||
* < [#6C01 35 6C01 35 03 519A 1312D0 E6 1E 00001001\r] (after being preprocessed)
|
||||
* 01234567890123456789012345678901234567890123456
|
||||
* 0 1 2 3 4
|
||||
* < [#6C01 35 6C01 35 03 519A 1312D0 E6 1E 00001001\r] ('P' protocol, after being preprocessed)
|
||||
* < [#6901 6C 6802 6C 00 5FD7 12C000 E4 1E 00001001 00000010\r] ('T' protocol, after being preprocessed)
|
||||
* 01234567890123456789012345678901234567890123456789012345
|
||||
* 0 1 2 3 4 5
|
||||
*/
|
||||
|
||||
{ "input.voltage", 0, NULL, "QS\r", "", 47, '#', "", 1, 7, "%.1f", 0, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_input_output_voltage },
|
||||
{ "output.voltage", 0, NULL, "QS\r", "", 47, '#', "", 9, 15, "%.1f", 0, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_input_output_voltage },
|
||||
{ "ups.load", 0, NULL, "QS\r", "", 47, '#', "", 17, 18, "%d", 0, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_load },
|
||||
{ "output.frequency", 0, NULL, "QS\r", "", 47, '#', "", 20, 30, "%.1f", 0, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_frequency },
|
||||
{ "battery.voltage", 0, NULL, "QS\r", "", 47, '#', "", 32, 36, "%.2f", 0, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_battery_voltage },
|
||||
{ "input.voltage", 0, NULL, "QS\r", "", 47, '#', "", 1, 7, "%.1f", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_input_output_voltage },
|
||||
{ "output.voltage", 0, NULL, "QS\r", "", 47, '#', "", 9, 15, "%.1f", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_input_output_voltage },
|
||||
{ "ups.load", 0, NULL, "QS\r", "", 47, '#', "", 17, 18, "%d", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_load },
|
||||
{ "output.frequency", 0, NULL, "QS\r", "", 47, '#', "", 20, 30, "%.1f", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_frequency },
|
||||
{ "battery.voltage", 0, NULL, "QS\r", "", 47, '#', "", 32, 36, "%.2f", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_battery_voltage },
|
||||
/* Status bits */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "QS\r", "", 47, '#', "", 41, 41, NULL, 0, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "QS\r", "", 47, '#', "", 42, 42, "%s", QX_FLAG_STATIC, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "QS\r", "", 47, '#', "", 45, 45, "%s", 0, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Beeper status */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "QS\r", "", 47, '#', "", 41, 41, NULL, 0, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "QS\r", "", 47, '#', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "QS\r", "", 47, '#', "", 45, 45, "%s", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Beeper status */
|
||||
/* Ratings bits */
|
||||
{ "output.frequency.nominal", 0, NULL, "QS\r", "", 56, '#', "", 47, 47, "%.1f", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits },
|
||||
{ "battery.voltage.nominal", 0, NULL, "QS\r", "", 56, '#', "", 48, 49, "%.1f", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits },
|
||||
/* { "reserved.1", 0, NULL, "QS\r", "", 56, '#', "", 50, 50, "%s", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits }, *//* Reserved */
|
||||
/* { "reserved.2", 0, NULL, "QS\r", "", 56, '#', "", 51, 51, "%s", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits }, *//* Reserved */
|
||||
{ "output.voltage.nominal", 0, NULL, "QS\r", "", 56, '#', "", 52, 54, "%.1f", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits },
|
||||
|
||||
/* Instant commands */
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL },
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL },
|
||||
|
||||
/* Server-side settable vars */
|
||||
{ "ups.delay.start", ST_FLAG_RW, voltronic_qs_hex_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, voltronic_qs_hex_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.start", ST_FLAG_RW, voltronic_qs_hex_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, voltronic_qs_hex_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
|
||||
/* End of structure. */
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL }
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -119,14 +126,11 @@ static testing_t voltronic_qs_hex_testing[] = {
|
|||
{ "QS\r", "#\x6C\x01 \x35 \x6C\x01 \x35 \x03 \x51\x9A \x28\x02\x12\xD0 \xE6 \x1E \x09\r", 27 },
|
||||
{ "M\r", "P\r", -1 },
|
||||
{ "Q\r", "", -1 },
|
||||
{ "S03\r", "", -1 },
|
||||
{ "S00R0000\r", "", -1 },
|
||||
{ "C\r", "", -1 },
|
||||
{ "S02R0005\r", "", -1 },
|
||||
{ "S.5R0000\r", "N\r", -1 },
|
||||
{ "T04\r", "", -1 },
|
||||
{ "TL\r", "", -1 },
|
||||
{ "T\r", "", -1 },
|
||||
{ "CT\r", "", -1 },
|
||||
{ NULL }
|
||||
};
|
||||
#endif /* TESTING */
|
||||
|
|
@ -235,10 +239,10 @@ static int voltronic_qs_hex_preprocess_qs_answer(item_t *item, const int len)
|
|||
snprintfcat(refined, sizeof(refined), "%02x", 0x20);
|
||||
break;
|
||||
default:
|
||||
if (token != 10)
|
||||
if (token != 10 && token != 11)
|
||||
snprintfcat(refined, sizeof(refined), "%02x", ((unsigned char *)item->answer)[i]);
|
||||
else
|
||||
snprintfcat(refined, sizeof(refined), "%08d", voltronic_qs_hex_status_char_to_binary(((unsigned char *)item->answer)[i]));
|
||||
snprintfcat(refined, sizeof(refined), "%08d", voltronic_qs_hex_char_to_binary(((unsigned char *)item->answer)[i]));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -251,14 +255,19 @@ static int voltronic_qs_hex_preprocess_qs_answer(item_t *item, const int len)
|
|||
if (item->answer[i] == 0x0D)
|
||||
break;
|
||||
|
||||
if (token != 10)
|
||||
if (token != 10 && token != 11)
|
||||
snprintfcat(refined, sizeof(refined), "%02x", ((unsigned char *)item->answer)[i]);
|
||||
else
|
||||
snprintfcat(refined, sizeof(refined), "%08d", voltronic_qs_hex_status_char_to_binary(((unsigned char *)item->answer)[i]));
|
||||
snprintfcat(refined, sizeof(refined), "%08d", voltronic_qs_hex_char_to_binary(((unsigned char *)item->answer)[i]));
|
||||
|
||||
}
|
||||
|
||||
if (token != 10 || strlen(refined) != 46) {
|
||||
if (
|
||||
token < 10 ||
|
||||
token > 11 ||
|
||||
(token == 10 && strlen(refined) != 46) ||
|
||||
(token == 11 && strlen(refined) != 55)
|
||||
) {
|
||||
upsdebugx(2, "noncompliant reply: %s", refined);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -269,8 +278,8 @@ static int voltronic_qs_hex_preprocess_qs_answer(item_t *item, const int len)
|
|||
return snprintf(item->answer, sizeof(item->answer), "%s\r", refined);
|
||||
}
|
||||
|
||||
/* Transform the QS 'status' char into its binary form (as an int) */
|
||||
static int voltronic_qs_hex_status_char_to_binary(const unsigned char value)
|
||||
/* Transform a char into its binary form (as an int) */
|
||||
static int voltronic_qs_hex_char_to_binary(const unsigned char value)
|
||||
{
|
||||
unsigned char remainder = value;
|
||||
int ret = 0,
|
||||
|
|
@ -293,39 +302,51 @@ static int voltronic_qs_hex_status_char_to_binary(const unsigned char value)
|
|||
/* == Preprocess functions == */
|
||||
|
||||
/* Protocol used by the UPS */
|
||||
static int voltronic_qs_hex_protocol(item_t *item, char *value, size_t valuelen)
|
||||
static int voltronic_qs_hex_protocol(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
item_t *unskip;
|
||||
int i;
|
||||
const struct {
|
||||
const char *info_type; /* info_type of the item to be unskipped */
|
||||
const unsigned long flags; /* qxflags that have to be set in the item */
|
||||
const unsigned long noflags; /* qxflags that have to be absent in the item */
|
||||
} items_to_be_unskipped[] = {
|
||||
{ "test.battery.start.quick", QX_FLAG_CMD, 0 },
|
||||
{ "output.frequency.nominal", 0, 0 },
|
||||
{ "battery.voltage.nominal", 0, 0 },
|
||||
{ "output.voltage.nominal", 0, 0 },
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
if (strcasecmp(item->value, "P") && strcasecmp(item->value, "T") && strcasecmp(item->value, "V")) {
|
||||
if (strcasecmp(item->value, "P") && strcasecmp(item->value, "T")) {
|
||||
upsdebugx(2, "%s: invalid protocol [%s]", __func__, item->value);
|
||||
return -1;
|
||||
}
|
||||
|
||||
snprintf(value, valuelen, item->dfl, item->value);
|
||||
|
||||
/* 'P' UPSes don't support 'T\r' command (battery test) -> leave test.battery.start.quick skipped */
|
||||
/* Unskip items supported only by devices that implement 'T' protocol */
|
||||
|
||||
if (!strcasecmp(item->value, "P"))
|
||||
return 0;
|
||||
|
||||
/* Unskip test.battery.start.quick */
|
||||
unskip = find_nut_info("test.battery.start.quick", QX_FLAG_CMD, 0);
|
||||
|
||||
/* Don't know what happened */
|
||||
if (!unskip)
|
||||
return -1;
|
||||
|
||||
unskip->qxflags &= ~QX_FLAG_SKIP;
|
||||
for (i = 0; items_to_be_unskipped[i].info_type; i++) {
|
||||
unskip = find_nut_info(items_to_be_unskipped[i].info_type, items_to_be_unskipped[i].flags, items_to_be_unskipped[i].noflags);
|
||||
/* Don't know what happened */
|
||||
if (!unskip)
|
||||
return -1;
|
||||
unskip->qxflags &= ~QX_FLAG_SKIP;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Input/Output voltage */
|
||||
int voltronic_qs_hex_input_output_voltage(item_t *item, char *value, size_t valuelen)
|
||||
static int voltronic_qs_hex_input_output_voltage(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
int val;
|
||||
double ret;
|
||||
char *str_end, buf[SMALLBUF] = "";
|
||||
char *str_end;
|
||||
|
||||
if (strspn(item->value, "0123456789ABCDEFabcdef ") != strlen(item->value)) {
|
||||
upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value);
|
||||
|
|
@ -333,11 +354,7 @@ int voltronic_qs_hex_input_output_voltage(item_t *item, char *value, size_t valu
|
|||
}
|
||||
|
||||
val = strtol(item->value, &str_end, 16) * strtol(str_end, NULL, 16) / 51;
|
||||
snprintf(buf, sizeof(buf), "%06x", val);
|
||||
|
||||
ret = strtol(buf + 4, NULL, 16) / 256.0;
|
||||
buf[4] = '\0';
|
||||
ret += strtol(buf, NULL, 16);
|
||||
ret = val / 256.0;
|
||||
|
||||
snprintf(value, valuelen, item->dfl, ret);
|
||||
|
||||
|
|
@ -345,7 +362,7 @@ int voltronic_qs_hex_input_output_voltage(item_t *item, char *value, size_t valu
|
|||
}
|
||||
|
||||
/* Device load */
|
||||
int voltronic_qs_hex_load(item_t *item, char *value, size_t valuelen)
|
||||
static int voltronic_qs_hex_load(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
if (strspn(item->value, "0123456789ABCDEFabcdef") != strlen(item->value)) {
|
||||
upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value);
|
||||
|
|
@ -358,7 +375,7 @@ int voltronic_qs_hex_load(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* Output frequency */
|
||||
int voltronic_qs_hex_frequency(item_t *item, char *value, size_t valuelen)
|
||||
static int voltronic_qs_hex_frequency(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
double val1, val2, ret;
|
||||
char *str_end;
|
||||
|
|
@ -380,7 +397,7 @@ int voltronic_qs_hex_frequency(item_t *item, char *value, size_t valuelen)
|
|||
}
|
||||
|
||||
/* Battery voltage */
|
||||
int voltronic_qs_hex_battery_voltage(item_t *item, char *value, size_t valuelen)
|
||||
static int voltronic_qs_hex_battery_voltage(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
int val1, val2;
|
||||
char *str_end;
|
||||
|
|
@ -398,6 +415,74 @@ int voltronic_qs_hex_battery_voltage(item_t *item, char *value, size_t valuelen)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Ratings bits */
|
||||
static int voltronic_qs_hex_process_ratings_bits(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
int val;
|
||||
double ret;
|
||||
|
||||
if (strspn(item->value, "01") != strlen(item->value)) {
|
||||
upsdebugx(3, "%s: unexpected value %s@%d->%s", __func__, item->info_type, item->from, item->value);
|
||||
return -1;
|
||||
}
|
||||
|
||||
val = strtol(item->value, NULL, 10);
|
||||
|
||||
switch (item->from)
|
||||
{
|
||||
case 47: /* Nominal output frequency */
|
||||
if (val == 0) /* 0 -> 50 Hz */
|
||||
ret = 50;
|
||||
else /* 1 -> 60 Hz */
|
||||
ret = 60;
|
||||
break;
|
||||
case 48: /* Nominal battery voltage */
|
||||
if (val == 0) /* 0 -> 12 V */
|
||||
ret = 12;
|
||||
else if (val == 1) /* 1 -> 24 V */
|
||||
ret = 24;
|
||||
else if (val == 10) /* 10 -> 36 V */
|
||||
ret = 36;
|
||||
else /* 11 -> 48 V */
|
||||
ret = 48;
|
||||
break;
|
||||
/* case 50: *//* Reserved */
|
||||
/* break;*/
|
||||
/* case 51: *//* Reserved */
|
||||
/* break;*/
|
||||
case 52: /* Nominal output voltage */
|
||||
switch (val)
|
||||
{
|
||||
case 0:
|
||||
ret = 110;
|
||||
break;
|
||||
case 1:
|
||||
ret = 120;
|
||||
break;
|
||||
case 10:
|
||||
ret = 220;
|
||||
break;
|
||||
case 11:
|
||||
ret = 230;
|
||||
break;
|
||||
case 100:
|
||||
ret = 240;
|
||||
break;
|
||||
default:
|
||||
/* Unknown */
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* Don't know what happened */
|
||||
return -1;
|
||||
}
|
||||
|
||||
snprintf(value, valuelen, item->dfl, ret);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* == Subdriver interface == */
|
||||
subdriver_t voltronic_qs_hex_subdriver = {
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@
|
|||
|
||||
#include "nutdrv_qx_voltronic-qs.h"
|
||||
|
||||
#define VOLTRONIC_QS_VERSION "Voltronic-QS 0.04"
|
||||
#define VOLTRONIC_QS_VERSION "Voltronic-QS 0.07"
|
||||
|
||||
/* Support functions */
|
||||
static int voltronic_qs_claim(void);
|
||||
static void voltronic_qs_initups(void);
|
||||
|
||||
/* Preprocess functions */
|
||||
static int voltronic_qs_protocol(item_t *item, char *value, size_t valuelen);
|
||||
static int voltronic_qs_protocol(item_t *item, char *value, const size_t valuelen);
|
||||
|
||||
|
||||
/* == Ranges == */
|
||||
|
|
@ -62,7 +62,7 @@ static item_t voltronic_qs_qx2nut[] = {
|
|||
* 0
|
||||
*/
|
||||
|
||||
{ "ups.firmware.aux", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%s", QX_FLAG_STATIC, NULL, voltronic_qs_protocol },
|
||||
{ "ups.firmware.aux", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "PM-%s", QX_FLAG_STATIC, NULL, NULL, voltronic_qs_protocol },
|
||||
|
||||
/* Query UPS for status
|
||||
* > [QS\r]
|
||||
|
|
@ -71,50 +71,50 @@ static item_t voltronic_qs_qx2nut[] = {
|
|||
* 0 1 2 3 4
|
||||
*/
|
||||
|
||||
{ "input.voltage", 0, NULL, "QS\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "QS\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "QS\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "QS\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "QS\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "QS\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "QS\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage", 0, NULL, "QS\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "QS\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "QS\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "QS\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL },
|
||||
{ "output.frequency", 0, NULL, "QS\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "QS\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "QS\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL },
|
||||
/* Status bits */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "QS\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "QS\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "QS\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "QS\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "QS\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "QS\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
|
||||
/* Query UPS for ratings
|
||||
* > [F\r]
|
||||
* < [#220.0 000 024.0 50.0\r]
|
||||
* < [#220.0 003 12.00 50.0\r]
|
||||
* 0123456789012345678901
|
||||
* 0 1 2
|
||||
*/
|
||||
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "output.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "output.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "output.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
|
||||
/* Instant commands */
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
|
||||
/* Server-side settable vars */
|
||||
{ "ups.delay.start", ST_FLAG_RW, voltronic_qs_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, voltronic_qs_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.start", ST_FLAG_RW, voltronic_qs_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, voltronic_qs_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
|
||||
/* End of structure. */
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL }
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ static item_t voltronic_qs_qx2nut[] = {
|
|||
#ifdef TESTING
|
||||
static testing_t voltronic_qs_testing[] = {
|
||||
{ "QS\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 },
|
||||
{ "F\r", "#230.0 000 024.0 50.0\r", -1 },
|
||||
{ "F\r", "#220.0 003 12.00 50.0\r", -1 },
|
||||
{ "M\r", "V\r", -1 },
|
||||
{ "Q\r", "", -1 },
|
||||
{ "C\r", "", -1 },
|
||||
|
|
@ -189,14 +189,14 @@ static void voltronic_qs_initups(void)
|
|||
/* == Preprocess functions == */
|
||||
|
||||
/* Protocol used by the UPS */
|
||||
static int voltronic_qs_protocol(item_t *item, char *value, size_t valuelen)
|
||||
static int voltronic_qs_protocol(item_t *item, char *value, const size_t valuelen)
|
||||
{
|
||||
if (strcasecmp(item->value, "V")) {
|
||||
upsdebugx(2, "%s: invalid protocol [%s]", __func__, item->value);
|
||||
return -1;
|
||||
}
|
||||
|
||||
snprintf(value, valuelen, item->dfl, "PMV");
|
||||
snprintf(value, valuelen, item->dfl, item->value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -210,8 +210,8 @@ subdriver_t voltronic_qs_subdriver = {
|
|||
voltronic_qs_initups,
|
||||
NULL,
|
||||
blazer_makevartable_light,
|
||||
"ACK",
|
||||
"(NAK\r",
|
||||
NULL,
|
||||
NULL,
|
||||
#ifdef TESTING
|
||||
voltronic_qs_testing,
|
||||
#endif /* TESTING */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "nutdrv_qx_zinto.h"
|
||||
|
||||
#define ZINTO_VERSION "Zinto 0.04"
|
||||
#define ZINTO_VERSION "Zinto 0.06"
|
||||
|
||||
/* qx2nut lookup table */
|
||||
static item_t zinto_qx2nut[] = {
|
||||
|
|
@ -37,22 +37,22 @@ static item_t zinto_qx2nut[] = {
|
|||
* 0 1 2 3 4
|
||||
*/
|
||||
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL },
|
||||
{ "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL },
|
||||
{ "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL },
|
||||
{ "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL },
|
||||
{ "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL },
|
||||
/* Status bits */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */
|
||||
{ "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */
|
||||
{ "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */
|
||||
{ "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */
|
||||
{ "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */
|
||||
|
||||
/*
|
||||
* > [F\r]
|
||||
|
|
@ -61,10 +61,10 @@ static item_t zinto_qx2nut[] = {
|
|||
* 0 1 2
|
||||
*/
|
||||
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL },
|
||||
{ "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
{ "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL },
|
||||
|
||||
/*
|
||||
* > [FW?\r]
|
||||
|
|
@ -73,28 +73,28 @@ static item_t zinto_qx2nut[] = {
|
|||
* 0 1 2 3
|
||||
*/
|
||||
|
||||
{ "device.mfr", 0, NULL, "FW?\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "FW?\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "FW?\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL },
|
||||
{ "device.mfr", 0, NULL, "FW?\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "device.model", 0, NULL, "FW?\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
{ "ups.firmware", 0, NULL, "FW?\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL },
|
||||
|
||||
/* Instant commands */
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL },
|
||||
{ "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command },
|
||||
{ "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
{ "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL },
|
||||
|
||||
/* Server-side settable vars */
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
{ "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar },
|
||||
|
||||
/* End of structure. */
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL }
|
||||
{ NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* Testing table */
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
* -OptiUPS VS 575C
|
||||
*
|
||||
* Copyrights:
|
||||
* (C) 2015 Arnaud Quette <ArnaudQuette@Eaton.com>
|
||||
* (C) 2013 Florian Bruhin <nut@the-compiler.org>
|
||||
* (C) 2002 Simon Rozman <simon@rozman.net>
|
||||
* (C) 1999 Peter Bieringer <pb@bieringer.de>
|
||||
|
|
@ -69,6 +70,10 @@
|
|||
*
|
||||
* Tested on: IMP-625AP
|
||||
*
|
||||
* rev 0.16: Arnaud Quette
|
||||
* - Fixed the processing of input/output voltages for KIN models
|
||||
* (https://github.com/networkupstools/nut/issues/187)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
|
|
@ -77,7 +82,7 @@
|
|||
#include "math.h"
|
||||
|
||||
#define DRIVER_NAME "PowerCom protocol UPS driver"
|
||||
#define DRIVER_VERSION "0.14"
|
||||
#define DRIVER_VERSION "0.17"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
|
@ -86,7 +91,8 @@ upsdrv_info_t upsdrv_info = {
|
|||
"Simon Rozman <simon@rozman.net>\n" \
|
||||
"Peter Bieringer <pb@bieringer.de>\n" \
|
||||
"Alexey Sidorov <alexsid@altlinux.org>\n" \
|
||||
"Florian Bruhin <nut@the-compiler.org>",
|
||||
"Florian Bruhin <nut@the-compiler.org>\n" \
|
||||
"Arnaud Quette <ArnaudQuette@Eaton.com>",
|
||||
DRV_STABLE,
|
||||
{ NULL }
|
||||
};
|
||||
|
|
@ -415,12 +421,24 @@ static float input_voltage(void)
|
|||
tmp=2.2*raw_data[INPUT_VOLTAGE]-24;
|
||||
} else if ( !strcmp(types[type].name, "KIN")) {
|
||||
model=KINmodels[raw_data[MODELNUMBER]/16];
|
||||
if (model<=625){
|
||||
tmp=1.79*raw_data[INPUT_VOLTAGE]+3.35;
|
||||
} else if (model<2000){
|
||||
tmp=1.61*raw_data[INPUT_VOLTAGE];
|
||||
} else {
|
||||
tmp=1.625*raw_data[INPUT_VOLTAGE];
|
||||
/* Process input voltage, according to line voltage and model rating */
|
||||
if (linevoltage < 200) {
|
||||
if (model <= 625) {
|
||||
tmp = 0.89 * raw_data[INPUT_VOLTAGE] + 6.18;
|
||||
} else if ((model >= 800) && (model < 2000)) {
|
||||
tmp = 1.61 * raw_data[INPUT_VOLTAGE] / 2.0;
|
||||
} else {
|
||||
tmp = 1.625 * raw_data[INPUT_VOLTAGE] / 2.0;
|
||||
}
|
||||
}
|
||||
if (linevoltage >= 200) {
|
||||
if (model <= 625) {
|
||||
tmp = 1.79 * raw_data[INPUT_VOLTAGE] + 3.35;
|
||||
} else if ((model >= 800) && (model < 2000)) {
|
||||
tmp = 1.61 * raw_data[INPUT_VOLTAGE];
|
||||
} else {
|
||||
tmp = 1.625 * raw_data[INPUT_VOLTAGE];
|
||||
}
|
||||
}
|
||||
} else if ( !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) {
|
||||
tmp=raw_data[INPUT_VOLTAGE]*2.0;
|
||||
|
|
@ -437,10 +455,13 @@ static float output_voltage(void)
|
|||
{
|
||||
float tmp,rdatax,rdatay,rdataz,boostdata;
|
||||
unsigned int statINV = 0,statAVR = 0,statAVRMode = 0,model,t;
|
||||
static float datax[]={0,1.0,1.0,1.0,1.0,1.89,1.89,1.89,0.127,0.127,1.89,1.89,1.89,0.256};
|
||||
static float datay[]={0,1.73,1.74,1.74,1.77,0.9,0.9,0.9,13.204,13.204,0.88,0.88,0.88,6.645};
|
||||
static float dataz[]={0,1.15,0.9,0.9,0.75,1.1,1.1,1.1,0.8,0.8,0.86,0.86,0.86,0.7};
|
||||
|
||||
static float datax1[]={0,1.0,1.0,1.0,1.0,0.945,0.945,0.945,0.127,0.127,0.945,0.945,0.945,0.256};
|
||||
static float datay1[]={0,0.85,0.85,0.85,0.88,0.9,0.9,0.9,6.6,6.6,0.87,0.87,0.87,3.29};
|
||||
static float dataz1[]={0,1.03,0.78,0.78,0.72,0.55,0.55,0.55,0.5,0.5,0.43,0.43,0.43,0.3};
|
||||
static float datax2[]={0,1.0,1.0,1.0,1.0,1.89,1.89,1.89,0.127,0.127,1.89,1.89,1.89,0.256};
|
||||
static float datay2[]={0,1.73,1.74,1.74,1.77,0.9,0.9,0.9,13.204,13.204,0.88,0.88,0.88,6.645};
|
||||
static float dataz2[]={0,1.15,0.9,0.9,0.75,1.1,1.1,1.1,0.8,0.8,0.86,0.86,0.86,0.7};
|
||||
|
||||
if ( !strcmp(types[type].name, "BNT") || !strcmp(types[type].name, "KIN")) {
|
||||
statINV=raw_data[STATUS_A] & ONLINE;
|
||||
statAVR=raw_data[STATUS_A] & AVR_ON;
|
||||
|
|
@ -466,41 +487,78 @@ static float output_voltage(void)
|
|||
}
|
||||
} else if ( !strcmp(types[type].name, "KIN")) {
|
||||
model=KINmodels[raw_data[MODELNUMBER]/16];
|
||||
if (statINV==0) {
|
||||
if (statAVR==0) {
|
||||
if (model<=625)
|
||||
tmp=1.79*raw_data[OUTPUT_VOLTAGE]+3.35;
|
||||
else if (model<2000)
|
||||
tmp=1.61*raw_data[OUTPUT_VOLTAGE];
|
||||
else
|
||||
tmp=1.625*raw_data[OUTPUT_VOLTAGE];
|
||||
} else {
|
||||
if (statAVRMode > 0){
|
||||
if (model<=525)
|
||||
tmp=2.07*raw_data[OUTPUT_VOLTAGE];
|
||||
else if (model==625)
|
||||
tmp=2.07*raw_data[OUTPUT_VOLTAGE]+5;
|
||||
if (statINV == 0) {
|
||||
if (statAVR == 0) {
|
||||
// FIXME: miss test "if (iUPS == 1) {"
|
||||
if (linevoltage >= 200) {
|
||||
if (linevoltage <= 625)
|
||||
tmp = 1.79*raw_data[OUTPUT_VOLTAGE] + 3.35;
|
||||
else if (model<2000)
|
||||
tmp=1.87*raw_data[OUTPUT_VOLTAGE];
|
||||
tmp = 1.61*raw_data[OUTPUT_VOLTAGE];
|
||||
else
|
||||
tmp=1.87*raw_data[OUTPUT_VOLTAGE];
|
||||
tmp = 1.625*raw_data[OUTPUT_VOLTAGE];
|
||||
} else {
|
||||
if (model<=625)
|
||||
tmp=1.571*raw_data[OUTPUT_VOLTAGE];
|
||||
if (linevoltage <= 625)
|
||||
tmp = 0.89 * raw_data[OUTPUT_VOLTAGE] + 6.18;
|
||||
else if (model<2000)
|
||||
tmp=1.37*raw_data[OUTPUT_VOLTAGE];
|
||||
tmp = 1.61 * raw_data[OUTPUT_VOLTAGE] / 2.0;
|
||||
else
|
||||
tmp=1.4*raw_data[OUTPUT_VOLTAGE];
|
||||
tmp = 1.625 * raw_data[OUTPUT_VOLTAGE] / 2.0;
|
||||
}
|
||||
}
|
||||
else if (statAVR == 1) {
|
||||
// FIXME: miss test "if ((iUPS == 1) || (iUPS == 13)) {"
|
||||
if (linevoltage >= 200) {
|
||||
if (model <= 525)
|
||||
tmp = 2.07 * raw_data[OUTPUT_VOLTAGE];
|
||||
else if (model == 625)
|
||||
tmp = 2.07 * raw_data[OUTPUT_VOLTAGE]+5;
|
||||
else if (model < 2000)
|
||||
tmp = 1.87 * raw_data[OUTPUT_VOLTAGE];
|
||||
else
|
||||
tmp = 1.87 * raw_data[OUTPUT_VOLTAGE];
|
||||
} else {
|
||||
if (model <= 625)
|
||||
tmp = 2.158 * raw_data[OUTPUT_VOLTAGE] / 2.0;
|
||||
else if (model < 2000)
|
||||
tmp = 1.842 * raw_data[OUTPUT_VOLTAGE] / 2.0;
|
||||
else
|
||||
tmp = 1.875 * raw_data[OUTPUT_VOLTAGE] / 2.0;
|
||||
}
|
||||
} else {
|
||||
// FIXME: miss test "if ((iUPS == 1) || (iUPS == 13)) {"
|
||||
if (linevoltage >= 200) {
|
||||
if (model == 625)
|
||||
tmp = 1.571 * raw_data[OUTPUT_VOLTAGE];
|
||||
else if (model < 2000)
|
||||
tmp = 1.37 * raw_data[OUTPUT_VOLTAGE];
|
||||
else
|
||||
tmp = 1.4 * raw_data[OUTPUT_VOLTAGE];
|
||||
} else {
|
||||
if (model <= 625)
|
||||
tmp = 1.635 * raw_data[OUTPUT_VOLTAGE] / 2.0;
|
||||
else if (model < 2000)
|
||||
tmp = 1.392 * raw_data[OUTPUT_VOLTAGE] / 2.0;
|
||||
else
|
||||
tmp = 1.392 * raw_data[OUTPUT_VOLTAGE] / 2.0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rdatax=datax[raw_data[MODELNUMBER]/16];
|
||||
rdatay=datay[raw_data[MODELNUMBER]/16];
|
||||
rdataz=dataz[raw_data[MODELNUMBER]/16];
|
||||
boostdata=1.0+statAVR*20.0/135.0;
|
||||
t=raw_data[OUTPUT_FREQUENCY]/2;
|
||||
tmp=0;
|
||||
if (model>625){
|
||||
// FIXME: miss test "if ((iUPS == 1) && (T != 0))"
|
||||
if (linevoltage < 200) {
|
||||
rdatax = datax1[raw_data[MODELNUMBER]/16];
|
||||
rdatay = datay1[raw_data[MODELNUMBER]/16];
|
||||
rdataz = dataz1[raw_data[MODELNUMBER]/16];
|
||||
} else {
|
||||
rdatax = datax2[raw_data[MODELNUMBER]/16];
|
||||
rdatay = datay2[raw_data[MODELNUMBER]/16];
|
||||
rdataz = dataz2[raw_data[MODELNUMBER]/16+1];
|
||||
}
|
||||
|
||||
boostdata = 1.0 + statAVR * 20.0 / 135.0;
|
||||
t = raw_data[OUTPUT_FREQUENCY]/2;
|
||||
tmp = 0;
|
||||
if (model > 625){
|
||||
tmp=(raw_data[BATTERY_CHARGE]*rdatax)*(raw_data[BATTERY_CHARGE]*rdatax)*
|
||||
(t-raw_data[OUTPUT_VOLTAGE])/t;
|
||||
if (tmp>0)
|
||||
|
|
@ -512,6 +570,7 @@ static float output_voltage(void)
|
|||
if (tmp>0)
|
||||
tmp=sqrt(tmp)*rdatay;
|
||||
}
|
||||
// FIXME: may miss a last processing with ErrorVal = 5 | 10
|
||||
}
|
||||
} else if ( !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) {
|
||||
tmp=raw_data[OUTPUT_VOLTAGE]*2.0;
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ static void powpan_initinfo(void)
|
|||
dstate_setinfo("ups.model", "%s", modeltab[i].model);
|
||||
} else {
|
||||
/* report model value as is */
|
||||
dstate_setinfo("ups.model", "%s", rtrim(s, ' '));
|
||||
dstate_setinfo("ups.model", "%s", str_rtrim(s, ' '));
|
||||
}
|
||||
}
|
||||
if ((s = strtok(NULL, ".")) != NULL) {
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ static void powpan_initinfo(void)
|
|||
* was used for autodetection of the UPS. No need to do it again.
|
||||
*/
|
||||
if ((s = strtok(&powpan_answer[1], ",")) != NULL) {
|
||||
dstate_setinfo("ups.model", "%s", rtrim(s, ' '));
|
||||
dstate_setinfo("ups.model", "%s", str_rtrim(s, ' '));
|
||||
}
|
||||
if ((s = strtok(NULL, ",")) != NULL) {
|
||||
dstate_setinfo("ups.firmware", "%s", s);
|
||||
|
|
@ -239,7 +239,7 @@ static void powpan_initinfo(void)
|
|||
dstate_setinfo("ups.serial", "%s", s);
|
||||
}
|
||||
if ((s = strtok(NULL, ",")) != NULL) {
|
||||
dstate_setinfo("ups.mfr", "%s", rtrim(s, ' '));
|
||||
dstate_setinfo("ups.mfr", "%s", str_rtrim(s, ' '));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ static subdriver_t *subdriver[] = {
|
|||
};
|
||||
|
||||
#define DRIVER_NAME "CyberPower text/binary protocol UPS driver"
|
||||
#define DRIVER_VERSION "0.26"
|
||||
#define DRIVER_VERSION "0.27"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C)
|
||||
* 2005-2006 Olli Savia <ops@iki.fi>
|
||||
* 2005-2006 Niels Baggesen <niels@baggesen.net>
|
||||
* 2015 Arnaud Quette <ArnaudQuette@Eaton.com>
|
||||
* 2015-2016 Arnaud Quette <ArnaudQuette@Eaton.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
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "powerware-mib.h"
|
||||
|
||||
#define PW_MIB_VERSION "0.7"
|
||||
#define PW_MIB_VERSION "0.87"
|
||||
|
||||
/* TODO: more sysOID and MIBs support:
|
||||
*
|
||||
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
/* Powerware UPS (Ingrasys X-SLOT and BD-SLOT) */
|
||||
#define POWERWARE_SYSOID ".1.3.6.1.4.1.534.1"
|
||||
/* Powerware UPS newer PXGX UPS cards (BladeUPS, ...) */
|
||||
#define EATON_PXGX_SYSOID ".1.3.6.1.4.1.534.2.12"
|
||||
|
||||
/* SNMP OIDs set */
|
||||
#define PW_OID_MFR_NAME "1.3.6.1.4.1.534.1.1.1.0" /* XUPS-MIB::xupsIdentManufacturer.0 */
|
||||
|
|
@ -68,10 +70,6 @@
|
|||
#define PW_OID_BY_LINES "1.3.6.1.4.1.534.1.5.2.0" /* XUPS-MIB::xupsBypassNumPhases.0 */
|
||||
#define PW_OID_BY_VOLTAGE "1.3.6.1.4.1.534.1.5.3.1.2" /* XUPS-MIB::xupsBypassVoltage */
|
||||
|
||||
#define PW_OID_AMBIENT_TEMP "1.3.6.1.4.1.534.1.6.1.0" /* XUPS-MIB::xupsEnvAmbientTemp.0 */
|
||||
#define PW_OID_AMBIENT_LOW "1.3.6.1.4.1.534.1.6.2.0" /* XUPS-MIB::xupsEnvAmbientLowerLimit.0 */
|
||||
#define PW_OID_AMBIENT_HIGH "1.3.6.1.4.1.534.1.6.3.0" /* XUPS-MIB::xupsEnvAmbientUpperLimit.0 */
|
||||
|
||||
#define PW_OID_BATTEST_START "1.3.6.1.4.1.534.1.8.1" /* XUPS-MIB::xupsTestBattery set to startTest(1) to initiate test*/
|
||||
#define PW_OID_BATTEST_RES "1.3.6.1.4.1.534.1.8.2" /* XUPS-MIB::xupsTestBatteryStatus */
|
||||
|
||||
|
|
@ -79,6 +77,7 @@
|
|||
#define PW_OID_CONT_ONDELAY "1.3.6.1.4.1.534.1.9.2" /* XUPS-MIB::xupsControlOutputOnDelay */
|
||||
#define PW_OID_CONT_OFFT_DEL "1.3.6.1.4.1.534.1.9.3" /* XUPS-MIB::xupsControlOutputOffTrapDelay */
|
||||
#define PW_OID_CONT_ONT_DEL "1.3.6.1.4.1.534.1.9.4" /* XUPS-MIB::xupsControlOutputOnTrapDelay */
|
||||
#define PW_OID_CONT_LOAD_SHED_AND_RESTART "1.3.6.1.4.1.534.1.9.6" /* XUPS-MIB::xupsLoadShedSecsWithRestart */
|
||||
|
||||
#define PW_OID_CONF_OVOLTAGE "1.3.6.1.4.1.534.1.10.1.0" /* XUPS-MIB::xupsConfigOutputVoltage.0 */
|
||||
#define PW_OID_CONF_IVOLTAGE "1.3.6.1.4.1.534.1.10.2.0" /* XUPS-MIB::xupsConfigInputVoltage.0 */
|
||||
|
|
@ -94,45 +93,69 @@
|
|||
#define IETF_OID_CONF_OUT_VA "1.3.6.1.2.1.33.1.9.5.0" /* UPS-MIB::upsConfigOutputVA.0 */
|
||||
#define IETF_OID_CONF_RUNTIME_LOW "1.3.6.1.2.1.33.1.9.7.0" /* UPS-MIB::upsConfigLowBattTime.0 */
|
||||
#define IETF_OID_LOAD_LEVEL "1.3.6.1.2.1.33.1.4.4.1.5" /* UPS-MIB::upsOutputPercentLoad */
|
||||
#define IETF_OID_AUTO_RESTART "1.3.6.1.2.1.33.1.8.5.0" /* UPS-MIB::upsAutoRestart */
|
||||
|
||||
/* Delay before powering off in seconds */
|
||||
#define DEFAULT_OFFDELAY 30
|
||||
/* Delay before powering on in seconds */
|
||||
#define DEFAULT_ONDELAY 20
|
||||
/* Default shutdown.return delay in seconds */
|
||||
#define DEFAULT_SHUTDOWNDELAY 0
|
||||
|
||||
static info_lkp_t pw_alarm_ob[] = {
|
||||
{ 1, "OB" },
|
||||
{ 2, "" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
static info_lkp_t pw_alarm_lb[] = {
|
||||
{ 1, "LB" },
|
||||
{ 2, "" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
static info_lkp_t pw_pwr_info[] = {
|
||||
{ 1, "" /* other */ },
|
||||
{ 2, "OFF" /* none */ },
|
||||
{ 3, "OL" /* normal */ },
|
||||
{ 4, "BYPASS" /* bypass */ },
|
||||
{ 5, "OB" /* battery */ },
|
||||
{ 6, "OL BOOST" /* booster */ },
|
||||
{ 7, "OL TRIM" /* reducer */ },
|
||||
{ 8, "OL" /* parallel capacity */ },
|
||||
{ 9, "OL" /* parallel redundancy */ },
|
||||
{10, "OL" /* high efficiancy */ },
|
||||
{ 0, "NULL" }
|
||||
{ 1, "" /* other */ },
|
||||
{ 2, "OFF" /* none */ },
|
||||
{ 3, "OL" /* normal */ },
|
||||
{ 4, "BYPASS" /* bypass */ },
|
||||
{ 5, "OB" /* battery */ },
|
||||
{ 6, "OL BOOST" /* booster */ },
|
||||
{ 7, "OL TRIM" /* reducer */ },
|
||||
{ 8, "OL" /* parallel capacity */ },
|
||||
{ 9, "OL" /* parallel redundancy */ },
|
||||
{ 10, "OL" /* high efficiency */ },
|
||||
/* Extended status values */
|
||||
{ 240, "OB" /* battery (0xF0) */ },
|
||||
{ 100, "BYPASS" /* maintenanceBypass (0x64) */ },
|
||||
{ 96, "BYPASS" /* Bypass (0x60) */ },
|
||||
{ 81, "OL" /* high efficiency (0x51) */ },
|
||||
{ 80, "OL" /* normal (0x50) */ },
|
||||
{ 64, "OL" /* UPS supporting load, normal degraded mode (0x40) */ },
|
||||
{ 16, "OFF" /* none (0x10) */ },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t pw_mode_info[] = {
|
||||
{ 1, "" },
|
||||
{ 2, "" },
|
||||
{ 3, "normal" },
|
||||
{ 4, "" },
|
||||
{ 5, "" },
|
||||
{ 6, "" },
|
||||
{ 7, "" },
|
||||
{ 8, "parallel capacity" },
|
||||
{ 9, "parallel redundancy" },
|
||||
{10, "high efficiency" },
|
||||
{ 0, "NULL" }
|
||||
{ 1, "" },
|
||||
{ 2, "" },
|
||||
{ 3, "normal" },
|
||||
{ 4, "" },
|
||||
{ 5, "" },
|
||||
{ 6, "" },
|
||||
{ 7, "" },
|
||||
{ 8, "parallel capacity" },
|
||||
{ 9, "parallel redundancy" },
|
||||
{ 10, "high efficiency" },
|
||||
/* Extended status values */
|
||||
{ 240, "" /* battery (0xF0) */ },
|
||||
{ 100, "" /* maintenanceBypass (0x64) */ },
|
||||
{ 96, "" /* Bypass (0x60) */ },
|
||||
{ 81, "high efficiency" /* high efficiency (0x51) */ },
|
||||
{ 80, "normal" /* normal (0x50) */ },
|
||||
{ 64, "" /* UPS supporting load, normal degraded mode (0x40) */ },
|
||||
{ 16, "" /* none (0x10) */ },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Legacy implementation */
|
||||
|
|
@ -142,7 +165,7 @@ static info_lkp_t pw_battery_abm_status[] = {
|
|||
/* { 3, "Floating" }, */
|
||||
/* { 4, "Resting" }, */
|
||||
/* { 5, "Unknown" }, */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
} ;
|
||||
|
||||
static info_lkp_t eaton_abm_status_info[] = {
|
||||
|
|
@ -152,7 +175,7 @@ static info_lkp_t eaton_abm_status_info[] = {
|
|||
{ 4, "resting" },
|
||||
{ 5, "unknown" }, /* Undefined - ABM is not activated */
|
||||
{ 6, "disabled" }, /* ABM Charger Disabled */
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t pw_batt_test_info[] = {
|
||||
|
|
@ -163,13 +186,19 @@ static info_lkp_t pw_batt_test_info[] = {
|
|||
{ 5, "Not supported" },
|
||||
{ 6, "Inhibited" },
|
||||
{ 7, "Scheduled" },
|
||||
{ 0, "NULL" }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static info_lkp_t ietf_yes_no_info[] = {
|
||||
{ 1, "yes" },
|
||||
{ 2, "no" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Snmp2NUT lookup table */
|
||||
|
||||
static snmp_info_t pw_mib[] = {
|
||||
/* FIXME: miss device page! */
|
||||
/* UPS page */
|
||||
/* info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar */
|
||||
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_MFR_NAME, "",
|
||||
|
|
@ -200,10 +229,19 @@ static snmp_info_t pw_mib[] = {
|
|||
0, NULL },
|
||||
{ "ups.power.nominal", 0, 1.0, IETF_OID_CONF_OUT_VA, "",
|
||||
0, NULL },
|
||||
/* XUPS-MIB::xupsEnvAmbientTemp.0 */
|
||||
{ "ups.temperature", 0, 1.0, "1.3.6.1.4.1.534.1.6.1.0", "", 0, NULL },
|
||||
/* FIXME: These 2 data needs RFC! */
|
||||
/* XUPS-MIB::xupsEnvAmbientLowerLimit.0 */
|
||||
{ "ups.temperature.low", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.2.0", "", 0, NULL },
|
||||
/* XUPS-MIB::xupsEnvAmbientUpperLimit.0 */
|
||||
{ "ups.temperature.high", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.3.0", "", 0, NULL },
|
||||
{ "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_BATTEST_RES, "",
|
||||
0, &pw_batt_test_info[0] },
|
||||
{ "ups.start.auto", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_AUTO_RESTART, "",
|
||||
SU_FLAG_OK, &ietf_yes_no_info[0] },
|
||||
{ "battery.charger.status", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_BATT_STATUS, "",
|
||||
SU_STATUS_BATT, &eaton_abm_status_info[0] },
|
||||
SU_STATUS_BATT, &eaton_abm_status_info[0] },
|
||||
|
||||
/* Battery page */
|
||||
{ "battery.charge", 0, 1.0, PW_OID_BATT_CHARGE, "",
|
||||
|
|
@ -246,6 +284,7 @@ static snmp_info_t pw_mib[] = {
|
|||
SU_OUTPUT_3, NULL },
|
||||
{ "output.L3.realpower", 0, 1.0, PW_OID_OUT_POWER ".3", "",
|
||||
SU_OUTPUT_3, NULL },
|
||||
/* FIXME: should better be output.Lx.load */
|
||||
{ "output.L1.power.percent", 0, 1.0, IETF_OID_LOAD_LEVEL ".1", "",
|
||||
SU_OUTPUT_3, NULL },
|
||||
{ "output.L2.power.percent", 0, 1.0, IETF_OID_LOAD_LEVEL ".2", "",
|
||||
|
|
@ -302,25 +341,39 @@ static snmp_info_t pw_mib[] = {
|
|||
SU_INPUT_3, NULL },
|
||||
|
||||
/* Ambient page */
|
||||
{ "ambient.temperature", 0, 1.0, PW_OID_AMBIENT_TEMP, "",
|
||||
0, NULL },
|
||||
{ "ambient.temperature.low", 0, 1.0, PW_OID_AMBIENT_LOW, "",
|
||||
0, NULL },
|
||||
{ "ambient.temperature.high", 0, 1.0, PW_OID_AMBIENT_HIGH, "",
|
||||
0, NULL },
|
||||
/* XUPS-MIB::xupsEnvRemoteTemp.0 */
|
||||
{ "ambient.temperature", 0, 1.0, "1.3.6.1.4.1.534.1.6.5.0", "", 0, NULL },
|
||||
/* XUPS-MIB::xupsEnvRemoteTempLowerLimit.0 */
|
||||
{ "ambient.temperature.low", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.9.0", "", 0, NULL },
|
||||
/* XUPS-MIB::xupsEnvRemoteTempUpperLimit.0 */
|
||||
{ "ambient.temperature.high", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.10.0", "", 0, NULL },
|
||||
|
||||
/* XUPS-MIB::xupsEnvRemoteHumidity.0 */
|
||||
{ "ambient.humidity", 0, 1.0, "1.3.6.1.4.1.534.1.6.6.0", "", 0, NULL },
|
||||
/* XUPS-MIB::xupsEnvRemoteHumidityLowerLimit.0 */
|
||||
{ "ambient.humidity.low", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.11.0", "", 0, NULL },
|
||||
/* XUPS-MIB::xupsEnvRemoteHumidityUpperLimit.0 */
|
||||
{ "ambient.humidity.high", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.12.0", "", 0, NULL },
|
||||
|
||||
/* instant commands */
|
||||
{ "test.battery.start.quick", 0, 1, PW_OID_BATTEST_START, "",
|
||||
SU_TYPE_CMD | SU_FLAG_OK, NULL },
|
||||
/* Cancel output off, by writing 0 to xupsControlOutputOffDelay */
|
||||
/* Shed load and restart when line power back on; cannot be canceled */
|
||||
{ "shutdown.return", 0, DEFAULT_SHUTDOWNDELAY, PW_OID_CONT_LOAD_SHED_AND_RESTART, "",
|
||||
SU_TYPE_CMD | SU_FLAG_OK, NULL },
|
||||
/* Cancel output off, by writing 0 to xupsControlOutputOffDelay */
|
||||
{ "shutdown.stop", 0, 0, PW_OID_CONT_OFFDELAY, "",
|
||||
SU_TYPE_CMD | SU_FLAG_OK, NULL },
|
||||
/* load off after 1 sec, shortest possible delay */
|
||||
/* load off after 1 sec, shortest possible delay; 0 cancels */
|
||||
{ "load.off", 0, 1, PW_OID_CONT_OFFDELAY, "",
|
||||
SU_TYPE_CMD | SU_FLAG_OK, NULL },
|
||||
/* load on after 1 sec, shortest possible delay */
|
||||
{ "load.off.delay", 0, DEFAULT_OFFDELAY, PW_OID_CONT_OFFDELAY, "",
|
||||
SU_TYPE_CMD | SU_FLAG_OK, NULL },
|
||||
/* load on after 1 sec, shortest possible delay; 0 cancels */
|
||||
{ "load.on", 0, 1, PW_OID_CONT_ONDELAY, "",
|
||||
SU_TYPE_CMD | SU_FLAG_OK, NULL },
|
||||
{ "load.on.delay", 0, DEFAULT_ONDELAY, PW_OID_CONT_ONDELAY, "",
|
||||
SU_TYPE_CMD | SU_FLAG_OK, NULL },
|
||||
|
||||
{ "ups.alarms", 0, 1.0, PW_OID_ALARMS, "",
|
||||
0, NULL },
|
||||
|
|
@ -330,10 +383,107 @@ static snmp_info_t pw_mib[] = {
|
|||
} ;
|
||||
|
||||
static alarms_info_t pw_alarms[] = {
|
||||
{ PW_OID_ALARM_LB, "LB" },
|
||||
/* xupsLowBattery */
|
||||
{ PW_OID_ALARM_LB, "LB", NULL },
|
||||
/* xupsOutputOverload */
|
||||
{ ".1.3.6.1.4.1.534.1.7.7", "OVER", "Output overload!" },
|
||||
/* xupsInternalFailure */
|
||||
{ ".1.3.6.1.4.1.534.1.7.8", NULL, "Internal failure!" },
|
||||
/* xupsBatteryDischarged */
|
||||
{ ".1.3.6.1.4.1.534.1.7.9", NULL, "Battery discharged!" },
|
||||
/* xupsInverterFailure */
|
||||
{ ".1.3.6.1.4.1.534.1.7.10", NULL, "Inverter failure!" },
|
||||
/* xupsOnBypass
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.11", "BYPASS", "On bypass!" },
|
||||
/* xupsBypassNotAvailable
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.12", NULL, "Bypass not available!" },
|
||||
/* xupsOutputOff
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.13", "OFF", "Output off!" },
|
||||
/* xupsInputFailure
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.14", NULL, "Input failure!" },
|
||||
/* xupsBuildingAlarm
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.15", NULL, "Building alarm!" },
|
||||
/* xupsShutdownImminent */
|
||||
{ ".1.3.6.1.4.1.534.1.7.16", NULL, "Shutdown imminent!" },
|
||||
/* xupsOnInverter
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.17", NULL, "On inverter!" },
|
||||
/* xupsBreakerOpen
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.20", NULL, "Breaker open!" },
|
||||
/* xupsAlarmBatteryBad */
|
||||
{ ".1.3.6.1.4.1.534.1.7.23", "RB", "Battery bad!" },
|
||||
/* xupsOutputOffAsRequested
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.24", "OFF", "Output off as requested!" },
|
||||
/* xupsDiagnosticTestFailed
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.25", NULL, "Diagnostic test failure!" },
|
||||
/* xupsCommunicationsLost */
|
||||
{ ".1.3.6.1.4.1.534.1.7.26", NULL, "Communication with UPS lost!" },
|
||||
/* xupsUpsShutdownPending */
|
||||
{ ".1.3.6.1.4.1.534.1.7.27", NULL, "Shutdown pending!" },
|
||||
/* xupsAmbientTempBad */
|
||||
{ ".1.3.6.1.4.1.534.1.7.29", NULL, "Bad ambient temperature!" },
|
||||
/* xupsLossOfRedundancy */
|
||||
{ ".1.3.6.1.4.1.534.1.7.30", NULL, "Redundancy lost!" },
|
||||
/* xupsAlarmTempBad */
|
||||
{ ".1.3.6.1.4.1.534.1.7.31", NULL, "Bad temperature!" },
|
||||
/* xupsAlarmChargerFailed */
|
||||
{ ".1.3.6.1.4.1.534.1.7.32", NULL, "Charger failure!" },
|
||||
/* xupsAlarmFanFailure */
|
||||
{ ".1.3.6.1.4.1.534.1.7.33", NULL, "Fan failure!" },
|
||||
/* xupsAlarmFuseFailure */
|
||||
{ ".1.3.6.1.4.1.534.1.7.34", NULL, "Fuse failure!" },
|
||||
/* xupsPowerSwitchBad */
|
||||
{ ".1.3.6.1.4.1.534.1.7.35", NULL, "Powerswitch failure!" },
|
||||
/* xupsModuleFailure */
|
||||
{ ".1.3.6.1.4.1.534.1.7.36", NULL, "Parallel or composite module failure!" },
|
||||
/* xupsOnAlternatePowerSource
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.37", NULL, "Using alternative power source!" },
|
||||
/* xupsAltPowerNotAvailable
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.38", NULL, "Alternative power source unavailable!" },
|
||||
/* xupsRemoteTempBad */
|
||||
{ ".1.3.6.1.4.1.534.1.7.40", NULL, "Bad remote temperature!" },
|
||||
/* xupsRemoteHumidityBad */
|
||||
{ ".1.3.6.1.4.1.534.1.7.41", NULL, "Bad remote humidity!" },
|
||||
/* xupsAlarmOutputBad */
|
||||
{ ".1.3.6.1.4.1.534.1.7.42", NULL, "Bad output condition!" },
|
||||
/* xupsAlarmAwaitingPower
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.43", NULL, "Awaiting power!" },
|
||||
/* xupsOnMaintenanceBypass
|
||||
* FIXME: informational (not an alarm),
|
||||
* to RFC'ed for device.event?
|
||||
* FIXME: NUT currently doesn't distinguish between Maintenance and
|
||||
* Automatic Bypass (both published as "ups.alarm: BYPASS)
|
||||
* Should we make the distinction? */
|
||||
{ ".1.3.6.1.4.1.534.1.7.44", "BYPASS", "On maintenance bypass!" },
|
||||
|
||||
|
||||
/* end of structure. */
|
||||
{ NULL, NULL }
|
||||
{ NULL, NULL, NULL }
|
||||
} ;
|
||||
|
||||
|
||||
mib2nut_info_t powerware = { "pw", PW_MIB_VERSION, "", PW_OID_MODEL_NAME, pw_mib, POWERWARE_SYSOID , pw_alarms };
|
||||
mib2nut_info_t powerware = { "pw", PW_MIB_VERSION, NULL, PW_OID_MODEL_NAME, pw_mib, POWERWARE_SYSOID , pw_alarms };
|
||||
mib2nut_info_t pxgx_ups = { "pxgx_ups", PW_MIB_VERSION, NULL, PW_OID_MODEL_NAME, pw_mib, EATON_PXGX_SYSOID , pw_alarms };
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@
|
|||
#include "snmp-ups.h"
|
||||
|
||||
extern mib2nut_info_t powerware;
|
||||
extern mib2nut_info_t pxgx_ups;
|
||||
|
||||
#endif /* POWERWARE_MIB_H */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "raritan-pdu-mib.h"
|
||||
|
||||
#define RARITAN_MIB_VERSION "0.4"
|
||||
#define RARITAN_MIB_VERSION "0.5"
|
||||
|
||||
/* Raritan MIB
|
||||
* this one uses the same MIB as Eaton Revelation,
|
||||
|
|
@ -57,6 +57,8 @@ static snmp_info_t raritan_mib[] = {
|
|||
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 },
|
||||
{ "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.6.0", "",
|
||||
SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
|
||||
/* UPS page */
|
||||
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Raritan",
|
||||
|
|
@ -71,8 +73,6 @@ static snmp_info_t raritan_mib[] = {
|
|||
SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
{ "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
|
||||
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.6.0", "",
|
||||
SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
|
||||
{ "ups.temperature", 0, 1, ".1.3.6.1.4.1.13742.1.3.1.5.0", NULL, 0, NULL, NULL },
|
||||
|
||||
/* Outlet page */
|
||||
|
|
@ -121,4 +121,4 @@ static snmp_info_t raritan_mib[] = {
|
|||
{ NULL, 0, 0, NULL, NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
mib2nut_info_t raritan = { "raritan", RARITAN_MIB_VERSION, "", RARITAN_OID_MODEL_NAME, raritan_mib, RARITAN_SYSOID };
|
||||
mib2nut_info_t raritan = { "raritan", RARITAN_MIB_VERSION, NULL, RARITAN_OID_MODEL_NAME, raritan_mib, RARITAN_SYSOID };
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -30,9 +30,12 @@
|
|||
- add syscontact/location (to all mib.h or centralized?)
|
||||
- complete shutdown
|
||||
- add enum values to OIDs.
|
||||
- optimize network flow by constructing one big packet (calling snmp_add_null_var
|
||||
for each OID request we made), instead of sending many small packets
|
||||
- add support for registration and traps (manager mode),
|
||||
- optimize network flow by:
|
||||
1) caching OID values (as in usbhid-ups) with timestamping and lifetime
|
||||
2) constructing one big packet (calling snmp_add_null_var
|
||||
for each OID request we made), instead of sending many small packets
|
||||
- add support for registration and traps (manager mode)
|
||||
=> Issue: 1 trap listener for N snmp-ups drivers!
|
||||
- complete mib2nut data (add all OID translation to NUT)
|
||||
- externalize mib2nut data in .m2n files and load at driver startup using parseconf()...
|
||||
- adjust information logging.
|
||||
|
|
@ -79,7 +82,9 @@ for each OID request we made), instead of sending many small packets
|
|||
#define DISABLE_MIB_LOADING 1
|
||||
|
||||
/* Parameters default values */
|
||||
#define DEFAULT_POLLFREQ 30 /* in seconds */
|
||||
#define DEFAULT_POLLFREQ 30 /* in seconds */
|
||||
#define DEFAULT_NETSNMP_RETRIES 5
|
||||
#define DEFAULT_NETSNMP_TIMEOUT 1 /* in seconds */
|
||||
|
||||
/* use explicit booleans */
|
||||
#ifndef FALSE
|
||||
|
|
@ -112,7 +117,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
const char *info_type; /* INFO_ or CMD_ element */
|
||||
int info_flags; /* flags to set in addinfo */
|
||||
float info_len; /* length of strings if STR,
|
||||
double info_len; /* length of strings if STR,
|
||||
* cmd value if CMD, multiplier otherwise. */
|
||||
const char *OID; /* SNMP OID or NULL */
|
||||
const char *dfl; /* default value */
|
||||
|
|
@ -151,6 +156,8 @@ typedef struct {
|
|||
#define SU_STATUS_NUM_ELEM 4
|
||||
#define SU_STATUS_INDEX(t) (((t) >> 8) & 7)
|
||||
|
||||
#define SU_OUTLET_GROUP (1 << 10) /* outlet group template definition */
|
||||
|
||||
/* Phase specific data */
|
||||
#define SU_PHASES (0x3F << 12)
|
||||
#define SU_INPHASES (0x3 << 12)
|
||||
|
|
@ -174,6 +181,8 @@ typedef struct {
|
|||
|
||||
#define SU_VAR_COMMUNITY "community"
|
||||
#define SU_VAR_VERSION "snmp_version"
|
||||
#define SU_VAR_RETRIES "snmp_retries"
|
||||
#define SU_VAR_TIMEOUT "snmp_timeout"
|
||||
#define SU_VAR_MIBS "mibs"
|
||||
#define SU_VAR_POLLFREQ "pollfreq"
|
||||
/* SNMP v3 related parameters */
|
||||
|
|
@ -202,7 +211,8 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
const char * OID;
|
||||
const char *info_value;
|
||||
const char *status_value; /* when not NULL, set ups.status to this */
|
||||
const char *alarm_value; /* when not NULL, set ups.alarm to this */
|
||||
} alarms_info_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
346
drivers/solis.c
346
drivers/solis.c
|
|
@ -24,6 +24,8 @@
|
|||
2005/07/01 - Version 0.50 - add internal e external shutdown programming
|
||||
2005/08/18 - Version 0.60 - save external shutdown programming to ups,
|
||||
and support new cables for solis 3
|
||||
2015/09/19 - Version 0.65 - patch for correct reading for Microsol Back-Ups BZ1200-BR
|
||||
(see the version control logs for more recent updates)
|
||||
|
||||
Microsol contributed with UPS Solis 1.5 HS 1.5 KVA for my tests.
|
||||
|
||||
|
|
@ -33,14 +35,14 @@
|
|||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <math.h>
|
||||
#include "main.h"
|
||||
#include "serial.h"
|
||||
#include "solis.h"
|
||||
#include "timehead.h"
|
||||
|
||||
#define DRIVER_NAME "Microsol Solis UPS driver"
|
||||
#define DRIVER_VERSION "0.62"
|
||||
#define DRIVER_VERSION "0.65"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
|
@ -53,6 +55,7 @@ upsdrv_info_t upsdrv_info = {
|
|||
|
||||
#define false 0
|
||||
#define true 1
|
||||
#define RESP_END 0xFE
|
||||
#define ENDCHAR 13 /* replies end with CR */
|
||||
/* solis commands */
|
||||
#define CMD_UPSCONT 0xCC
|
||||
|
|
@ -90,11 +93,11 @@ upsdrv_info_t upsdrv_info = {
|
|||
#define NO_EVENT "No events\n"
|
||||
#define UPS_TIME "UPS internal Time %0d:%02d:%02d\n"
|
||||
#define PRG_DAYS "Programming Shutdown Sun Mon Tue Wed Thu Fri Sat\n"
|
||||
#define PRG_ONON "External shutdown programming ative\n"
|
||||
#define PRG_ONOU "Internal shutdown programming ative\n"
|
||||
#define PRG_ONON "External shutdown programming active\n"
|
||||
#define PRG_ONOU "Internal shutdown programming atcive\n"
|
||||
#define TIME_OFF "UPS Time power off %02d:%02d\n"
|
||||
#define TIME_ON "UPS Time power on %02d:%02d\n"
|
||||
#define PRG_ONOF "Shutdown programming not atived\n"
|
||||
#define PRG_ONOF "Shutdown programming not activated\n"
|
||||
#define TODAY_DD "Shutdown today at %02d:%02d\n"
|
||||
#define SHUT_NOW "Shutdown now!\n"
|
||||
#endif
|
||||
|
|
@ -129,7 +132,7 @@ static char* convdays( char *cop )
|
|||
}
|
||||
|
||||
alt[7] = 0; /* string terminator */
|
||||
|
||||
|
||||
stra = strdup( alt );
|
||||
return stra;
|
||||
}
|
||||
|
|
@ -149,7 +152,7 @@ static int Binary( char *nome )
|
|||
char ch, cc;
|
||||
int cont=0, nint = 1, tobin=0;
|
||||
int ex, nbin;
|
||||
|
||||
|
||||
while( *nome && ( cont < 7 ) ) {
|
||||
ch = *nome;
|
||||
if( !(IsBinary( ch ) ) )
|
||||
|
|
@ -166,7 +169,7 @@ static int Binary( char *nome )
|
|||
nome++;
|
||||
cont++;
|
||||
}
|
||||
|
||||
|
||||
if( nint == 0 )
|
||||
return nint;
|
||||
else
|
||||
|
|
@ -345,7 +348,7 @@ static void confups( void )
|
|||
|
||||
for(i=0; i < 12; i++)
|
||||
ser_send_char(upsfd, ConfigPack[i] );
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* print UPS internal variables */
|
||||
|
|
@ -363,7 +366,7 @@ static void prnInfo( void )
|
|||
dweek = DaysStd;
|
||||
|
||||
if( prgups > 0 ) {
|
||||
|
||||
|
||||
/* this is the string to binary standard */
|
||||
sunday = ( ( dweek & 0x40 ) == 0x40 );
|
||||
monday = ( ( dweek & 0x20 ) == 0x20 );
|
||||
|
|
@ -408,9 +411,9 @@ static int IsToday( unsigned char dweek, int nweek)
|
|||
case 6: /* saturday */
|
||||
return ( ( ( dweek & 0x01 ) == 0x01 ) );
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void AutonomyCalc( int iauto ) /* all models */
|
||||
|
|
@ -451,7 +454,7 @@ static void AutonomyCalc( int iauto ) /* all models */
|
|||
if( indice < min ) Autonomy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( BattExtension > 0 && iauto < 4 )
|
||||
Autonomy = ( Autonomy * ( BattExtension + bx ) * 1.0 / bx );
|
||||
|
||||
|
|
@ -459,7 +462,6 @@ static void AutonomyCalc( int iauto ) /* all models */
|
|||
|
||||
static void ScanReceivePack( void )
|
||||
{
|
||||
|
||||
int aux, im, ov = 0;
|
||||
|
||||
/* model independent data */
|
||||
|
|
@ -472,7 +474,7 @@ static void ScanReceivePack( void )
|
|||
/* Days of week if in UPS shutdown programming mode */
|
||||
if( prgups == 3 ) {
|
||||
DaysStd = revertdays( DaysOnWeek );
|
||||
|
||||
|
||||
/* time for programming UPS off */
|
||||
dhour = RecPack[15];
|
||||
dmin = RecPack[16];
|
||||
|
|
@ -480,12 +482,12 @@ static void ScanReceivePack( void )
|
|||
lhour = RecPack[13];
|
||||
lmin = RecPack[14];
|
||||
}
|
||||
|
||||
|
||||
/* UPS internal time */
|
||||
ihour = RecPack[11];
|
||||
imin = RecPack[10];
|
||||
isec = RecPack[9];
|
||||
|
||||
|
||||
if( ( ( 0x01 & RecPack[ 20 ] ) == 0x01 ) )
|
||||
Out220 = 1;
|
||||
CriticBatt = ( ( 0x04 & RecPack[ 20 ] ) == 0x04 );
|
||||
|
|
@ -507,14 +509,28 @@ static void ScanReceivePack( void )
|
|||
im = inds[imodel];
|
||||
ov = Out220;
|
||||
|
||||
if( RecPack[ 6 ] >= 194 )
|
||||
InVoltage = RecPack[ 6 ] * ctab[imodel].m_involt194[0] + ctab[imodel].m_involt194[1];
|
||||
else
|
||||
InVoltage = RecPack[ 6 ] * ctab[imodel].m_involt193[0] + ctab[imodel].m_involt193[1];
|
||||
|
||||
if (SolisModel != 16) {
|
||||
|
||||
if( RecPack[ 6 ] >= 194 )
|
||||
InVoltage = RecPack[ 6 ] * ctab[imodel].m_involt194[0] + ctab[imodel].m_involt194[1];
|
||||
else
|
||||
InVoltage = RecPack[ 6 ] * ctab[imodel].m_involt193[0] + ctab[imodel].m_involt193[1];
|
||||
} else {
|
||||
/* Code InVoltage for STAY1200_USB */
|
||||
|
||||
if ((RecPack[20] & 0x1) == 0) { //IsOutVoltage 220
|
||||
|
||||
InVoltage = RecPack[2] * ctab[imodel].m_involt193[0] + ctab[imodel].m_involt193[1];
|
||||
} else {
|
||||
|
||||
InVoltage = RecPack[2] * ctab[imodel].m_involt193[0] + ctab[imodel].m_involt193[1] - 3.0;
|
||||
}
|
||||
}
|
||||
|
||||
BattVoltage = RecPack[ 3 ] * ctab[imodel].m_battvolt[0] + ctab[imodel].m_battvolt[1];
|
||||
|
||||
|
||||
NominalPower = nompow[im];
|
||||
|
||||
if( SourceFail ) {
|
||||
OutVoltage = RecPack[ 1 ] * ctab[imodel].m_outvolt_i[ov][0] + ctab[imodel].m_outvolt_i[ov][1];
|
||||
OutCurrent = RecPack[ 5 ] * ctab[imodel].m_outcurr_i[ov][0] + ctab[imodel].m_outcurr_i[ov][1];
|
||||
|
|
@ -531,13 +547,75 @@ static void ScanReceivePack( void )
|
|||
InCurrent = ( ctab[imodel].m_incurr[0] * 1.0 / BattVoltage ) - ( AppPower * 1.0 / ctab[imodel].m_incurr[1] )
|
||||
+ OutCurrent *( OutVoltage * 1.0 / InVoltage );
|
||||
}
|
||||
if (SolisModel == 16) {
|
||||
|
||||
int configRelay = (RecPack[6] & 0x38) >> 3;
|
||||
double TENSAO_SAIDA_F1_MR[8] = { 1.1549, 1.0925, 0.0, 0.0, 1.0929, 1.0885, 0.0, 0.8654262224145391 };
|
||||
double TENSAO_SAIDA_F2_MR[8] = { -6.9157, 11.026, 10.43, 0.0, -0.6109, 12.18, 0.0, 13.677};
|
||||
|
||||
const double TENSAO_SAIDA_F2_MI[8] ={ 5.59, 9.47, 13.7, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||
const double TENSAO_SAIDA_F1_MI[8] = { 7.9, 9.1, 17.6, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||
|
||||
const double corrente_saida_F1_MR = 0.12970000389100012;
|
||||
const double corrente_saida_F2_MR = 0.5387060281204546;
|
||||
/* double corrente_saida_F1_MI = 0.1372;
|
||||
double corrente_saida_F2_MI = 0.3456; */
|
||||
|
||||
if (SourceFail) {
|
||||
if (RecPack[20] == 0) {
|
||||
double a = RecPack[1] * 2;
|
||||
a /= 128.0;
|
||||
// a = double sqrt(a);
|
||||
OutVoltage = RecPack[1] * a * TENSAO_SAIDA_F1_MI[configRelay] + TENSAO_SAIDA_F2_MI[configRelay];
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
OutCurrent = (float)(corrente_saida_F1_MR * RecPack[5] + corrente_saida_F2_MR);
|
||||
OutVoltage = RecPack[1] * TENSAO_SAIDA_F1_MR[configRelay] + TENSAO_SAIDA_F2_MR[configRelay];
|
||||
AppPower = OutCurrent * OutVoltage;
|
||||
|
||||
|
||||
|
||||
double RealPower = (RecPack[7] + RecPack[8] * 256);
|
||||
|
||||
double potVA1 = 5.968 * AppPower - 284.36;
|
||||
double potVA2 = 7.149 * AppPower - 567.18;
|
||||
double potLin = 0.1664 * RealPower + 49.182;
|
||||
double potRe = 0.1519 * RealPower + 32.644;
|
||||
if (fabs(potVA1 - RealPower) < fabs(potVA2 - RealPower)) {
|
||||
RealPower = potLin;
|
||||
} else {
|
||||
RealPower = potRe;
|
||||
|
||||
}
|
||||
if (OutCurrent < 0.7) {
|
||||
RealPower = AppPower;
|
||||
}
|
||||
if (AppPower < RealPower) {
|
||||
double f = AppPower;
|
||||
AppPower = RealPower;
|
||||
RealPower = f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
aux = ( RecPack[ 21 ] + RecPack[ 22 ] * 256 );
|
||||
if( aux > 0 )
|
||||
InFreq = ctab[imodel].m_infreq * 1.0 / aux;
|
||||
|
||||
/* Specific for STAY1200_USB */
|
||||
if (SolisModel == 16) {
|
||||
InFreq = ((float)(0.37 * (257 - (aux >> 8))));
|
||||
}
|
||||
else
|
||||
InFreq = 0;
|
||||
|
||||
|
||||
/* input voltage offset */
|
||||
if( InVoltage < InVolt_offset ) { /* all is equal 30 */
|
||||
InFreq = 0;
|
||||
|
|
@ -552,7 +630,7 @@ static void ScanReceivePack( void )
|
|||
ChargePowerFactor = 0;
|
||||
OutCurrent = 0;
|
||||
}
|
||||
|
||||
|
||||
if( im < 3 )
|
||||
AutonomyCalc( im );
|
||||
else
|
||||
|
|
@ -600,7 +678,7 @@ static void ScanReceivePack( void )
|
|||
SourceReturn = true;
|
||||
ser_flush_in(upsfd,"",0); /* clean port */
|
||||
}
|
||||
|
||||
|
||||
if( !( SourceFail ) == SourceLast ) {
|
||||
SourceReturn = false;
|
||||
FailureFlag = false;
|
||||
|
|
@ -702,101 +780,107 @@ CommReceive(const char *bufptr, int size)
|
|||
|
||||
int i, CheckSum, i_end;
|
||||
|
||||
if( size==25 )
|
||||
Waiting = 0;
|
||||
|
||||
switch( Waiting )
|
||||
{
|
||||
/* normal package */
|
||||
case 0:
|
||||
{
|
||||
if( size == 25 ) {
|
||||
i_end = 25;
|
||||
for( i = 0 ; i < i_end ; ++i ) {
|
||||
RecPack[i] = *bufptr;
|
||||
bufptr++;
|
||||
if( size == 25 ) {
|
||||
i_end = 25;
|
||||
for( i = 0 ; i < i_end ; ++i ) {
|
||||
RecPack[i] = *bufptr;
|
||||
bufptr++;
|
||||
}
|
||||
|
||||
if(nut_debug_level >= 3) {
|
||||
upsdebug_hex(3, "CommReceive: RecPack", RecPack, size);
|
||||
}
|
||||
|
||||
/* CheckSum verify */
|
||||
CheckSum = 0;
|
||||
i_end = 23;
|
||||
for( i = 0 ; i < i_end ; ++i )
|
||||
CheckSum = RecPack[ i ] + CheckSum;
|
||||
CheckSum = CheckSum % 256;
|
||||
|
||||
upsdebugx(4, "%s: calculated checksum = 0x%02x, RecPack[23] = 0x%02x", __func__, CheckSum, RecPack[23]);
|
||||
|
||||
ser_flush_in(upsfd,"",0); /* clean port */
|
||||
|
||||
/* correct package */
|
||||
/* 0xA0 is original solis.c; 0xB0 is for APC-branded Microsol units */
|
||||
|
||||
/* RecPack[0] identify the model number below.
|
||||
* SOLIS = 1;
|
||||
RHINO = 2;
|
||||
STAY = 3;
|
||||
SOLIS_LI_700 = 169;
|
||||
SOLIS_M11 = 171;
|
||||
SOLIS_M15 = 175;
|
||||
SOLIS_M14 = 174;
|
||||
SOLIS_M13 = 173;
|
||||
SOLISDC_M14 = 201;
|
||||
SOLISDC_M13 = 206;
|
||||
SOLISDC_M15 = 207;
|
||||
CABECALHO_RHINO = 194;
|
||||
PS800 = 185;
|
||||
STAY1200_USB = 186;
|
||||
PS350_CII = 184;
|
||||
PS2200 = 187;
|
||||
PS2200_22 = 188;
|
||||
STAY700_USB = 189;
|
||||
BZ1500 = 190;
|
||||
*/
|
||||
if( ( ( (RecPack[0] & 0xF0) == 0xA0 ) || (RecPack[0] & 0xF0) == 0xB0)
|
||||
&& ( RecPack[ 24 ] == 254 )
|
||||
&& ( RecPack[ 23 ] == CheckSum ) ) {
|
||||
&& ( RecPack[ 24 ] == 254 )
|
||||
&& ( RecPack[ 23 ] == CheckSum ) ) {
|
||||
|
||||
if(!(detected)) {
|
||||
SolisModel = (int) (RecPack[0] & 0x0F);
|
||||
|
||||
if (RecPack[0] == 186) {
|
||||
SolisModel = 16;
|
||||
} else {
|
||||
SolisModel = (int) (RecPack[0] & 0x0F);
|
||||
}
|
||||
if( SolisModel < 13 )
|
||||
imodel = SolisModel - 10; /* 10 = 0, 11 = 1 */
|
||||
else
|
||||
imodel = SolisModel - 11; /* 13 = 2, 14 = 3, 15 = 4 */
|
||||
|
||||
detected = true;
|
||||
|
||||
}
|
||||
|
||||
switch( SolisModel )
|
||||
{
|
||||
case 10: /* Added for APC-Branded Microsol units */
|
||||
{
|
||||
ScanReceivePack();
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
{
|
||||
ScanReceivePack();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
printf( M_UNKN );
|
||||
ScanReceivePack(); // Scan anyway.
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
{
|
||||
ScanReceivePack();
|
||||
break;
|
||||
}
|
||||
case 16: // STAY1200_USB model
|
||||
{
|
||||
ScanReceivePack();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
printf( M_UNKN );
|
||||
ScanReceivePack(); // Scan anyway.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
/* dumping package nothing to do yet */
|
||||
Waiting = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Waiting =0;
|
||||
|
||||
}
|
||||
|
||||
static void getbaseinfo(void)
|
||||
{
|
||||
|
||||
unsigned char temp[256];
|
||||
unsigned char tmp;
|
||||
#ifdef PORTUGUESE
|
||||
char diassemana[7][4]={"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"};
|
||||
const char diassemana[7][4]={"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"};
|
||||
#else
|
||||
char DaysOfWeek[7][4]={"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
const char DaysOfWeek[7][4]={"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
#endif
|
||||
char mycmd[8];
|
||||
char *str1, *str2, *str3, *str4, *strx;
|
||||
unsigned char Pacote[25];
|
||||
int i, i1=0, i2=0, j=0, tam, tpac=25;
|
||||
int i, i1=0, i2=0, tam;
|
||||
const int tpac=25;
|
||||
|
||||
time_t tmt;
|
||||
struct tm *now;
|
||||
|
|
@ -812,7 +896,7 @@ static void getbaseinfo(void)
|
|||
|
||||
#ifdef PORTUGUESE
|
||||
strcpy( seman, diassemana[weekn] );
|
||||
#else
|
||||
#else
|
||||
strcpy( seman, DaysOfWeek[weekn] );
|
||||
#endif
|
||||
|
||||
|
|
@ -860,29 +944,31 @@ static void getbaseinfo(void)
|
|||
DaysOnWeek = DaysOffWeek;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} /* end prgups 1 - 2 */
|
||||
|
||||
/* dummy read attempt to sync - throw it out */
|
||||
snprintf(mycmd, sizeof(mycmd), "%c%c",CMD_UPSCONT, ENDCHAR);
|
||||
ser_send(upsfd, "%s", mycmd);
|
||||
upsdebugx(3, "%s: sending CMD_UPSCONT and ENDCHAR to sync", __func__);
|
||||
ser_send(upsfd, "%c%c", CMD_UPSCONT, ENDCHAR);
|
||||
|
||||
/* trying detect solis model */
|
||||
while ( ( !detected ) && ( j < 20 ) ) {
|
||||
temp[0] = 0; /* flush temp buffer */
|
||||
tam = ser_get_buf_len(upsfd, temp, tpac, 3, 0);
|
||||
if( tam == 25 ) {
|
||||
for( i = 0 ; i < tam ; i++ ) {
|
||||
Pacote[i] = temp[i];
|
||||
}
|
||||
/* Read until end-of-response character (0xFE): */
|
||||
for(i=0; i<tpac*3; i++) {
|
||||
ser_get_char(upsfd, &tmp, 3, 0);
|
||||
if(tmp == RESP_END)
|
||||
break;
|
||||
}
|
||||
|
||||
if(tmp != RESP_END) {
|
||||
fatalx(EXIT_FAILURE, NO_SOLIS);
|
||||
} else {
|
||||
upsdebugx(4, "%s: requesting %d bytes from ser_get_buf_len()", __func__, tpac);
|
||||
tam = ser_get_buf_len(upsfd, Pacote, tpac, 3, 0);
|
||||
upsdebugx(2, "%s: received %d bytes from ser_get_buf_len()", __func__, tam);
|
||||
if(tam > 0 && nut_debug_level >= 4) {
|
||||
upsdebug_hex(4, "received from ser_get_buf_len()", Pacote, tam);
|
||||
}
|
||||
|
||||
j++;
|
||||
if( tam == 25)
|
||||
CommReceive((char *)Pacote, tam);
|
||||
else
|
||||
CommReceive((char *)temp, tam);
|
||||
} /* while end */
|
||||
CommReceive((char *)Pacote, tam);
|
||||
}
|
||||
|
||||
if( (!detected) ) {
|
||||
fatalx(EXIT_FAILURE, NO_SOLIS );
|
||||
|
|
@ -890,11 +976,8 @@ static void getbaseinfo(void)
|
|||
|
||||
switch( SolisModel )
|
||||
{
|
||||
case 10: /* Added for APC-Microsol units */
|
||||
{
|
||||
Model = "Back-UPS 1200 BR";
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
|
||||
case 11:
|
||||
case 12:
|
||||
{
|
||||
|
|
@ -916,6 +999,9 @@ static void getbaseinfo(void)
|
|||
Model = "Solis 3.0";
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
Model = "Microsol Back-Ups BZ1200-BR";
|
||||
break;
|
||||
}
|
||||
|
||||
/* if( isprogram ) */
|
||||
|
|
@ -955,8 +1041,6 @@ static void getbaseinfo(void)
|
|||
printf("Detected %s on %s\n", dstate_getinfo("ups.model"), device_path);
|
||||
|
||||
prnInfo();
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void getupdateinfo(void)
|
||||
|
|
@ -978,7 +1062,7 @@ static void getupdateinfo(void)
|
|||
isday = IsToday( DaysStd, weekn );
|
||||
else
|
||||
isday = IsToday( DaysStd, weekn );
|
||||
|
||||
|
||||
if( isday )
|
||||
printf( TODAY_DD, hourshut, minshut );
|
||||
|
||||
|
|
@ -986,7 +1070,7 @@ static void getupdateinfo(void)
|
|||
printf( SHUT_NOW );
|
||||
progshut = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* programable shutdown end block */
|
||||
|
||||
|
|
@ -994,8 +1078,15 @@ static void getupdateinfo(void)
|
|||
|
||||
/* get update package */
|
||||
temp[0] = 0; /* flush temp buffer */
|
||||
|
||||
upsdebugx(3, "%s: requesting %d bytes from ser_get_buf_len()", __func__, pacsize);
|
||||
tam = ser_get_buf_len(upsfd, temp, pacsize, 3, 0);
|
||||
|
||||
upsdebugx(2, "%s: received %d bytes from ser_get_buf_len()", __func__, tam);
|
||||
if(tam > 0 && nut_debug_level >= 4) {
|
||||
upsdebug_hex(4, "received from ser_get_buf_len()", temp, tam);
|
||||
}
|
||||
|
||||
CommReceive((char *)temp, tam);
|
||||
|
||||
}
|
||||
|
|
@ -1039,7 +1130,7 @@ void upsdrv_updateinfo(void)
|
|||
dstate_setinfo("input.voltage", "%03.1f", InVoltage);
|
||||
dstate_setinfo("battery.voltage", "%02.1f", BattVoltage);
|
||||
dstate_setinfo("battery.charge", "%03.1f", batcharge);
|
||||
|
||||
dstate_setinfo("output.current", "%03.1f", OutCurrent);
|
||||
status_init();
|
||||
|
||||
if (!SourceFail )
|
||||
|
|
@ -1067,25 +1158,26 @@ void upsdrv_updateinfo(void)
|
|||
|
||||
}
|
||||
|
||||
/* power down the attached load immediately */
|
||||
/*! @brief Power down the attached load immediately.
|
||||
* Basic idea: find out line status and send appropriate command.
|
||||
* - on battery: send normal shutdown, UPS will return by itself on utility
|
||||
* - on line: send shutdown+return, UPS will cycle and return soon.
|
||||
*/
|
||||
void upsdrv_shutdown(void)
|
||||
{
|
||||
|
||||
/* basic idea: find out line status and send appropriate command */
|
||||
/* on battery: send normal shutdown, ups will return by itself on utility */
|
||||
/* on line: send shutdown+return, ups will cycle and return soon */
|
||||
|
||||
if (!SourceFail) { /* on line */
|
||||
|
||||
printf("On line, sending shutdown+return command...\n");
|
||||
|
||||
upslogx(LOG_NOTICE, "On line, sending shutdown+return command...\n");
|
||||
ser_send_char(upsfd, CMD_SHUTRET );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("On battery, sending normal shutdown command...\n");
|
||||
upslogx(LOG_NOTICE, "On battery, sending normal shutdown command...\n");
|
||||
ser_send_char(upsfd, CMD_SHUT);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void upsdrv_help(void)
|
||||
|
|
@ -1120,7 +1212,7 @@ void upsdrv_makevartable(void)
|
|||
addvar(VAR_VALUE, "daysoff", "Days of week Driver shutdown");
|
||||
addvar(VAR_VALUE, "houron", "Power on hour (hh:mm)");
|
||||
addvar(VAR_VALUE, "houroff", "Power off hour (hh:mm)");
|
||||
|
||||
|
||||
}
|
||||
|
||||
void upsdrv_initups(void)
|
||||
|
|
|
|||
108
drivers/solis.h
108
drivers/solis.h
|
|
@ -22,7 +22,8 @@
|
|||
2004/10/30 - Version 0.40 - add model data structs
|
||||
2004/11/22 - Version 0.50 - add internal e external shutdown programming
|
||||
2005/06/16 - Version 0.60 - save external shutdown programming to ups,
|
||||
support new cables and Solaris compilation
|
||||
support new cables and Solaris compilation
|
||||
2015/09/19 - Version 0.63 - patch for correct reading for Microsol Back-Ups BZ1200-BR
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -33,12 +34,12 @@ typedef int bool_t;
|
|||
|
||||
/* autonomy constants */
|
||||
|
||||
int bext[5] = {14,18,28,18,1};
|
||||
int nompow[4] = { 1000,1500,2000,3000 };
|
||||
int inds[5] = { 0,0,1,2,3 };
|
||||
double InVolt_offset = 30.;
|
||||
const static int bext[5] = {14,18,28,18,1};
|
||||
const static int nompow[5] = { 1000,1500,2000,3000,1200 };
|
||||
const static int inds[6] = { 0,0,1,2,3,4 };
|
||||
const static double InVolt_offset = 30.;
|
||||
|
||||
struct {
|
||||
const static struct {
|
||||
int maxi; /* power internals */
|
||||
int minc[21]; /* power minimal index */
|
||||
int maxc[21]; /* power maximus index */
|
||||
|
|
@ -201,7 +202,7 @@ struct {
|
|||
* Solis constants for data ajustment
|
||||
* ----------------------------------------------------------- */
|
||||
|
||||
struct {
|
||||
const static struct {
|
||||
double m_infreq;
|
||||
double m_appp_offset;
|
||||
double m_involt193[2];
|
||||
|
|
@ -216,7 +217,7 @@ struct {
|
|||
double m_utilp_i[2][2];
|
||||
double m_appp_s[2][2];
|
||||
double m_appp_i[2][2];
|
||||
} ctab[5] =
|
||||
} ctab[6] =
|
||||
{
|
||||
{ 101620.0, 25.0,
|
||||
{ 1.141, 13.0 },
|
||||
|
|
@ -287,21 +288,56 @@ struct {
|
|||
{ { 1.0/4.78, 52.0 }, { 1.0/4.55, 55.0 } },
|
||||
{ { 1.0/5.15, 29.0 }, { 1.0/4.8, 26.0 } },
|
||||
{ { 1.0/4.78, 52.0 }, { 1.0/4.55, 55.0 } }
|
||||
},
|
||||
|
||||
/*STAY1200_USB
|
||||
|
||||
double m_infreq;
|
||||
double m_appp_offset;
|
||||
double m_involt193[2];
|
||||
double m_involt194[2];
|
||||
double m_incurr[2];
|
||||
double m_battvolt[2];
|
||||
double m_outvolt_s[2][2];
|
||||
double m_outvolt_i[2][2];
|
||||
double m_outcurr_s[2][2];
|
||||
double m_outcurr_i[2][2];
|
||||
double m_utilp_s[2][2];
|
||||
double m_utilp_i[2][2];
|
||||
double m_appp_s[2][2];
|
||||
double m_appp_i[2][2];
|
||||
|
||||
|
||||
*/
|
||||
{ 101800.0, //m_infreq
|
||||
56.0, //m_appp_offset
|
||||
{ 1.64, 9.34 },// m_involt193 - ok
|
||||
{ 2.5, -250.0 }, //m_involt194
|
||||
{ 35.0, 1000.0 }, //m_incurr
|
||||
{ 0.1551, 0.2525 }, //m_battvolt
|
||||
{ { 1.41, 13.0 }, { 1.4, 17.0 } }, //m_outvolt_s
|
||||
{ { 2.73, 25.0 }, { 2.73, 30.0 } }, //m_outvolt_i
|
||||
{ { 1.0/8.15, 0.25 }, { 1.0/8.15, 0.25 } }, //m_outcurr_s
|
||||
{ { 1.0/16.0, 0.4 }, { 1.0/15.0, 0.4 } }, //m_outcurr_i
|
||||
{ { 1.0/4.87, 19.0 }, { 1.0/4.55, 17.0 } }, //m_utilp_s
|
||||
{ { 1.0/4.78, 52.0 }, { 1.0/4.55, 55.0 } }, //m_utilp_i
|
||||
{ { 1.0/5.15, 29.0 }, { 1.0/4.8, 26.0 } }, //m__app_s
|
||||
{ { 1.0/4.78, 52.0 }, { 1.0/4.55, 55.0 } } //m_app_i
|
||||
}
|
||||
};
|
||||
|
||||
/* Date, time and programming group */
|
||||
static int const BASE_YEAR = 1998;
|
||||
int Day, Month, Year;
|
||||
int isprogram = 0, progshut = 0, prgups = 0;
|
||||
int dian=0, mesn=0, anon=0, weekn=0;
|
||||
int dhour, dmin, lhour, lmin, ihour,imin, isec, hourshut, minshut;
|
||||
unsigned char DaysOnWeek=0, DaysOffWeek=0, DaysStd = 0;
|
||||
char seman[4];
|
||||
static int Day, Month, Year;
|
||||
static int isprogram = 0, progshut = 0, prgups = 0;
|
||||
static int dian=0, mesn=0, anon=0, weekn=0;
|
||||
static int dhour, dmin, lhour, lmin, ihour,imin, isec, hourshut, minshut;
|
||||
static unsigned char DaysOnWeek=0, DaysOffWeek=0, DaysStd = 0;
|
||||
static char seman[4];
|
||||
|
||||
/* buffers */
|
||||
unsigned char RecPack[25];
|
||||
unsigned char ConfigPack[12];
|
||||
static unsigned char RecPack[25];
|
||||
static unsigned char ConfigPack[12];
|
||||
|
||||
/*
|
||||
unsigned char MibData[161];
|
||||
|
|
@ -309,37 +345,35 @@ unsigned char DumpPack[242];
|
|||
*/
|
||||
|
||||
/* Identification */
|
||||
const char *Model;
|
||||
int SolisModel, imodel;
|
||||
int InputValue, Out220;
|
||||
static const char *Model;
|
||||
static int SolisModel, imodel;
|
||||
static int InputValue, Out220;
|
||||
|
||||
/* protocol */
|
||||
int Waiting, NumByteRec = 0;
|
||||
int pacsize;
|
||||
static int pacsize;
|
||||
|
||||
/* Status group */
|
||||
unsigned char InputStatus,OutputStatus, BattStatus, StatusGeral;
|
||||
static unsigned char InputStatus,OutputStatus, BattStatus;
|
||||
/* Events group */
|
||||
unsigned char SourceEvents, OutputEvents, BattEvents, GeneralEvents;
|
||||
static unsigned char SourceEvents, OutputEvents, BattEvents;
|
||||
|
||||
/* logical */
|
||||
bool_t detected = 0;
|
||||
bool_t SourceFail, SourceLast, FailureFlag, SourceReturn, SuperHeat;
|
||||
bool_t SuperHeatLast, OverCharge, OverChargeLast, LowBatt;
|
||||
bool_t CriticBatt, CriticBattLast, Flag_inversor, InversorOn, InversorOnLast;
|
||||
static bool_t detected = 0;
|
||||
static bool_t SourceFail, SourceLast, FailureFlag, SourceReturn, SuperHeat;
|
||||
static bool_t SuperHeatLast, OverCharge, OverChargeLast, LowBatt;
|
||||
static bool_t CriticBatt, CriticBattLast, Flag_inversor, InversorOn, InversorOnLast;
|
||||
|
||||
/* Input group */
|
||||
double InVoltage, InCurrent, InFreq;
|
||||
double InDownLim, InUpLim, NomInVolt;
|
||||
static double InVoltage, InCurrent, InFreq;
|
||||
static double InDownLim, InUpLim, NomInVolt;
|
||||
/* Output group */
|
||||
double OutVoltage, OutCurrent, OutFreq, OutDownLim, OutUpLim, NomOutVolt;
|
||||
static double OutVoltage, OutCurrent, OutFreq, OutDownLim, OutUpLim, NomOutVolt;
|
||||
/* Battery group */
|
||||
int Autonomy, BattExtension, maxauto;
|
||||
double BattVoltage, BattCurrent, Temperature, batcharge;
|
||||
double Bat_LimInfRede, Bat_LimSupRede, Bat_LimInfInv, Bat_LimSupInv, Bat_VoltNom;
|
||||
static int Autonomy, BattExtension, maxauto;
|
||||
static double BattVoltage, Temperature, batcharge;
|
||||
/* Power group */
|
||||
double AppPower, UtilPower, upscharge;
|
||||
int ChargePowerFactor, NominalPower, UpsPowerFactor;
|
||||
static double AppPower, UtilPower, upscharge;
|
||||
static int ChargePowerFactor, NominalPower, UpsPowerFactor;
|
||||
|
||||
static void prnInfo(void);
|
||||
static int IsToday( unsigned char, int );
|
||||
|
|
@ -350,7 +384,3 @@ static void getbaseinfo(void);
|
|||
static void getupdateinfo(void);
|
||||
|
||||
#endif /* INCLUDED_SOLIS_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "tripplite-hid.h"
|
||||
#include "usb-common.h"
|
||||
|
||||
#define TRIPPLITE_HID_VERSION "TrippLite HID 0.81"
|
||||
#define TRIPPLITE_HID_VERSION "TrippLite HID 0.82"
|
||||
/* FIXME: experimental flag to be put in upsdrv_info */
|
||||
|
||||
|
||||
|
|
@ -40,6 +40,10 @@
|
|||
*/
|
||||
static double battery_scale = 1.0;
|
||||
|
||||
static double io_voltage_scale = 1.0;
|
||||
static double io_frequency_scale = 1.0;
|
||||
static double io_current_scale = 1.0;
|
||||
|
||||
/* Specific handlers for USB device matching */
|
||||
static void *battery_scale_1dot0(USBDevice_t *device)
|
||||
{
|
||||
|
|
@ -52,6 +56,14 @@ static void *battery_scale_0dot1(USBDevice_t *device)
|
|||
battery_scale = 0.1;
|
||||
return NULL;
|
||||
}
|
||||
static void *smart1500lcdt_scale(USBDevice_t *device)
|
||||
{
|
||||
battery_scale = 100000.0;
|
||||
io_voltage_scale = 100000.0;
|
||||
io_frequency_scale = 0.01;
|
||||
io_current_scale = 0.01;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* TrippLite */
|
||||
#define TRIPPLITE_VENDORID 0x09ae
|
||||
|
|
@ -96,7 +108,7 @@ static usb_device_id_t tripplite_usb_device_table[] = {
|
|||
/* e.g. ? */
|
||||
{ USB_DEVICE(TRIPPLITE_VENDORID, 0x3015), battery_scale_1dot0 },
|
||||
/* e.g. TrippLite Smart1500LCD (newer unit) */
|
||||
{ USB_DEVICE(TRIPPLITE_VENDORID, 0x3016), battery_scale_1dot0 },
|
||||
{ USB_DEVICE(TRIPPLITE_VENDORID, 0x3016), smart1500lcdt_scale },
|
||||
/* e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) */
|
||||
{ USB_DEVICE(TRIPPLITE_VENDORID, 0x4001), battery_scale_1dot0 },
|
||||
/* e.g. TrippLite SmartOnline SU6000RT4U? */
|
||||
|
|
@ -175,6 +187,45 @@ static info_lkp_t tripplite_battvolt[] = {
|
|||
{ 0, NULL, tripplite_battvolt_fun }
|
||||
};
|
||||
|
||||
static const char *tripplite_iovolt_fun(double value)
|
||||
{
|
||||
static char buf[8];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%.1f", io_voltage_scale * value);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static info_lkp_t tripplite_iovolt[] = {
|
||||
{ 0, NULL, tripplite_iovolt_fun }
|
||||
};
|
||||
|
||||
static const char *tripplite_iofreq_fun(double value)
|
||||
{
|
||||
static char buf[8];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%.1f", io_frequency_scale * value);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static info_lkp_t tripplite_iofreq[] = {
|
||||
{ 0, NULL, tripplite_iofreq_fun }
|
||||
};
|
||||
|
||||
static const char *tripplite_ioamp_fun(double value)
|
||||
{
|
||||
static char buf[8];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%.1f", io_current_scale * value);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static info_lkp_t tripplite_ioamp[] = {
|
||||
{ 0, NULL, tripplite_ioamp_fun }
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------- */
|
||||
/* Vendor-specific usage table */
|
||||
/* --------------------------------------------------------------- */
|
||||
|
|
@ -279,7 +330,7 @@ static hid_info_t tripplite_hid2nut[] = {
|
|||
#endif /* USBHID_UPS_TRIPPLITE_DEBUG */
|
||||
|
||||
/* Device page */
|
||||
{ "device.part", 0, 0, "UPS.TLCustom.[1].iUPSPartNumber", NULL, "%.0f", 0, stringid_conversion },
|
||||
{ "device.part", 0, 0, "UPS.TLCustom.[1].iUPSPartNumber", NULL, "%s", HU_FLAG_STATIC, stringid_conversion },
|
||||
|
||||
/* Battery page */
|
||||
{ "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL },
|
||||
|
|
@ -363,9 +414,9 @@ static hid_info_t tripplite_hid2nut[] = {
|
|||
|
||||
/* Input page */
|
||||
{ "input.voltage.nominal", 0, 0, "UPS.PowerSummary.Input.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL },
|
||||
{ "input.voltage", 0, 0, "UPS.PowerSummary.Input.Voltage", NULL, "%.1f", 0, NULL },
|
||||
{ "input.voltage", 0, 0, "UPS.PowerConverter.Input.Voltage", NULL, "%.1f", 0, NULL },
|
||||
{ "input.frequency", 0, 0, "UPS.PowerConverter.Input.Frequency", NULL, "%.1f", 0, NULL },
|
||||
{ "input.voltage", 0, 0, "UPS.PowerSummary.Input.Voltage", NULL, "%s", 0, tripplite_iovolt },
|
||||
{ "input.voltage", 0, 0, "UPS.PowerConverter.Input.Voltage", NULL, "%s", 0, tripplite_iovolt },
|
||||
{ "input.frequency", 0, 0, "UPS.PowerConverter.Input.Frequency", NULL, "%s", 0, tripplite_iofreq },
|
||||
{ "input.transfer.low", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Output.LowVoltageTransfer", NULL, "%.1f", HU_FLAG_SEMI_STATIC, NULL },
|
||||
{ "input.transfer.low.max", 0, 0, "UPS.PowerConverter.Output.TLLowVoltageTransferMax", NULL, "%.0f", HU_FLAG_STATIC, NULL },
|
||||
{ "input.transfer.low.min", 0, 0, "UPS.PowerConverter.Output.TLLowVoltageTransferMin", NULL, "%.0f", HU_FLAG_STATIC, NULL },
|
||||
|
|
@ -375,11 +426,11 @@ static hid_info_t tripplite_hid2nut[] = {
|
|||
|
||||
/* Output page */
|
||||
{ "output.voltage.nominal", 0, 0, "UPS.Flow.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL },
|
||||
{ "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.1f", 0, NULL },
|
||||
{ "output.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.1f", 0, NULL },
|
||||
{ "output.current", 0, 0, "UPS.PowerConverter.Output.Current", NULL, "%.2f", 0, NULL },
|
||||
{ "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%s", 0, tripplite_iovolt },
|
||||
{ "output.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%s", 0, tripplite_iovolt },
|
||||
{ "output.current", 0, 0, "UPS.PowerConverter.Output.Current", NULL, "%s", 0, tripplite_ioamp },
|
||||
{ "output.frequency.nominal", 0, 0, "UPS.Flow.ConfigFrequency", NULL, "%.0f", HU_FLAG_STATIC, NULL },
|
||||
{ "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", NULL, "%.1f", 0, NULL },
|
||||
{ "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", NULL, "%s", 0, tripplite_iofreq },
|
||||
|
||||
/* instant commands. */
|
||||
{ "test.battery.start.quick", 0, 0, "UPS.BatterySystem.Test", NULL, "1", HU_TYPE_CMD, NULL }, /* reported to work on OMNI1000 */
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@
|
|||
#include "serial.h"
|
||||
|
||||
#define DRIVER_NAME "Tripp Lite SmartOnline driver"
|
||||
#define DRIVER_VERSION "0.03"
|
||||
#define DRIVER_VERSION "0.05"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
|
@ -296,7 +296,7 @@ static int do_command(char type, const char *command, const char *parameters, ch
|
|||
I don't like that, so I remove them. This is safe to
|
||||
do with all responses for this protocol, so I just
|
||||
do that here. */
|
||||
rtrim(response, ' ');
|
||||
str_rtrim(response, ' ');
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -552,6 +552,11 @@ static int init_comm(void)
|
|||
char response[MAX_RESPONSE_LENGTH];
|
||||
|
||||
ups.commands_available = 0;
|
||||
/* Repeat enumerate command 2x, firmware bug on some units garbles 1st response */
|
||||
if (do_command(POLL, AVAILABLE, "", response) <= 0){
|
||||
upslogx(LOG_NOTICE, "init_comm: Initial response malformed, retrying in 300ms");
|
||||
usleep(3E5);
|
||||
}
|
||||
if (do_command(POLL, AVAILABLE, "", response) <= 0)
|
||||
return 0;
|
||||
i = strlen(response);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
#include <math.h>
|
||||
|
||||
#define DRIVER_NAME "UPScode II UPS driver"
|
||||
#define DRIVER_VERSION "0.88"
|
||||
#define DRIVER_VERSION "0.89"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
||||
|
|
@ -1046,7 +1046,7 @@ static int upscrecv(char *buf)
|
|||
} else if (res == 0) {
|
||||
upsdebugx(3, "upscrecv: Timeout");
|
||||
} else {
|
||||
upsdebugx(3, "upscrecv: %u bytes:\t'%s'", res-1, rtrim(buf, ENDCHAR));
|
||||
upsdebugx(3, "upscrecv: %u bytes:\t'%s'", res-1, str_rtrim(buf, ENDCHAR));
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -38,12 +38,13 @@
|
|||
* corresponding string did not exist or could not be retrieved.
|
||||
*/
|
||||
typedef struct USBDevice_s {
|
||||
uint16_t VendorID; /*!< Device's Vendor ID */
|
||||
uint16_t ProductID; /*!< Device's Product ID */
|
||||
char *Vendor; /*!< Device's Vendor Name */
|
||||
char *Product; /*!< Device's Product Name */
|
||||
char *Serial; /* Product serial number */
|
||||
char *Bus; /* Bus name, e.g. "003" */
|
||||
uint16_t VendorID; /*!< Device's Vendor ID */
|
||||
uint16_t ProductID; /*!< Device's Product ID */
|
||||
char *Vendor; /*!< Device's Vendor Name */
|
||||
char *Product; /*!< Device's Product Name */
|
||||
char *Serial; /*!< Product serial number */
|
||||
char *Bus; /*!< Bus name, e.g. "003" */
|
||||
uint16_t bcdDevice; /*!< Device release number */
|
||||
} USBDevice_t;
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#define DRIVER_NAME "Generic HID driver"
|
||||
#define DRIVER_VERSION "0.39"
|
||||
#define DRIVER_VERSION "0.41"
|
||||
|
||||
#include "main.h"
|
||||
#include "libhid.h"
|
||||
|
|
@ -753,7 +753,7 @@ void upsdrv_makevartable(void)
|
|||
void upsdrv_updateinfo(void)
|
||||
{
|
||||
hid_info_t *item;
|
||||
HIDData_t *event[MAX_EVENT_NUM];
|
||||
HIDData_t *event[MAX_EVENT_NUM], *found_data;
|
||||
int i, evtCount;
|
||||
double value;
|
||||
time_t now;
|
||||
|
|
@ -826,7 +826,15 @@ void upsdrv_updateinfo(void)
|
|||
}
|
||||
|
||||
/* Skip Input reports, if we don't use the Feature report */
|
||||
item = find_hid_info(FindObject_with_Path(pDesc, &(event[i]->Path), interrupt_only ? ITEM_INPUT:ITEM_FEATURE));
|
||||
found_data = FindObject_with_Path(pDesc, &(event[i]->Path), interrupt_only ? ITEM_INPUT:ITEM_FEATURE);
|
||||
if(!found_data && !interrupt_only) {
|
||||
found_data = FindObject_with_Path(pDesc, &(event[i]->Path), ITEM_INPUT);
|
||||
}
|
||||
if(!found_data) {
|
||||
upsdebugx(2, "Could not find event as either ITEM_INPUT or ITEM_FEATURE?");
|
||||
continue;
|
||||
}
|
||||
item = find_hid_info(found_data);
|
||||
if (!item) {
|
||||
upsdebugx(3, "NUT doesn't use this HID object");
|
||||
continue;
|
||||
|
|
@ -1481,6 +1489,11 @@ static hid_info_t *find_hid_info(const HIDData_t *hiddata)
|
|||
{
|
||||
hid_info_t *hidups_item;
|
||||
|
||||
if(!hiddata) {
|
||||
upsdebugx(2, "%s: hiddata == NULL", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (hidups_item = subdriver->hid2nut; hidups_item->info_type != NULL ; hidups_item++) {
|
||||
|
||||
/* Skip server side vars */
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
* static info_lkp_t onbatt_info[] = {
|
||||
* { 1, "OB" },
|
||||
* { 2, "OL" },
|
||||
* { 0, "NULL" }
|
||||
* { 0, NULL }
|
||||
* };
|
||||
*/
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ static snmp_info_t xppc_mib[] = {
|
|||
* static info_lkp_t onbatt_info[] = {
|
||||
* { 1, "OB" },
|
||||
* { 2, "OL" },
|
||||
* { 0, "NULL" }
|
||||
* { 0, NULL }
|
||||
* };
|
||||
*/
|
||||
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Tripp Lite / Phoenixtec",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue