Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/envstat Instead of relying on the want-percent attr...
details: https://anonhg.NetBSD.org/src/rev/85a52480a049
branches: trunk
changeset: 765873:85a52480a049
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Wed Jun 08 16:11:25 2011 +0000
description:
Instead of relying on the want-percent attribute, use the sensor
type to restrict value-based limits from Battery-capacity sensors.
diffstat:
usr.sbin/envstat/config.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diffs (48 lines):
diff -r 10d96c0eca11 -r 85a52480a049 usr.sbin/envstat/config.c
--- a/usr.sbin/envstat/config.c Wed Jun 08 16:04:40 2011 +0000
+++ b/usr.sbin/envstat/config.c Wed Jun 08 16:11:25 2011 +0000
@@ -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)
Home |
Main Index |
Thread Index |
Old Index