From 5ccde941d06021013f8d68e541af4061fa0e46eb Mon Sep 17 00:00:00 2001
From: nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Sat, 8 Oct 2011 17:34:56 +0000
Subject: mac80211: set the country code early to allow crda to settle

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28387 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 package/mac80211/files/lib/wifi/mac80211.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh
index 72549092b..1ae0c2083 100644
--- a/package/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/mac80211/files/lib/wifi/mac80211.sh
@@ -302,6 +302,13 @@ enable_mac80211() {
 	fixed=""
 	local hostapd_ctrl=""
 
+	[ -n "$country" ] && {
+		iw reg get | grep -q "^country $country:" || {
+			iw reg set "$country"
+			sleep 1
+		}
+	}
+
 	config_get ath9k_chanbw "$device" ath9k_chanbw
 	[ -n "$ath9k_chanbw" -a -d /sys/kernel/debug/ieee80211/$phy/ath9k ] && echo "$ath9k_chanbw" > /sys/kernel/debug/ieee80211/$phy/ath9k/chanbw
 
-- 
cgit v1.2.3