mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 06:15:15 +00:00
Even stricter MAX1617 and LM84 detection tests.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2404 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -3409,8 +3409,8 @@ sub adm1021_detect
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Extra checks for MAX1617 and LM84, since those are often misdetected
|
# Extra checks for MAX1617 and LM84, since those are often misdetected
|
||||||
# We verify 6 assertions and discard the chip if too many (2 for the
|
# We verify several assertions (6 for the MAX1617, 4 for the LM84) and
|
||||||
# MAX1617, 4 for the LM84) fail. Not that these checks are not done
|
# discard the chip if any fail. Note that these checks are not done
|
||||||
# by the adm1021 driver.
|
# by the adm1021 driver.
|
||||||
if ($chip == 2 || $chip == 5)
|
if ($chip == 2 || $chip == 5)
|
||||||
{
|
{
|
||||||
@@ -3425,35 +3425,20 @@ sub adm1021_detect
|
|||||||
return if $lte == $rte and $lte == $lhi and $lte == $rhi
|
return if $lte == $rte and $lte == $lhi and $lte == $rhi
|
||||||
and $lte == $llo and $lte == $rlo;
|
and $lte == $llo and $lte == $rlo;
|
||||||
|
|
||||||
# Increase the misdetect value each time a temperature doesn't
|
|
||||||
# match reasonable expectations
|
|
||||||
my $misdetect = 0;
|
|
||||||
# Negative temperatures
|
# Negative temperatures
|
||||||
$misdetect++ if ($lte & 0x80);
|
return if ($lte & 0x80) or ($rte & 0x80);
|
||||||
$misdetect++ if ($rte & 0x80);
|
|
||||||
# Negative high limits
|
# Negative high limits
|
||||||
if ($lhi & 0x80)
|
return if ($lhi & 0x80) or ($rhi & 0x80);
|
||||||
{
|
|
||||||
$misdetect++;
|
|
||||||
$lhi-=256;
|
|
||||||
}
|
|
||||||
if ($rhi & 0x80)
|
|
||||||
{
|
|
||||||
$misdetect++;
|
|
||||||
$rhi-=256;
|
|
||||||
}
|
|
||||||
# Low limits over high limits
|
# Low limits over high limits
|
||||||
if ($chip != 5) # LM84 doesn't have low limits
|
if ($chip != 5) # LM84 doesn't have low limits
|
||||||
{
|
{
|
||||||
$llo-=256 if ($llo & 0x80);
|
$llo-=256 if ($llo & 0x80);
|
||||||
$rlo-=256 if ($rlo & 0x80);
|
$rlo-=256 if ($rlo & 0x80);
|
||||||
$misdetect++ if $llo > $lhi;
|
return if ($llo > $lhi) or ($rlo > $rhi);
|
||||||
$misdetect++ if $rlo > $rhi;
|
|
||||||
}
|
}
|
||||||
return if $misdetect > 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 3 if $chip == 2;
|
return 3 if ($chip == 2) or ($chip == 5);
|
||||||
return 7 if $chip <= 3;
|
return 7 if $chip <= 3;
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user