diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2007-02-28 15:28:23 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2007-02-28 15:28:23 +0000 |
commit | 7ebdecca2d6ec1365f10d76b7d030c6c9985d1d1 (patch) | |
tree | 00a933acddcdce18772540aab3111796c4466687 /usr.sbin | |
parent | 5bcf755413bb28c6ebd9ba449594bf61d4f80022 (diff) |
do status dampening for OK status as well, i. e.
if a sensor is always bad, but sometimes goes OK for only a few seconds,
we want to ignore that bogus change as well
also fix setting if last_val.
from Constantine, ok mickey
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sensorsd/sensorsd.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c index 519dc0a7801..32bef5b8951 100644 --- a/usr.sbin/sensorsd/sensorsd.c +++ b/usr.sbin/sensorsd/sensorsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensorsd.c,v 1.28 2007/02/23 22:55:40 deraadt Exp $ */ +/* $OpenBSD: sensorsd.c,v 1.29 2007/02/28 15:28:22 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -213,7 +213,6 @@ check_sensors(void) if (sysctl(mib, 5, &sensor, &len, NULL, 0) == -1) err(1, "sysctl"); - limit->last_val = sensor.value; newstatus = sensor.status; /* unknown may as well mean producing valid * status had failed so warn about it */ @@ -228,14 +227,11 @@ check_sensors(void) } if (limit->status != newstatus) { - if (newstatus == SENSOR_S_OK) { - limit->status2 = - limit->status = newstatus; - limit->status_changed = time(NULL); - } else if (limit->status2 != newstatus) { + if (limit->status2 != newstatus) { limit->status2 = newstatus; limit->count = 0; } else if (++limit->count >= 3) { + limit->last_val = sensor.value; limit->status2 = limit->status = newstatus; limit->status_changed = time(NULL); |