(change version)

fixed fan speed output for fringe cases, also fixed possible overwrite of fan speeds.
the fan output isn't perfect though, but it will do for now.
This commit is contained in:
inxi-svn 2010-01-07 23:59:16 +00:00
parent 829aa64b70
commit 8eb4d3d470

41
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.2.8
#### Date: December 25 2009
#### version: 1.2.9
#### Date: January 7 2010
########################################################################
#### SPECIAL THANKS
########################################################################
@ -3312,19 +3312,32 @@ get_sensors_data()
/(Power|P\/S|POWER)(.*)[ \t]*([0-9]+)[ \t]RPM/ {
aFanMain[3]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
}
/^(AUX(1)? |FAN(1)? |CASE(1)? |CHASSIS(1)? )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
aFanMain[4]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
}
/^(AUX([2-9]) |FAN([2-9]) |CASE([2-9]) |CHASSIS([2-9]) )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
sysFanNu=gensub( /^(AUX|FAN|CASE|CHASSIS)([2-9])[ \t]+(.*)/, "\\2", 1, $1 )
if ( sysFanNu ~ /^([2-9])$/ ) {
# note: cpu/mobo/ps/fan1 above are 1/2/3/4
sysFanNu = sysFanNu + 3
# note that the counters are dynamically set for fan numbers here
# otherwise you could overwrite eg aux fan2 with case fan2 in theory
# note: cpu/mobo/ps are 1/2/3
/^(AUX(1)? |CASE(1)? |CHASSIS(1)? )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
for ( i = 4; i < 7; i++ ){
if ( ! i in aFanMain ){
sysFanNu = i
aFanMain[sysFanNu]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
break
}
}
/^fan([0-9]+)(.*)[ \t]*([0-9]+)[ \t]RPM/ {
}
/^(AUX([2-9]) |CASE([2-9]) |CHASSIS([2-9]) )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
for ( i = 5; i < 30; i++ ){
if ( ! i in aFanMain ){
sysFanNu = i
aFanMain[sysFanNu]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
break
}
}
}
# in rare cases syntax is like: fan1: xxx RPM
/^(FAN(1)?[ \t:])(.*)[ \t]*([0-9]+)[ \t]RPM/ {
aFanDefault[1]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
}
/^FAN([2-9]|1[0-9])(.*)[ \t]*([0-9]+)[ \t]RPM/ {
fanWorking=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
sysFanNu=gensub( /fan([0-9]+)/, "\\1", 1, $1 )
if ( sysFanNu ~ /^([0-9]+)$/ ) {
@ -3364,6 +3377,9 @@ get_sensors_data()
else if ( temp1 == "" && temp2 == "" && cpuTemp == "" && moboTemp == "" ){
tempFanType=1
}
else if ( temp1 != "" && temp2 == "" && cpuTemp == "" && moboTemp == "" ){
tempFanType=1
}
# then get the real cpu temp, best guess is hottest is real
if ( cpuTemp != "" ){
@ -3434,7 +3450,6 @@ get_sensors_data()
aFanDefault[j] = ""
}
}
}
}