Module Name: src
Committed By: pgoyette
Date: Wed Jun 8 16:11:25 UTC 2011
Modified Files:
src/usr.sbin/envstat: config.c
Log Message:
Instead of relying on the want-percent attribute, use the sensor
type to restrict value-based limits from Battery-capacity sensors.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/envstat/config.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/envstat/config.c
diff -u src/usr.sbin/envstat/config.c:1.10 src/usr.sbin/envstat/config.c:1.11
--- src/usr.sbin/envstat/config.c:1.10 Tue Oct 5 05:03:49 2010
+++ src/usr.sbin/envstat/config.c Wed Jun 8 16:11:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: config.c,v 1.10 2010/10/05 05:03:49 pgoyette Exp $ */
+/* $NetBSD: config.c,v 1.11 2011/06/08 16:11:25 pgoyette Exp $ */
/*-
* Copyright (c) 2007 Juan Romero Pardines.
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: config.c,v 1.10 2010/10/05 05:03:49 pgoyette Exp $");
+__RCSID("$NetBSD: config.c,v 1.11 2011/06/08 16:11:25 pgoyette Exp $");
#endif /* not lint */
#include <stdio.h>
@@ -623,7 +623,7 @@
}
/*
- * Conversions for critical-max and critical-min properties.
+ * Conversions for {critical,warning}-{max,min} properties.
*/
prop_number_t
convert_val_to_pnumber(prop_dictionary_t kdict, const char *prop,
@@ -639,17 +639,15 @@
val = max = min = 0;
/*
- * critical-max and critical-min are not allowed in
- * battery sensors.
+ * Not allowed in battery sensors.
*/
- obj = prop_dictionary_get(kdict, "want-percentage");
- if (prop_bool_true(obj))
+ obj = prop_dictionary_get(kdict, "type");
+ if (prop_string_equals_cstring(obj, "Battery capacity"))
config_errmsg(PROP_ERR, prop, sensor);
/*
* Make the conversion for sensor's type.
*/
- obj = prop_dictionary_get(kdict, "type");
if (prop_string_equals_cstring(obj, "Temperature")) {
tmp = strchr(value, 'C');
if (tmp)