From 7a6e1bdec335234507fb0d12632f1208a65f9be4 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Mon, 27 Jul 2009 06:07:18 +0000 Subject: [PATCH] trying to handle fan1:, temp1:, temp2: --- inxi | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/inxi b/inxi index cbad503..2b288bb 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.0.85-b1 +#### version: 1.0.86-b1 #### Date: 26 July 2009 ######################################################################## #### SPECIAL THANKS @@ -3019,26 +3019,51 @@ get_sensors_data() moboTemp="" cpuTemp="" cpuFan="" + tempData1="" + tempData2="" } # dumping the extra + signs, nobody has negative temps # also, note gawk treats ° as a space, so we have to get the C/F data # explicitly by testing for $4 ~ /C|F/ then concatenating manually # there are some guesses here, and we will need a lot more data of - # different systems before this can be trusted much + # different systems before this can be trusted much. Note that there + # is a hack here to handle cases where search term has 1 or 2 words with space /M\/B Temp|SYS Temp|temp2:/ { - moboTemp=gensub( /\+(.+)/, "\\1", 1, $3 ) - if ( $4 ~ /C|F/ ){ - moboTemp=moboTemp "°" $4 + if ( $1 == "temp2:" ) { + tempData1=$2 + tempData2=$3 + } + else { + tempData1=$3 + tempData2=$4 + } + moboTemp=gensub( /\+(.+)/, "\\1", 1, tempData1 ) + if ( tempData2 ~ /C|F/ ){ + moboTemp=moboTemp "°" tempData2 } } /CPU Temp|temp1:/ { - cpuTemp=gensub( /\+(.+)/, "\\1", 1, $3 ) - if ( $4 ~ /C|F/ ){ - cpuTemp=cpuTemp "°" $4 + if ( $1 == "temp1:" ) { + tempData1=$2 + tempData2=$3 + } + else { + tempData1=$3 + tempData2=$4 + } + cpuTemp=gensub( /\+(.+)/, "\\1", 1, tempData1 ) + if ( tempData2 ~ /C|F/ ){ + cpuTemp=cpuTemp "°" tempData2 } } - /CPU Fan/ { - cpuFan=$3 + /CPU Fan|fan1:/ { + if ( $1 == "fan1:" ) { + tempData1=$2 + } + else { + tempData1=$3 + } + cpuFan=tempData1 } END {