mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
52 lines
928 B
Bash
52 lines
928 B
Bash
#!/bin/sh
|
|
|
|
[ -f /etc/wifi.json ] && exit 0
|
|
|
|
. /usr/share/libubox/jshn.sh
|
|
|
|
is_broadcom() {
|
|
[ -e /dev/bcm ] && return 0
|
|
return 1
|
|
}
|
|
|
|
is_qualcomm() {
|
|
[ -f /proc/device-tree/compatible ] || return
|
|
strings /proc/device-tree/compatible | grep -qE '^(qcom,|ipq,)'; return
|
|
}
|
|
|
|
if is_broadcom; then
|
|
ifname="wl*"
|
|
family="bcmwl nl80211"
|
|
group="scan"
|
|
else
|
|
ifname="wlan*"
|
|
family="nl80211"
|
|
if is_qualcomm; then
|
|
group="scan"
|
|
else
|
|
group="scan config mlme vendor"
|
|
fi
|
|
fi
|
|
|
|
json_init
|
|
json_add_array "events"
|
|
for fm in $family; do
|
|
echo fm=$fm
|
|
json_add_object ""
|
|
json_add_string "type" "wifi-event"
|
|
json_add_string "name" "$fm"
|
|
json_add_string "ifname" "$ifname"
|
|
json_add_string "family" "$fm"
|
|
json_add_array "group"
|
|
if [ "$fm" == "bcmwl" ]; then
|
|
json_add_string "" "notify"
|
|
else
|
|
for gr in $group; do
|
|
json_add_string "" "$gr"
|
|
done
|
|
fi
|
|
json_select ..
|
|
json_select ..
|
|
done
|
|
json_select ..
|
|
json_dump | jq >/etc/wifi.json
|