mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 14:23:38 +00:00
autocore: implement tempinfo display for luci js
This commit is contained in:
parent
b7cf62b3a8
commit
3f4f0ccac9
@ -43,11 +43,15 @@ define Package/autocore-arm/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/arm/index.htm $(1)/etc/index.htm
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/arm/090-cover-index_htm $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
|
||||
$(INSTALL_BIN) ./files/arm/sbin/ethinfo $(1)/sbin/ethinfo
|
||||
$(INSTALL_BIN) ./files/arm/sbin/usage $(1)/sbin/usage
|
||||
$(INSTALL_BIN) ./files/arm/tempinfo $(1)/sbin/tempinfo
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
endef
|
||||
|
||||
define Package/autocore-x86/install
|
||||
@ -55,8 +59,12 @@ define Package/autocore-x86/install
|
||||
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/x86/index.htm $(1)/etc/index.htm
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(CP) ./files/x86/sbin/* $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,autocore-arm))
|
||||
|
5
package/lean/autocore/files/60-autocore-reload-rpcd
Executable file
5
package/lean/autocore/files/60-autocore-reload-rpcd
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
/etc/init.d/rpcd restart
|
||||
|
||||
exit 0
|
40
package/lean/autocore/files/arm/sbin/tempinfo
Executable file
40
package/lean/autocore/files/arm/sbin/tempinfo
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/openwrt_release
|
||||
|
||||
IEEE_PATH="/sys/class/ieee80211"
|
||||
THERMAL_PATH="/sys/class/thermal"
|
||||
|
||||
case "$DISTRIB_TARGET" in
|
||||
ipq40xx/*|ipq806x/*)
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
;;
|
||||
mediatek/mt7622)
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/wl*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
;;
|
||||
*)
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$DISTRIB_TARGET" in
|
||||
ipq40xx/*)
|
||||
if [ -e "$IEEE_PATH/phy0/hwmon0/temp1_input" ]; then
|
||||
mt76_temp="$(awk -F ': ' '{print $2}' "$IEEE_PATH/phy0/hwmon0/temp1_input" 2>"/dev/null")°C"
|
||||
fi
|
||||
[ -z "$mt76_temp" ] || wifi_temp="${wifi_temp:+$wifi_temp }$mt76_temp"
|
||||
;;
|
||||
*)
|
||||
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' "$THERMAL_PATH/thermal_zone0/temp" 2>"/dev/null")"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$cpu_temp" ] && [ -z "$wifi_temp" ]; then
|
||||
echo -n "CPU: $cpu_temp"
|
||||
elif [ -z "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
|
||||
echo -n "WiFi: $wifi_temp"
|
||||
elif [ -n "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
|
||||
echo -n "CPU: $cpu_temp, WiFi: $wifi_temp"
|
||||
else
|
||||
echo -n "No temperature info"
|
||||
fi
|
10
package/lean/autocore/files/luci-mod-status-autocore.json
Normal file
10
package/lean/autocore/files/luci-mod-status-autocore.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"luci-mod-status-autocore": {
|
||||
"description": "Grant access to autocore",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"luci": [ "getCPUInfo", "getTempInfo" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user