Revert "Fix to exclude sensors with unknown temperatures"

This reverts commit f596d064b4.
This commit is contained in:
iliajie
2022-10-02 19:48:59 +03:00
parent f596d064b4
commit 2eded6df95

View File

@@ -496,11 +496,13 @@ sub get_current_cpu_data
{
my @cpu;
my @fans;
my @cputhermisters;
if (&has_command("sensors")) {
my ($cpu, $cpu_aux, $cpu_package, $cpu_broadcom, $cpu_amd);
my $fh = "SENSORS";
# Examples https://gist.github.com/547451c9ca376b2d18f9bb8d3748276c
# &open_execute_command($fh, "cat /tmp/.webmin/sensors </dev/null 2>/dev/null", 1);
&open_execute_command($fh, "sensors </dev/null 2>/dev/null", 1);
while (<$fh>) {
@@ -517,6 +519,15 @@ if (&has_command("sensors")) {
}
) if ($cpu_fan_num);
# AMD CPU Thermisters #1714
if ($cpu && /thermistor\s+[\d]+:\s+[+-]([\d]+)/i) {
my $temp = int($1);
push(@cputhermisters,
{ 'core' => scalar(@cputhermisters) + 1,
'temp' => $temp
}) if ($temp);
}
# CPU package
($cpu_package) = $_ =~ /(?|(package\s+id\s+[\d]+)|(coretemp-[a-z]+-[\d]+))/i
if (!$cpu_package);
@@ -549,7 +560,7 @@ if (&has_command("sensors")) {
# Non-standard outputs
else {
# Auxiliary CPU temperature and fans were already captured
# Auxiliary CPU temperature and fans were already captured
next if ($cpu_aux);
# CPU types
@@ -628,11 +639,8 @@ if (&has_command("sensors")) {
}
close($fh);
}
# Fix to remove cannot detect
# package temperatures (178)
if (@cpu) {
@cpu = grep {$_->{'temp'} != 178} @cpu;
}
@cpu = @cputhermisters
if (!@cpu && @cputhermisters);
return (\@cpu, \@fans);
}