From 4d953d3a481dd847524eae78c7aae00153bc7efd Mon Sep 17 00:00:00 2001 From: blogic Date: Fri, 21 Jun 2013 16:54:37 +0000 Subject: packages: clean up the package folder Signed-off-by: John Crispin git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37007 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/mac80211/files/lib/wifi/mac80211.sh | 641 +++++++++++++++++++++ 1 file changed, 641 insertions(+) create mode 100644 package/kernel/mac80211/files/lib/wifi/mac80211.sh (limited to 'package/kernel/mac80211/files/lib/wifi') diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh new file mode 100644 index 0000000000..a052a1cbfb --- /dev/null +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -0,0 +1,641 @@ +#!/bin/sh +append DRIVERS "mac80211" + +mac80211_hostapd_setup_base() { + local phy="$1" + local ifname="$2" + + cfgfile="/var/run/hostapd-$phy.conf" + + config_get device "$vif" device + config_get country "$device" country + config_get hwmode "$device" hwmode + config_get channel "$device" channel + config_get beacon_int "$device" beacon_int + config_get basic_rate_list "$device" basic_rate + config_get_bool noscan "$device" noscan + + hostapd_set_log_options base_cfg "$device" + + [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device" + + [ "$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" ] && { + hwmode="$hwmode_11n" + append base_cfg "ieee80211n=1" "$N" + config_get htmode "$device" htmode + config_get ht_capab_list "$device" ht_capab + case "$htmode" in + HT20|HT40+|HT40-) ht_capab="[$htmode]";; + *)ht_capab=;; + esac + for cap in $ht_capab_list; do + ht_capab="$ht_capab[$cap]" + done + [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" + } + } + + local country_ie=0 + [ -n "$country" ] && country_ie=1 + config_get_bool country_ie "$device" country_ie "$country_ie" + [ "$country_ie" -gt 0 ] && append base_cfg "ieee80211d=1" "$N" + + local br brval brstr + [ -n "$basic_rate_list" ] && { + for br in $basic_rate_list; do + brval="$(($br / 100))" + [ -n "$brstr" ] && brstr="$brstr " + brstr="$brstr$brval" + done + } + + cat >> "$cfgfile" <