diff --git a/inxi b/inxi index 9716111..b33c049 100755 --- a/inxi +++ b/inxi @@ -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 ######################################################################## @@ -3213,7 +3213,7 @@ get_sensors_data() # 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,like - :1287 A_SENSORS_DATA=( $( - sensors | gawk -F ':' -v userCpuNo="$SENSORS_CPU_NO" ' + sensors | gawk -F ':' -v userCpuNo="$SENSORS_CPU_NO" ' BEGIN { IGNORECASE=1 core0Temp="" # only if all else fails... @@ -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 - aFanMain[sysFanNu]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 ) + # 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] = "" } } - } }