From 6649e5c79432519032e525fe86990505e2c75f78 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Mon, 3 Aug 2009 08:21:11 +0000 Subject: [PATCH] bug fix, handled case of multiple gpus and temps --- inxi | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/inxi b/inxi index 87dac00..d7293b4 100755 --- a/inxi +++ b/inxi @@ -2195,12 +2195,17 @@ get_gpu_temp_data() gpu_temp=$( nvidia-settings -q GPUCoreTemp | gawk -F ': ' ' BEGIN { IGNORECASE=1 + gpuTemp="" + gpuTempWorking="" } /Attribute (.*)[0-9]+\.$/ { gsub(/\./, "", $2) if ( $2 ~ /^[0-9]+$/ ) { - print $2 + gpuTemp=gpuTemp $2 "C " } + } + END { + print gpuTemp }' ) elif [[ -n $( type -p aticonfig ) ]];then @@ -2208,12 +2213,17 @@ get_gpu_temp_data() gpu_temp=$( aticonfig --adapter=all --od-gettemperature | gawk -F ': ' ' BEGIN { IGNORECASE=1 + gpuTemp="" + gpuTempWorking="" } /Sensor (.*)[0-9\.]+ / { - gpuTemp=gensub(/(.*) ([0-9\.]+) (.*)/, "\\2", "1", $2) - if ( gpuTemp ~ /^[0-9\.]+$/ ) { - print gpuTemp + gpuTempWorking=gensub(/(.*) ([0-9\.]+) (.*)/, "\\2", "1", $2) + if ( gpuTempWorking ~ /^[0-9\.]+$/ ) { + gpuTemp=gpuTemp gpuTempWorking "C " } + } + END { + print gpuTemp }' ) fi @@ -4273,7 +4283,7 @@ print_sensors_data() fi gpu_temp=$( get_gpu_temp_data ) if [[ -n $gpu_temp ]];then - gpu_temp="${C1}gpu:${C2} ${gpu_temp}C " + gpu_temp="${C1}gpu:${C2} ${gpu_temp} " fi ;; # then the fan data from main fan array