mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 21:26:49 +00:00
xbmc: merge 'gputemp' script with 'cputemp'
usage: <cputemp [cpu|gpu]> to show CPU or GPU temperature, without any parameters the CPU temperate is shown <gputemp> to show the GPU temperature if 'gputemp' is a symlink to 'cputemp' Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
c354b71f65
commit
535351f080
@ -454,7 +454,7 @@ post_makeinstall_target() {
|
|||||||
|
|
||||||
mkdir -p $INSTALL/usr/bin
|
mkdir -p $INSTALL/usr/bin
|
||||||
cp $PKG_DIR/scripts/cputemp $INSTALL/usr/bin
|
cp $PKG_DIR/scripts/cputemp $INSTALL/usr/bin
|
||||||
cp $PKG_DIR/scripts/gputemp $INSTALL/usr/bin
|
ln -sf cputemp $INSTALL/usr/bin/gputemp
|
||||||
cp $PKG_DIR/scripts/setwakeup.sh $INSTALL/usr/bin
|
cp $PKG_DIR/scripts/setwakeup.sh $INSTALL/usr/bin
|
||||||
cp tools/EventClients/Clients/XBMC\ Send/xbmc-send.py $INSTALL/usr/bin/xbmc-send
|
cp tools/EventClients/Clients/XBMC\ Send/xbmc-send.py $INSTALL/usr/bin/xbmc-send
|
||||||
|
|
||||||
|
@ -23,33 +23,45 @@
|
|||||||
|
|
||||||
TEMP=0
|
TEMP=0
|
||||||
|
|
||||||
if [ -f /sys/class/hwmon/hwmon1/temp1_input ]; then
|
if [ $(basename "$0") = "gputemp" -o "$1" = "gpu" ]; then
|
||||||
# used on Asus systems (ie. AT5IONT-I)
|
if [ -x /usr/bin/lspci ]; then
|
||||||
TEMP=`cat /sys/class/hwmon/hwmon1/temp1_input`
|
if lspci -n | grep 0300 | grep -q 10de; then
|
||||||
elif [ -f /sys/devices/platform/coretemp.0/temp1_input ]; then
|
[ -x /usr/bin/nvidia-smi ] && TEMP=`/usr/bin/nvidia-smi -q -x | grep 'gpu_temp' | awk '{ print $1 }' | sed 's,<gpu_temp>,,g'`
|
||||||
# used with coretemp
|
fi
|
||||||
TEMP=`cat /sys/devices/platform/coretemp.0/temp1_input`
|
fi
|
||||||
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`
|
|
||||||
elif [ -f /sys/class/thermal/thermal_zone0/temp ]; then
|
|
||||||
# used on RaspberryPi
|
|
||||||
TEMP=`cat /sys/class/thermal/thermal_zone0/temp`
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$(( $TEMP / 1000 )) C"
|
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
|
||||||
|
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`
|
||||||
|
elif [ -f /sys/class/thermal/thermal_zone0/temp ]; then
|
||||||
|
# used on RaspberryPi
|
||||||
|
TEMP=`cat /sys/class/thermal/thermal_zone0/temp`
|
||||||
|
fi
|
||||||
|
|
||||||
|
TEMP="$(( $TEMP / 1000 ))"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${TEMP} C"
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# This file is part of OpenELEC - http://www.openelec.tv
|
|
||||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
|
||||||
#
|
|
||||||
# OpenELEC is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# OpenELEC is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
TEMP="0"
|
|
||||||
|
|
||||||
if [ -x /usr/bin/lspci ] ; then
|
|
||||||
if lspci -n | grep 0300 | grep -q 10de; then
|
|
||||||
[ -f /usr/bin/nvidia-smi ] && TEMP=`/usr/bin/nvidia-smi -q -x | grep 'gpu_temp' | awk '{ print $1 }' | sed 's,<gpu_temp>,,g'`
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "${TEMP} C"
|
|
Loading…
x
Reference in New Issue
Block a user