Commit da2e612e authored by Jani Juvan's avatar Jani Juvan

base-files: support wifi channel list for acs

parent 1fae04a8
...@@ -403,7 +403,7 @@ wifi_device_settings() { ...@@ -403,7 +403,7 @@ wifi_device_settings() {
#config_get macaddr $cfg macaddr #config_get macaddr $cfg macaddr
config_get_bool disabled $cfg disabled 0 config_get_bool disabled $cfg disabled 0
config_get channel $cfg channel "auto" config_get channel $cfg channel "auto"
config_get channels $cfg channels "1 6 11" config_get channels $cfg channels ""
config_get hwmode $cfg hwmode "11g" config_get hwmode $cfg hwmode "11g"
config_get htmode $cfg htmode "HT20" config_get htmode $cfg htmode "HT20"
#config_get chanbw $cfg chanbw "20" # Not supported by wlconf, can be set by wl chanspec #config_get chanbw $cfg chanbw "20" # Not supported by wlconf, can be set by wl chanspec
...@@ -520,11 +520,59 @@ wifi_device_settings() { ...@@ -520,11 +520,59 @@ 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"
...@@ -574,6 +622,7 @@ wifi_device_settings() { ...@@ -574,6 +622,7 @@ 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
nvram set "$device"_acs_excl_chans=$chanlist_excl
} }
setup_wifi_device() { setup_wifi_device() {
......
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