From 7f5983c5a69d9c9c1f1c567c3020234f8083e467 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Jan 2005 20:38:58 +0000 Subject: [PATCH] Fix the DS1621 detection which was broken since December 2003. Thanks to Peter A. Henning for reporting. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2852 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 65a9092f..654c03f7 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -3008,16 +3008,14 @@ sub lm92_detect # $_[0]: A reference to the file descriptor to access this chip. # We may assume an i2c_set_slave_addr was already done. # $_[1]: Address -# Returns: undef if not detected, (3) if detected, -# (5) or (7) if even more bits match. +# Returns: undef if not detected, 3 if detected # Registers used: # 0xAA: Temperature # 0xA1: High limit # 0xA2: Low limit # 0xAC: Configuration -# Detection is weak. We check if Bit 3 is set and Bit 2 is clear. -# The DS1621 will aways have a config like 0x????10??. A even better -# match would be 0x0??01000. +# Detection is weak. We check if bit 4 (NVB) is clear, because it is +# unlikely to be set (would mean that EEPROM is currently being accessed). # Temperature checkings will hopefully prevent LM75 chips from being # detected as a DS1621. sub ds1621_detect @@ -3025,16 +3023,14 @@ sub ds1621_detect my $i; my ($file,$addr) = @_; my $temp = i2c_smbus_read_word_data($file,0xAA); - return if ($temp & 0x007F); + return if ($temp & 0x7F00); $temp = i2c_smbus_read_word_data($file,0xA1); - return if ($temp & 0x007F); + return if ($temp & 0x7F00); $temp = i2c_smbus_read_word_data($file,0xA2); - return if ($temp & 0x007F); + return if ($temp & 0x7F00); my $conf = i2c_smbus_read_byte_data($file,0xAC); - return (7) if ($conf & 0x9F) == 0x98; - return (5) if ($conf & 0x0F) == 0x08; - return (3) if ($conf & 0x0C) == 0x08; - return ; + return 3 if ($conf & 0x10) == 0x00; + return; } # $_[0]: A reference to the file descriptor to access this chip.