bug fix, handled case of multiple gpus and temps

This commit is contained in:
inxi-svn 2009-08-03 08:21:11 +00:00
parent a890e72a7f
commit 6649e5c794

20
inxi
View file

@ -2195,12 +2195,17 @@ get_gpu_temp_data()
gpu_temp=$( nvidia-settings -q GPUCoreTemp | gawk -F ': ' ' gpu_temp=$( nvidia-settings -q GPUCoreTemp | gawk -F ': ' '
BEGIN { BEGIN {
IGNORECASE=1 IGNORECASE=1
gpuTemp=""
gpuTempWorking=""
} }
/Attribute (.*)[0-9]+\.$/ { /Attribute (.*)[0-9]+\.$/ {
gsub(/\./, "", $2) gsub(/\./, "", $2)
if ( $2 ~ /^[0-9]+$/ ) { if ( $2 ~ /^[0-9]+$/ ) {
print $2 gpuTemp=gpuTemp $2 "C "
} }
}
END {
print gpuTemp
}' }'
) )
elif [[ -n $( type -p aticonfig ) ]];then elif [[ -n $( type -p aticonfig ) ]];then
@ -2208,12 +2213,17 @@ get_gpu_temp_data()
gpu_temp=$( aticonfig --adapter=all --od-gettemperature | gawk -F ': ' ' gpu_temp=$( aticonfig --adapter=all --od-gettemperature | gawk -F ': ' '
BEGIN { BEGIN {
IGNORECASE=1 IGNORECASE=1
gpuTemp=""
gpuTempWorking=""
} }
/Sensor (.*)[0-9\.]+ / { /Sensor (.*)[0-9\.]+ / {
gpuTemp=gensub(/(.*) ([0-9\.]+) (.*)/, "\\2", "1", $2) gpuTempWorking=gensub(/(.*) ([0-9\.]+) (.*)/, "\\2", "1", $2)
if ( gpuTemp ~ /^[0-9\.]+$/ ) { if ( gpuTempWorking ~ /^[0-9\.]+$/ ) {
print gpuTemp gpuTemp=gpuTemp gpuTempWorking "C "
} }
}
END {
print gpuTemp
}' }'
) )
fi fi
@ -4273,7 +4283,7 @@ print_sensors_data()
fi fi
gpu_temp=$( get_gpu_temp_data ) gpu_temp=$( get_gpu_temp_data )
if [[ -n $gpu_temp ]];then if [[ -n $gpu_temp ]];then
gpu_temp="${C1}gpu:${C2} ${gpu_temp}C " gpu_temp="${C1}gpu:${C2} ${gpu_temp} "
fi fi
;; ;;
# then the fan data from main fan array # then the fan data from main fan array