Commit ede30ac6 authored by Jani Juvan's avatar Jani Juvan

base-files: acs channel list feature moved to post setup due to timing issues

parent e2c1c2f7
...@@ -520,59 +520,11 @@ wifi_device_settings() { ...@@ -520,59 +520,11 @@ wifi_device_settings() {
acs_fcs=0 acs_fcs=0
fi fi
local chanlist chanlist_excl
case "$channel" in case "$channel" in
auto) auto)
channel=0 channel=0
chanspec=0 chanspec=0
[ -n "$_ACSIFS" ] && _ACSIFS="$_ACSIFS $device" || _ACSIFS="$device" [ -n "$_ACSIFS" ] && _ACSIFS="$_ACSIFS $device" || _ACSIFS="$device"
if [ -n "$channels" ]; then
local bw
case $bw_cap in
1) bw=20 ;;
3) bw=40 ;;
7) bw=80 ;;
f) bw=160 ;;
esac
# get list of possible chanspecs
chanspecs=$(wlctl -i $device chanspecs -b $freq -w $bw -c $country)
# expand list of requested channels
for item in $channels; do
for ch in $(seq ${item%%-*} ${item##*-}); do
[ -z "$chanlist" ] && chanlist="$ch" || chanlist="$chanlist $ch"
done
done
# exclude undesired channels
local chanspec_ch chanspec_match
for spec in $chanspecs; do
chanspec_ch=${spec%%[!0-9]*}
if [ -z "$chanspec_ch" ]; then
# this is the chanspec hex
if [ -n "$chanspec_match" ]; then
#echo "$spec matches!"
unset chanspec_match
else
# exclude this chanspec
local chanspec_hex=$(echo $spec | tr -d '()')
#echo "add $chanspec_hex to exclude list"
[ -z "$chanlist_excl" ] && chanlist_excl="$chanspec_hex" || chanlist_excl="$chanlist_excl,$chanspec_hex"
fi
else
# this is the chanspec channel
for ch in $chanlist; do
if [ $ch -eq $chanspec_ch ]; then
chanspec_match=true
#echo "$ch matches!"
break
fi
done
fi
done
fi
;; ;;
*) *)
chanspec="$channel" chanspec="$channel"
...@@ -622,6 +574,57 @@ wifi_device_settings() { ...@@ -622,6 +574,57 @@ wifi_device_settings() {
nvram set "$device"_radio=$radio nvram set "$device"_radio=$radio
nvram set "$device"_radarthrs="$(db -q get hw.$pcid.radarthrs)" nvram set "$device"_radarthrs="$(db -q get hw.$pcid.radarthrs)"
nvram set "$device"_acs_cs_scan_timer=$acs_refresh_time nvram set "$device"_acs_cs_scan_timer=$acs_refresh_time
}
setup_acs_channels() {
local cfg=$1
local device=$cfg
local channel channels
local chanlist chanlist_excl
config_get channel $cfg channel "auto"
config_get channels $cfg channels ""
if [ "$channel" == "auto" -a -n "$channels" ]; then
# get full list of possible chanspecs
chanspecs=$(wlctl -i $device chanspecs)
# expand list of requested channels
for item in $channels; do
for ch in $(seq ${item%%-*} ${item##*-}); do
[ -z "$chanlist" ] && chanlist="$ch" || chanlist="$chanlist $ch"
done
done
# exclude undesired channels
local chanspec_ch chanspec_match
for spec in $chanspecs; do
chanspec_ch=${spec%%[!0-9]*}
if [ -z "$chanspec_ch" ]; then
# this is the chanspec hex
if [ -n "$chanspec_match" ]; then
#echo "$spec matches!"
unset chanspec_match
else
# exclude this chanspec
local chanspec_hex=$(echo $spec | tr -d '()')
#echo "add $chanspec_hex to exclude list"
[ -z "$chanlist_excl" ] && chanlist_excl="$chanspec_hex" || chanlist_excl="$chanlist_excl,$chanspec_hex"
fi
else
# this is the chanspec channel
for ch in $chanlist; do
if [ $ch -eq $chanspec_ch ]; then
chanspec_match=true
#echo "$ch matches!"
break
fi
done
fi
done
fi
nvram set "$device"_acs_excl_chans=$chanlist_excl nvram set "$device"_acs_excl_chans=$chanlist_excl
} }
...@@ -670,6 +673,7 @@ configure_wifi() { ...@@ -670,6 +673,7 @@ configure_wifi() {
config_load wireless config_load wireless
config_foreach add_to_network wifi-iface config_foreach add_to_network wifi-iface
config_foreach setup_acs_channels wifi-device
uci commit wireless uci commit wireless
nvram set acs_ifnames="$_ACSIFS" nvram set acs_ifnames="$_ACSIFS"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment