diff options
Diffstat (limited to 'sysutils/ups-nut/patches')
-rw-r--r-- | sysutils/ups-nut/patches/patch-aa | 24 | ||||
-rw-r--r-- | sysutils/ups-nut/patches/patch-ab | 127 | ||||
-rw-r--r-- | sysutils/ups-nut/patches/patch-ac | 102 |
3 files changed, 222 insertions, 31 deletions
diff --git a/sysutils/ups-nut/patches/patch-aa b/sysutils/ups-nut/patches/patch-aa index af24a1f1874..a9a7a2bc74d 100644 --- a/sysutils/ups-nut/patches/patch-aa +++ b/sysutils/ups-nut/patches/patch-aa @@ -1,13 +1,13 @@ -$NetBSD: patch-aa,v 1.9 2004/02/15 13:14:25 lukem Exp $ +$NetBSD: patch-aa,v 1.10 2011/07/29 15:11:40 bouyer Exp $ ---- conf/Makefile.in.orig Tue Sep 3 09:23:02 2002 -+++ conf/Makefile.in Sat Feb 14 22:02:46 2004 -@@ -4,7 +4,7 @@ - prefix = @prefix@ - exec_prefix = @exec_prefix@ - --CONFPATH = $(DESTDIR)@sysconfdir@ -+CONFPATH = $(DESTDIR)@prefix@/share/examples/nut - - INSTALLCMD = @INSTALL@ - +--- conf/Makefile.in.orig 2011-06-27 14:45:05.000000000 +0200 ++++ conf/Makefile.in 2011-06-27 14:49:32.000000000 +0200 +@@ -109,7 +109,7 @@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ +-CONFPATH = @CONFPATH@ ++CONFPATH = $(DESTDIR)@prefix@/share/examples/nut + CPP = @CPP@ + CPPFLAGS = @CPPFLAGS@ + CYGPATH_W = @CYGPATH_W@ diff --git a/sysutils/ups-nut/patches/patch-ab b/sysutils/ups-nut/patches/patch-ab index 2c31e89ce05..c19a943ffc0 100644 --- a/sysutils/ups-nut/patches/patch-ab +++ b/sysutils/ups-nut/patches/patch-ab @@ -1,25 +1,114 @@ -$NetBSD: patch-ab,v 1.10 2008/01/30 22:10:13 ghen Exp $ +$NetBSD: patch-ab,v 1.11 2011/07/29 15:11:40 bouyer Exp $ ---- Makefile.in.orig 2006-11-08 03:08:45.000000000 +0100 -+++ Makefile.in -@@ -41,7 +41,7 @@ distclean: clean - rm $$i/Makefile; \ - done +Keep trying initialisation if we get a timeout or network error while +probing the device. +Submitted upstream as tracker #313195 + +--- drivers/snmp-ups.c.orig 2011-05-31 12:36:49.000000000 +0200 ++++ drivers/snmp-ups.c 2011-06-29 13:16:16.000000000 +0200 +@@ -76,6 +76,9 @@ + const char *mibname; + const char *mibvers; + ++int nut_snmp_err; /* saved snmp error from nut_snmp_get */ ++int nut_sys_err; /* saved system errno from nut_snmp_get */ ++ + static void disable_transfer_oids(void); + + #define DRIVER_NAME "Generic SNMP UPS driver" +@@ -225,15 +228,15 @@ + + /* FIXME: first test if the device is reachable to avoid timeouts! */ + +- /* Load the SNMP to NUT translation data */ +- load_mib2nut(mibs); +- + /* init polling frequency */ + if (getval(SU_VAR_POLLFREQ)) + pollfreq = atoi(getval(SU_VAR_POLLFREQ)); + else + pollfreq = DEFAULT_POLLFREQ; + ++ /* Load the SNMP to NUT translation data */ ++ load_mib2nut(mibs); ++ + /* Get UPS Model node to see if there's a MIB */ + su_info_p = su_find_info("ups.model"); + status = nut_snmp_get_str(su_info_p->OID, model, sizeof(model), NULL); +@@ -393,6 +396,9 @@ + size_t name_len = MAX_OID_LEN; + static unsigned int numerr = 0; + ++ nut_sys_err = 0; ++ nut_snmp_err = 0; ++ + upsdebugx(3, "nut_snmp_get(%s)", OID); + + /* create and send request. */ +@@ -411,8 +417,10 @@ + + status = snmp_synch_response(g_snmp_sess_p, pdu, &response); + +- if (!response) ++ if (!response) { ++ snmp_error(g_snmp_sess_p, &nut_sys_err, &nut_snmp_err, NULL); + return NULL; ++ } --install: install-dirs install-bin install-man install-data -+install: install-dirs install-bin install-man install-conf install-data + if (!((status == STAT_SUCCESS) && (response->errstat == SNMP_ERR_NOERROR))) + { +@@ -431,7 +439,7 @@ - install-bin: - @for i in $(SUBDIRS); do \ -@@ -72,9 +72,10 @@ build-cgi-fake: - @echo "Run 'configure --with-cgi' before doing 'make cgi'." + if ((numerr < SU_ERR_LIMIT) || ((numerr % SU_ERR_RATE) == 0)) + nut_snmp_perror(g_snmp_sess_p, status, response, +- "nut_snmp_get: %s", OID); ++ "nut_snmp_get: %s", OID); - build-cgi: -+ @cd common; $(MAKE); cd ..; - @cd clients; $(MAKE) cgi; cd ..; + snmp_free_pdu(response); + response = NULL; +@@ -718,6 +726,7 @@ + { + int i; + char buf[LARGEBUF]; ++ int snmp_timeout = 0; --install-cgi: cgi install-cgi-dir install-dirs install-cgi-bin install-cgi-man install-cgi-html -+install-cgi: cgi install-cgi-dir install-dirs install-cgi-conf install-cgi-bin install-cgi-man install-cgi-html + upsdebugx(2, "SNMP UPS driver : entering load_mib2nut(%s)", mib); - install-cgi-dir: - if (test ! -d $(CGIPATH)) then \ +@@ -728,12 +737,16 @@ + * APHEL-GENESIS-II-MIB => .iso.org.dod.internet.private.enterprises.17373 + * APHEL Revelation MIB => .iso.org.dod.internet.private.enterprises.534.6.6.6 + */ ++again: + for (i = 0; mib2nut[i] != NULL; i++) { + if (strcmp(mib, "auto") && strcmp(mib, mib2nut[i]->mib_name)) { + continue; + } + upsdebugx(1, "load_mib2nut: trying %s mib", mib2nut[i]->mib_name); + if (!nut_snmp_get_str(mib2nut[i]->oid_auto_check, buf, sizeof(buf), NULL)) { ++ if (nut_snmp_err == SNMPERR_BAD_SENDTO || ++ nut_snmp_err == SNMPERR_TIMEOUT) ++ snmp_timeout++; + continue; + } + snmp_info = mib2nut[i]->snmp_info; +@@ -743,6 +756,20 @@ + upsdebugx(1, "load_mib2nut: using %s mib", mibname); + return TRUE; + } ++ if (snmp_timeout > 0) { ++ upslogx(LOG_WARNING, "timeout while probing %s", ++ upsname?upsname:device_name); ++ snmp_timeout = 0; ++ if (sleep(pollfreq) == 0) { ++ /* ++ * we're likely to end up in background if started ++ * from upsdrvctl so enable syslog now ++ */ ++ syslogbit_set(); ++ goto again; ++ } ++ } ++ + /* Did we find something or is it really an unknown mib */ + if (strcmp(mib, "auto") != 0) { + fatalx(EXIT_FAILURE, "Unknown mibs value: %s", mib); diff --git a/sysutils/ups-nut/patches/patch-ac b/sysutils/ups-nut/patches/patch-ac new file mode 100644 index 00000000000..810051d175f --- /dev/null +++ b/sysutils/ups-nut/patches/patch-ac @@ -0,0 +1,102 @@ +$NetBSD: patch-ac,v 1.7 2011/07/29 15:11:40 bouyer Exp $ + +Improve netvision handling (especially, add 3-phase support) +Submitted upstream as tracker #313197 + +--- drivers/netvision-mib.c.orig 2011-05-31 12:36:49.000000000 +0200 ++++ drivers/netvision-mib.c 2011-06-30 00:12:14.000000000 +0200 +@@ -49,8 +49,12 @@ + #define NETVISION_OID_BATT_VOLTS ".1.3.6.1.4.1.4555.1.1.1.1.2.5.0" + + #define NETVISION_OID_INPUT_NUM_LINES ".1.3.6.1.4.1.4555.1.1.1.1.3.1.0" /* 1phase or 3phase UPS input */ ++#define NETVISION_OID_INPUT_FREQ ".1.3.6.1.4.1.4555.1.1.1.1.3.2.0" + #define NETVISION_OID_OUTPUT_NUM_LINES ".1.3.6.1.4.1.4555.1.1.1.1.4.3.0" /* 1phase or 3phase UPS output */ ++#define NETVISION_OID_OUTPUT_FREQ ".1.3.6.1.4.1.4555.1.1.1.1.4.2.0" + ++#define NETVISION_OID_BYPASS_FREQ ".1.3.6.1.4.1.4555.1.1.1.1.5.1.0" ++#define NETVISION_OID_BYPASS_NUM_LINES ".1.3.6.1.4.1.4555.1.1.1.1.5.2.0" /* 1phase or 3phase UPS input */ + /* + three phase ups provide input/output/load for each phase + in case of one-phase output, only _P1 should be used +@@ -60,19 +64,31 @@ + #define NETVISION_OID_OUT_CURRENT_P1 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.3.1" + #define NETVISION_OID_OUT_LOAD_PCT_P1 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.4.1" + #define NETVISION_OID_IN_VOLTAGE_P1 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.5.1" ++#define NETVISION_OID_IN_CURRENT_P1 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.3.1" ++#define NETVISION_OID_BY_VOLTAGE_P1 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.2.1" ++#define NETVISION_OID_BY_CURRENT_P1 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.3.1" + + #define NETVISION_OID_OUT_VOLTAGE_P2 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.2.2" + #define NETVISION_OID_OUT_CURRENT_P2 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.3.2" + #define NETVISION_OID_OUT_LOAD_PCT_P2 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.4.2" + #define NETVISION_OID_IN_VOLTAGE_P2 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.5.2" ++#define NETVISION_OID_IN_CURRENT_P2 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.3.2" ++#define NETVISION_OID_BY_VOLTAGE_P2 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.2.2" ++#define NETVISION_OID_BY_CURRENT_P2 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.3.2" + + #define NETVISION_OID_OUT_VOLTAGE_P3 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.2.3" + #define NETVISION_OID_OUT_CURRENT_P3 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.3.3" + #define NETVISION_OID_OUT_LOAD_PCT_P3 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.4.3" + #define NETVISION_OID_IN_VOLTAGE_P3 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.5.3" ++#define NETVISION_OID_IN_CURRENT_P3 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.3.3" ++#define NETVISION_OID_BY_VOLTAGE_P3 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.2.3" ++#define NETVISION_OID_BY_CURRENT_P3 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.3.3" + + #define NETVISION_OID_OUTPUT_SOURCE ".1.3.6.1.4.1.4555.1.1.1.1.4.1.0" + ++#define NETVISION_OID_CONTROL_STATUS ".1.3.6.1.4.1.4555.1.1.1.1.8.1" ++#define NETVISION_OID_CONTROL_SHUTDOWN_DELAY ".1.3.6.1.4.1.4555.1.1.1.1.8.2" ++ + static info_lkp_t netvision_output_info[] = { + { 1, "" }, /* output source other */ + { 2, "" }, /* output source none */ +@@ -102,12 +118,45 @@ + SU_FLAG_OK | SU_STATUS_PWR, &netvision_output_info[0] }, + + /* ups load */ +- { "ups.load", 0, 1, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_FLAG_OK, NULL }, ++ { "ups.load", 0, 1, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_INPUT_1, NULL }, + + /*ups input,output voltage, output frquency phase 1 */ +- { "input.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, 0, SU_FLAG_OK, NULL }, +- { "output.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, 0, SU_FLAG_OK, NULL }, +- { "output.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, 0, SU_FLAG_OK, NULL }, ++ { "input.phases", 0, 1.0, NETVISION_OID_INPUT_NUM_LINES, 0, SU_FLAG_SETINT, NULL, &input_phases }, ++ { "input.frequency", 0, 0.1, NETVISION_OID_INPUT_FREQ, 0, SU_FLAG_OK, NULL }, ++ { "input.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, 0, SU_INPUT_1, NULL }, ++ { "input.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P1, 0, SU_INPUT_1, NULL }, ++ { "input.L1-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, 0, SU_INPUT_3, NULL }, ++ { "input.L1.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P1, 0, SU_INPUT_3, NULL }, ++ { "input.L2-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P2, 0, SU_INPUT_3, NULL }, ++ { "input.L2.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P2, 0, SU_INPUT_3, NULL }, ++ { "input.L3-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P3, 0, SU_INPUT_3, NULL }, ++ { "input.L3.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P3, 0, SU_INPUT_3, NULL }, ++ ++ { "output.phases", 0, 1.0, NETVISION_OID_OUTPUT_NUM_LINES, 0, SU_FLAG_SETINT, NULL, &output_phases }, ++ { "output.frequency", 0, 0.1, NETVISION_OID_OUTPUT_FREQ, 0, SU_FLAG_OK, NULL }, ++ { "output.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, 0, SU_OUTPUT_1, NULL }, ++ { "output.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, 0, SU_OUTPUT_1, NULL }, ++ { "output.load", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_OUTPUT_1, NULL }, ++ { "output.L1-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, 0, SU_OUTPUT_3, NULL }, ++ { "output.L1.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, 0, SU_OUTPUT_3, NULL }, ++ { "output.L1.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_OUTPUT_3, NULL }, ++ { "output.L2-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P2, 0, SU_OUTPUT_3, NULL }, ++ { "output.L2.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P2, 0, SU_OUTPUT_3, NULL }, ++ { "output.L2.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P2, 0, SU_OUTPUT_3, NULL }, ++ { "output.L3-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P3, 0, SU_OUTPUT_3, NULL }, ++ { "output.L3.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P3, 0, SU_OUTPUT_3, NULL }, ++ { "output.L3.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P3, 0, SU_OUTPUT_3, NULL }, ++ ++ { "input.bypass.phases", 0, 1.0, NETVISION_OID_BYPASS_NUM_LINES, 0, SU_FLAG_SETINT, NULL, &bypass_phases }, ++ { "input.bypass.frequency", 0, 0.1, NETVISION_OID_BYPASS_FREQ, 0, SU_FLAG_OK, NULL }, ++ { "input.bypass.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P1, 0, SU_BYPASS_1, NULL }, ++ { "input.bypass.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P1, 0, SU_BYPASS_1, NULL }, ++ { "input.bypass.L1-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P1, 0, SU_BYPASS_3, NULL }, ++ { "input.bypass.L1.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P1, 0, SU_BYPASS_3, NULL }, ++ { "input.bypass.L2-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P2, 0, SU_BYPASS_3, NULL }, ++ { "input.bypass.L2.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P2, 0, SU_BYPASS_3, NULL }, ++ { "input.bypass.L3-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P3, 0, SU_BYPASS_3, NULL }, ++ { "input.bypass.L3.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P3, 0, SU_BYPASS_3, NULL }, + + /* battery info */ + { "battery.charge", 0, 1, NETVISION_OID_BATT_CHARGE, "", SU_FLAG_OK, NULL }, |