mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-07 01:53:34 +08:00
autocore: fix tri-band wifi temperature
This commit is contained in:
parent
c4f65e89b3
commit
5e16f8a4f2
@ -4,26 +4,28 @@ IEEE_PATH="/sys/class/ieee80211"
|
|||||||
THERMAL_PATH="/sys/class/thermal"
|
THERMAL_PATH="/sys/class/thermal"
|
||||||
|
|
||||||
get_mtwifi_temp() {
|
get_mtwifi_temp() {
|
||||||
local ifname="$1"
|
|
||||||
local flag
|
local flag
|
||||||
if [ -f "/sys/class/net/${ifname}/flags" ]; then
|
local ifname
|
||||||
flag="$(cat /sys/class/net/${ifname}/flags)"
|
local temp
|
||||||
if [ "$((flag & 0x1))" -eq "1" ]; then
|
local mtwifi_vifs="ra0 rax0 rai0 ray0 rae0 raz0"
|
||||||
iwpriv ${ifname} stat | awk '/CurrentTemperature/ {printf("%d°C", $3)}'
|
local result=""
|
||||||
else
|
|
||||||
echo "unknown"
|
for ifname in $mtwifi_vifs; do
|
||||||
|
if [ -f "/sys/class/net/${ifname}/flags" ]; then
|
||||||
|
flag="$(cat /sys/class/net/${ifname}/flags)"
|
||||||
|
if [ "$((flag & 0x1))" -eq "1" ]; then
|
||||||
|
temp="$(iwpriv ${ifname} stat | awk '/CurrentTemperature/ {printf("%d°C", $3)}')"
|
||||||
|
[ -z "$result" ] && result="${temp}" || result="${result}/${temp}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
echo "unknown"
|
echo ${result:-unknown}
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if grep -Eq "ipq40xx|ipq806x" "/etc/openwrt_release"; then
|
if grep -Eq "ipq40xx|ipq806x" "/etc/openwrt_release"; then
|
||||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input | awk '$1=$1')"
|
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input | awk '$1=$1')"
|
||||||
elif grep -Eq "mediatek" "/etc/openwrt_release"; then
|
elif grep -Eq "mediatek" "/etc/openwrt_release"; then
|
||||||
wifi_temp1="$(get_mtwifi_temp ra0)"
|
wifi_temp="$(get_mtwifi_temp)"
|
||||||
wifi_temp2="$(get_mtwifi_temp rax0)"
|
|
||||||
wifi_temp="$(echo "$wifi_temp1 $wifi_temp2" | xargs)"
|
|
||||||
else
|
else
|
||||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input | awk '$1=$1')"
|
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input | awk '$1=$1')"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user