summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Jung <jung@cvs.openbsd.org>2015-12-15 20:58:23 +0000
committerJoerg Jung <jung@cvs.openbsd.org>2015-12-15 20:58:23 +0000
commit10113e8030022900b38b6c9dc081997a56ea933b (patch)
tree35bb5384651c76bf13c5f8bf11720baab55d7598
parentf0b19af9db86f6c36f1baae49d4d34fcd76a9ef6 (diff)
ignore unlikely temperature values like -127 degC
-rw-r--r--sys/dev/isa/asmc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/isa/asmc.c b/sys/dev/isa/asmc.c
index c0de26c170c..6a53d2303e8 100644
--- a/sys/dev/isa/asmc.c
+++ b/sys/dev/isa/asmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asmc.c,v 1.20 2015/12/15 20:34:33 jung Exp $ */
+/* $OpenBSD: asmc.c,v 1.21 2015/12/15 20:58:22 jung Exp $ */
/*
* Copyright (c) 2015 Joerg Jung <jung@openbsd.org>
*
@@ -555,11 +555,14 @@ static int
asmc_temp(struct asmc_softc *sc, uint8_t idx)
{
uint8_t buf[2];
+ uint32_t uk;
int i, r;
if ((r = asmc_try(sc, ASMC_READ, sc->sc_prod->pr_temp[idx], buf, 2)))
return r;
- sc->sc_sensor_temp[idx].value = asmc_uk(buf);
+ if ((uk = asmc_uk(buf)) < 253150000) /* ignore unlikely values */
+ return 0;
+ sc->sc_sensor_temp[idx].value = uk;
sc->sc_sensor_temp[idx].flags &= ~SENSOR_FUNKNOWN;
if (sc->sc_init)