mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-02 15:25:38 +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
|
# 0xAC: Configuration
|
||||||
# Detection is weak. We check if bit 4 (NVB) is clear, because it is
|
# 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).
|
# unlikely to be set (would mean that EEPROM is currently being accessed).
|
||||||
# Temperature checkings will hopefully prevent LM75 chips from being
|
# Temperature checkings will hopefully prevent LM75 or other chips from
|
||||||
# detected as a DS1621.
|
# being detected as a DS1621.
|
||||||
sub ds1621_detect
|
sub ds1621_detect
|
||||||
{
|
{
|
||||||
my $i;
|
my $i;
|
||||||
my ($file,$addr) = @_;
|
my ($file,$addr) = @_;
|
||||||
my $temp = i2c_smbus_read_word_data($file,0xAA);
|
my $temp = i2c_smbus_read_word_data($file,0xAA);
|
||||||
return if ($temp & 0x7F00);
|
my $high = i2c_smbus_read_word_data($file,0xA1);
|
||||||
$temp = i2c_smbus_read_word_data($file,0xA1);
|
my $low = i2c_smbus_read_word_data($file,0xA2);
|
||||||
return if ($temp & 0x7F00);
|
return if ($temp | $high | $low) & 0x7F00;
|
||||||
$temp = i2c_smbus_read_word_data($file,0xA2);
|
|
||||||
return if ($temp & 0x7F00);
|
|
||||||
my $conf = i2c_smbus_read_byte_data($file,0xAC);
|
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 3 if ($conf & 0x10) == 0x00;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user