tightened up fan/temp etc handling

This commit is contained in:
inxi-svn 2009-07-27 19:20:30 +00:00
parent 9218415849
commit 3d188b3814

14
inxi
View file

@ -3035,7 +3035,7 @@ get_sensors_data()
# different systems before this can be trusted much. Note that there # different systems before this can be trusted much. Note that there
# is a hack here to handle cases where search term has 1 or 2 words with space # is a hack here to handle cases where search term has 1 or 2 words with space
# also, the assumption that temp1 is cpu fan and temp2 is sys temp is not always right. # also, the assumption that temp1 is cpu fan and temp2 is sys temp is not always right.
/M\/B Temp|MB Temp|SYS Temp|temp2:/ { /^(M\/B|MB|SYS) Temp|^temp2:/ {
if ( $1 == "temp2:" ) { if ( $1 == "temp2:" ) {
tempData1=$2 tempData1=$2
tempData2=$3 tempData2=$3
@ -3055,7 +3055,7 @@ get_sensors_data()
} }
} }
} }
/CPU Temp|temp1:/ { /^CPU Temp|^temp1:/ {
if ( $1 == "temp1:" ) { if ( $1 == "temp1:" ) {
tempData1=$2 tempData1=$2
tempData2=$3 tempData2=$3
@ -3076,7 +3076,7 @@ get_sensors_data()
} }
} }
# 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 ~ /(.+):/ ){
cpuFan=$4 cpuFan=$4
} }
@ -3084,18 +3084,18 @@ get_sensors_data()
cpuFan=$3 cpuFan=$3
} }
} }
/fan1:/ { /^fan1:/ {
sysFan1=$2 sysFan1=$2
} }
/fan2:/ { /^fan2:/ {
sysFan2=$2 sysFan2=$2
} }
/fan3:/ { /^fan3:/ {
sysFan3=$2 sysFan3=$2
} }
END { END {
# rough hack to get rid of bad fan speeds for cases where fan1 and cpu fan speeds are the same: # rough hack to get rid of bad fan speeds for cases where fan1/2/3 and cpu fan speed are the same:
if ( cpuFan == sysFan1 && cpuFan != 0 ) { if ( cpuFan == sysFan1 && cpuFan != 0 ) {
sysFan1 = "" sysFan1 = ""
} }