qsap: Enhance 'set' command to configure for SAP + SAP.
This enhances existing 'set' command to allow configuration of dual SAP. It will create/read/write/update to following configuration files: CMD: "softap qccmd set channel=6" writes to hostapd.conf CMD: "softap qccmd set dual2g channel=6" writes to hostapd_dual2g.conf CMD: "softap qccmd set dual5g channel=6" writes to hostapd_dual5g.conf Additionally enable LOG_TAG for logging APIs with TAG "QCSDK" and modify default config file location. CRs-Fixed: 2080924 Change-Id: I46c59de7fbd2ea273793406f0b82515df94e5c38
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
5d72c3af41
commit
a21d26579d
@@ -64,7 +64,7 @@
|
||||
#define QCSAP_PARAM_GET_AUTO_CHANNEL 9
|
||||
#define WE_SET_SAP_CHANNELS 3
|
||||
|
||||
//#define LOG_TAG "QCSDK-"
|
||||
#define LOG_TAG "QCSDK"
|
||||
|
||||
#include "cutils/properties.h"
|
||||
#include "cutils/log.h"
|
||||
@@ -84,6 +84,15 @@ s8 *Cmd_req[eCMD_REQ_LAST] = {
|
||||
"set"
|
||||
};
|
||||
|
||||
/** Supported config file requests.
|
||||
* WANRING: The enum eConf_req in the file qsap_api.h should be
|
||||
* updated if Conf_req[], us updated
|
||||
*/
|
||||
s8 *Conf_req[CONF_REQ_LAST] = {
|
||||
"dual2g",
|
||||
"dual5g"
|
||||
};
|
||||
|
||||
/*
|
||||
* WARNING: On updating the cmd_list, the enum esap_cmd in file
|
||||
* qsap_api.h must be updates to reflect the changes
|
||||
@@ -2512,6 +2521,15 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
|
||||
|
||||
SKIP_BLANK_SPACE(pcmd);
|
||||
|
||||
if(!(strncmp(pcmd, Conf_req[CONF_2g], strlen(Conf_req[CONF_2g])))) {
|
||||
pcmd += strlen(Conf_req[CONF_2g]);
|
||||
SKIP_BLANK_SPACE(pcmd);
|
||||
} else if (!(strncmp(pcmd, Conf_req[CONF_5g], strlen(Conf_req[CONF_5g])))) {
|
||||
pcmd += strlen(Conf_req[CONF_5g]);
|
||||
SKIP_BLANK_SPACE(pcmd);
|
||||
} else {
|
||||
// DO NOTHING
|
||||
}
|
||||
cNum = qsap_get_cmd_num(pcmd);
|
||||
if(cNum == eCMD_INVALID) {
|
||||
*plen = qsap_scnprintf(presp, *plen, "%s", ERR_INVALID_ARG);
|
||||
@@ -3072,6 +3090,16 @@ void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen)
|
||||
/* Skip any blank spaces */
|
||||
SKIP_BLANK_SPACE(pcmd);
|
||||
|
||||
if(!(strncmp(pcmd, Cmd_req[eCMD_SET], strlen(Cmd_req[eCMD_SET])))) {
|
||||
if(!(strncmp(pcmd+4, Conf_req[CONF_2g], strlen(Conf_req[CONF_2g])))) {
|
||||
pconffile = CONFIG_FILE_2G;
|
||||
} else if (!(strncmp(pcmd+4, Conf_req[CONF_5g], strlen(Conf_req[CONF_5g])))) {
|
||||
pconffile = CONFIG_FILE_5G;
|
||||
} else {
|
||||
pconffile = CONFIG_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
check_for_configuration_files();
|
||||
if(fIni == NULL)
|
||||
qsap_set_ini_filename();
|
||||
@@ -3267,14 +3295,14 @@ void check_for_configuration_files(void)
|
||||
/* Check if configuration files are present, if not create the default files */
|
||||
|
||||
/* If configuration file does not exist copy the default file */
|
||||
if ( NULL == (fp = fopen(CONFIG_FILE, "r")) ) {
|
||||
wifi_qsap_reset_to_default(CONFIG_FILE, DEFAULT_CONFIG_FILE_PATH);
|
||||
if ( NULL == (fp = fopen(pconffile, "r")) ) {
|
||||
wifi_qsap_reset_to_default(pconffile, DEFAULT_CONFIG_FILE_PATH);
|
||||
}
|
||||
else {
|
||||
|
||||
/* The configuration file could be of 0 byte size, replace with default */
|
||||
if (check_for_config_file_size(fp) <= 0)
|
||||
wifi_qsap_reset_to_default(CONFIG_FILE, DEFAULT_CONFIG_FILE_PATH);
|
||||
wifi_qsap_reset_to_default(pconffile, DEFAULT_CONFIG_FILE_PATH);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
@@ -88,8 +88,12 @@ enum error_val {
|
||||
#define WIFI_DRIVER_DEF_CONF_FILE NULL
|
||||
#endif
|
||||
|
||||
/** Configuration file name for SAP+SAP*/
|
||||
#define CONFIG_FILE_2G "/data/vendor/wifi/hostapd_dual2g.conf"
|
||||
#define CONFIG_FILE_5G "/data/vendor/wifi/hostapd_dual5g.conf"
|
||||
|
||||
/** Configuration file name */
|
||||
#define CONFIG_FILE "/data/misc/wifi/hostapd.conf"
|
||||
#define CONFIG_FILE "/data/vendor/wifi/hostapd.conf"
|
||||
|
||||
/** Default configuration file path */
|
||||
#define DEFAULT_CONFIG_FILE_PATH "/system/etc/hostapd/hostapd_default.conf"
|
||||
@@ -244,6 +248,14 @@ enum eCmd_req {
|
||||
eCMD_REQ_LAST
|
||||
};
|
||||
|
||||
/** config request index - in the array Conf_req[] */
|
||||
enum eConf_req {
|
||||
CONF_2g = 0,
|
||||
CONF_5g = 1,
|
||||
|
||||
CONF_REQ_LAST
|
||||
};
|
||||
|
||||
/**
|
||||
* Command numbers, these numbers form the index into the array of
|
||||
* command names stored in the 'cmd_list'.
|
||||
|
||||
Reference in New Issue
Block a user