From afe339da5592e2ed7608e10ba7ff799736387c1b Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sat, 27 Sep 2014 21:09:19 +0200 Subject: [PATCH] xbmc: add a more general check for cpu temperature found on some newer systems Signed-off-by: Stephan Raue --- packages/mediacenter/xbmc/scripts/cputemp | 58 +++++++++++++---------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/packages/mediacenter/xbmc/scripts/cputemp b/packages/mediacenter/xbmc/scripts/cputemp index aacdedb2af..5d198f30ba 100755 --- a/packages/mediacenter/xbmc/scripts/cputemp +++ b/packages/mediacenter/xbmc/scripts/cputemp @@ -32,32 +32,42 @@ if [ $(basename "$0") = "gputemp" -o "$1" = "gpu" ]; then fi if [ "$1" = "cpu" -o "$TEMP" = "0" ]; then - if [ -f /sys/class/hwmon/hwmon1/temp1_input ]; then - # used on Asus systems (ie. AT5IONT-I) - TEMP=`cat /sys/class/hwmon/hwmon1/temp1_input` - elif [ -f /sys/devices/platform/coretemp.0/temp1_input ]; then - # used with coretemp - TEMP=`cat /sys/devices/platform/coretemp.0/temp1_input` - elif [ -f /sys/devices/platform/coretemp.0/temp2_input ]; then - # used with coretemp - TEMP=`cat /sys/devices/platform/coretemp.0/temp2_input` - elif [ -f /sys/bus/acpi/devices/LNXTHERM\:00/thermal_zone/temp ]; then - # used on some intel systems - TEMP=`cat /sys/bus/acpi/devices/LNXTHERM\:00/thermal_zone/temp` - elif [ -f /sys/devices/virtual/thermal/thermal_zone0/temp ]; then - # used on some intel systems - TEMP=`cat /sys/devices/virtual/thermal/thermal_zone0/temp` - elif [ -f /sys/class/hwmon/hwmon0/temp1_input ]; then - # hwmon for new 2.6.39, 3.0 linux kernels - TEMP=`cat /sys/class/hwmon/hwmon0/temp1_input` - elif [ -f /sys/class/hwmon/hwmon0/device/temp1_input ]; then - # used on AMD systems + + # used with coretemp + for hwmon in hwmon0 hwmon1; do + for temp in temp1 temp2; do + if [ "$TEMP" = "0" -a -f /sys/class/hwmon/${hwmon}/${temp}_input ]; then + if [ -f /sys/class/hwmon/${hwmon}/name ]; then + if [ ! "$(cat /sys/class/hwmon/${hwmon}/name)" = acpitz ]; then + TEMP=$(cat /sys/class/hwmon/${hwmon}/${temp}_input) + fi + fi + fi + done + done + + # used on AMD systems + if [ "$TEMP" = "0" -a -f /sys/class/hwmon/hwmon0/device/temp1_input ]; then TEMP=`cat /sys/class/hwmon/hwmon0/device/temp1_input` - elif [ -f /sys/class/hwmon/hwmon0/device/temp2_input ]; then - # used on ION systems + fi + + # used on ION systems + if [ "$TEMP" = "0" -a -f /sys/class/hwmon/hwmon0/device/temp2_input ]; then TEMP=`cat /sys/class/hwmon/hwmon0/device/temp2_input` - elif [ -f /sys/class/thermal/thermal_zone0/temp ]; then - # used on RaspberryPi + fi + + # used on some intel systems + if [ "$TEMP" = "0" -a -f /sys/bus/acpi/devices/LNXTHERM\:00/thermal_zone/temp ]; then + TEMP=`cat /sys/bus/acpi/devices/LNXTHERM\:00/thermal_zone/temp` + fi + + # used on some intel systems + if [ "$TEMP" = "0" -a -f /sys/devices/virtual/thermal/thermal_zone0/temp ]; then + TEMP=`cat /sys/devices/virtual/thermal/thermal_zone0/temp` + fi + + # used on RaspberryPi + if [ "$TEMP" = "0" -a -f /sys/class/thermal/thermal_zone0/temp ]; then TEMP=`cat /sys/class/thermal/thermal_zone0/temp` fi