summaryrefslogtreecommitdiffstats
path: root/drivers/w1/slaves
diff options
context:
space:
mode:
authorDavid Fries <david@fries.net>2008-01-22 03:31:39 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-01-22 09:17:48 -0800
commit80c002ddd2e732062e4371314d40515d0b5d8415 (patch)
tree77ca216b3b655c1362c4bfaa130fea67f529d770 /drivers/w1/slaves
parent941ed3b53086697eac7449f3ab5d2c5ab3259de2 (diff)
downloadlinux-stable-80c002ddd2e732062e4371314d40515d0b5d8415.tar.gz
linux-stable-80c002ddd2e732062e4371314d40515d0b5d8415.tar.bz2
linux-stable-80c002ddd2e732062e4371314d40515d0b5d8415.zip
W1: w1_therm.c is flagging 0C etc as invalid
The extra rom[0] check is flagging valid temperatures as invalid when there is already a CRC data transmission check. w1_therm_read_bin() if (rom[8] == crc && rom[0]) verdict = 1; Requiring rom[0] to be non-zero will flag as invalid temperature conversions when the low byte is zero, specifically the temperatures 0C, 16C, 32C, 48C, -16C, -32C, and -48C. The CRC check is produced on the device for the previous 8 bytes and is required to ensure the data integrity in transmission. I don't see why the extra check for rom[0] being non-zero is in there. Evgeniy Polyakov didn't know either. Just for a check I unplugged the sensor, executed a temperature conversion, and read the results. The read was all ff's, which also failed the CRC, so it doesn't need to protect against a disconnected sensor. I have more extensive patches in the work, but these two trivial ones will do for today. I would like to hear from people who use the ds2490 USB to one wire dongle. 1 if you would be willing to test the patches as I currently only have the one sensor on a short parisite powered wire, 2 if there is any cheap sources for the ds2490. Signed-off-by: David Fries <david@fries.net> Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/w1/slaves')
-rw-r--r--drivers/w1/slaves/w1_therm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index feed89e733e4..112f4ec59035 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -204,7 +204,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj,
crc = w1_calc_crc8(rom, 8);
- if (rom[8] == crc && rom[0])
+ if (rom[8] == crc)
verdict = 1;
}
}