mirror of
https://github.com/LibreELEC/LibreELEC.tv
synced 2025-09-24 19:46:01 +07:00
Rockchip: consolidate cputemp and gputemp
Use thermal zone type to determin how to read cpu or gpu temp
This commit is contained in:
committed by
Christian Hewitt
parent
1d6c4baa27
commit
3cce144b5e
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)"
|
||||
echo "$(($TEMP / 1000)) C"
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
TEMP="$(cat /sys/class/thermal/thermal_zone1/temp)"
|
||||
echo "$(($TEMP / 1000)) C"
|
||||
@@ -4,5 +4,18 @@
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)"
|
||||
# try to find temperature of cpu
|
||||
for thermal_zone in /sys/devices/virtual/thermal/thermal_zone*; do
|
||||
[ -d "$thermal_zone" ] || continue
|
||||
if [[ "$(cat $thermal_zone/type)" =~ '(cpu|soc)-thermal' ]]; then
|
||||
TEMP="$(cat $thermal_zone/temp)"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# fallback to highest temperature
|
||||
if [ -z "$TEMP" ]; then
|
||||
TEMP=$(cat /sys/devices/virtual/thermal/thermal_zone*/temp | sort -n | tail -1)
|
||||
fi
|
||||
|
||||
echo "$(($TEMP / 1000)) C"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
cputemp
|
||||
21
projects/Rockchip/filesystem/usr/bin/gputemp
Executable file
21
projects/Rockchip/filesystem/usr/bin/gputemp
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
# try to find temperature of gpu
|
||||
for thermal_zone in /sys/devices/virtual/thermal/thermal_zone*; do
|
||||
[ -d "$thermal_zone" ] || continue
|
||||
if [ "$(cat $thermal_zone/type)" = "gpu-thermal" ]; then
|
||||
TEMP="$(cat $thermal_zone/temp)"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# fallback to highest temperature
|
||||
if [ -z "$TEMP" ]; then
|
||||
TEMP=$(cat /sys/devices/virtual/thermal/thermal_zone*/temp | sort -n | tail -1)
|
||||
fi
|
||||
|
||||
echo "$(($TEMP / 1000)) C"
|
||||
Reference in New Issue
Block a user