summaryrefslogtreecommitdiff
path: root/package/madwifi/files
diff options
context:
space:
mode:
authorTravis Kemen <thepeople@openwrt.org>2009-01-22 22:00:07 +0000
committerTravis Kemen <thepeople@openwrt.org>2009-01-22 22:00:07 +0000
commit4337de497757ad101c871935a9559171ce4c4a52 (patch)
treee15b1e8c0abb05b49896cf036d118941bfd2946c /package/madwifi/files
parent2332708af1f4baace1847a1662f8f806c76577d4 (diff)
downloadmtk-20170518-4337de497757ad101c871935a9559171ce4c4a52.zip
mtk-20170518-4337de497757ad101c871935a9559171ce4c4a52.tar.gz
mtk-20170518-4337de497757ad101c871935a9559171ce4c4a52.tar.bz2
Allow changing country code for madwifi driver. Thanks alisonken1
SVN-Revision: 14148
Diffstat (limited to 'package/madwifi/files')
-rwxr-xr-xpackage/madwifi/files/lib/wifi/madwifi.sh18
1 files changed, 14 insertions, 4 deletions
diff --git a/package/madwifi/files/lib/wifi/madwifi.sh b/package/madwifi/files/lib/wifi/madwifi.sh
index d53bc06..550bba7 100755
--- a/package/madwifi/files/lib/wifi/madwifi.sh
+++ b/package/madwifi/files/lib/wifi/madwifi.sh
@@ -67,6 +67,15 @@ disable_atheros() (
enable_atheros() {
local device="$1"
+ # Can only set the country code to one setting for the entire system. The last country code is the one that will be applied.
+ config_get country "$device" country
+ [ -z "$country" ] && country="0"
+ local cc="0"
+ [ -e /proc/sys/dev/$device/countrycode ] && cc="$(cat /proc/sys/dev/$device/countrycode)"
+ if [ ! "$cc" = "$country" ] ; then
+ rmmod ath_pci
+ insmod ath_pci countrycode=$country
+ fi
config_get channel "$device" channel
config_get vifs "$device" vifs
@@ -278,10 +287,6 @@ enable_atheros() {
ifconfig "$ifname" up
- # TXPower settings only work if device is up already
- config_get txpwr "$vif" txpower
- [ -n "$txpwr" ] && iwconfig "$ifname" txpower "${txpwr%%.*}"
-
local net_cfg bridge
net_cfg="$(find_net_config "$vif")"
[ -z "$net_cfg" ] || {
@@ -292,6 +297,11 @@ enable_atheros() {
[ -n "$ssid" ] && iwconfig "$ifname" essid on
iwconfig "$ifname" essid "$ssid"
set_wifi_up "$vif" "$ifname"
+
+ # TXPower settings only work if device is up already
+ config_get txpwr "$vif" txpower
+ [ -n "$txpwr" ] && iwconfig "$ifname" txpower "${txpwr%%.*}"
+
case "$mode" in
ap)
config_get_bool isolate "$vif" isolate 0