wlan:SAP:Configure SAP country code through the gAPCntryCode
Added functionality to configure the SAP Country code through
the user configurable parameter 'gAPCntryCode'
Change-Id: I162455a6de4ea5ba43a72d88e755c6749818bc3a
CRs-Fixed: 564664
diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h
index 25d7abc..979a797 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg80211.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h
@@ -191,7 +191,7 @@
extern void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext,
tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp);
#endif
-
+void* wlan_hdd_change_country_code_cb(void *pAdapter);
void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel);
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 1cd0225..c3c815f 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -2563,6 +2563,16 @@
return 0;
}
+/* FUNCTION: wlan_hdd_change_country_code_cd
+* to wait for contry code completion
+*/
+void* wlan_hdd_change_country_code_cb(void *pAdapter)
+{
+ hdd_adapter_t *call_back_pAdapter = pAdapter;
+ complete(&call_back_pAdapter->change_country_code);
+ return NULL;
+}
+
/*
* FUNCTION: wlan_hdd_cfg80211_change_iface
* This function is used to set the interface type (INFRASTRUCTURE/ADHOC)
@@ -2776,6 +2786,43 @@
hdd_set_ap_ops( pAdapter->dev );
+ /* This is for only SAP mode where users can
+ * control country through ini.
+ * P2P GO follows station country code
+ * acquired during the STA scanning. */
+ if((NL80211_IFTYPE_AP == type) &&
+ (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0))
+ {
+ int status = 0;
+ VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO,
+ "%s: setting country code from INI ", __func__);
+ init_completion(&pAdapter->change_country_code);
+ status = (int)sme_ChangeCountryCode(pHddCtx->hHal,
+ (void *)(tSmeChangeCountryCallback)
+ wlan_hdd_change_country_code_cb,
+ pConfig->apCntryCode, pAdapter,
+ pHddCtx->pvosContext,
+ VOS_FALSE);
+ if (eHAL_STATUS_SUCCESS == status)
+ {
+ /* Wait for completion */
+ status = wait_for_completion_interruptible_timeout(
+ &pAdapter->change_country_code,
+ msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY));
+ if (status <= 0)
+ {
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: SME Timed out while setting country code ",
+ __func__);
+ }
+ }
+ else
+ {
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: SME Change Country code failed \n",__func__);
+ return -EINVAL;
+ }
+ }
status = hdd_init_ap_mode(pAdapter);
if(status != VOS_STATUS_SUCCESS)
{