xbmc: another try for 'cputemp'

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-10-05 11:16:24 +02:00
parent e4494ea446
commit 35052f91b9

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
################################################################################ ################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv # This file is part of OpenELEC - http://www.openelec.tv
# 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 # 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 # it under the terms of the GNU General Public License as published by
@ -20,10 +20,32 @@
# http://www.gnu.org/copyleft/gpl.html # 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=0
TEMP=`/usr/bin/sensors -u | grep -A 1 "Core " | tail -n 1 | awk '{printf("%d\n",$2 + 0.5);}'`
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 fi
echo "${TEMP} C" echo "$(( $TEMP / 1000 )) C"