diff --git a/proc/linux-lib.pl b/proc/linux-lib.pl index 17ec20b05..6add0aeed 100755 --- a/proc/linux-lib.pl +++ b/proc/linux-lib.pl @@ -500,6 +500,7 @@ if (&has_command("sensors")) { my $fh = "SENSORS"; my $aa; my $ab; + my $ac; &open_execute_command($fh, "sensors /dev/null", 1); while(<$fh>) { if (/Core\s+(\d+):\s+([\+\-][0-9\.]+)/) { @@ -522,7 +523,7 @@ if (&has_command("sensors")) { if ($aa && /temp(\d+):\s+([\+\-][0-9\.]+)\s+.*?[=+].*?\)/) { # Adjust to start from `0` as all other outputs push(@rvx, { 'core' => (int($1) - 1), - 'temp' => $2 }); + 'temp' => $2 }); } # New line - new device @@ -531,10 +532,20 @@ if (&has_command("sensors")) { $ab = 1 if (/cpu_thermal-virtual-[\d]+/i); # Get odd output like in #1280 if ($ab && /temp(\d+):\s+([\+\-][0-9\.]+)/) { - push(@rvx, { 'core' => $1, - 'temp' => $2 }); - } + push(@rvx, { 'core' => $1, + 'temp' => $2 }); } + + # AMD Ryzen oddness + $ac = 0 if (/^\s*$/); + # Check for CPU + $ac = 1 if (/[\d]+temp-pci/i); + # Get odd output like in #discussion/600155 + if ($ac && /Tdie:\s+([\+\-][0-9\.]+)/) { + push(@rvx, { 'core' => 0, + 'temp' => $1 }); + } + } } close($fh); }