From 8449bbedf9fe6a8087fa89287e5a1145f1838e66 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Tue, 28 Jul 2009 22:11:40 +0000 Subject: [PATCH] added final fallback for core0 temp if cpu temp is null --- inxi | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/inxi b/inxi index 93bb22f..cb8984a 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.0.106-b1 +#### version: 1.0.107-b1 #### Date: 28 July 2009 ######################################################################## #### SPECIAL THANKS @@ -3012,10 +3012,6 @@ get_sensors_data() { eval $LOGFS -local sample=" -" -# echo "$sample"| gawk -v userCpuNo="$SENSORS_CPU_NO" ' - IFS="," if [[ $B_SENSORS == 'true' ]];then # note: non-configured sensors gives error message, which we need to redirect to stdout @@ -3025,6 +3021,7 @@ local sample=" IGNORECASE=1 moboTemp="" cpuTemp="" + core0Temp="" # only if all else fails... moboTempReal="" cpuTempReal="" tempUnit="" @@ -3074,6 +3071,17 @@ local sample=" tempUnit="°" $3 } } + # final fallback if all else fails + /^core0:/ { + tempWorking=gensub( /\+(.+)/, "\\1", 1, $2 ) + if ( core0Temp == "" || tempWorking > 0 ) { + core0Temp=$2 + } + if ( $3 ~ /C|F/ && tempUnit == "" ){ + tempUnit="°" $3 + } + } + # note: can be cpu fan:, cpu fan speed:, etc /^CPU Fan(.*):/ { if ( $3 ~ /(.+):/ ){ @@ -3148,7 +3156,6 @@ local sample=" else if ( temp1 == "" && temp2 == "" && cpuTemp == "" && moboTemp == "" ){ tempFanType=1 } -# print "tft: " tempFanType # then get the real cpu temp, best guess is hottest is real if ( cpuTemp != "" ){ @@ -3165,6 +3172,10 @@ local sample=" else { cpuTempReal=temp1 } + # if all else fails, use core0 temp if it is present and cpu is null + if ( cpuTempReal == "" && core0Temp != "" ) { + cpuTempReal=core0Temp + } # then the real mobo temp if ( moboTemp != "" ){ @@ -3236,7 +3247,6 @@ local sample=" if ( cpuTempReal != "" ) { cpuTempReal = cpuTempReal tempUnit } -# print "tempunit: " tempUnit # if they are ALL null, print error message. psFan is not used in output currently if ( cpuTempReal == "" && moboTempReal == "" && aFanReal[1] == "" && aFanReal[2] == "" && aFanReal[3] == "" && sysFanString == "" ) {