Compare commits
32 Commits
stable/cm-
...
cm-13.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc46d223c6 | ||
|
|
c46bf72725 | ||
|
|
bb81a3fc87 | ||
|
|
a1c6f1dbe5 | ||
|
|
cc16315997 | ||
|
|
e1bfb737ad | ||
|
|
cddacfa293 | ||
|
|
e629e82bc8 | ||
|
|
650d036038 | ||
|
|
fddc6bed07 | ||
|
|
a51136993f | ||
|
|
4659de289b | ||
|
|
71846207cc | ||
|
|
595015ac77 | ||
|
|
69a004c094 | ||
|
|
88df07cb5a | ||
|
|
b8a71a5a88 | ||
|
|
f31a10d2e2 | ||
|
|
120aeacf0f | ||
|
|
64f15fc591 | ||
|
|
d98f57876f | ||
|
|
e9159df711 | ||
|
|
5620bb1611 | ||
|
|
a9fe9d38bd | ||
|
|
e601816b24 | ||
|
|
04a6a9712e | ||
|
|
56710aac73 | ||
|
|
9b8ed11141 | ||
|
|
92dd0a5d38 | ||
|
|
f5fecdcc36 | ||
|
|
587b8b3d67 | ||
|
|
8e9475b346 |
@@ -319,7 +319,7 @@ JNIEXPORT jstring JNICALL
|
|||||||
char code[32] = {0};
|
char code[32] = {0};
|
||||||
int connect_retry;
|
int connect_retry;
|
||||||
|
|
||||||
strncpy(cmd, "softap qccmd ", sizeof(cmd));
|
strlcpy(cmd, "softap qccmd ", sizeof(cmd));
|
||||||
|
|
||||||
pcmd = (char *) ((*env)->GetStringUTFChars(env, jcmd, NULL));
|
pcmd = (char *) ((*env)->GetStringUTFChars(env, jcmd, NULL));
|
||||||
|
|
||||||
@@ -330,12 +330,12 @@ JNIEXPORT jstring JNICALL
|
|||||||
|
|
||||||
ALOGD("Received Command: %s\n", pcmd);
|
ALOGD("Received Command: %s\n", pcmd);
|
||||||
|
|
||||||
if ((strlen(cmd) + strlen(pcmd)) > sizeof(cmd)) {
|
if ((strlen(cmd) + strlen(pcmd)) >= sizeof(cmd)) {
|
||||||
UPDATE_ERROR_CODE("Command length is larger than MAX_CMD_SIZE", "");
|
UPDATE_ERROR_CODE("Command length is larger than MAX_CMD_SIZE", "");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(cmd, pcmd);
|
strlcat(cmd, pcmd, sizeof(cmd));
|
||||||
|
|
||||||
connect_retry = 0;
|
connect_retry = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@
|
|||||||
|
|
||||||
#include "qsap_api.h"
|
#include "qsap_api.h"
|
||||||
#include "qsap.h"
|
#include "qsap.h"
|
||||||
#include "libwpa_client/wpa_ctrl.h"
|
|
||||||
|
|
||||||
#include <sys/system_properties.h>
|
#include <sys/system_properties.h>
|
||||||
|
|
||||||
@@ -585,3 +584,45 @@ s32 wifi_qsap_reload_softap()
|
|||||||
|
|
||||||
return eSUCCESS;
|
return eSUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32 wifi_qsap_set_tx_power(s32 tx_power)
|
||||||
|
{
|
||||||
|
#define QCSAP_IOCTL_SET_MAX_TX_POWER (SIOCIWFIRSTPRIV + 22)
|
||||||
|
s32 sock;
|
||||||
|
s32 ret = eERR_SET_TX_POWER;
|
||||||
|
s8 interface[128];
|
||||||
|
s8 *iface;
|
||||||
|
s32 len = 128;
|
||||||
|
struct iwreq wrq;
|
||||||
|
|
||||||
|
if(NULL == (iface = qsap_get_config_value(CONFIG_FILE, &qsap_str[STR_INTERFACE], interface, (u32*)&len))) {
|
||||||
|
ALOGE("%s :interface error \n", __func__);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Issue QCSAP_IOCTL_SET_MAX_TX_POWER ioctl */
|
||||||
|
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
|
||||||
|
if (sock < 0) {
|
||||||
|
ALOGE("%s :socket error \n", __func__);
|
||||||
|
return eERR_SET_TX_POWER;
|
||||||
|
}
|
||||||
|
|
||||||
|
strlcpy(wrq.ifr_name, iface, sizeof(wrq.ifr_name));
|
||||||
|
wrq.u.data.length = sizeof(s32);
|
||||||
|
wrq.u.data.pointer = &tx_power;
|
||||||
|
wrq.u.data.flags = 0;
|
||||||
|
|
||||||
|
ret = ioctl(sock, QCSAP_IOCTL_SET_MAX_TX_POWER, &wrq);
|
||||||
|
close(sock);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
ALOGE("%s :IOCTL set tx power failed: %ld\n", __func__, ret);
|
||||||
|
ret = eERR_SET_TX_POWER;
|
||||||
|
} else {
|
||||||
|
ALOGD("%s :IOCTL set tx power issued\n", __func__);
|
||||||
|
ret = eSUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ s32 wifi_qsap_start_softap_in_concurrency(void);
|
|||||||
s32 wifi_qsap_stop_softap_in_concurrency(void);
|
s32 wifi_qsap_stop_softap_in_concurrency(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
s32 wifi_qsap_set_tx_power(s32);
|
||||||
|
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
}; // extern "C"
|
}; // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -153,6 +153,11 @@ static struct Command cmd_list[eCMD_LAST] = {
|
|||||||
{ "autochannel", NULL },
|
{ "autochannel", NULL },
|
||||||
{ "ieee80211w", NULL },
|
{ "ieee80211w", NULL },
|
||||||
{ "wpa_key_mgmt", NULL },
|
{ "wpa_key_mgmt", NULL },
|
||||||
|
{ "max_num_sta", "8" },
|
||||||
|
{ "ieee80211ac", NULL },
|
||||||
|
{ "vht_oper_chwidth", NULL },
|
||||||
|
{ "chanlist", NULL },
|
||||||
|
{ "ht_capab", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Command qsap_str[eSTR_LAST] = {
|
struct Command qsap_str[eSTR_LAST] = {
|
||||||
@@ -305,7 +310,7 @@ static s32 qsap_write_cfg(s8 *pfile, struct Command * pcmd, s8 *pVal, s8 *presp,
|
|||||||
s8 buf[MAX_CONF_LINE_LEN+1];
|
s8 buf[MAX_CONF_LINE_LEN+1];
|
||||||
s16 len, result = FALSE;
|
s16 len, result = FALSE;
|
||||||
|
|
||||||
ALOGD("cmd=%s, Val:%s, INI:%ld \n", pcmd->name, pVal, inifile);
|
ALOGV("cmd=%s, Val:%s, INI:%ld \n", pcmd->name, pVal, inifile);
|
||||||
|
|
||||||
/** Open the configuration file */
|
/** Open the configuration file */
|
||||||
fcfg = fopen(pfile, "r");
|
fcfg = fopen(pfile, "r");
|
||||||
@@ -340,7 +345,7 @@ static s32 qsap_write_cfg(s8 *pfile, struct Command * pcmd, s8 *pVal, s8 *presp,
|
|||||||
if(pline[len] == '=') {
|
if(pline[len] == '=') {
|
||||||
qsap_scnprintf(buf, sizeof(buf), "%s=%s\n", pcmd->name, pVal);
|
qsap_scnprintf(buf, sizeof(buf), "%s=%s\n", pcmd->name, pVal);
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
ALOGD("Updated:%s\n", buf);
|
ALOGV("Updated:%s\n", buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +360,7 @@ static s32 qsap_write_cfg(s8 *pfile, struct Command * pcmd, s8 *pVal, s8 *presp,
|
|||||||
/* Add the new line at the end of file */
|
/* Add the new line at the end of file */
|
||||||
qsap_scnprintf(buf, sizeof(buf), "%s=%s\n", pcmd->name, pVal);
|
qsap_scnprintf(buf, sizeof(buf), "%s=%s\n", pcmd->name, pVal);
|
||||||
fprintf(ftmp, "%s", buf);
|
fprintf(ftmp, "%s", buf);
|
||||||
ALOGD("Adding a new line in %s file: [%s] \n", inifile ? "inifile" : "hostapd.conf", buf);
|
ALOGV("Adding a new line in %s file: [%s] \n", inifile ? "inifile" : "hostapd.conf", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inifile) {
|
if(inifile) {
|
||||||
@@ -705,6 +710,40 @@ static s8 *qsap_get_allow_deny_file_name(s8 *pcfgfile, struct Command * pcmd, s8
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int qsap_hostd_exec(int argc, char ** argv) {
|
||||||
|
|
||||||
|
#define MAX_CMD_SIZE 256
|
||||||
|
char qcCmdBuf[MAX_CMD_SIZE], *pCmdBuf;
|
||||||
|
u32 len = MAX_CMD_SIZE;
|
||||||
|
int i = 2, ret;
|
||||||
|
|
||||||
|
if ( argc < 4 ) {
|
||||||
|
ALOGD("failure: invalid arguments");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
argc -= 2;
|
||||||
|
pCmdBuf = qcCmdBuf;
|
||||||
|
|
||||||
|
while (argc--) {
|
||||||
|
ret = snprintf(pCmdBuf, len, " %s", argv[i]);
|
||||||
|
if ((ret < 0) || (ret >= (int)len)) {
|
||||||
|
/* Error case */
|
||||||
|
/* TODO: Command too long send the error message */
|
||||||
|
*pCmdBuf = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ALOGD("argv[%d] (%s)",i, argv[i]);
|
||||||
|
pCmdBuf += ret;
|
||||||
|
len -= ret;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALOGD("QCCMD data (%s)", pCmdBuf);
|
||||||
|
len = MAX_CMD_SIZE;
|
||||||
|
qsap_hostd_exec_cmd(qcCmdBuf, qcCmdBuf, (u32*)&len);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/** Function to identify a valid MAC address */
|
/** Function to identify a valid MAC address */
|
||||||
static int isValid_MAC_address(char *pMac)
|
static int isValid_MAC_address(char *pMac)
|
||||||
{
|
{
|
||||||
@@ -933,7 +972,7 @@ static void qsap_remove_from_file(s8 *pfile, s8 *pVal, s8 *presp, u32 *plen)
|
|||||||
*/
|
*/
|
||||||
static void qsap_update_mac_list(s8 *pfile, esap_cmd_t cNum, s8 *pVal, s8 *presp, u32 *plen)
|
static void qsap_update_mac_list(s8 *pfile, esap_cmd_t cNum, s8 *pVal, s8 *presp, u32 *plen)
|
||||||
{
|
{
|
||||||
ALOGD("%s : Updating file %s \n", __func__, pfile);
|
ALOGV("%s : Updating file %s \n", __func__, pfile);
|
||||||
|
|
||||||
switch(cNum) {
|
switch(cNum) {
|
||||||
case eCMD_ADD_TO_ALLOW:
|
case eCMD_ADD_TO_ALLOW:
|
||||||
@@ -1088,7 +1127,7 @@ static int qsap_read_mac_address(s8 *presp, u32 *plen)
|
|||||||
|
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
ALOGD("MAC :%s \n", ptr);
|
ALOGV("MAC :%s \n", ptr);
|
||||||
if(TRUE == isValid_MAC_address(ptr)) {
|
if(TRUE == isValid_MAC_address(ptr)) {
|
||||||
nRet = eSUCCESS;
|
nRet = eSUCCESS;
|
||||||
}
|
}
|
||||||
@@ -1124,7 +1163,7 @@ static void qsap_read_wps_state(s8 *presp, u32 *plen)
|
|||||||
|
|
||||||
if(NULL == (pstate = qsap_get_config_value(pconffile, &cmd_list[eCMD_WPS_STATE], presp, &tlen))) {
|
if(NULL == (pstate = qsap_get_config_value(pconffile, &cmd_list[eCMD_WPS_STATE], presp, &tlen))) {
|
||||||
/** unable to read the wps configuration, WPS is disabled !*/
|
/** unable to read the wps configuration, WPS is disabled !*/
|
||||||
ALOGD("%s :wps_state not in cfg file \n", __func__);
|
ALOGV("%s :wps_state not in cfg file \n", __func__);
|
||||||
status = DISABLE;
|
status = DISABLE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1179,9 +1218,9 @@ int qsap_get_operating_channel(s32 *pchan)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGE("Recv len :%d \n", wrq.u.data.length);
|
ALOGV("Recv len :%d \n", wrq.u.data.length);
|
||||||
*pchan = *(int *)(&wrq.u.name[0]);
|
*pchan = *(int *)(&wrq.u.name[0]);
|
||||||
ALOGE("Operating channel :%ld \n", *pchan);
|
ALOGV("Operating channel :%ld \n", *pchan);
|
||||||
close(sock);
|
close(sock);
|
||||||
return eSUCCESS;
|
return eSUCCESS;
|
||||||
|
|
||||||
@@ -1212,7 +1251,7 @@ int qsap_get_sap_auto_channel_selection(s32 *pautochan)
|
|||||||
|
|
||||||
if(NULL == (pif = qsap_get_config_value(pconffile,
|
if(NULL == (pif = qsap_get_config_value(pconffile,
|
||||||
&qsap_str[STR_INTERFACE], interface, &len))) {
|
&qsap_str[STR_INTERFACE], interface, &len))) {
|
||||||
ALOGD("%s :interface error \n", __func__);
|
ALOGV("%s :interface error \n", __func__);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1220,7 +1259,7 @@ int qsap_get_sap_auto_channel_selection(s32 *pautochan)
|
|||||||
|
|
||||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
if(sock < 0) {
|
if(sock < 0) {
|
||||||
ALOGD("%s :socket error \n", __func__);
|
ALOGV("%s :socket error \n", __func__);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1243,9 +1282,9 @@ int qsap_get_sap_auto_channel_selection(s32 *pautochan)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGD("Recv len :%d \n", wrq.u.data.length);
|
ALOGV("Recv len :%d \n", wrq.u.data.length);
|
||||||
*pautochan = *(int *)(&wrq.u.name[0]);
|
*pautochan = *(int *)(&wrq.u.name[0]);
|
||||||
ALOGD("Sap auto channel selection pautochan=%ld \n", *pautochan);
|
ALOGV("Sap auto channel selection pautochan=%ld \n", *pautochan);
|
||||||
close(sock);
|
close(sock);
|
||||||
return eSUCCESS;
|
return eSUCCESS;
|
||||||
|
|
||||||
@@ -1273,7 +1312,7 @@ int qsap_get_mode(s32 *pmode)
|
|||||||
*pmode = -1;
|
*pmode = -1;
|
||||||
if(NULL == (pif = qsap_get_config_value(pconffile,
|
if(NULL == (pif = qsap_get_config_value(pconffile,
|
||||||
&qsap_str[STR_INTERFACE], interface, &len))) {
|
&qsap_str[STR_INTERFACE], interface, &len))) {
|
||||||
ALOGD("%s :interface error \n", __func__);
|
ALOGV("%s :interface error \n", __func__);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1281,7 +1320,7 @@ int qsap_get_mode(s32 *pmode)
|
|||||||
|
|
||||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
if(sock < 0) {
|
if(sock < 0) {
|
||||||
ALOGD("%s :socket error \n", __func__);
|
ALOGV("%s :socket error \n", __func__);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1385,7 +1424,7 @@ int qsap_set_channel_range(s8 *buf)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGE("Recv len :%d\n", wrq.u.data.length);
|
ALOGV("Recv len :%d\n", wrq.u.data.length);
|
||||||
|
|
||||||
close(sock);
|
close(sock);
|
||||||
return eSUCCESS;
|
return eSUCCESS;
|
||||||
@@ -1403,7 +1442,7 @@ int qsap_read_channel(s8 *pfile, struct Command *pcmd, s8 *presp, u32 *plen, s8
|
|||||||
|
|
||||||
if(eSUCCESS == qsap_get_operating_channel(&chan)) {
|
if(eSUCCESS == qsap_get_operating_channel(&chan)) {
|
||||||
*plen = qsap_scnprintf(presp, len, "%s %s=%lu", SUCCESS, pcmd->name, chan);
|
*plen = qsap_scnprintf(presp, len, "%s %s=%lu", SUCCESS, pcmd->name, chan);
|
||||||
ALOGD("presp :%s\n", presp);
|
ALOGV("presp :%s\n", presp);
|
||||||
} else {
|
} else {
|
||||||
*plen = qsap_scnprintf(presp, len, "%s", ERR_UNKNOWN);
|
*plen = qsap_scnprintf(presp, len, "%s", ERR_UNKNOWN);
|
||||||
}
|
}
|
||||||
@@ -1713,15 +1752,9 @@ static void qsap_get_from_config(esap_cmd_t cNum, s8 *presp, u32 *plen)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case eCMD_FRAG_THRESHOLD:
|
case eCMD_FRAG_THRESHOLD:
|
||||||
qsap_read_cfg(fIni, &qsap_str[STR_FRAG_THRESHOLD_IN_INI], presp, plen, cmd_list[eCMD_FRAG_THRESHOLD].name, GET_ENABLED_ONLY);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case eCMD_REGULATORY_DOMAIN:
|
case eCMD_REGULATORY_DOMAIN:
|
||||||
qsap_read_cfg(pconffile, &cmd_list[cNum], presp, plen, NULL, GET_ENABLED_ONLY);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case eCMD_RTS_THRESHOLD:
|
case eCMD_RTS_THRESHOLD:
|
||||||
qsap_read_cfg(fIni, &qsap_str[STR_RTS_THRESHOLD_IN_INI], presp, plen, cmd_list[eCMD_RTS_THRESHOLD].name, GET_ENABLED_ONLY);
|
qsap_read_cfg(pconffile, &cmd_list[cNum], presp, plen, NULL, GET_ENABLED_ONLY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCMD_ALLOW_LIST: /* fall through */
|
case eCMD_ALLOW_LIST: /* fall through */
|
||||||
@@ -1740,7 +1773,7 @@ static void qsap_get_from_config(esap_cmd_t cNum, s8 *presp, u32 *plen)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case eCMD_WMM_STATE:
|
case eCMD_WMM_STATE:
|
||||||
qsap_read_cfg(fIni, &qsap_str[STR_WMM_IN_INI], presp, plen, cmd_list[eCMD_WMM_STATE].name, GET_ENABLED_ONLY);
|
qsap_read_cfg(pconffile, &cmd_list[cNum], presp, plen, NULL, GET_ENABLED_ONLY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCMD_WPS_STATE:
|
case eCMD_WPS_STATE:
|
||||||
@@ -1889,7 +1922,7 @@ static s16 is_valid_wep_key(s8 *pwep, s8 *pkey, s16 len)
|
|||||||
weplen--;
|
weplen--;
|
||||||
while(weplen--) {
|
while(weplen--) {
|
||||||
if(0 == isascii(pwep[weplen])) {
|
if(0 == isascii(pwep[weplen])) {
|
||||||
ALOGD("%c not ascii \n", pwep[weplen]);
|
ALOGV("%c not ascii \n", pwep[weplen]);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1948,6 +1981,11 @@ s16 wifi_qsap_reset_to_default(s8 *pcfgfile, s8 *pdefault)
|
|||||||
if(eERR_UNKNOWN == rename(buf, pcfgfile))
|
if(eERR_UNKNOWN == rename(buf, pcfgfile))
|
||||||
status = eERR_CONF_FILE;
|
status = eERR_CONF_FILE;
|
||||||
|
|
||||||
|
if (chown(pcfgfile, AID_WIFI, AID_WIFI) < 0) {
|
||||||
|
ALOGE("Error changing group ownership of %s to %d: %s",
|
||||||
|
pcfgfile, AID_WIFI, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
/** Remove the temporary file. Dont care the return value */
|
/** Remove the temporary file. Dont care the return value */
|
||||||
unlink(buf);
|
unlink(buf);
|
||||||
|
|
||||||
@@ -2030,7 +2068,7 @@ static int qsap_send_cmd_to_hostapd(s8 *pcmd)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGD("Connect to :%s\n", ptr);
|
ALOGV("Connect to :%s\n", ptr);
|
||||||
|
|
||||||
sock = socket(PF_UNIX, SOCK_DGRAM, 0);
|
sock = socket(PF_UNIX, SOCK_DGRAM, 0);
|
||||||
if(sock < 0) {
|
if(sock < 0) {
|
||||||
@@ -2050,7 +2088,7 @@ static int qsap_send_cmd_to_hostapd(s8 *pcmd)
|
|||||||
|
|
||||||
ser.sun_family = AF_UNIX;
|
ser.sun_family = AF_UNIX;
|
||||||
qsap_scnprintf(ser.sun_path, sizeof(ser.sun_path), "%s", ptr);
|
qsap_scnprintf(ser.sun_path, sizeof(ser.sun_path), "%s", ptr);
|
||||||
ALOGD("Connect to: %s,(%d)\n", ser.sun_path, sock);
|
ALOGV("Connect to: %s,(%d)\n", ser.sun_path, sock);
|
||||||
|
|
||||||
ret = connect(sock, (struct sockaddr *)&ser, sizeof(ser));
|
ret = connect(sock, (struct sockaddr *)&ser, sizeof(ser));
|
||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
@@ -2205,7 +2243,7 @@ static void qsap_config_wps_method(s8 *pVal, s8 *presp, u32 *plen)
|
|||||||
qsap_scnprintf(buf, sizeof(buf), "WPS_PBC");
|
qsap_scnprintf(buf, sizeof(buf), "WPS_PBC");
|
||||||
else {
|
else {
|
||||||
if(strlen(ptr) < WPS_KEY_LEN) {
|
if(strlen(ptr) < WPS_KEY_LEN) {
|
||||||
ALOGD("%s :Invalid WPS key length\n", __func__);
|
ALOGV("%s :Invalid WPS key length\n", __func__);
|
||||||
*plen = qsap_scnprintf(presp, *plen, "%s", ERR_INVALID_PARAM);
|
*plen = qsap_scnprintf(presp, *plen, "%s", ERR_INVALID_PARAM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2605,6 +2643,9 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
|
|||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case eCMD_SET_MAX_CLIENTS:
|
||||||
|
value = strlen(pVal);
|
||||||
|
break;
|
||||||
case eCMD_BSSID:
|
case eCMD_BSSID:
|
||||||
value = atoi(pVal);
|
value = atoi(pVal);
|
||||||
if(FALSE == IS_VALID_BSSID(value))
|
if(FALSE == IS_VALID_BSSID(value))
|
||||||
@@ -2867,8 +2908,6 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
|
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
|
||||||
cNum = STR_WMM_IN_INI;
|
|
||||||
ini = INI_CONF_FILE;
|
|
||||||
break;
|
break;
|
||||||
case eCMD_WPS_STATE:
|
case eCMD_WPS_STATE:
|
||||||
value = atoi(pVal);
|
value = atoi(pVal);
|
||||||
@@ -2899,9 +2938,6 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
|
|||||||
if(TRUE != IS_VALID_FRAG_THRESHOLD(value))
|
if(TRUE != IS_VALID_FRAG_THRESHOLD(value))
|
||||||
goto error;
|
goto error;
|
||||||
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
|
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
|
||||||
|
|
||||||
cNum = STR_FRAG_THRESHOLD_IN_INI;
|
|
||||||
ini = INI_CONF_FILE;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCMD_REGULATORY_DOMAIN:
|
case eCMD_REGULATORY_DOMAIN:
|
||||||
@@ -2918,8 +2954,6 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
|
|||||||
if(TRUE != IS_VALID_RTS_THRESHOLD(value))
|
if(TRUE != IS_VALID_RTS_THRESHOLD(value))
|
||||||
goto error;
|
goto error;
|
||||||
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
|
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
|
||||||
cNum = STR_RTS_THRESHOLD_IN_INI;
|
|
||||||
ini = INI_CONF_FILE;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCMD_GTK_TIMEOUT:
|
case eCMD_GTK_TIMEOUT:
|
||||||
@@ -2933,7 +2967,6 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
|
|||||||
value = atoi(pVal);
|
value = atoi(pVal);
|
||||||
if(TRUE != IS_VALID_TX_POWER(value))
|
if(TRUE != IS_VALID_TX_POWER(value))
|
||||||
goto error;
|
goto error;
|
||||||
qsap_set_ini_filename();
|
|
||||||
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
|
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
|
||||||
cNum = STR_TX_POWER_IN_INI;
|
cNum = STR_TX_POWER_IN_INI;
|
||||||
ini = INI_CONF_FILE;
|
ini = INI_CONF_FILE;
|
||||||
@@ -2994,7 +3027,7 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ini == INI_CONF_FILE) {
|
if(ini == INI_CONF_FILE) {
|
||||||
ALOGD("WRITE TO INI FILE :%s\n", qsap_str[cNum].name);
|
ALOGV("WRITE TO INI FILE :%s\n", qsap_str[cNum].name);
|
||||||
qsap_write_cfg(fIni, &qsap_str[cNum], pVal, presp, plen, ini);
|
qsap_write_cfg(fIni, &qsap_str[cNum], pVal, presp, plen, ini);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -3023,11 +3056,13 @@ error:
|
|||||||
*/
|
*/
|
||||||
void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen)
|
void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen)
|
||||||
{
|
{
|
||||||
ALOGD("CMD INPUT [%s][%lu]\n", pcmd, *plen);
|
ALOGV("CMD INPUT [%s][%lu]\n", pcmd, *plen);
|
||||||
/* Skip any blank spaces */
|
/* Skip any blank spaces */
|
||||||
SKIP_BLANK_SPACE(pcmd);
|
SKIP_BLANK_SPACE(pcmd);
|
||||||
|
|
||||||
check_for_configuration_files();
|
check_for_configuration_files();
|
||||||
|
if(fIni == NULL)
|
||||||
|
qsap_set_ini_filename();
|
||||||
|
|
||||||
if(!strncmp(pcmd, Cmd_req[eCMD_GET], strlen(Cmd_req[eCMD_GET])) && isblank(pcmd[strlen(Cmd_req[eCMD_GET])])) {
|
if(!strncmp(pcmd, Cmd_req[eCMD_GET], strlen(Cmd_req[eCMD_GET])) && isblank(pcmd[strlen(Cmd_req[eCMD_GET])])) {
|
||||||
qsap_handle_get_request(pcmd, presp, plen);
|
qsap_handle_get_request(pcmd, presp, plen);
|
||||||
@@ -3041,7 +3076,7 @@ void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen)
|
|||||||
*plen = qsap_scnprintf(presp, *plen, "%s", ERR_INVALIDREQ);
|
*plen = qsap_scnprintf(presp, *plen, "%s", ERR_INVALIDREQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGD("CMD OUTPUT [%s]\nlen :%lu\n\n", presp, *plen);
|
ALOGV("CMD OUTPUT [%s]\nlen :%lu\n\n", presp, *plen);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3070,10 +3105,10 @@ int qsapsetSoftap(int argc, char *argv[])
|
|||||||
int hidden = 0;
|
int hidden = 0;
|
||||||
int sec = SEC_MODE_NONE;
|
int sec = SEC_MODE_NONE;
|
||||||
|
|
||||||
ALOGD("%s, %s, %s, %d\n", __FUNCTION__, argv[0], argv[1], argc);
|
ALOGV("%s, %s, %s, %d\n", __FUNCTION__, argv[0], argv[1], argc);
|
||||||
|
|
||||||
for ( i=0; i<argc;i++) {
|
for ( i=0; i<argc;i++) {
|
||||||
ALOGD("ARG: %d - %s\n", i+1, argv[i]);
|
ALOGV("ARG: %d - %s\n", i+1, argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** set SSID */
|
/** set SSID */
|
||||||
@@ -3163,6 +3198,16 @@ int qsapsetSoftap(int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rlen = RECV_BUF_LEN;
|
||||||
|
if(argc > 8) {
|
||||||
|
qsap_scnprintf(cmdbuf, sizeof(cmdbuf), "set max_num_sta=%d",atoi(argv[8]));
|
||||||
|
}
|
||||||
|
(void) qsap_hostd_exec_cmd(cmdbuf, respbuf, &rlen);
|
||||||
|
|
||||||
|
if(strncmp("success", respbuf, rlen) != 0) {
|
||||||
|
ALOGE("Failed to set maximun client connections number \n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
rlen = RECV_BUF_LEN;
|
rlen = RECV_BUF_LEN;
|
||||||
|
|
||||||
qsap_scnprintf(cmdbuf, sizeof(cmdbuf), "set commit");
|
qsap_scnprintf(cmdbuf, sizeof(cmdbuf), "set commit");
|
||||||
@@ -3194,9 +3239,9 @@ static int check_for_config_file_size(FILE *fp)
|
|||||||
void check_for_configuration_files(void)
|
void check_for_configuration_files(void)
|
||||||
{
|
{
|
||||||
FILE * fp;
|
FILE * fp;
|
||||||
|
char *pfile;
|
||||||
|
|
||||||
/* Check if configuration files are present, if not create the default files */
|
/* Check if configuration files are present, if not create the default files */
|
||||||
mkdir("/data/hostapd", 0771);
|
|
||||||
|
|
||||||
/* If configuration file does not exist copy the default file */
|
/* If configuration file does not exist copy the default file */
|
||||||
if ( NULL == (fp = fopen(CONFIG_FILE, "r")) ) {
|
if ( NULL == (fp = fopen(CONFIG_FILE, "r")) ) {
|
||||||
@@ -3224,6 +3269,18 @@ void check_for_configuration_files(void)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Provide read and write permissions to the owner */
|
||||||
|
pfile = ACCEPT_LIST_FILE;
|
||||||
|
if (chmod(pfile, 0660) < 0) {
|
||||||
|
ALOGE("Error changing permissions of %s to 0660: %s",
|
||||||
|
pfile, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chown(pfile, AID_SYSTEM, AID_WIFI) < 0) {
|
||||||
|
ALOGE("Error changing group ownership of %s to %d: %s",
|
||||||
|
pfile, AID_WIFI, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
/* If deny MAC list file does not exist, copy the default file */
|
/* If deny MAC list file does not exist, copy the default file */
|
||||||
if ( NULL == (fp = fopen(DENY_LIST_FILE, "r")) ) {
|
if ( NULL == (fp = fopen(DENY_LIST_FILE, "r")) ) {
|
||||||
wifi_qsap_reset_to_default(DENY_LIST_FILE, DEFAULT_DENY_LIST_FILE_PATH);
|
wifi_qsap_reset_to_default(DENY_LIST_FILE, DEFAULT_DENY_LIST_FILE_PATH);
|
||||||
@@ -3237,6 +3294,18 @@ void check_for_configuration_files(void)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Provide read and write permissions to the owner */
|
||||||
|
pfile = DENY_LIST_FILE;
|
||||||
|
if (chmod(pfile, 0660) < 0) {
|
||||||
|
ALOGE("Error changing permissions of %s to 0660: %s",
|
||||||
|
pfile, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chown(pfile, AID_SYSTEM, AID_WIFI) < 0) {
|
||||||
|
ALOGE("Error changing group ownership of %s to %d: %s",
|
||||||
|
pfile, AID_WIFI, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ typedef unsigned char u8;
|
|||||||
typedef char s8;
|
typedef char s8;
|
||||||
typedef unsigned short int u16;
|
typedef unsigned short int u16;
|
||||||
typedef signed short int s16;
|
typedef signed short int s16;
|
||||||
typedef unsigned long int u32;
|
typedef unsigned int u32;
|
||||||
typedef signed long int s32;
|
typedef signed int s32;
|
||||||
|
|
||||||
/** Success and error messages */
|
/** Success and error messages */
|
||||||
#define SUCCESS "success"
|
#define SUCCESS "success"
|
||||||
@@ -77,7 +77,8 @@ enum error_val {
|
|||||||
eERR_LOAD_FAILED_SDIOIF,
|
eERR_LOAD_FAILED_SDIOIF,
|
||||||
eERR_LOAD_FAILED_SOFTAP,
|
eERR_LOAD_FAILED_SOFTAP,
|
||||||
eERR_SET_CHAN_RANGE,
|
eERR_SET_CHAN_RANGE,
|
||||||
eERR_GET_AUTO_CHAN
|
eERR_GET_AUTO_CHAN,
|
||||||
|
eERR_SET_TX_POWER
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef WIFI_DRIVER_CONF_FILE
|
#ifndef WIFI_DRIVER_CONF_FILE
|
||||||
@@ -98,19 +99,19 @@ enum error_val {
|
|||||||
#define DEFAULT_ACCEPT_LIST_FILE_PATH "/system/etc/hostapd/hostapd.accept"
|
#define DEFAULT_ACCEPT_LIST_FILE_PATH "/system/etc/hostapd/hostapd.accept"
|
||||||
|
|
||||||
/** Accept list file name */
|
/** Accept list file name */
|
||||||
#define ACCEPT_LIST_FILE "/data/hostapd/hostapd.accept"
|
#define ACCEPT_LIST_FILE "/data/misc/wifi/hostapd.accept"
|
||||||
|
|
||||||
/** Default Deny list file name */
|
/** Default Deny list file name */
|
||||||
#define DEFAULT_DENY_LIST_FILE_PATH "/system/etc/hostapd/hostapd.deny"
|
#define DEFAULT_DENY_LIST_FILE_PATH "/system/etc/hostapd/hostapd.deny"
|
||||||
|
|
||||||
/** Deny list file name */
|
/** Deny list file name */
|
||||||
#define DENY_LIST_FILE "/data/hostapd/hostapd.deny"
|
#define DENY_LIST_FILE "/data/misc/wifi/hostapd.deny"
|
||||||
|
|
||||||
/** Default Ini file */
|
/** Default Ini file */
|
||||||
#define DEFAULT_INI_FILE "/persist/qcom/softap/qcom_cfg_default.ini"
|
#define DEFAULT_INI_FILE "/persist/qcom/softap/qcom_cfg_default.ini"
|
||||||
|
|
||||||
/** SDK control interface path */
|
/** SDK control interface path */
|
||||||
#define SDK_CTRL_IF "/data/hostapd/softap_sdk_ctrl"
|
#define SDK_CTRL_IF "/data/misc/wifi/softap_sdk_ctrl"
|
||||||
|
|
||||||
/** Maximum length of the line in the configuration file */
|
/** Maximum length of the line in the configuration file */
|
||||||
#define MAX_CONF_LINE_LEN (156)
|
#define MAX_CONF_LINE_LEN (156)
|
||||||
@@ -324,6 +325,11 @@ typedef enum esap_cmd {
|
|||||||
eCMD_GET_AUTO_CHANNEL = 63,
|
eCMD_GET_AUTO_CHANNEL = 63,
|
||||||
eCMD_IEEE80211W = 64,
|
eCMD_IEEE80211W = 64,
|
||||||
eCMD_WPA_KEY_MGMT = 65,
|
eCMD_WPA_KEY_MGMT = 65,
|
||||||
|
eCMD_SET_MAX_CLIENTS = 66,
|
||||||
|
eCMD_IEEE80211AC = 67,
|
||||||
|
eCMD_VHT_OPER_CH_WIDTH = 68,
|
||||||
|
eCMD_ACS_CHAN_LIST = 69,
|
||||||
|
eCMD_HT_CAPAB = 70,
|
||||||
|
|
||||||
eCMD_LAST /** New command numbers should be added above this */
|
eCMD_LAST /** New command numbers should be added above this */
|
||||||
} esap_cmd_t;
|
} esap_cmd_t;
|
||||||
@@ -576,6 +582,7 @@ typedef struct sap_auto_channel_info {
|
|||||||
#define IS_VALID_ENERGY_DETECT_TH(x) ((((x >= AP_ENERGY_DETECT_TH_MIN) && (x <= AP_ENERGY_DETECT_TH_MAX)) ||( x == 128)) ? TRUE : FALSE)
|
#define IS_VALID_ENERGY_DETECT_TH(x) ((((x >= AP_ENERGY_DETECT_TH_MIN) && (x <= AP_ENERGY_DETECT_TH_MAX)) ||( x == 128)) ? TRUE : FALSE)
|
||||||
|
|
||||||
/** Function declartion */
|
/** Function declartion */
|
||||||
|
int qsap_hostd_exec(int argc, char ** argv);
|
||||||
void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen);
|
void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen);
|
||||||
s8 *qsap_get_config_value(s8 *pfile, struct Command *pcmd, s8 *pbuf, u32 *plen);
|
s8 *qsap_get_config_value(s8 *pfile, struct Command *pcmd, s8 *pbuf, u32 *plen);
|
||||||
int qsapsetSoftap(int argc, char *argv[]);
|
int qsapsetSoftap(int argc, char *argv[]);
|
||||||
|
|||||||
Reference in New Issue
Block a user