From 6cd07f90085991e45179caa0d6ba3e26459553a0 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 24 Jun 2011 21:59:57 +0000 Subject: [PATCH] adding support, initial, for free xorg gpu temp output, first only for the newer radeons --- inxi | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/inxi b/inxi index ff78395..21e0457 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.7.10 -#### Date: June 22 2011 +#### version: 1.7.11 +#### Date: June 24 2011 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -3504,6 +3504,30 @@ get_gpu_temp_data() print gpuTemp }' ) + # this handles some newer cases of free driver temp readouts, will require modifications as + # more user data appears. + elif [[ -n $Sensors_Data ]];then + gpu_temp=$( + gawk ' + BEGIN { + IGNORECASE=1 + gpuTemp="" + separator="" + } + /^radeon-/ { + while ( getline && !/^$/ ) { + if ( /^temp/ ) { + sub(/^[[:alnum:]]*.*:/, "", $0 ) # clear out everything to the : + gsub(/[\+ \t°]/, "", $1) # ° is a special case, like a space for gawk + gpuTemp=gpuTemp separator $1 + separator="," + } + } + } + END { + print gpuTemp + }' <<< "$Sensors_Data" + ) fi if [[ -n $gpu_temp ]];then @@ -5327,15 +5351,15 @@ get_sensors_data() { eval $LOGFS - local sensors_path=$( type -p sensors ) + local temp_array='' IFS=$'\n' - if [[ -n $sensors_path ]];then + if [[ -n $Sensors_Data ]];then # 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_path | gawk -F ':' -v userCpuNo="$SENSORS_CPU_NO" ' + gawk -F ':' -v userCpuNo="$SENSORS_CPU_NO" ' BEGIN { IGNORECASE=1 core0Temp="" # only if all else fails... @@ -5645,8 +5669,7 @@ get_sensors_data() print fanMainString print fanDefaultString } - } - ' + }' <<< "$Sensors_Data" ) ) # the error case needs to go here because we are setting special array delimiter ',' else @@ -5660,6 +5683,14 @@ get_sensors_data() eval $LOGFE } +get_sensors_output() +{ + local sensors_path=$( type -p sensors ) + if [[ $sensors_path ]];then + $sensors_path 2>/dev/null + fi +} + get_unmounted_partition_data() { eval $LOGFS @@ -7321,6 +7352,7 @@ print_sensors_data() local mobo_temp='' cpu_temp='' psu_temp='' cpu_fan='' mobo_fan='' ps_fan='' sys_fans='' sys_fans2='' local temp_data='' fan_data='' fan_data2='' b_is_error='false' fan_count=0 gpu_temp='' local a_sensors_working='' + local Sensors_Data="$( get_sensors_output )" get_sensors_data IFS=","