mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
added final fallback for core0 temp if cpu temp is null
This commit is contained in:
parent
64aa40b175
commit
8449bbedf9
24
inxi
24
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 1.0.106-b1
|
#### version: 1.0.107-b1
|
||||||
#### Date: 28 July 2009
|
#### Date: 28 July 2009
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
|
@ -3012,10 +3012,6 @@ get_sensors_data()
|
||||||
{
|
{
|
||||||
eval $LOGFS
|
eval $LOGFS
|
||||||
|
|
||||||
local sample="
|
|
||||||
"
|
|
||||||
# echo "$sample"| gawk -v userCpuNo="$SENSORS_CPU_NO" '
|
|
||||||
|
|
||||||
IFS=","
|
IFS=","
|
||||||
if [[ $B_SENSORS == 'true' ]];then
|
if [[ $B_SENSORS == 'true' ]];then
|
||||||
# note: non-configured sensors gives error message, which we need to redirect to stdout
|
# note: non-configured sensors gives error message, which we need to redirect to stdout
|
||||||
|
@ -3025,6 +3021,7 @@ local sample="
|
||||||
IGNORECASE=1
|
IGNORECASE=1
|
||||||
moboTemp=""
|
moboTemp=""
|
||||||
cpuTemp=""
|
cpuTemp=""
|
||||||
|
core0Temp="" # only if all else fails...
|
||||||
moboTempReal=""
|
moboTempReal=""
|
||||||
cpuTempReal=""
|
cpuTempReal=""
|
||||||
tempUnit=""
|
tempUnit=""
|
||||||
|
@ -3074,6 +3071,17 @@ local sample="
|
||||||
tempUnit="°" $3
|
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
|
# note: can be cpu fan:, cpu fan speed:, etc
|
||||||
/^CPU Fan(.*):/ {
|
/^CPU Fan(.*):/ {
|
||||||
if ( $3 ~ /(.+):/ ){
|
if ( $3 ~ /(.+):/ ){
|
||||||
|
@ -3148,7 +3156,6 @@ local sample="
|
||||||
else if ( temp1 == "" && temp2 == "" && cpuTemp == "" && moboTemp == "" ){
|
else if ( temp1 == "" && temp2 == "" && cpuTemp == "" && moboTemp == "" ){
|
||||||
tempFanType=1
|
tempFanType=1
|
||||||
}
|
}
|
||||||
# print "tft: " tempFanType
|
|
||||||
|
|
||||||
# then get the real cpu temp, best guess is hottest is real
|
# then get the real cpu temp, best guess is hottest is real
|
||||||
if ( cpuTemp != "" ){
|
if ( cpuTemp != "" ){
|
||||||
|
@ -3165,6 +3172,10 @@ local sample="
|
||||||
else {
|
else {
|
||||||
cpuTempReal=temp1
|
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
|
# then the real mobo temp
|
||||||
if ( moboTemp != "" ){
|
if ( moboTemp != "" ){
|
||||||
|
@ -3236,7 +3247,6 @@ local sample="
|
||||||
if ( cpuTempReal != "" ) {
|
if ( cpuTempReal != "" ) {
|
||||||
cpuTempReal = cpuTempReal tempUnit
|
cpuTempReal = cpuTempReal tempUnit
|
||||||
}
|
}
|
||||||
# print "tempunit: " tempUnit
|
|
||||||
|
|
||||||
# if they are ALL null, print error message. psFan is not used in output currently
|
# 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 == "" ) {
|
if ( cpuTempReal == "" && moboTempReal == "" && aFanReal[1] == "" && aFanReal[2] == "" && aFanReal[3] == "" && sysFanString == "" ) {
|
||||||
|
|
Loading…
Reference in a new issue