summaryrefslogtreecommitdiff
path: root/package/mac80211/files/lib/wifi/mac80211.sh
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-08-13 22:55:59 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-08-13 22:55:59 +0000
commit3aa922d33cf8b0e63925a45a8ae38e2bfcd9a96f (patch)
treef98505074ef59f34be57d170bc63c51f9c16e758 /package/mac80211/files/lib/wifi/mac80211.sh
parent12c84f8eebfa3a336c70c7fb5068ec24bcbda79b (diff)
downloadmtk-20170518-3aa922d33cf8b0e63925a45a8ae38e2bfcd9a96f.zip
mtk-20170518-3aa922d33cf8b0e63925a45a8ae38e2bfcd9a96f.tar.gz
mtk-20170518-3aa922d33cf8b0e63925a45a8ae38e2bfcd9a96f.tar.bz2
mac80211: use first available channel from current phy if channel is set to "auto"
SVN-Revision: 27976
Diffstat (limited to 'package/mac80211/files/lib/wifi/mac80211.sh')
-rw-r--r--package/mac80211/files/lib/wifi/mac80211.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh
index dbf13b8..86ec75c 100644
--- a/package/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/mac80211/files/lib/wifi/mac80211.sh
@@ -17,7 +17,13 @@ mac80211_hostapd_setup_base() {
config_get basic_rate_list "$device" basic_rate
config_get_bool noscan "$device" noscan
[ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device"
- [ "$channel" = auto ] && channel=
+
+ [ "$channel" = auto ] && {
+ channel=$(iw phy "$phy" info | \
+ sed -ne '/MHz/ { /disabled\|passive\|radar/d; s/.*\[//; s/\].*//; p; q }')
+ config_set "$device" channel "$channel"
+ }
+
[ -n "$hwmode" ] && {
config_get hwmode_11n "$device" hwmode_11n
[ -n "$hwmode_11n" ] && {