diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2007-09-06 19:33:21 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2007-09-06 19:33:21 +0000 |
commit | de2411e7a633f63c9757989584463766a84e5449 (patch) | |
tree | c715f0595a04516435f370caa8d2c785f219c959 | |
parent | 384948e12fff32be1a9d00a7cb6d05772fb48156 (diff) |
fix temperature sensor. the sensors framework wants muK not degC!
-rw-r--r-- | sys/dev/pci/if_iwn.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/if_iwnreg.h | 3 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index 34fb3659796..9f321fa8f7c 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.2 2007/09/06 16:51:49 damien Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.3 2007/09/06 19:33:20 damien Exp $ */ /*- * Copyright (c) 2007 @@ -359,7 +359,6 @@ iwn_sensor_attach(struct iwn_softc *sc) { strlcpy(sc->sensordev.xname, sc->sc_dev.dv_xname, sizeof sc->sensordev.xname); - strlcpy(sc->sensor.desc, "temperature", sizeof sc->sensor.desc); sc->sensor.type = SENSOR_TEMP; /* temperature invalid until interface is up */ sc->sensor.value = 0; @@ -1368,7 +1367,7 @@ iwn_rx_statistics(struct iwn_softc *sc, struct iwn_rx_desc *desc) DPRINTFN(2, ("temperature=%d\n", temp)); /* update temperature sensor */ - sc->sensor.value = temp; + sc->sensor.value = IWN_CTOMUK(temp); /* update Tx power if need be */ iwn_power_calibration(sc, temp); @@ -3507,7 +3506,7 @@ iwn_init(struct ifnet *ifp) sc->rawtemp = sc->ucode_info.temp[3].chan20MHz; sc->temp = iwn_get_temperature(sc); DPRINTF(("temperature=%d\n", sc->temp)); - sc->sensor.value = sc->temp; + sc->sensor.value = IWN_CTOMUK(sc->temp); sc->sensor.flags &= ~SENSOR_FINVALID; if ((error = iwn_config(sc)) != 0) { diff --git a/sys/dev/pci/if_iwnreg.h b/sys/dev/pci/if_iwnreg.h index aaf5a47a290..d24c3d7e35b 100644 --- a/sys/dev/pci/if_iwnreg.h +++ b/sys/dev/pci/if_iwnreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwnreg.h,v 1.1 2007/09/06 16:37:03 damien Exp $ */ +/* $OpenBSD: if_iwnreg.h,v 1.2 2007/09/06 19:33:20 damien Exp $ */ /*- * Copyright (c) 2007 @@ -586,6 +586,7 @@ struct iwn_critical_temp { /* degK <-> degC conversion macros */ #define IWN_CTOK(c) ((c) + 273) #define IWN_KTOC(k) ((k) - 273) +#define IWN_CTOMUK(c) (((c) * 1000000) + 273150000) } __packed; /* structure for command IWN_SENSITIVITY */ |