branch one, sensors

This commit is contained in:
inxi-svn 2014-04-28 19:57:42 +00:00
parent 2b6b9ae04e
commit c237ac3e02

26
inxi
View file

@ -3,7 +3,7 @@
#### Script Name: inxi
#### Version: 2.1.23
#### Date: 2014-04-28
#### Patch Number: 05-b1
#### Patch Number: 06-b1
########################################################################
#### SPECIAL THANKS
########################################################################
@ -8211,6 +8211,7 @@ get_sensors_data()
sysFanString=""
temp1=""
temp2=""
temp3=""
tempDiff=20 # for C, handled for F after that is determined
tempFanType="" # set to 1 or 2
tempUnit=""
@ -8284,6 +8285,17 @@ get_sensors_data()
tempUnit=tempWorkingUnit
}
}
# temp3 is only used as an absolute override for systems with all 3 present
$1 ~ /^temp3$/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
tempWorking=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 )
if ( temp3 == "" || tempWorking > 0 ) {
temp3=tempWorking
}
tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
tempUnit=tempWorkingUnit
}
}
# final fallback if all else fails, funtoo user showed sensors putting
# temp on wrapped second line, not handled
/^(core0|core 0|Physical id 0)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
@ -8356,13 +8368,15 @@ get_sensors_data()
END {
# first we need to handle the case where we have to determine which temp/fan to use for cpu and mobo:
# note, for rare cases of weird cool cpus, user can override in their prefs and force the assignment
# this is wrong for systems with > 2 tempX readings, but the logic is too complex with 3 variables
# so have to accept that it will be wrong in some cases, particularly for motherboard temp readings.
if ( temp1 != "" && temp2 != "" ){
if ( userCpuNo != "" && userCpuNo ~ /(1|2)/ ) {
tempFanType=userCpuNo
}
else {
# first some fringe cases with cooler cpu than mobo: assume which is cpu temp based on fan speed
# but only if other fan speed is 0
# but only if other fan speed is 0.
if ( temp1 >= temp2 && 1 in aFanDefault && 2 in aFanDefault && aFanDefault[1] == 0 && aFanDefault[2] > 0 ) {
tempFanType=2
}
@ -8412,7 +8426,7 @@ get_sensors_data()
cpuTempReal=temp2
}
else {
cpuTempReal=temp2
cpuTempReal=temp1
}
}
else {
@ -8423,6 +8437,9 @@ get_sensors_data()
cpuTempReal=temp2
}
}
if ( temp1 != "" && temp2 != "" && temp3 != "" && temp3 > cpuTempReal ) {
cpuTempReal=temp3
}
}
else {
cpuTempReal=temp1 # can be null, that is ok
@ -8465,6 +8482,9 @@ get_sensors_data()
moboTempReal=temp1
}
}
if ( temp1 != "" && temp2 != "" && temp3 != "" && temp3 < moboTempReal ) {
moboTempReal= temp3
}
}
else {
moboTempReal=temp2