Module Name: src
Committed By: pgoyette
Date: Wed Jun 8 16:14:57 UTC 2011
Modified Files:
src/sys/dev/sysmon: sysmon_envsys_events.c
Log Message:
Restrict limit monitoring for Indicator sensors as well as for
Battery-charge sensors.
To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/sysmon/sysmon_envsys_events.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/sysmon/sysmon_envsys_events.c
diff -u src/sys/dev/sysmon/sysmon_envsys_events.c:1.97 src/sys/dev/sysmon/sysmon_envsys_events.c:1.98
--- src/sys/dev/sysmon/sysmon_envsys_events.c:1.97 Thu Dec 30 03:59:59 2010
+++ src/sys/dev/sysmon/sysmon_envsys_events.c Wed Jun 8 16:14:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys_events.c,v 1.97 2010/12/30 03:59:59 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsys_events.c,v 1.98 2011/06/08 16:14:57 pgoyette Exp $ */
/*-
* Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.97 2010/12/30 03:59:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.98 2011/06/08 16:14:57 pgoyette Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -101,7 +101,8 @@
/*
* Some validation first for limit-checking events
*
- * 1. Limits are not permitted if the units is ENVSYS_INDICATOR.
+ * 1. Limits are not permitted if the units is ENVSYS_INDICATOR
+ * or ENVSYS_BATTERY_CHARGE.
*
* 2. Capacity limits are permitted only if the sensor has the
* ENVSYS_FPERCENT flag set and value_max is set.
@@ -117,8 +118,10 @@
" edata-flags 0x%04x\n", __func__, edata->units, props,
edata->upropset, edata->value_max, edata->flags));
- if (props && edata->units == ENVSYS_INDICATOR)
- return ENOTSUP;
+ if (props)
+ if (edata->units == ENVSYS_INDICATOR ||
+ edata->units == ENVSYS_BATTERY_CHARGE)
+ return ENOTSUP;
if ((props & PROP_CAP_LIMITS) &&
((edata->value_max == 0) ||