I am CC'ing tech@ not because I like to crosspost, but because I believe
this to be the end of a conversation on misc@ and the start of a
discussion on tech@ about hopefully getting this changed.

On Sat, Jan 13, 2007 at 10:11:24AM -0500, Constantine A. Murenin wrote:
> On 12/01/07, andrew fresh <[EMAIL PROTECTED]> wrote:
> >I am trying to shut down my laptop using the voltage sensors.
> >Unfortunatly I can't test this with a generic kernel because all my
> >sensors on my only -current box come from the ACPI subsystem.
> >
> >The problem is, the limits don't seems to work:
> >
> >$ sysctl hw.sensors.acpibat0.volt1
> >hw.sensors.acpibat0.volt1=7.96 VDC (current voltage), OK
> >$ tail -3 /etc/sensorsd.conf
> >hw.sensors.acpibat0.volt1:low=8V:high=9V

no matter what I set, sensorsd always says "within limits".

> sensorsd.conf(5) says [that's how it is supposed to work]
> 
> The following patch will allow you to set high and low values for
> volt0 and volt1 on acpibat in sensorsd:

I think would prefer this patch, or something like it, just in case I
want to override the choices someone made for other sensors.

I believe this diff adds useful functionality without losing anything.
However, I am NOT a C programmer, so I may have screwed something up.

Index: sensorsd.c
===================================================================
RCS file: /cvs/src/usr.sbin/sensorsd/sensorsd.c,v
retrieving revision 1.27
diff -u -r1.27 sensorsd.c
--- sensorsd.c  6 Jan 2007 18:17:06 -0000       1.27
+++ sensorsd.c  13 Jan 2007 18:15:12 -0000
@@ -218,7 +218,9 @@
                         * status had failed so warn about it */
                        if (newstatus == SENSOR_S_UNKNOWN)
                                newstatus = SENSOR_S_WARN;
-                       else if (newstatus == SENSOR_S_UNSPEC) {
+                       else if (newstatus == SENSOR_S_UNSPEC ||
+                           limit->upper != LLONG_MAX  ||
+                           limit->lower != LLONG_MIN) {
                                if (sensor.value > limit->upper ||
                                    sensor.value < limit->lower)
                                        newstatus = SENSOR_S_CRIT;
Index: sensorsd.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/sensorsd/sensorsd.conf.5,v
retrieving revision 1.10
diff -u -r1.10 sensorsd.conf.5
--- sensorsd.conf.5     28 Dec 2006 10:04:27 -0000      1.10
+++ sensorsd.conf.5     13 Jan 2007 18:15:12 -0000
@@ -58,8 +58,8 @@
 .Xr esm 4 ,
 or
 .Xr ipmi 4 )
-do not require boundary values specified (that otherwise will be
-ignored) and simply trigger on status transitions.
+do not require boundary values specified and simply trigger on status
+transitions unless you specify either boundry.
 .Pp
 The command is executed on transitions out of, and back into, given limits.
 Tokens in the command are substituted as follows:
===================================================================

l8rZ,
-- 
andrew - ICQ# 253198 - JID: [EMAIL PROTECTED]

BOFH excuse of the day: (l)user error

Reply via email to