From 15afeadcd2b9089d222447295afbb37be2cc0573 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Tue, 28 Jul 2009 19:23:41 +0000 Subject: [PATCH] bug fixes --- inxi | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/inxi b/inxi index 6f613d2..8497686 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.0.100-b1 +#### version: 1.0.101-b1 #### Date: 28 July 2009 ######################################################################## #### SPECIAL THANKS @@ -3012,6 +3012,11 @@ get_sensors_data() { eval $LOGFS +local sample=" + +" +# echo "$sample"| gawk -v userCpuNo="$SENSORS_CPU_NO" ' + IFS="," if [[ $B_SENSORS == 'true' ]];then # note: non-configured sensors gives error message, which we need to redirect to stdout @@ -3052,13 +3057,20 @@ get_sensors_data() } } /^temp1:/ { - temp1=gensub( /\+(.+)/, "\\1", 1, $2 ) + tempWorking=gensub( /\+(.+)/, "\\1", 1, $2 ) + if ( temp1 == "" || tempWorking > 0 ) { + temp1=tempWorking + } if ( $3 ~ /C|F/ && tempUnit == "" ){ tempUnit="°" $3 } } /^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 == "" ){ tempUnit="°" $3 } @@ -3109,7 +3121,10 @@ get_sensors_data() /^fan([0-9]+):/ { sysFanNu=gensub( /fan([0-9]+):/, "\\1", 1, $1 ) if ( sysFanNu ~ /([0-9]+)/ ) { - aFanWorking[sysFanNu]=$2 + # 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 + } } } @@ -3117,7 +3132,7 @@ get_sensors_data() # 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 if ( temp1 != "" && temp2 != "" ){ - if ( userCpuNo ~ /(1|2)/ ) { + if ( userCpuNo != "" && userCpuNo ~ /(1|2)/ ) { tempFanType=userCpuNo } else { @@ -3129,6 +3144,7 @@ get_sensors_data() } } } +# print "tft: " tempFanType # then get the real cpu temp, best guess is hottest is real if ( cpuTemp != "" ){ @@ -3162,8 +3178,8 @@ get_sensors_data() moboTempReal=temp2 } - # then the cpu fan speed - if ( aFanReal[1] != "" ) { + # then set the cpu fan speed + if ( aFanReal[1] == "" ) { if ( tempFanType == 1 && aFanWorking[1] != "" ) { aFanReal[1]=aFanWorking[1] } @@ -3171,7 +3187,8 @@ get_sensors_data() 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 ) { aFanReal[2] = "" } @@ -3214,6 +3231,7 @@ get_sensors_data() if ( cpuTempReal != "" ) { cpuTempReal = cpuTempReal tempUnit } +# print "tempunit: " tempUnit # if they are ALL null, print error message. psFan is not used in output currently if ( cpuTempReal == "" && moboTempReal == "" && sysFanString == "" ) {