bug fixes

This commit is contained in:
inxi-svn 2009-07-28 19:23:41 +00:00
parent d2c15cfec9
commit 15afeadcd2

32
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.0.100-b1 #### version: 1.0.101-b1
#### Date: 28 July 2009 #### Date: 28 July 2009
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -3012,6 +3012,11 @@ 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
@ -3052,13 +3057,20 @@ get_sensors_data()
} }
} }
/^temp1:/ { /^temp1:/ {
temp1=gensub( /\+(.+)/, "\\1", 1, $2 ) tempWorking=gensub( /\+(.+)/, "\\1", 1, $2 )
if ( temp1 == "" || tempWorking > 0 ) {
temp1=tempWorking
}
if ( $3 ~ /C|F/ && tempUnit == "" ){ if ( $3 ~ /C|F/ && tempUnit == "" ){
tempUnit="°" $3 tempUnit="°" $3
} }
} }
/^temp2:/ { /^temp2:/ {
temp2=gensub( /\+(.+)/, "\\1", 1, $2 ) # add to array if array index does not exist OR if number is > 0
tempWorking=gensub( /\+(.+)/, "\\1", 1, $2 )
if ( temp2 == "" || tempWorking > 0 ) {
temp2=tempWorking
}
if ( $3 ~ /C|F/ && tempUnit == "" ){ if ( $3 ~ /C|F/ && tempUnit == "" ){
tempUnit="°" $3 tempUnit="°" $3
} }
@ -3109,15 +3121,18 @@ get_sensors_data()
/^fan([0-9]+):/ { /^fan([0-9]+):/ {
sysFanNu=gensub( /fan([0-9]+):/, "\\1", 1, $1 ) sysFanNu=gensub( /fan([0-9]+):/, "\\1", 1, $1 )
if ( sysFanNu ~ /([0-9]+)/ ) { if ( sysFanNu ~ /([0-9]+)/ ) {
# add to array if array index does not exist OR if number is > existing number
if ( ! sysFanNu in aFanWorking || $2 >= aFanWorking[sysFanNu] ) {
aFanWorking[sysFanNu]=$2 aFanWorking[sysFanNu]=$2
} }
} }
}
END { END {
# first we need to handle the case where we have to determine which temp/fan to use for cpu and mobo: # 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 # note, for rare cases of weird cool cpus, user can override in their prefs and force the assignment
if ( temp1 != "" && temp2 != "" ){ if ( temp1 != "" && temp2 != "" ){
if ( userCpuNo ~ /(1|2)/ ) { if ( userCpuNo != "" && userCpuNo ~ /(1|2)/ ) {
tempFanType=userCpuNo tempFanType=userCpuNo
} }
else { else {
@ -3129,6 +3144,7 @@ get_sensors_data()
} }
} }
} }
# 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 != "" ){
@ -3162,8 +3178,8 @@ get_sensors_data()
moboTempReal=temp2 moboTempReal=temp2
} }
# then the cpu fan speed # then set the cpu fan speed
if ( aFanReal[1] != "" ) { if ( aFanReal[1] == "" ) {
if ( tempFanType == 1 && aFanWorking[1] != "" ) { if ( tempFanType == 1 && aFanWorking[1] != "" ) {
aFanReal[1]=aFanWorking[1] aFanReal[1]=aFanWorking[1]
} }
@ -3171,7 +3187,8 @@ get_sensors_data()
aFanReal[1]=aFanWorking[2] aFanReal[1]=aFanWorking[2]
} }
} }
# then set mobo fan if missing
# then set mobo fan if missing. Note, not trying to guess on either of these
if ( ! 2 in aFanReal ) { if ( ! 2 in aFanReal ) {
aFanReal[2] = "" aFanReal[2] = ""
} }
@ -3214,6 +3231,7 @@ get_sensors_data()
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 == "" && sysFanString == "" ) { if ( cpuTempReal == "" && moboTempReal == "" && sysFanString == "" ) {