aboutsummaryrefslogtreecommitdiffstats
path: root/package/mac80211/files/lib/wifi
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-10-02 19:41:04 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-10-02 19:41:04 +0000
commit9ca04519e581fbae95d548fd19a298072d543b4f (patch)
tree4fb0473ef17e98e6e043b549be11d4f7ec1ce1fc /package/mac80211/files/lib/wifi
parent8b8c16b0ea1d45f53b0d2d4ac5c666986c84cb41 (diff)
downloadupstream-9ca04519e581fbae95d548fd19a298072d543b4f.tar.gz
upstream-9ca04519e581fbae95d548fd19a298072d543b4f.tar.bz2
upstream-9ca04519e581fbae95d548fd19a298072d543b4f.zip
mac80211: autodetect the default phy mode based on 11n and freq capabilities
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17825 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/mac80211/files/lib/wifi')
-rw-r--r--package/mac80211/files/lib/wifi/mac80211.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh
index 3acb3dc1cc..a7b3005dd9 100644
--- a/package/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/mac80211/files/lib/wifi/mac80211.sh
@@ -272,12 +272,17 @@ detect_mac80211() {
[ -n "$type" ] || break
devidx=$(($devidx + 1))
done
+ mode_11n=""
+ mode_band="g"
+ iw phy "$dev" info | grep -q 'HT cap' && mode_11n="n"
+ iw phy "$dev" info | grep -q '2412 MHz' || mode_band="a"
cat <<EOF
config wifi-device wifi$devidx
option type mac80211
option channel 5
option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)
+ option hwmode 11${mode_11n}${mode_band}
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 1