Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sysmon Enable creation of value_{max, min, avg} entrie...
details: https://anonhg.NetBSD.org/src/rev/5f38e21c8624
branches: trunk
changeset: 765729:5f38e21c8624
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sat Jun 04 02:02:55 2011 +0000
description:
Enable creation of value_{max,min,avg} entries via the proplist, as well
as setting the ENVSYS_FPERCENT flag
diffstat:
sys/dev/sysmon/swsensor.c | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
diffs (59 lines):
diff -r 07af350150f1 -r 5f38e21c8624 sys/dev/sysmon/swsensor.c
--- a/sys/dev/sysmon/swsensor.c Sat Jun 04 01:57:34 2011 +0000
+++ b/sys/dev/sysmon/swsensor.c Sat Jun 04 02:02:55 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: swsensor.c,v 1.7 2010/12/17 13:37:37 pooka Exp $ */
+/* $NetBSD: swsensor.c,v 1.8 2011/06/04 02:02:55 pgoyette Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: swsensor.c,v 1.7 2010/12/17 13:37:37 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: swsensor.c,v 1.8 2011/06/04 02:02:55 pgoyette Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -234,6 +234,40 @@
if (po != NULL && prop_object_type(po) == PROP_TYPE_NUMBER)
sw_sensor_value = prop_number_integer_value(po);
+ /* Retrieve any value_{max,min,avg} that might be present */
+ if (pd != NULL) {
+ po = prop_dictionary_get(pd, "value_max");
+ if (po != NULL && prop_object_type(po) == PROP_TYPE_NUMBER) {
+ swsensor_edata.value_max =
+ prop_number_integer_value(po);
+ swsensor_edata.flags |= ENVSYS_FVALID_MAX;
+ }
+
+ po = prop_dictionary_get(pd, "value_min");
+ if (po != NULL && prop_object_type(po) == PROP_TYPE_NUMBER) {
+ swsensor_edata.value_min =
+ prop_number_integer_value(po);
+ swsensor_edata.flags |= ENVSYS_FVALID_MIN;
+ }
+
+ po = prop_dictionary_get(pd, "value_avg");
+ if (po != NULL && prop_object_type(po) == PROP_TYPE_NUMBER) {
+ swsensor_edata.value_avg =
+ prop_number_integer_value(po);
+ swsensor_edata.flags |= ENVSYS_FVALID_AVG;
+ }
+ }
+
+ /* See if this sensor should report percentages vs raw values */
+ if (pd != NULL) {
+ po = prop_dictionary_get(pd, "percentage");
+ if (po != NULL &&
+ prop_object_type(po) == PROP_TYPE_BOOL &&
+ prop_bool_true(po))
+ swsensor_edata.flags |= ENVSYS_FPERCENT;
+ }
+
+ swsensor_edata.state = ENVSYS_SVALID;
swsensor_edata.value_cur = 0;
strlcpy(swsensor_edata.desc, "sensor", ENVSYS_DESCLEN);
Home |
Main Index |
Thread Index |
Old Index