Add check in code such that if BT is ON then SoftAP cannot be started

Change-Id: I274cefd07401f5b7f2beac78a16e892be73efdae
This commit is contained in:
Raj Kushwaha
2011-03-12 10:21:45 -08:00
parent 7e46ea01e8
commit 13eb75f8cc
3 changed files with 38 additions and 4 deletions

View File

@@ -35,7 +35,7 @@
int rc; \
rc = snprintf(resp, sizeof(resp), "failure %s:%s",msg, code); \
if ( rc == sizeof(resp)) resp[sizeof(resp)-1] = 0; \
LOGE("%s", resp); \
LOGE("%s",resp); \
}
static struct sockaddr_nl rtnl_local;

View File

@@ -224,6 +224,36 @@ end:
return ret;
}
void qsap_send_module_down_indication(void)
{
int s, ret;
struct iwreq wrq;
/*
* If the driver is loaded, ask it to broadcast a netlink message
* that it will be closing, so listeners can close their sockets.
*
*/
/* Equivalent to: iwpriv wlan0 sendModuleInd */
if ((s = socket(PF_INET, SOCK_DGRAM, 0)) >= 0) {
strncpy(wrq.ifr_name, "wlan0", IFNAMSIZ);
wrq.u.data.length = 0; /* No Set arguments */
wrq.u.mode = 5; /* WE_MODULE_DOWN_IND sub-command */
ret = ioctl(s, (SIOCIWFIRSTPRIV + 1), &wrq);
close(s);
if (ret < 0 ) {
LOGE("ioctl failed: %s", strerror(errno));
}
sched_yield();
}
else {
LOGE("Socket open failed: %s", strerror(errno));
}
}
s32 wifi_qsap_unload_wifi_sta_driver(void)
{
s32 ret = 0;
@@ -233,6 +263,7 @@ s32 wifi_qsap_unload_wifi_sta_driver(void)
}
if ( check_driver_loaded(WIFI_DRIVER_MODULE_NAME " ") ) {
qsap_send_module_down_indication();
if ( rmmod(WIFI_DRIVER_MODULE_NAME) ) {
LOGE("Unable to unload the station mode wifi driver...\n");
ret = 1;
@@ -267,6 +298,7 @@ s32 wifi_qsap_unload_driver()
}
if ( check_driver_loaded(WIFI_DRIVER_MODULE_NAME " ") ) {
qsap_send_module_down_indication();
if ( rmmod(WIFI_DRIVER_MODULE_NAME) ) {
LOGE("Unable to unload the libra_softap driver\n");
ret = eERR_UNLOAD_FAILED_SOFTAP;

View File

@@ -1849,6 +1849,9 @@ static int qsap_send_cmd_to_hostapd(s8 *pcmd)
LOGE("Command failed in hostapd \n");
goto close_ret;
}
else {
break;
}
}
else {
LOGE("%s: Select failed \n", __func__);
@@ -2516,8 +2519,7 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
case eCMD_RESET_TO_DEFAULT:
if(eSUCCESS == (status = wifi_qsap_reset_to_default(pconffile, DEFAULT_CONFIG_FILE_PATH))) {
if(eSUCCESS == (status = wifi_qsap_reset_to_default(fIni, DEFAULT_INI_FILE))) {
gIniUpdated = 1;
status = commit();
status = wifi_qsap_reload_softap();
}
}
*plen = snprintf(presp, *plen, "%s", (status == eSUCCESS) ? SUCCESS : ERR_UNKNOWN);