diff --git a/packages/mediacenter/xbmc/scripts/cputemp b/packages/mediacenter/xbmc/scripts/cputemp index b61b416323..3c35564ed1 100755 --- a/packages/mediacenter/xbmc/scripts/cputemp +++ b/packages/mediacenter/xbmc/scripts/cputemp @@ -1,8 +1,8 @@ #!/bin/sh ################################################################################ -# Copyright (C) 2009-2010 OpenELEC.tv -# http://www.openelec.tv +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) # # This Program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,10 +20,32 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -TEMP="0" +# inspired by +# https://github.com/xtranophilist/gnome-shell-extension-cpu-temperature/blob/master/extension.js -if [ -f /usr/bin/sensors ]; then - TEMP=`/usr/bin/sensors -u | grep -A 1 "Core " | tail -n 1 | awk '{printf("%d\n",$2 + 0.5);}'` +TEMP=0 + +if [ -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 + TEMP=`cat /sys/class/hwmon/hwmon0/device/temp1_input` +elif [ -f /sys/class/hwmon/hwmon0/device/temp2_input ]; then + # used on ION systems + TEMP=`cat /sys/class/hwmon/hwmon0/device/temp2_input` fi -echo "${TEMP} C" +echo "$(( $TEMP / 1000 )) C"