From eb80b6f0bdc684dd9d1d10f22e0144743f6945f7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 17 Jan 2006 07:34:49 +0000 Subject: [PATCH] Improve DS1621 detection to prevent other chips from being misdetected as one. Thanks to Aurelien Jarno for testing. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3234 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 355664f8..8e499d74 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -3151,19 +3151,18 @@ sub lm92_detect # 0xAC: Configuration # 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. +# Temperature checkings will hopefully prevent LM75 or other chips from +# being detected as a DS1621. sub ds1621_detect { my $i; my ($file,$addr) = @_; my $temp = i2c_smbus_read_word_data($file,0xAA); - return if ($temp & 0x7F00); - $temp = i2c_smbus_read_word_data($file,0xA1); - return if ($temp & 0x7F00); - $temp = i2c_smbus_read_word_data($file,0xA2); - return if ($temp & 0x7F00); + my $high = i2c_smbus_read_word_data($file,0xA1); + my $low = i2c_smbus_read_word_data($file,0xA2); + return if ($temp | $high | $low) & 0x7F00; my $conf = i2c_smbus_read_byte_data($file,0xAC); + return if ($temp == 0 && $high == 0 && $low == 0 && $conf == 0); return 3 if ($conf & 0x10) == 0x00; return; }