mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-02 07:15:39 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user