From b59b5489f1e2a741fc777a6cc9bc2afe80afb38b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 19 Jan 2009 21:07:56 +0000 Subject: [PATCH] Fix detection of older DS1621. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5613 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index a10cbb0f..003e6708 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm_sensors CHANGES file SVN-HEAD File lm_sensors.lsm: Delete, don't advertise a legacy branch File doc/developers/release_checklist: Skip mail to lsm + Program sensors-detect: Fix detection of older DS1621 2.10.8 (20081216) File doc/chips/lm90: Update datasheet links (2.6 backport) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index c383fa6d..97d50531 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -3863,10 +3863,6 @@ sub ds1621_detect my $conf = i2c_smbus_read_byte_data($file, 0xAC); return if ($conf & 0x10); - my $counter = i2c_smbus_read_byte_data($file, 0xA8); - my $slope = i2c_smbus_read_byte_data($file, 0xA9); - return if ($slope != 0x10 || $counter > $slope); - my $temp = i2c_smbus_read_word_data($file, 0xAA); return if $temp < 0 || ($temp & 0x0f00); # On the DS1631, the following two checks are too strict in theory, @@ -3879,7 +3875,11 @@ sub ds1621_detect return if ($temp == 0 && $high == 0 && $low == 0 && $conf == 0); - return 3; + # Old versions of the DS1621 apparently don't have the counter and + # slope registers (or they return crap) + my $counter = i2c_smbus_read_byte_data($file, 0xA8); + my $slope = i2c_smbus_read_byte_data($file, 0xA9); + return ($slope == 0x10 && $counter <= $slope) ? 3 : 2; } # $_[0]: A reference to the file descriptor to access this chip.