xbmc: add a more general check for cpu temperature found on some newer systems

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2014-09-27 21:09:19 +02:00
parent 60b7dcc1e2
commit afe339da55

View File

@ -32,32 +32,42 @@ if [ $(basename "$0") = "gputemp" -o "$1" = "gpu" ]; then
fi fi
if [ "$1" = "cpu" -o "$TEMP" = "0" ]; then if [ "$1" = "cpu" -o "$TEMP" = "0" ]; then
if [ -f /sys/class/hwmon/hwmon1/temp1_input ]; then
# used on Asus systems (ie. AT5IONT-I) # used with coretemp
TEMP=`cat /sys/class/hwmon/hwmon1/temp1_input` for hwmon in hwmon0 hwmon1; do
elif [ -f /sys/devices/platform/coretemp.0/temp1_input ]; then for temp in temp1 temp2; do
# used with coretemp if [ "$TEMP" = "0" -a -f /sys/class/hwmon/${hwmon}/${temp}_input ]; then
TEMP=`cat /sys/devices/platform/coretemp.0/temp1_input` if [ -f /sys/class/hwmon/${hwmon}/name ]; then
elif [ -f /sys/devices/platform/coretemp.0/temp2_input ]; then if [ ! "$(cat /sys/class/hwmon/${hwmon}/name)" = acpitz ]; then
# used with coretemp TEMP=$(cat /sys/class/hwmon/${hwmon}/${temp}_input)
TEMP=`cat /sys/devices/platform/coretemp.0/temp2_input` fi
elif [ -f /sys/bus/acpi/devices/LNXTHERM\:00/thermal_zone/temp ]; then fi
# used on some intel systems fi
TEMP=`cat /sys/bus/acpi/devices/LNXTHERM\:00/thermal_zone/temp` done
elif [ -f /sys/devices/virtual/thermal/thermal_zone0/temp ]; then done
# used on some intel systems
TEMP=`cat /sys/devices/virtual/thermal/thermal_zone0/temp` # used on AMD systems
elif [ -f /sys/class/hwmon/hwmon0/temp1_input ]; then if [ "$TEMP" = "0" -a -f /sys/class/hwmon/hwmon0/device/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
TEMP=`cat /sys/class/hwmon/hwmon0/device/temp1_input` TEMP=`cat /sys/class/hwmon/hwmon0/device/temp1_input`
elif [ -f /sys/class/hwmon/hwmon0/device/temp2_input ]; then fi
# used on ION systems
# 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` TEMP=`cat /sys/class/hwmon/hwmon0/device/temp2_input`
elif [ -f /sys/class/thermal/thermal_zone0/temp ]; then fi
# used on RaspberryPi
# 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` TEMP=`cat /sys/class/thermal/thermal_zone0/temp`
fi fi