Simplify thermal readouts in update-motd.d/30-sysinfo

This commit is contained in:
Thomas Kaiser 2017-04-14 14:51:47 +02:00
parent fc8889a60c
commit 88bf31f88b
2 changed files with 26 additions and 29 deletions

View File

@ -125,7 +125,7 @@ InstallOpenMediaVault() {
# add USB3 Gigabit Ethernet and NAS Dock support
echo -e "r8152\nax88179_178a" >>/etc/modules
egrep -q "neo|zero" <<<${BOARD} && echo "overlays=usbhost0 usbhost2 usbhost3" >>/boot/armbianEnv.txt
egrep -q "air|neo|zero" <<<${BOARD} && echo "overlays=usbhost0 usbhost2 usbhost3" >>/boot/armbianEnv.txt
# some performance tuning
grep -q ondemand /etc/default/cpufrequtils && sed -i '/^exit\ 0/i \

View File

@ -100,43 +100,40 @@ if [ -e "$storage" ]; then
[[ "$storage" == */sd* ]] && hdd_temp=$(hddtemp -u C -nq $storage)
fi
# read temperature from different locations
# read temperature from different locations and create a symlink to a unique location
[ -d /etc/armbianmonitor/datasources ] || mkdir -p -m775 /etc/armbianmonitor/datasources
read board_temp </sys/devices/virtual/thermal/thermal_zone1/temp
ln -fs /sys/devices/virtual/thermal/thermal_zone1/temp /etc/armbianmonitor/datasources/soctemp
# from axp via i2c for some old sunxi
if [ -d "/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/" ]; then
board_temp=$(awk '{printf("%d",$1/1000)}' </sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input)
ln -fs /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input /etc/armbianmonitor/datasources/soctemp
fi
# deal with the exceptions first: legacy Allwinner variants (if SoC is not available take PMU)
for tempsource in /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034 /sys/devices/platform/a20-tp-hwmon ; do
if [ -d ${tempsource} ]; then
board_temp=$(awk '{printf("%d",$1/1000)}' ${tempsource}/temp1_input)
ln -fs ${tempsource}/temp1_input /etc/armbianmonitor/datasources/soctemp
fi
done
# if we are reading from A20
if [ -d "/sys/devices/platform/a20-tp-hwmon/" ]; then
board_temp=$(awk '{printf("%d",$1/1000)}' </sys/devices/platform/a20-tp-hwmon/temp1_input)
ln -fs /sys/devices/platform/a20-tp-hwmon/temp1_input /etc/armbianmonitor/datasources/soctemp
fi
# S500 and RK3288 legacy kernels
for tempsource in /sys/devices/virtual/thermal/thermal_zone1 /sys/class/thermal/thermal_zone2 ; do
if [ -d ${tempsource} ]; then
board_temp=$(awk '{printf("%d",$1/1000)}' ${tempsource}/temp)
ln -fs ${tempsource}/temp /etc/armbianmonitor/datasources/soctemp
fi
done
# where it should be
if [[ -d "/sys/devices/virtual/thermal/thermal_zone0/" && $(cat /sys/devices/virtual/thermal/thermal_zone0/type) == "cpu_thermal" ]]; then
board_temp=$(awk '{printf("%d",$1/1000)}' </sys/devices/virtual/thermal/thermal_zone0/temp)
if [[ -d "/sys/devices/virtual/thermal/thermal_zone0/" ]]; then
ln -fs /sys/devices/virtual/thermal/thermal_zone0/temp /etc/armbianmonitor/datasources/soctemp
fi
# lemaker guitar / roseapple pi
source /etc/armbian-release
if [[ -d "/sys/devices/virtual/thermal/thermal_zone1/" && ${LINUXFAMILY} == "s500" ]]; then
board_temp=$(awk '{printf("%d",$1/1000)}' </sys/devices/virtual/thermal/thermal_zone1/temp)
ln -fs /sys/devices/virtual/thermal/thermal_zone1/temp /etc/armbianmonitor/datasources/soctemp
fi
# Rockchip RK3288 miqi
if [[ -d "/sys/class/thermal/thermal_zone2" ]]; then
board_temp=$(awk '{printf("%d",$1/1000)}' </sys/class/thermal/thermal_zone2/temp)
ln -fs /sys/class/thermal/thermal_zone2/temp /etc/armbianmonitor/datasources/soctemp
case $(cat /sys/devices/virtual/thermal/thermal_zone0/type) in
cpu_thermal) # mainline kernel
board_temp=$(awk '{printf("%d",$1/1000)}' </sys/devices/virtual/thermal/thermal_zone0/temp)
;;
soc_thermal) # pine64 legacy
read board_temp </sys/devices/virtual/thermal/thermal_zone0/temp
;;
esac
fi
# H3 based boards, legacy kernel
source /etc/armbian-release
if [[ -d "/sys/class/thermal/thermal_zone1" && ${LINUXFAMILY} == "sun8i" ]]; then
read board_temp </sys/class/thermal/thermal_zone1/temp
ln -fs /sys/devices/virtual/thermal/thermal_zone1/temp /etc/armbianmonitor/datasources/soctemp