(change version)

More fine tuning of sensors. Handled case where temp 1 or 2 is greater than temp 2 or 1, but fan speed is zero for the hotter case, and is 
> 0 for the cooler case. This means that the cpu fan will be the cooler temp.

Added an attempt to set mobo fan speed if fanx is > 5000k rpm, those little fans will always be fast and on mobo, or almost always.
This commit is contained in:
inxi-svn 2009-07-31 22:26:09 +00:00
parent a402275233
commit 0bc773464f

35
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.1.3 #### version: 1.1.4
#### Date: 29 July 2009 #### Date: 31 July 2009
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
######################################################################## ########################################################################
@ -3020,9 +3020,9 @@ get_sensors_data()
IFS=$'\n' IFS=$'\n'
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
# also, -F ':' no space, since some cases have the data starting right after : # also, -F ':' no space, since some cases have the data starting right after,like - :1287
A_SENSORS_DATA=( $( A_SENSORS_DATA=( $(
sensors | gawk -F ': ' -v userCpuNo="$SENSORS_CPU_NO" ' sensors | gawk -F ':' -v userCpuNo="$SENSORS_CPU_NO" '
BEGIN { BEGIN {
IGNORECASE=1 IGNORECASE=1
core0Temp="" # only if all else fails... core0Temp="" # only if all else fails...
@ -3120,7 +3120,7 @@ get_sensors_data()
aFanMain[3]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 ) aFanMain[3]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
} }
/^(FAN(1)? |CHASSIS(1)?)[ \t](.*)[ \t]*([0-9]+)[ \t]RPM/ { /^(AUX|FAN(1)? |CHASSIS(1)? )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
aFanMain[4]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 ) aFanMain[4]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
} }
/^FAN([2-9]) |CHASSIS([2-9] )(.*)[ \t]*([0-9]+)[ \t]RPM/ { /^FAN([2-9]) |CHASSIS([2-9] )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
@ -3150,7 +3150,16 @@ get_sensors_data()
tempFanType=userCpuNo tempFanType=userCpuNo
} }
else { else {
if ( temp1 >= temp2 ) { # 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
if ( temp1 >= temp2 && 1 in aFanDefault && 2 in aFanDefault && aFanDefault[1] == 0 && aFanDefault[2] > 0 ) {
tempFanType=2
}
else if ( temp2 >= temp1 && 1 in aFanDefault && 2 in aFanDefault && aFanDefault[2] == 0 && aFanDefault[1] > 0 ) {
tempFanType=1
}
# then handle the standard case if these fringe cases are false
else if ( temp1 >= temp2 ) {
tempFanType=1 tempFanType=1
} }
else { else {
@ -3230,6 +3239,18 @@ get_sensors_data()
aFanDefault[j] = "" aFanDefault[j] = ""
} }
} }
}
}
# now see if you can find the fast little mobo fan, > 5000 rpm and put it as mobo
for (j = 1; j <= indexCountaFanDefault; j++) {
if ( j in aFanDefault && aFanDefault[j] > 5000 && aFanMain[2] == "" ) {
aFanMain[2] = aFanDefault[j]
aFanDefault[j] = ""
# then add one if required for output
if ( indexCountaFanMain < 2 ) {
indexCountaFanMain = 2
}
} }
} }
@ -4201,7 +4222,7 @@ print_sensors_data()
;; ;;
2) 2)
if [[ -n ${a_sensors_working[2]} ]];then if [[ -n ${a_sensors_working[2]} ]];then
ps_fan="${C1}ps:${C2} ${a_sensors_working[2]} " ps_fan="${C1}psu:${C2} ${a_sensors_working[2]} "
(( fan_count++ )) (( fan_count++ ))
fi fi
;; ;;