Skip to content

Commit 6bbf4a5

Browse files
mantas-pAnsuel
authored andcommitted
wifi-scripts: add hotplug handler for slow-to-initialize ath12k radios
Some ath12k radios can take long time to initialize and register a phy. This can cause netifd to fail to detect them during initial scan. To address this issue, a hotplug script has been added to retry configuration once they have registered their phy. Signed-off-by: Mantas Pucka <[email protected]> Link: openwrt#18459 Signed-off-by: Christian Marangi <[email protected]>
1 parent de20536 commit 6bbf4a5

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
# Restart ath12k radios that take long time to initialize on boot
4+
5+
[ "${ACTION}" = "add" ] || exit 0
6+
[ $(grep -c DRIVER=ath12k_pci /sys/$DEVPATH/device/uevent) -gt 0 ] || exit 0
7+
8+
. /usr/share/libubox/jshn.sh
9+
10+
restart_radio() {
11+
radio=$1
12+
arg="{\"radio\": \"$radio\"}"
13+
ubus call network reload
14+
ubus call network.wireless down "$arg"
15+
ubus call network.wireless up "$arg"
16+
}
17+
18+
json_init
19+
json_load "$(ubus -S call network.wireless status)"
20+
json_get_keys radios
21+
for radio in $radios; do
22+
json_select $radio
23+
json_get_vars up
24+
json_get_vars retry_setup_failed
25+
26+
json_select config
27+
json_get_vars path
28+
json_select ..
29+
30+
if [ $up = 0 -a $retry_setup_failed = 1 ] &&
31+
[ $(iwinfo nl80211 phyname "path=$path") = "$DEVICENAME" ]; then
32+
restart_radio $radio
33+
fi
34+
35+
json_select ..
36+
done

0 commit comments

Comments
 (0)