wlan: SAP changes.
1. Fix Compilation error. 3. Changes to make qsap compatible w.r.t android framework. 4. Changes to check if SAP is enabled or not. Change-Id: I8a21585bc1af92f5fbc885d981227349bb56b0f9
This commit is contained in:
committed by
Jeff Johnson
parent
070ff77ac5
commit
d0ea69c721
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
|
||||||
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
* copyright notice, this list of conditions and the following
|
* copyright notice, this list of conditions and the following
|
||||||
* disclaimer in the documentation and/or other materials provided
|
* disclaimer in the documentation and/or other materials provided
|
||||||
* with the distribution.
|
* with the distribution.
|
||||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
* * Neither the name of The Linux Foundation, Inc. nor the names of its
|
||||||
* contributors may be used to endorse or promote products derived
|
* contributors may be used to endorse or promote products derived
|
||||||
* from this software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
|
|
||||||
@@ -34,10 +34,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
#include <linux/wireless.h>
|
#include <linux/wireless.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
@@ -252,7 +252,6 @@ end:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qsap_send_module_down_indication(void)
|
void qsap_send_module_down_indication(void)
|
||||||
{
|
{
|
||||||
int s, ret;
|
int s, ret;
|
||||||
@@ -435,15 +434,26 @@ s32 wifi_qsap_stop_bss(void)
|
|||||||
|
|
||||||
s32 is_softap_enabled(void)
|
s32 is_softap_enabled(void)
|
||||||
{
|
{
|
||||||
s8 stat[32] = {0};
|
FILE *fp;
|
||||||
|
char buf[1024];
|
||||||
|
|
||||||
if ( property_get("wifi.hostapd", stat, NULL) &&
|
fp = popen("ps", "r");
|
||||||
(strcmp(stat, "1") == 0)) {
|
if (fp == NULL) {
|
||||||
ALOGD("HOSTAPD enabled \n");
|
ALOGE("Failed to open file");
|
||||||
return ENABLE;
|
return eERR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGD("HOSTAPD disabled \n");
|
while (fgets(buf, sizeof(buf)-1, fp) != NULL) {
|
||||||
|
if(NULL !=(strstr(buf,"hostapd")))
|
||||||
|
{
|
||||||
|
pclose(fp);
|
||||||
|
ALOGD("HOSTAPD enabled\n");
|
||||||
|
return ENABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ALOGD("HOSTAPD disabled\n");
|
||||||
|
pclose(fp);
|
||||||
return DISABLE;
|
return DISABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
|
||||||
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
* copyright notice, this list of conditions and the following
|
* copyright notice, this list of conditions and the following
|
||||||
* disclaimer in the documentation and/or other materials provided
|
* disclaimer in the documentation and/or other materials provided
|
||||||
* with the distribution.
|
* with the distribution.
|
||||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
* * Neither the name of The Linux Foundation, Inc. nor the names of its
|
||||||
* contributors may be used to endorse or promote products derived
|
* contributors may be used to endorse or promote products derived
|
||||||
* from this software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
|
|
||||||
@@ -2997,12 +2997,12 @@ void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen)
|
|||||||
#define CMD_BUF_LEN 255
|
#define CMD_BUF_LEN 255
|
||||||
|
|
||||||
/** Command input
|
/** Command input
|
||||||
argv[4] = SSID,
|
argv[3] = SSID,
|
||||||
argv[5] = SEC,
|
argv[4] = SEC,
|
||||||
argv[6] = 12345,
|
argv[5] = 12345,
|
||||||
argv[7] = CHANNEL
|
argv[6] = CHANNEL
|
||||||
argv[8] = PREAMBLE,
|
argv[7] = PREAMBLE,
|
||||||
argv[9] = MAX_SCB,
|
argv[8] = MAX_SCB,
|
||||||
*/
|
*/
|
||||||
int qsapsetSoftap(int argc, char *argv[])
|
int qsapsetSoftap(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -3019,8 +3019,8 @@ int qsapsetSoftap(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** set SSID */
|
/** set SSID */
|
||||||
if(argc > 4) {
|
if(argc > 3) {
|
||||||
snprintf(cmdbuf, CMD_BUF_LEN, "set ssid=%s",argv[4]);
|
snprintf(cmdbuf, CMD_BUF_LEN, "set ssid=%s",argv[3]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
snprintf(cmdbuf, CMD_BUF_LEN, "set ssid=%s_%d", DEFAULT_SSID, rand());
|
snprintf(cmdbuf, CMD_BUF_LEN, "set ssid=%s_%d", DEFAULT_SSID, rand());
|
||||||
@@ -3034,19 +3034,19 @@ int qsapsetSoftap(int argc, char *argv[])
|
|||||||
|
|
||||||
/** Security */
|
/** Security */
|
||||||
rlen = RECV_BUF_LEN;
|
rlen = RECV_BUF_LEN;
|
||||||
if(argc > 5) {
|
if(argc > 4) {
|
||||||
|
|
||||||
/**TODO : need to identify the SEC strings for "wep", "wpa", "wpa2" */
|
/**TODO : need to identify the SEC strings for "wep", "wpa", "wpa2" */
|
||||||
if(!strcmp(argv[5], "open"))
|
if(!strcmp(argv[4], "open"))
|
||||||
sec = SEC_MODE_NONE;
|
sec = SEC_MODE_NONE;
|
||||||
|
|
||||||
else if(!strcmp(argv[5], "wep"))
|
else if(!strcmp(argv[4], "wep"))
|
||||||
sec = SEC_MODE_WEP;
|
sec = SEC_MODE_WEP;
|
||||||
|
|
||||||
else if(!strcmp(argv[5], "wpa-psk"))
|
else if(!strcmp(argv[4], "wpa-psk"))
|
||||||
sec = SEC_MODE_WPA_PSK;
|
sec = SEC_MODE_WPA_PSK;
|
||||||
|
|
||||||
else if(!strcmp(argv[5], "wpa2-psk"))
|
else if(!strcmp(argv[4], "wpa2-psk"))
|
||||||
sec = SEC_MODE_WPA2_PSK;
|
sec = SEC_MODE_WPA2_PSK;
|
||||||
|
|
||||||
snprintf(cmdbuf, CMD_BUF_LEN, "set security_mode=%d",sec);
|
snprintf(cmdbuf, CMD_BUF_LEN, "set security_mode=%d",sec);
|
||||||
@@ -3065,10 +3065,10 @@ int qsapsetSoftap(int argc, char *argv[])
|
|||||||
/** Key -- passphrase */
|
/** Key -- passphrase */
|
||||||
rlen = RECV_BUF_LEN;
|
rlen = RECV_BUF_LEN;
|
||||||
if ( (sec == SEC_MODE_WPA_PSK) || (sec == SEC_MODE_WPA2_PSK) ) {
|
if ( (sec == SEC_MODE_WPA_PSK) || (sec == SEC_MODE_WPA2_PSK) ) {
|
||||||
if(argc > 6) {
|
if(argc > 5) {
|
||||||
/* If the input passphrase is more than 63 characters, consider first 63 characters only*/
|
/* If the input passphrase is more than 63 characters, consider first 63 characters only*/
|
||||||
if ( strlen(argv[6]) > 63 ) argv[6][63] = '\0';
|
if ( strlen(argv[5]) > 63 ) argv[5][63] = '\0';
|
||||||
snprintf(cmdbuf, CMD_BUF_LEN, "set wpa_passphrase=%s",argv[6]);
|
snprintf(cmdbuf, CMD_BUF_LEN, "set wpa_passphrase=%s",argv[5]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
snprintf(cmdbuf, CMD_BUF_LEN, "set wpa_passphrase=%s", DEFAULT_PASSPHRASE);
|
snprintf(cmdbuf, CMD_BUF_LEN, "set wpa_passphrase=%s", DEFAULT_PASSPHRASE);
|
||||||
@@ -3083,8 +3083,8 @@ int qsapsetSoftap(int argc, char *argv[])
|
|||||||
|
|
||||||
/** channel */
|
/** channel */
|
||||||
rlen = RECV_BUF_LEN;
|
rlen = RECV_BUF_LEN;
|
||||||
if(argc > 7) {
|
if(argc > 6) {
|
||||||
snprintf(cmdbuf, CMD_BUF_LEN, "set channel=%d", atoi(argv[7]));
|
snprintf(cmdbuf, CMD_BUF_LEN, "set channel=%d", atoi(argv[6]));
|
||||||
(void) qsap_hostd_exec_cmd(cmdbuf, respbuf, &rlen);
|
(void) qsap_hostd_exec_cmd(cmdbuf, respbuf, &rlen);
|
||||||
|
|
||||||
if(strncmp("success", respbuf, rlen) != 0) {
|
if(strncmp("success", respbuf, rlen) != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user