From f6bb77e5237ffd5bddb4b35131538fdc5cf3982e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 1 Dec 2008 08:16:53 +0000 Subject: [PATCH] Simplify LM77 detection. The extra detection steps were broken and nobody complained. And it's not like the LM77 is an immensely popular chip. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5482 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 18f1522a..ec4dd506 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -3203,26 +3203,10 @@ sub lm77_detect or (($high >> 4) != 0 && ($high >> 4) != 0xf); # Make sure the chip supports SMBus read word transactions - $cur = i2c_smbus_read_word_data($file, 0x00); - return if $cur < 0; - $hyst = i2c_smbus_read_word_data($file, 0x02); - return if $hyst < 0; - $os = i2c_smbus_read_word_data($file, 0x03); - return if $os < 0; - $low = i2c_smbus_read_word_data($file, 0x04); - return if $low < 0; - $high = i2c_smbus_read_word_data($file, 0x05); - return if $high < 0; + foreach $i (0x00, 0x02, 0x03, 0x04, 0x05) { + return if i2c_smbus_read_word_data($file, $i) < 0; + } - $cur /= 16; - $hyst /= 16; - $os /= 16; - $high /= 16; - $low /= 16; - - # Most probable value ranges - return 6 if $cur <= 100 and $hyst <= 40 - and ($os >= 20 && $os <= 127) and ($high >= 20 && $high <= 127); return 3; }