Compare commits

...

2 Commits

Author SHA1 Message Date
Jakob Olsson
e4cc650afd mapagent: 30-generate-map-config: pass args based on platform 2024-01-04 16:38:01 +01:00
Jakob Olsson
00560b6e1e mapagent: map_genconfig: allow per-phy config generation 2024-01-04 16:38:01 +01:00
2 changed files with 83 additions and 5 deletions

View File

@@ -0,0 +1,45 @@
#!/bin/sh
. /lib/functions.sh
is_airoha() {
[ -f /proc/device-tree/compatible ] || return
strings /proc/device-tree/compatible | grep -qE '^(econet,|airoha,)'; return
}
is_broadcom() {
[ -e /dev/bcm ] && return 0
return 1
}
is_qualcomm() {
[ -d /sys/module/ath12k ] && return 0
return 1
}
if is_airoha; then
/lib/wifi/multiap conf
elif is_broadcom; then
phy_to_radio() {
section="$1"
dev="$2"
config_get phy $section phy
[ "$dev" = "$phy" ] && {
echo "$section"
break
}
}
config_load wireless
dev=$DEVICENAME
radio="$(config_foreach phy_to_radio wifi-device $dev)"
/lib/wifi/multiap conf $radio
elif is_qualcomm; then
:
else
return
fi

View File

@@ -28,9 +28,12 @@ generate_multiap_config() {
generate_config() {
dev="$1"
phy="$2"
[ -n "$dev" ] || continue
[ -n "$phy" -a "$phy" != "$dev" ] && continue
config_get band $dev band
mode_band=""
@@ -147,16 +150,46 @@ generate_multiap_config() {
}
config_load wireless
config_foreach generate_config wifi-device
config_foreach generate_config wifi-device $@
}
map_genconf () {
if [ -f /etc/config/mapagent -a -z "$(uci -q get mapagent.@radio[0].band)" ]; then
find_radio() {
section="$1"
phy="$2"
config_get device $section device
[ "$device" = "$phy" ] && {
echo 1
break
}
}
find_sta() {
section="$1"
radio="$2"
config_get mode $section mode
config_get device $section device
[ "$device" = "$radio" -a "$mode" = "sta" ] && {
echo 1
break
}
}
phy=$1
config_load mapagent
radio="$(config_foreach find_radio radio $phy)"
if [ "$radio" = "" -a "$phy" != "" -o -z "$(uci -q get mapagent.@radio[0].band)" ]; then
generate_mapagent_config=1
fi
if [ "$network_mode" == "extender" ]; then
if ! uci show wireless | grep -q "mode=.*sta"; then
if [ "$network_mode" = "extender" ]; then
config_load wireless
if [ -z $(config_foreach find_sta wifi-iface $radio) ]; then
generate_wireless_sta_config=1
if is_broadcom; then
@@ -171,7 +204,7 @@ map_genconf () {
fi
fi
generate_multiap_config
generate_multiap_config $phy
if [ $generate_mapagent_config -eq 1 ]; then
uci set mapagent.agent.enabled="1"