armbianmonitor related

https://github.com/igorpecovnik/lib/pull/218
This commit is contained in:
Igor Pecovnik 2016-03-08 17:59:07 +01:00
parent 7a080c7a84
commit e7e2f88761

View File

@ -99,30 +99,36 @@ if [ -e "$storage" ]; then
fi
# read temperature from different locations
mkdir -p -m775 /etc/armbianmonitor/datasources/
# from axp via i2c for some old sunxi
if [ -d "/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/" ]; then
board_temp=$(cat /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input | awk '{printf("%d",$1/1000)}')
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
# if we are reading from A20
if [ -d "/sys/devices/platform/a20-tp-hwmon/" ]; then
board_temp=$(cat /sys/devices/platform/a20-tp-hwmon/temp1_input | awk '{printf("%d",$1/1000)}')
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
# where it should be
if [ -d "/sys/devices/virtual/thermal/thermal_zone0/" ]; then
board_temp=$(cat /sys/devices/virtual/thermal/thermal_zone0/temp | awk '{printf("%d",$1/1000)}')
board_temp=$(awk '{printf("%d",$1/1000)}' </sys/devices/virtual/thermal/thermal_zone0/temp)
ln -fs /sys/devices/virtual/thermal/thermal_zone0/temp /etc/armbianmonitor/datasources/soctemp
fi
# lemaker guitar
if [[ -d "/sys/devices/virtual/thermal/thermal_zone1/" && $board_temp == "0" ]]; then
board_temp=$(cat /sys/devices/virtual/thermal/thermal_zone1/temp | awk '{printf("%d",$1/1000)}')
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
# H3 based boards, legacy kernel
if [[ -d "/sys/class/thermal/thermal_zone1" && $board_temp == "0" ]]; then
board_temp=$(cat /sys/class/thermal/thermal_zone1/temp)
read board_temp </sys/class/thermal/thermal_zone1/temp
ln -fs /sys/devices/virtual/thermal/thermal_zone1/temp /etc/armbianmonitor/datasources/soctemp
fi
# read ambient temperature from USB device
@ -155,4 +161,4 @@ display "Usage of /" "$root_usage" "90" "1" "%" " of $root_total"
display "storage/" "$storage_usage" "90" "1" "%" " of $storage_total"
display "Battery" "$battery_percent" "20" "1" "%" "$status_battery_text"
echo ""
echo ""
echo ""