aiboost_refresh_sensors:
- use the edata pointer rather than using the softc's edata array. - if aiboost_get_value() couldn't get a proper value, invalidate the sensor.
This commit is contained in:
parent
bdb4152ea8
commit
d0f8b29da6
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: aiboost.c,v 1.7 2007/07/01 20:45:10 xtraeme Exp $ */
|
||||
/* $NetBSD: aiboost.c,v 1.8 2007/07/02 10:06:58 xtraeme Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 Juan Romero Pardines
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aiboost.c,v 1.7 2007/07/01 20:45:10 xtraeme Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aiboost.c,v 1.8 2007/07/02 10:06:58 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -211,26 +211,32 @@ aiboost_refresh_sensors(struct aiboost_softc *sc, envsys_data_t *edata)
|
|||
case ENVSYS_STEMP:
|
||||
/* Temperatures */
|
||||
val = aiboost_get_value(h, "RTMP", sc->sc_aitemp->elem[i].id);
|
||||
if (val == -1)
|
||||
edata->state = ENVSYS_SINVALID;
|
||||
/* envsys(9) wants mK... convert from Celsius. */
|
||||
sc->sc_data[i].value_cur = val * 100000 + 273150000;
|
||||
edata->value_cur = val * 100000 + 273150000;
|
||||
DPRINTF(("%s: temp[%d] value_cur=%d val=%d j=%d\n", __func__,
|
||||
i, sc->sc_data[i].value_cur, val, j));
|
||||
i, edata->value_cur, val, j));
|
||||
break;
|
||||
case ENVSYS_SVOLTS_DC:
|
||||
/* Voltages */
|
||||
j = i - sc->sc_aitemp->num;
|
||||
val = aiboost_get_value(h, "RVLT", sc->sc_aivolt->elem[j].id);
|
||||
if (val == -1)
|
||||
edata->state = ENVSYS_SINVALID;
|
||||
/* envsys(4) wants mV... */
|
||||
sc->sc_data[i].value_cur = val * 10000;
|
||||
sc->sc_data[i].value_cur /= 10;
|
||||
edata->value_cur = val * 10000;
|
||||
edata->value_cur /= 10;
|
||||
DPRINTF(("%s: volt[%d] value_cur=%d val=%d j=%d\n", __func__,
|
||||
i, sc->sc_data[i].value_cur, val, j));
|
||||
i, edata->value_cur, val, j));
|
||||
break;
|
||||
case ENVSYS_SFANRPM:
|
||||
/* Fans */
|
||||
j = i - (sc->sc_aitemp->num + sc->sc_aivolt->num);
|
||||
val = aiboost_get_value(h, "RFAN", sc->sc_aifan->elem[j].id);
|
||||
sc->sc_data[i].value_cur = val;
|
||||
if (val == -1)
|
||||
edata->state = ENVSYS_SINVALID;
|
||||
edata->value_cur = val;
|
||||
DPRINTF(("%s: fan[%d] val=%d j=%d\n", __func__, i, val, j));
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue