made 2 line output, for fans and temps

This commit is contained in:
inxi-svn 2009-07-27 22:20:15 +00:00
parent c911060396
commit d9b0fde91a

23
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.0.95-b1
#### version: 1.0.96-b1
#### Date: 27 July 2009
########################################################################
#### SPECIAL THANKS
@ -4057,26 +4057,27 @@ print_sensors_data()
{
eval $LOGFS
local mobo_temp='' cpu_temp='' cpu_fan='' sys_fan1='' sys_fan2='' sys_fan3=''
local ps_fan='' sensors_data=''
local ps_fan='' temp_data='' fan_data='' b_is_error='false'
get_sensors_data
# initial error cases, for missing app or unconfigured sensors
if [[ ${#A_SENSORS_DATA[@]} -eq 1 ]];then
mobo_temp=${A_SENSORS_DATA[0]}
b_is_error='true'
else
if [[ -n ${A_SENSORS_DATA[0]} ]];then
mobo_temp=${A_SENSORS_DATA[0]}
else
mobo_temp='N/A'
fi
mobo_temp="${C1}Mobo Temp:${C2} $mobo_temp "
mobo_temp="${C1}System Temperatures: mobo:${C2} $mobo_temp "
if [[ -n ${A_SENSORS_DATA[1]} ]];then
cpu_temp=${A_SENSORS_DATA[1]}
else
cpu_temp='N/A'
fi
cpu_temp="${C1}Cpu Temp:${C2} $cpu_temp "
cpu_temp="${C1}cpu:${C2} $cpu_temp "
# we need to make sure it's either cpu fan OR cpu fan and sys fan 1
if [[ -n ${A_SENSORS_DATA[2]} ]];then
@ -4086,7 +4087,7 @@ print_sensors_data()
else
cpu_fan='N/A'
fi
cpu_fan="${C1}:: FANS(rpm): cpu:${C2} $cpu_fan "
cpu_fan="${C1}Fan Speeds (rpm): cpu:${C2} $cpu_fan "
# then set the sys fans, if present or 0. sys fan 1 only if cpu fan is present,
# otherwise fan1: is cpu fan
if [[ -n ${A_SENSORS_DATA[2]} && -n ${A_SENSORS_DATA[3]} ]];then
@ -4102,9 +4103,15 @@ print_sensors_data()
ps_fan="${C1}ps:${C2} ${A_SENSORS_DATA[6]} "
fi
fi
sensors_data="$mobo_temp$cpu_temp$cpu_fan$sys_fan1$sys_fan2$sys_fan3$ps_fan"
sensors_data=$( create_print_line "Sensors:" "$sensors_data" )
print_screen_output "$sensors_data"
temp_data="$mobo_temp$cpu_temp"
temp_data=$( create_print_line "Sensors:" "$temp_data" )
print_screen_output "$temp_data"
# don't print second or subsequent lines if error data
if [[ $b_is_error != 'true' ]];then
fan_data="$cpu_fan$sys_fan1$sys_fan2$sys_fan3$ps_fan"
fan_data=$( create_print_line " " "$fan_data" )
print_screen_output "$fan_data"
fi
eval $LOGFE
}