[Nut-upsdev] [PATCH 29/36] Configuration variable "sdtype" is as yet unused.
Greg A. Woods
woods at planix.com
Thu Mar 8 23:21:40 UTC 2012
From: "Greg A. Woods" <woods at planix.com>
also remark on the weirdness of pollfreq.
---
drivers/snmp-ups.c | 15 ++++++++++++++-
drivers/snmp-ups.h | 2 +-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c
index a68c1c5..3d31f9c 100644
--- a/drivers/snmp-ups.c
+++ b/drivers/snmp-ups.c
@@ -166,7 +166,14 @@ void upsdrv_updateinfo(void)
/* only update every pollfreq */
/* FIXME: only update status (SU_STATUS_*), à la usbhid-ups, in between */
- if (time(NULL) > (lastpoll + pollfreq)) {
+ /*
+ * XXX there should be a *_POLL flag for values that should be checked
+ * with every call, and then a full snmp_ups_walk() would only happen
+ * every pollfreq seconds.
+ *
+ * XXX also, pollfreq is redundant with generic nutupsdrv '-i' flag!
+ */
+ if (time(NULL) > (lastpoll + pollfreq)) { /* XXX maybe should use difftime()??? */
status_init();
@@ -249,6 +256,10 @@ void upsdrv_makevartable(void)
"Set the authentication protocol (MD5 or SHA) used for authenticated SNMPv3 messages (default=MD5)");
addvar(VAR_VALUE, SU_VAR_PRIVPROT,
"Set the privacy protocol (DES or AES) used for encrypted SNMPv3 messages (default=DES)");
+#if 0 /* XXX unused */
+ addvar(VAR_VALUE, SU_VAR_SDTYPE,
+ "Set the shutdown mode (3 or 2, default=3)");
+#endif
addvar(VAR_FLAG, SU_VAR_MAGIC, "Run the secret magic header dumper");
}
@@ -1626,6 +1637,7 @@ int su_instcmd(const char *cmdname, const char *extradata)
return retval;
}
+#if 0 /* XXX not yet used -- see upsdrv_shutdown() */
/* TODO: complete rewrite */
void su_shutdown_ups(void)
{
@@ -1673,6 +1685,7 @@ void su_shutdown_ups(void)
break;
}
}
+#endif
static void dump_nutscanner_snmp()
{
diff --git a/drivers/snmp-ups.h b/drivers/snmp-ups.h
index 802da9e..2fd0400 100644
--- a/drivers/snmp-ups.h
+++ b/drivers/snmp-ups.h
@@ -171,7 +171,7 @@ typedef struct {
#define SU_VAR_VERSION "snmp_version"
#define SU_VAR_MIBS "mibs"
#define SU_VAR_POLLFREQ "pollfreq"
-#define SU_VAR_SDTYPE "sdtype"
+#define SU_VAR_SDTYPE "sdtype" /* XXX unused */
/* SNMP v3 related parameters */
#define SU_VAR_SECLEVEL "secLevel"
#define SU_VAR_SECNAME "secName"
--
1.7.9.2
More information about the Nut-upsdev
mailing list