APC_IGNORE was only used in query_ups(), and could be easily handled by APC_PRESENT and different tests/sets. Also, APC_IGNORE's comment in .h was a bit misleading.
Signed-off-by: Michal Soltys <[email protected]> --- drivers/apcsmart.c | 11 ++++++----- drivers/apcsmart.h | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/apcsmart.c b/drivers/apcsmart.c index b3d482d..200df5d 100644 --- a/drivers/apcsmart.c +++ b/drivers/apcsmart.c @@ -252,8 +252,10 @@ static int query_ups(const char *var, int first) return 0; } - /* already known to not be supported? */ - if (vt->flags & APC_IGNORE) + /* + * not first run and already known to not be supported ? + */ + if (!first && !(vt->flags & APC_PRESENT)) return 0; /* empty the input buffer (while allowing the alert handler to run) */ @@ -278,11 +280,10 @@ static int query_ups(const char *var, int first) ser_comm_good(); - if ((ret < 1) || (!strcmp(temp, "NA"))) { /* not supported */ - vt->flags |= APC_IGNORE; + if ((ret < 1) || (!strcmp(temp, "NA"))) /* not supported */ return 0; - } + vt->flags |= APC_PRESENT; ptr = convert_data(vt, temp); dstate_setinfo(vt->name, "%s", ptr); diff --git a/drivers/apcsmart.h b/drivers/apcsmart.h index 4cd0ad5..95e8c14 100644 --- a/drivers/apcsmart.h +++ b/drivers/apcsmart.h @@ -77,7 +77,6 @@ /* Driver command table flag values */ #define APC_POLL 0x0001 /* Poll this variable regularly */ -#define APC_IGNORE 0x0002 /* Never poll this */ #define APC_PRESENT 0x0004 /* Capability seen on this UPS */ #define APC_RW 0x0010 /* read-write variable */ -- 1.7.2.1 _______________________________________________ Nut-upsdev mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev
