sm7325-common: Switch to commom QSAP

Change-Id: Ia57042a4fb9afe4c5b3e70c29d80c4f652901096
This commit is contained in:
Nolen Johnson 2022-08-08 11:37:32 -04:00
parent 8bb6ded719
commit e438ed51d8
7 changed files with 6 additions and 5219 deletions

View File

@ -6,5 +6,9 @@
{ {
"repository": "android_hardware_motorola", "repository": "android_hardware_motorola",
"target_path": "hardware/motorola" "target_path": "hardware/motorola"
},
{
"repository": "android_system_qcom",
"target_path": "system/qcom"
} }
] ]

View File

@ -1,88 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(TOP)/hardware/libhardware_legacy/wifi $(TOP)/external/libnl/include $(TOP)/external/wpa_supplicant_8/wpa_supplicant/src/drivers
LOCAL_MODULE:= libqsap_sdk
LOCAL_MODULE_TAGS := optional
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += -DSDK_VERSION=\"0.0.1.0\"
LOCAL_USE_VNDK := true
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/qsap_api.h \
$(LOCAL_PATH)/qsap.h
ifdef WIFI_DRIVER_MODULE_PATH
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_PATH=\"$(WIFI_DRIVER_MODULE_PATH)\"
endif
ifdef WIFI_DRIVER_MODULE_ARG
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_ARG=\"$(WIFI_DRIVER_MODULE_ARG)\"
endif
ifdef WIFI_DRIVER_MODULE_NAME
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_NAME=\"$(WIFI_DRIVER_MODULE_NAME)\"
endif
ifdef WIFI_SDIO_IF_DRIVER_MODULE_PATH
LOCAL_CFLAGS += -DWIFI_SDIO_IF_DRIVER_MODULE_PATH=\"$(WIFI_SDIO_IF_DRIVER_MODULE_PATH)\"
endif
ifdef WIFI_SDIO_IF_DRIVER_MODULE_NAME
LOCAL_CFLAGS += -DWIFI_SDIO_IF_DRIVER_MODULE_NAME=\"$(WIFI_SDIO_IF_DRIVER_MODULE_NAME)\"
endif
ifdef WIFI_CFG80211_DRIVER_MODULE_PATH
LOCAL_CFLAGS += -DWIFI_CFG80211_DRIVER_MODULE_PATH=\"$(WIFI_CFG80211_DRIVER_MODULE_PATH)\"
endif
ifdef WIFI_CFG80211_DRIVER_MODULE_ARG
LOCAL_CFLAGS += -DWIFI_CFG80211_DRIVER_MODULE_ARG=\"$(WIFI_CFG80211_DRIVER_MODULE_ARG)\"
endif
ifdef WIFI_CFG80211_DRIVER_MODULE_NAME
LOCAL_CFLAGS += -DWIFI_CFG80211_DRIVER_MODULE_NAME=\"$(WIFI_CFG80211_DRIVER_MODULE_NAME)\"
endif
ifdef WIFI_DRIVER_CONF_FILE
LOCAL_CFLAGS += -DWIFI_DRIVER_CONF_FILE=\"$(WIFI_DRIVER_CONF_FILE)\"
endif
ifdef WIFI_DRIVER_DEF_CONF_FILE
LOCAL_CFLAGS += -DWIFI_DRIVER_DEF_CONF_FILE=\"$(WIFI_DRIVER_DEF_CONF_FILE)\"
endif
LOCAL_CFLAGS += \
-Wall \
-Werror \
-Wno-unused-variable \
-Wno-unused-value \
-Wno-format \
-Wno-sometimes-uninitialized \
-Wno-enum-conversion \
-Wno-unused-parameter \
-Wno-implicit-function-declaration
LOCAL_SRC_FILES := qsap_api.c \
qsap.c
LOCAL_PRELINK_MODULE := false
LOCAL_SHARED_LIBRARIES := libnetutils libutils libbinder libcutils libhardware_legacy libnl liblog
LOCAL_HEADER_LIBRARIES := libcutils_headers
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libqsap_headers
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
LOCAL_VENDOR_MODULE := true
include $(BUILD_HEADER_LIBRARY)

View File

@ -1,752 +0,0 @@
/*
* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sched.h>
#include <sys/socket.h>
#include <linux/if.h>
#include <linux/wireless.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define LOG_TAG "QCLDR-"
#include <cutils/log.h>
#include <cutils/memory.h>
#include <cutils/misc.h>
#include <cutils/properties.h>
#include <grp.h>
#include <pwd.h>
#include "qsap_api.h"
#include "qsap.h"
#include <sys/system_properties.h>
#ifndef WIFI_DRIVER_MODULE_PATH
#define WIFI_DRIVER_MODULE_PATH "/system/lib/modules/wlan.ko"
#endif
#ifndef WIFI_DRIVER_MODULE_NAME
#define WIFI_DRIVER_MODULE_NAME "wlan"
#endif
#ifdef WIFI_DRIVER_MODULE_ARG
#undef WIFI_DRIVER_MODULE_ARG
#endif
#define WIFI_DRIVER_MODULE_ARG ""
/* WIFI_SDIO_IF_DRIVER_MODULE_NAME must be defined if sdioif driver required */
#ifdef WIFI_SDIO_IF_DRIVER_MODULE_NAME
#ifndef WIFI_SDIO_IF_DRIVER_MODULE_PATH
#define WIFI_SDIO_IF_DRIVER_MODULE_PATH "/system/lib/modules/librasdioif.ko"
#endif
#ifndef WIFI_SDIO_IF_DRIVER_MODULE_ARG
#define WIFI_SDIO_IF_DRIVER_MODULE_ARG ""
#endif
#endif
#ifndef WIFI_CFG80211_DRIVER_MODULE_PATH
#define WIFI_CFG80211_DRIVER_MODULE_PATH ""
#endif
#ifndef WIFI_CFG80211_DRIVER_MODULE_NAME
#define WIFI_CFG80211_DRIVER_MODULE_NAME ""
#endif
#ifndef WIFI_CFG80211_DRIVER_MODULE_ARG
#define WIFI_CFG80211_DRIVER_MODULE_ARG ""
#endif
extern int init_module(const char *name, u32, const s8 *);
extern int delete_module(const char *name, int);
extern struct Command qsap_str[];
static s32 check_driver_loaded( const s8 * tag)
{
FILE *proc;
s8 line[126];
if ((proc = fopen("/proc/modules", "r")) == NULL) {
ALOGW("Could not open %s: %s", "/proc/modules", strerror(errno));
return 0;
}
while ((fgets(line, sizeof(line), proc)) != NULL) {
if (strncmp(line, tag, strlen(tag)) == 0) {
fclose(proc);
return 1;
}
}
fclose(proc);
return 0;
}
static s32 insmod(const s8 *filename, const s8 *args, const s8 * tag)
{
#ifndef SDK_TEST
void *module;
s32 size;
s32 ret = 0;
if ( check_driver_loaded(tag) ) {
ALOGE("Driver: %s already loaded\n", filename);
return ret;
}
ALOGD("Loading Driver: %s %s\n", filename, args);
module = (void*)load_file(filename, (unsigned int*)&size);
if (!module) {
ALOGE("Cannot load file: %s\n", filename);
return -1;
}
ret = init_module(module, size, args);
if ( ret ) {
ALOGE("init_module (%s:%d) failed\n", filename, (int)size);
}
free(module);
return ret;
#else
return 0;
#endif
}
static s32 rmmod(const s8 *modname)
{
#ifndef SDK_TEST
s32 ret = 0;
s32 maxtry = 10;
while (maxtry-- > 0) {
ret = delete_module(modname, O_NONBLOCK | O_EXCL);
if (ret < 0 && errno == EAGAIN){
usleep(50000);
} else {
break;
}
}
if (ret != 0) {
ALOGD("Unable to unload driver module \"%s\": %s\n",
modname, strerror(errno));
}
return ret;
#else
return 0;
#endif
}
static const s8 SDIO_POLLING_ON[] = "/etc/init.qcom.sdio.sh 1";
static const s8 SDIO_POLLING_OFF[] = "/etc/init.qcom.sdio.sh 0";
static const char DRIVER_CFG80211_MODULE_NAME[] = WIFI_CFG80211_DRIVER_MODULE_NAME;
static const char DRIVER_CFG80211_MODULE_PATH[] = WIFI_CFG80211_DRIVER_MODULE_PATH;
static const char DRIVER_CFG80211_MODULE_ARG[] = WIFI_CFG80211_DRIVER_MODULE_ARG;
s32 wifi_qsap_load_driver(void)
{
s32 size;
s32 ret = -1;
s32 retry;
if (system(SDIO_POLLING_ON)) {
// ALOGE("Could not turn on the polling...");
}
if ('\0' != *DRIVER_CFG80211_MODULE_PATH) {
if (insmod(DRIVER_CFG80211_MODULE_PATH, DRIVER_CFG80211_MODULE_ARG,DRIVER_CFG80211_MODULE_NAME) < 0) {
ALOGE("Could not load cfg80211...");
return ret;
}
}
#ifdef WIFI_SDIO_IF_DRIVER_MODULE_NAME
ret = insmod(WIFI_SDIO_IF_DRIVER_MODULE_PATH, WIFI_SDIO_IF_DRIVER_MODULE_ARG, WIFI_SDIO_IF_DRIVER_MODULE_NAME " ");
if ( ret != 0 ) {
ALOGE("init_module failed sdioif\n");
ret = eERR_LOAD_FAILED_SDIOIF;
goto end;
}
sched_yield();
#endif
ret = insmod(WIFI_DRIVER_MODULE_PATH, WIFI_DRIVER_MODULE_ARG, WIFI_DRIVER_MODULE_NAME " ");
if ( ret != 0 ) {
#ifdef WIFI_SDIO_IF_DRIVER_MODULE_NAME
if ( check_driver_loaded(WIFI_SDIO_IF_DRIVER_MODULE_NAME " ") ) {
if ( rmmod(WIFI_SDIO_IF_DRIVER_MODULE_NAME) ) {
ALOGE("Unable to unload the station mode librasdioif driver\n");
}
}
#endif
if ('\0' != *DRIVER_CFG80211_MODULE_NAME) {
rmmod(DRIVER_CFG80211_MODULE_NAME);
}
ALOGE("init_module failed libra_softap\n");
ret = eERR_LOAD_FAILED_SOFTAP;
goto end;
}
sched_yield();
ret = eSUCCESS;
end:
if(system(SDIO_POLLING_OFF)) {
// ALOGE("Could not turn off the polling...");
}
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) {
strlcpy(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);
if (ret < 0 ) {
strlcpy(wrq.ifr_name, "softap.0", IFNAMSIZ);
ret = ioctl(s, (SIOCIWFIRSTPRIV + 1), &wrq);
if (ret < 0 ) {
ALOGE("ioctl failed: %s", strerror(errno));
}
}
close(s);
sched_yield();
}
else {
ALOGE("Socket open failed: %s", strerror(errno));
}
}
s32 qsap_send_init_ap(void)
{
int s, ret;
struct iwreq wrq;
s32 status = eSUCCESS;
u32 *params = (u32 *)&wrq.u;
/* Equivalent to: iwpriv wlan0 initAP */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) {
strlcpy(wrq.ifr_name, "wlan0", IFNAMSIZ);
wrq.u.data.length = 0; /* No Set arguments */
wrq.u.data.flags = 2; /* WE_INIT_AP sub-command */
ret = ioctl(s, (SIOCIWFIRSTPRIV + 6), &wrq);
if (ret < 0 ) {
ALOGE("ioctl failed: %s", strerror(errno));
status = eERR_START_SAP;
}
close(s);
sched_yield();
}
else {
ALOGE("Socket open failed: %s", strerror(errno));
status = eERR_START_SAP;
}
return status;
}
s32 qsap_send_exit_ap(void)
{
int s, ret;
struct iwreq wrq;
s32 status = eSUCCESS;
u32 *params = (u32 *)&wrq.u;
/* Equivalent to: iwpriv wlan0 exitAP */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) {
strlcpy(wrq.ifr_name, "wlan0", IFNAMSIZ);
wrq.u.data.length = 0; /* No Set arguments */
wrq.u.data.flags = 3; /*WE_EXIT_AP sub-command */
ret = ioctl(s, (SIOCIWFIRSTPRIV + 6), &wrq);
if (ret < 0 ) {
ALOGE("ioctl failed: %s", strerror(errno));
status = eERR_STOP_SAP;
}
close(s);
sched_yield();
}
else {
ALOGE("Socket open failed: %s", strerror(errno));
status = eERR_STOP_SAP;
}
return status;
}
s32 wifi_qsap_unload_driver()
{
s32 ret = eSUCCESS;
if(system(SDIO_POLLING_ON)) {
ALOGE("Could not turn on the polling...");
}
if ( check_driver_loaded(WIFI_DRIVER_MODULE_NAME " ") ) {
qsap_send_module_down_indication();
if ( rmmod(WIFI_DRIVER_MODULE_NAME) ) {
ALOGE("Unable to unload the libra_softap driver\n");
ret = eERR_UNLOAD_FAILED_SOFTAP;
goto end;
}
}
sched_yield();
#ifdef WIFI_SDIO_IF_DRIVER_MODULE_NAME
if ( check_driver_loaded(WIFI_SDIO_IF_DRIVER_MODULE_NAME " ") ) {
if ( rmmod(WIFI_SDIO_IF_DRIVER_MODULE_NAME) ) {
ALOGE("Unable to unload the librasdioif driver\n");
ret = eERR_UNLOAD_FAILED_SDIO;
goto end;
}
}
#endif
end:
if(system(SDIO_POLLING_OFF)) {
ALOGE("Could not turn off the polling...");
}
return ret;
}
s32 wifi_qsap_stop_bss(void)
{
#define QCIEEE80211_IOCTL_STOPBSS (SIOCIWFIRSTPRIV + 6)
s32 sock;
s32 ret = eERR_STOP_BSS;
s8 cmd[] = "stopbss";
s8 interface[128];
s8 *iface;
s32 len = 128;
struct iwreq wrq;
struct iw_priv_args *priv_ptr;
if(ENABLE != is_softap_enabled()) {
ret = eERR_BSS_NOT_STARTED;
return ret;
}
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 the stopbss command to driver */
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
ALOGE("Failed to open socket");
return eERR_STOP_BSS;
}
strlcpy(wrq.ifr_name, iface, sizeof(wrq.ifr_name));
wrq.u.data.length = sizeof(cmd);
wrq.u.data.pointer = cmd;
wrq.u.data.flags = 0;
ret = ioctl(sock, QCIEEE80211_IOCTL_STOPBSS, &wrq);
/* Here IOCTL is always returning non Zero: temporary fix untill driver is fixed*/
ret = 0;
close(sock);
if (ret) {
ALOGE("IOCTL stopbss failed: %ld", ret);
ret = eERR_STOP_BSS;
} else {
ALOGD("STOP BSS ISSUED");
ret = eSUCCESS;
}
sched_yield();
return ret;
}
s32 is_softap_enabled(void)
{
s32 mode = 0;
int ret;
ret = qsap_get_mode(&mode);
if (eSUCCESS != ret) {
ALOGD("Failed to get the mode of operation\n");
return eERR_UNKNOWN;
}
if (mode == IW_MODE_MASTER) {
ALOGD("HOSTAPD Enabled\n");
return ENABLE;
}
ALOGD("HOSTAPD Disabled\n");
return DISABLE;
}
s32 commit(void)
{
#ifndef SDK_TEST
s32 ret = eERR_COMMIT;
if ( is_softap_enabled() ) {
/** Stop BSS */
if(eSUCCESS != (ret = wifi_qsap_stop_bss())) {
ALOGE("%s: stop bss failed \n", __func__);
return ret;
}
sleep(1);
}
ret = wifi_qsap_start_softap();
if( eSUCCESS != ret )
wifi_qsap_unload_driver();
return ret;
#else
return eSUCCESS;
#endif
}
s32 wifi_qsap_start_softap()
{
s32 retry = 4;
FILE * fp;
ALOGD("Starting Soft AP...\n");
/* Check if configuration files are present, if not create the default files */
check_for_configuration_files();
/* Delete control interface if it was left over because of previous crash */
if ( !is_softap_enabled() ) {
qsap_del_ctrl_iface();
}
/* Ensure correct path for ini file name */
qsap_set_ini_filename();
while(retry--) {
/* May be the configuration file is corrupted or not available, */
/* copy the default configuration file */
if ( retry == 1 )
wifi_qsap_reset_to_default(CONFIG_FILE, DEFAULT_CONFIG_FILE_PATH);
/** Stop hostapd */
if(0 != property_set("ctl.start", "hostapd")) {
ALOGE("failed \n");
continue;
}
sleep(1);
if ( is_softap_enabled() ) {
ALOGD("success \n");
return eSUCCESS;
}
}
ALOGE("Unable to start the SoftAP\n");
return eERR_START_SAP;
}
#ifdef QCOM_WLAN_CONCURRENCY
s32 wifi_qsap_start_softap_in_concurrency()
{
s32 status;
/*Send initAP IOCTL to Driver. Hostapd start is done by Netd.*/
status = qsap_send_init_ap();
return status;
}
s32 wifi_qsap_stop_softap_in_concurrency()
{
s32 status;
/*Send exitAP IOCTL to Driver. Hostapd stop is done by Netd.*/
status = qsap_send_exit_ap();
return status;
}
#endif
s32 wifi_qsap_stop_softap()
{
s32 ret = eSUCCESS;
if ( is_softap_enabled() ) {
ALOGD("Stopping BSS ..... ");
/** Stop the BSS */
if (eSUCCESS != (ret = wifi_qsap_stop_bss()) ) {
ALOGE("failed \n");
return ret;
}
sleep(1);
}
return ret;
}
s32 wifi_qsap_reload_softap()
{
s32 ret = eERR_RELOAD_SAP;
/** SDK API to reload the firmware */
if (eSUCCESS != (ret = wifi_qsap_stop_softap())) {
return ret;
}
if (eSUCCESS != (ret = wifi_qsap_unload_driver())) {
return ret;
}
usleep(500000);
if (eSUCCESS != (ret = wifi_qsap_load_driver())) {
return ret;
}
sleep(1);
if (eSUCCESS != (ret = wifi_qsap_start_softap())) {
wifi_qsap_unload_driver();
return ret;
}
return eSUCCESS;
}
static pid_t wigigSoftApPid = 0;
static const char WIGIG_ENTROPY_FILE[] = "/data/misc/wifi/wigig_entropy.bin";
static unsigned char dummy_key[21] = { 0x02, 0x11, 0xbe, 0x33, 0x43, 0x35,
0x68, 0x47, 0x84, 0x99, 0xa9, 0x2b,
0x1c, 0xd3, 0xee, 0xff, 0xf1, 0xe2,
0xf3, 0xf4, 0xf5 };
static const char HOSTAPD_BIN_FILE[] = "/system/bin/hostapd";
static const char WIGIG_HOSTAPD_CONF_FILE[] = "/data/misc/wifi/wigig_hostapd.conf";
#define AP_BSS_START_DELAY 200000
#define AP_BSS_STOP_DELAY 500000
int wigig_ensure_entropy_file_exists()
{
int ret;
int destfd;
struct passwd *pw;
struct group *gr;
ret = access(WIGIG_ENTROPY_FILE, R_OK|W_OK);
if ((ret == 0) || (errno == EACCES)) {
if ((ret != 0) &&
(chmod(WIGIG_ENTROPY_FILE, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) != 0)) {
ALOGE("Cannot set RW to \"%s\": %s", WIGIG_ENTROPY_FILE, strerror(errno));
return -1;
}
return 0;
}
destfd = TEMP_FAILURE_RETRY(open(WIGIG_ENTROPY_FILE, O_CREAT|O_RDWR, 0660));
if (destfd < 0) {
ALOGE("Cannot create \"%s\": %s", WIGIG_ENTROPY_FILE, strerror(errno));
return -1;
}
if (TEMP_FAILURE_RETRY(write(destfd, dummy_key, sizeof(dummy_key))) != sizeof(dummy_key)) {
ALOGE("Error writing \"%s\": %s", WIGIG_ENTROPY_FILE, strerror(errno));
close(destfd);
return -1;
}
close(destfd);
/* chmod is needed because open() didn't set permisions properly */
if (chmod(WIGIG_ENTROPY_FILE, 0660) < 0) {
ALOGE("Error changing permissions of %s to 0660: %s",
WIGIG_ENTROPY_FILE, strerror(errno));
unlink(WIGIG_ENTROPY_FILE);
return -1;
}
pw = getpwnam("system");
gr = getgrnam("wifi");
if (pw && gr) {
if (chown(WIGIG_ENTROPY_FILE, pw->pw_uid, gr->gr_gid) < 0) {
ALOGE("Error changing group ownership of %s to %d: %s",
WIGIG_ENTROPY_FILE, gr->gr_gid, strerror(errno));
unlink(WIGIG_ENTROPY_FILE);
return -1;
}
} else {
ALOGE("Cannot get pw_uid or gr_gid : %s", strerror(errno));
unlink(WIGIG_ENTROPY_FILE);
return -1;
}
return 0;
}
s32 wifi_qsap_start_wigig_softap(void)
{
pid_t pid = 1;
ALOGD("%s", __func__);
if (wigigSoftApPid) {
ALOGE("Wigig SoftAP is already running");
return eERR_START_SAP;
}
if (wigig_ensure_entropy_file_exists() < 0) {
ALOGE("Wigig entropy file was not created");
}
if ((pid = fork()) < 0) {
ALOGE("fork failed (%s)", strerror(errno));
return eERR_START_SAP;
}
if (!pid) {
if (execl(HOSTAPD_BIN_FILE, HOSTAPD_BIN_FILE,
"-e", WIGIG_ENTROPY_FILE, "-dd",
WIGIG_HOSTAPD_CONF_FILE, (char *) NULL)) {
ALOGE("execl failed (%s)", strerror(errno));
}
ALOGE("Wigig SoftAP failed to start. Exiting child process...");
exit(-1);
}
wigigSoftApPid = pid;
ALOGD("Wigig SoftAP started successfully");
usleep(AP_BSS_START_DELAY);
return eSUCCESS;
}
s32 wifi_qsap_stop_wigig_softap(void)
{
ALOGD("%s", __func__);
if (wigigSoftApPid == 0) {
ALOGE("Wigig SoftAP is not running");
return eSUCCESS;
}
ALOGD("Stopping the Wigig SoftAP...");
kill(wigigSoftApPid, SIGTERM);
waitpid(wigigSoftApPid, NULL, 0);
wigigSoftApPid = 0;
ALOGD("Wigig SoftAP stopped successfully");
usleep(AP_BSS_STOP_DELAY);
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: %d\n", __func__, ret);
ret = eERR_SET_TX_POWER;
} else {
ALOGD("%s :IOCTL set tx power issued\n", __func__);
ret = eSUCCESS;
}
return ret;
}

View File

@ -1,62 +0,0 @@
/*
* Copyright (c) 2010, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _QSAP_H
#define _QSAP_H
#if __cplusplus
extern "C" {
#endif
#include "qsap_api.h"
s32 wifi_qsap_load_driver(void);
s32 wifi_qsap_unload_driver(void);
s32 wifi_qsap_stop_bss(void);
s32 commit(void);
s32 is_softap_enabled(void);
s32 wifi_qsap_start_softap(void);
s32 wifi_qsap_stop_softap(void);
s32 wifi_qsap_start_wigig_softap(void);
s32 wifi_qsap_stop_wigig_softap(void);
s32 wifi_qsap_reload_softap(void);
s32 wifi_qsap_unload_wifi_sta_driver(void);
s32 wifi_qsap_set_tx_power(s32 tx_power);
#ifdef QCOM_WLAN_CONCURRENCY
s32 wifi_qsap_start_softap_in_concurrency(void);
s32 wifi_qsap_stop_softap_in_concurrency(void);
#endif
#if __cplusplus
}; // extern "C"
#endif
#endif // _QSAP_H

File diff suppressed because it is too large Load Diff

View File

@ -1,651 +0,0 @@
/*
* Copyright (c) 2010, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _QSAP_API_H_
#define _QSAP_API_H_
#if __cplusplus
extern "C" {
#endif
#include <android/log.h>
typedef unsigned char u8;
typedef char s8;
typedef unsigned short int u16;
typedef signed short int s16;
typedef unsigned int u32;
typedef signed int s32;
/** Success and error messages */
#define SUCCESS "success"
#define ERR_INVALID_ARG "failure invalid arguments"
#define ERR_INVALID_PARAM "failure invalid parameter"
#define ERR_UNKNOWN "failure unknown error"
#define ERR_INVALIDCMD "failure invalid command"
#define ERR_INVALIDREQ "failure invalid request"
#define ERR_FEATURE_NOT_ENABLED "failure feature not enabled"
#define ERR_NOT_SUPPORTED "failure not supported"
#define ERR_NOT_READY "failure not ready"
#define ERR_RES_UNAVAILABLE "failure resource unavailable"
#define ERR_SOFTAP_NOT_STARTED "failure softap not started"
/** Error numbers used with the SDK */
enum error_val {
eERR_UNKNOWN = -1,
eSUCCESS = 0,
eERR_STOP_BSS,
eERR_BSS_NOT_STARTED,
eERR_COMMIT,
eERR_START_SAP,
eERR_STOP_SAP,
eERR_RELOAD_SAP,
eERR_FILE_OPEN,
eERR_CONF_FILE,
eERR_INVALID_MAC_ADDR,
eERR_SEND_TO_HOSTAPD,
eERR_CONFIG_PARAM_MISSING,
eERR_CHAN_READ,
eERR_FEATURE_NOT_ENABLED,
eERR_UNLOAD_FAILED_SDIO,
eERR_UNLOAD_FAILED_SOFTAP,
eERR_LOAD_FAILED_SDIOIF,
eERR_LOAD_FAILED_SOFTAP,
eERR_SET_CHAN_RANGE,
eERR_GET_AUTO_CHAN,
eERR_SET_TX_POWER
};
#ifndef WIFI_DRIVER_CONF_FILE
#define WIFI_DRIVER_CONF_FILE NULL
#endif
#ifndef WIFI_DRIVER_DEF_CONF_FILE
#define WIFI_DRIVER_DEF_CONF_FILE NULL
#endif
/** Configuration file name for SAP+SAP*/
#define CONFIG_FILE_2G "/data/vendor/wifi/hostapd/hostapd_dual2g.conf"
#define CONFIG_FILE_5G "/data/vendor/wifi/hostapd/hostapd_dual5g.conf"
#define CONFIG_FILE_60G "/data/vendor/wifi/hostapd/hostapd_60g.conf"
/** Configuration file name for OWE-transition */
#define CONFIG_FILE_OWE "/data/vendor/wifi/hostapd/hostapd_owe.conf"
/** Configuration file name */
#define CONFIG_FILE "/data/vendor/wifi/hostapd/hostapd.conf"
/** Default configuration file path */
#define DEFAULT_CONFIG_FILE_PATH "/vendor/etc/hostapd/hostapd_default.conf"
/** Default Accept list file name */
#define DEFAULT_ACCEPT_LIST_FILE_PATH "/vendor/etc/hostapd/hostapd.accept"
/** Accept list file name */
#define ACCEPT_LIST_FILE "/data/vendor/wifi/hostapd/hostapd.accept"
/** Default Deny list file name */
#define DEFAULT_DENY_LIST_FILE_PATH "/vendor/etc/hostapd/hostapd.deny"
/** Deny list file name */
#define DENY_LIST_FILE "/data/vendor/wifi/hostapd/hostapd.deny"
/** Default Ini file */
#define DEFAULT_INI_FILE "/persist/qcom/softap/qcom_cfg_default.ini"
/** SDK control interface path */
#define SDK_CTRL_IF "/data/vendor/wifi/hostapd/ctrl/softap_sdk_ctrl"
/** Maximum length of the line in the configuration file */
#define MAX_CONF_LINE_LEN (156)
/** MAC address length in acsii string format*/
#define MAC_ADDR_LEN (17)
/** MAC address length, as integer */
#define MAC_ADDR_LEN_INT (6)
/** Maximum number of MAC address in the allow / deny MAC list */
#define MAX_ALLOWED_MAC (15)
/** Maximum length of the file path */
#define MAX_FILE_PATH_LEN (128)
/** WPS key length - 8 digit key, usually*/
#define WPS_KEY_LEN (8)
/** Maximum length of the SSID */
#define SSD_MAX_LEN (32)
#define CTRY_MAX_LEN (3)
/** Beacon interval 50 to 65535 */
#define BCN_INTERVAL_MIN (1)
#define BCN_INTERVAL_MAX (65535)
/** Passphrase max length 63 bytes, Minumum lenght is 8.
* NOTE: If Passphrase length is 64, then phassphrase is treated as PSK.
*/
#define PASSPHRASE_MIN (8)
#define PASSPHRASE_MAX (63)
/** DTIM period 1 to 255 -- Qualcomm 10 */
#define DTIM_PERIOD_MIN (1)
#define DTIM_PERIOD_MAX (255)
/** WEP key lengths in ASCII and hex */
#define WEP_64_KEY_ASCII (5)
#define WEP_64_KEY_HEX (10)
#define WEP_128_KEY_ASCII (13)
#define WEP_128_KEY_HEX (26)
#define WEP_152_KEY_ASCII (16)
#define WEP_152_KEY_HEX (32)
#define WPS_PIN_LEN (8)
#define CHANNEL_MIN (0)
#define CHANNEL_MAX (14)
#define AUTO_CHANNEL (0)
#define BG_MAX_CHANNEL (11)
/** Fragmentation threshold 256 to 2346 */
#define FRAG_THRESHOLD_MIN (256)
#define FRAG_THRESHOLD_MAX (2346)
/** RTS threshold 1 to 2347 */
#define RTS_THRESHOLD_MIN (1)
#define RTS_THRESHOLD_MAX (2347)
#define MIN_UUID_LEN (1)
#define MAX_UUID_LEN (36)
#define MIN_DEVICENAME_LEN (1)
#define MAX_DEVICENAME_LEN (32)
#define MIN_MANUFACTURER_LEN (1)
#define MAX_MANUFACTURER_LEN (64)
#define MIN_MODELNAME_LEN (1)
#define MAX_MODELNAME_LEN (32)
#define MIN_MODELNUM_LEN (1)
#define MAX_MODELNUM_LEN (32)
#define MIN_SERIALNUM_LEN (1)
#define MAX_SERIALNUM_LEN (32)
#define MIN_DEV_TYPE_LEN (1)
#define MAX_DEV_TYPE_LEN (20)
#define MIN_OS_VERSION_LEN (1)
#define MAX_OS_VERSION_LEN (12)
#define MIN_FRIENDLY_NAME_LEN (1)
#define MAX_FRIENDLY_NAME_LEN (64)
#define MAX_URL_LEN (128)
#define MIN_MODEL_DESC_LEN (1)
#define MAX_MODEL_DESC_LEN (128)
#define MIN_UPC_LEN (1)
#define MAX_UPC_LEN (128)
#define GTK_MIN (30)
#define MAX_INT_STR (8)
/** Tx Power range 2dBm to 18 dBm */
#define MIN_TX_POWER (2)
#define MAX_TX_POWER (30)
/** Data rate index */
#define MIN_DATA_RATE_IDX (0)
#define MAX_DATA_RATE_IDX (28)
#define AUTO_DATA_RATE (0)
#define B_MODE_MAX_DATA_RATE_IDX (4)
#define G_ONLY_MODE_MAX_DATA_RATE_IDX (12)
/** parameters for read config */
#define GET_COMMENTED_VALUE 1
#define GET_ENABLED_ONLY 0
#define MAX_RESP_LEN 255
/** AP shutoff time */
#define AP_SHUTOFF_MIN (0)
#define AP_SHUTOFF_MAX (120)
/** AP shutoff time */
#define AP_ENERGY_DETECT_TH_MIN (0)
#define AP_ENERGY_DETECT_TH_MAX (9)
/** command request index - in the array Cmd_req[] */
enum eCmd_req {
eCMD_GET = 0,
eCMD_SET = 1,
eCMD_REQ_LAST
};
/** config request index - in the array Conf_req[] */
enum eConf_req {
CONF_2g = 0,
CONF_5g = 1,
CONF_owe = 2,
CONF_60g = 3,
CONF_REQ_LAST
};
/**
* Command numbers, these numbers form the index into the array of
* command names stored in the 'cmd_list'.
*
* Warning: An addtion of an entry in 'esap_cmd', should be followed
* by an addition of a command name string in the 'cmd_list' array
*/
typedef enum esap_cmd {
eCMD_INVALID = -1,
eCMD_SSID = 0,
eCMD_BSSID = 1,
eCMD_CHAN = 2,
eCMD_BCN_INTERVAL = 3,
eCMD_DTIM_PERIOD = 4,
eCMD_HW_MODE = 5,
eCMD_AUTH_ALGS = 6,
eCMD_SEC_MODE = 7,
eCMD_WEP_KEY0 = 8,
eCMD_WEP_KEY1 = 9,
eCMD_WEP_KEY2 = 10,
eCMD_WEP_KEY3 = 11,
eCMD_DEFAULT_KEY = 12,
eCMD_PASSPHRASE = 13,
eCMD_WPA_PAIRWISE = 14,
eCMD_RSN_PAIRWISE = 15,
eCMD_MAC_ADDR = 16,
eCMD_RESET_AP = 17,
eCMD_MAC_ACL = 18,
eCMD_ADD_TO_ALLOW = 19,
eCMD_ADD_TO_DENY = 20,
eCMD_REMOVE_FROM_ALLOW = 21,
eCMD_REMOVE_FROM_DENY = 22,
eCMD_ALLOW_LIST = 23,
eCMD_DENY_LIST = 24,
eCMD_COMMIT = 25,
eCMD_ENABLE_SOFTAP = 26,
eCMD_DISASSOC_STA = 27,
eCMD_RESET_TO_DEFAULT = 28,
eCMD_PROTECTION_FLAG = 29,
eCMD_DATA_RATES = 30,
eCMD_ASSOC_STA_MACS = 31,
eCMD_TX_POWER = 32,
eCMD_SDK_VERSION = 33,
eCMD_WMM_STATE = 34,
/** WARNING: The order of WPS commands should not be altered.
New commands SHOULD be added above or below this */
eCMD_WPS_STATE = 35,
eCMD_WPS_CONFIG_METHOD = 36,
eCMD_UUID = 37,
eCMD_DEVICE_NAME = 38,
eCMD_MANUFACTURER = 39,
eCMD_MODEL_NAME = 40,
eCMD_MODEL_NUMBER = 41,
eCMD_SERIAL_NUMBER = 42,
eCMD_DEVICE_TYPE = 43,
eCMD_OS_VERSION = 44,
eCMD_FRIENDLY_NAME = 45,
eCMD_MANUFACTURER_URL = 46,
eCMD_MODEL_DESC = 47,
eCMD_MODEL_URL = 48,
eCMD_UPC = 49,
/******************************************************/
eCMD_FRAG_THRESHOLD = 50,
eCMD_RTS_THRESHOLD = 51,
eCMD_GTK_TIMEOUT = 52,
eCMD_COUNTRY_CODE = 53,
eCMD_INTRA_BSS_FORWARD = 54,
eCMD_REGULATORY_DOMAIN = 55,
eCMD_AP_STATISTICS = 56,
eCMD_AP_AUTOSHUTOFF = 57,
eCMD_AP_ENERGY_DETECT_TH = 58,
eCMD_BASIC_RATES = 59,
eCMD_REQUIRE_HT = 60,
eCMD_IEEE80211N = 61,
eCMD_SET_CHANNEL_RANGE = 62,
eCMD_GET_AUTO_CHANNEL = 63,
eCMD_IEEE80211W = 64,
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_IEEE80211H = 71,
eCMD_ENABLE_WIGIG_SOFTAP = 72,
eCMD_INTERFACE = 73,
eCMD_SSID2 = 74,
eCMD_BRIDGE = 75,
eCMD_CTRL_INTERFACE = 76,
eCMD_VENDOR_ELEMENT = 77,
eCMD_ASSOCRESP_ELEMENT = 78,
eCMD_ACS_EXCLUDE_DFS = 79,
eCMD_WOWLAN_TRIGGERS = 80,
eCMD_ACCEPT_MAC_FILE = 81,
eCMD_DENY_MAC_FILE = 82,
eCMD_OWE_TRANS_IFNAME = 83,
eCMD_SAE_REQUIRE_MPF = 84,
eCMD_IEEE80211AX = 85,
eCMD_ENABLE_EDMG = 86,
eCMD_EDMG_CHANNEL = 87,
eCMD_LAST /** New command numbers should be added above this */
} esap_cmd_t;
/** non-commands */
typedef enum esap_str {
STR_WPA = 0,
STR_ACCEPT_MAC_FILE = 1,
STR_DENY_MAC_FILE = 2,
STR_MAC_IN_INI = 3,
STR_PROT_FLAG_IN_INI = 4,
STR_DATA_RATE_IN_INI = 5,
STR_TX_POWER_IN_INI = 6,
STR_FRAG_THRESHOLD_IN_INI = 7,
STR_RTS_THRESHOLD_IN_INI = 8,
STR_COUNTRY_CODE_IN_INI = 9,
STR_INTRA_BSS_FORWARD_IN_INI = 10,
STR_WMM_IN_INI = 11,
STR_802DOT11D_IN_INI = 12,
STR_HT_80211N = 13,
STR_CTRL_INTERFACE = 14,
STR_INTERFACE = 15,
STR_EAP_SERVER = 16,
STR_AP_AUTOSHUTOFF = 17,
STR_AP_ENERGY_DETECT_TH = 18,
eSTR_LAST
} esap_str_t;
/** Supported security mode */
typedef enum sec_mode {
SEC_MODE_NONE = 0,
SEC_MODE_WEP = 1,
SEC_MODE_WPA_PSK = 2,
SEC_MODE_WPA2_PSK = 3,
SEC_MODE_WPA_WPA2_PSK = 4,
SEC_MODE_INVALID
} sec_mode_t;
/** security mode in the configuration file */
enum wpa_in_conf_file {
WPA_IN_CONF_FILE = 1,
WPA2_IN_CONF_FILE = 2,
WPA_WPA2_IN_CONF_FILE = 3
};
enum {
DISABLE = 0,
ENABLE = 1
};
enum {
FALSE = 0,
TRUE = 1
};
/** IEEE 802.11 operating mode */
enum oper_mode {
HW_MODE_B = 0,
HW_MODE_G = 1,
HW_MODE_N = 2,
HW_MODE_G_ONLY = 3,
HW_MODE_N_ONLY = 4,
HW_MODE_A = 5,
HW_MODE_ANY = 6,
HW_MODE_AD = 7,
HW_MODE_UNKNOWN
};
/** Authentication algorithm */
enum auth_alg {
AHTH_ALG_OPEN = 1,
AUTH_ALG_SHARED = 2,
AUTH_ALG_OPEN_SHARED = 3,
AUTH_ALG_INVALID
};
/** Allow or Deny MAC address list selection */
enum macaddr_acl {
ACL_DENY_LIST = 0,
ACL_ALLOW_LIST = 1,
ACL_ALLOW_AND_DENY_LIST = 2
};
enum ap_reset {
SAP_RESET_BSS = 0,
SAP_RESET_DRIVER_BSS = 1,
SAP_STOP_BSS = 2,
SAP_STOP_DRIVER_BSS = 3,
#ifdef QCOM_WLAN_CONCURRENCY
SAP_INITAP = 4,
SAP_EXITAP = 5,
#endif
SAP_RESET_INVALID
};
enum wmm_state {
WMM_AUTO_IN_INI = 0,
WMM_ENABLED_IN_INI = 1,
WMM_DISABLED_IN_INI = 2
};
enum wps_state {
WPS_STATE_DISABLE = 0,
WPS_STATE_ENABLE = 2
};
enum wps_config {
WPS_CONFIG_PBC = 0,
WPS_CONFIG_PIN = 1,
};
/** Choose the configuration file */
enum eChoose_conf_file {
HOSTAPD_CONF_QCOM_FILE = 0,
INI_CONF_FILE = 1
};
struct Command
{
s8 * name;
s8 * default_value;
};
/** STA Channel information*/
typedef struct sta_channel_info {
int subioctl;
int stastartchan;
int staendchan;
int staband;
} sta_channel_info;
/**SAP Channel information*/
typedef struct sap_channel_info {
int startchan;
int endchan;
int band;
} sap_channel_info;
/**SAP auto Channel information*/
typedef struct sap_auto_channel_info {
int subioctl;
} sap_auto_channel_info;
/** Validate enable / disable softap */
#define IS_VALID_SOFTAP_ENABLE(x) (((value == ENABLE) || (value == DISABLE)) ? TRUE: FALSE)
/** Validate the channel */
#define IS_VALID_CHANNEL(x) ((value >= CHANNEL_MIN) && (value <= CHANNEL_MAX) ? TRUE : FALSE)
/** Validate the security mode */
#define IS_VALID_SEC_MODE(x) (((x >= SEC_MODE_NONE) && (x < SEC_MODE_INVALID)) ? TRUE : FALSE)
/** Validate the selection of access or deny MAC address list */
#define IS_VALID_MAC_ACL(x) (((x==ACL_DENY_LIST) || (x==ACL_ALLOW_LIST) || (x==ACL_ALLOW_AND_DENY_LIST)) ? TRUE : FALSE)
/** Validate the broadcast SSID status */
#define IS_VALID_BSSID(x) (((value == ENABLE) || (value == DISABLE)) ? TRUE: FALSE)
/** Validate the length of the passphrase */
#define IS_VALID_PASSPHRASE_LEN(x) ((((x >= PASSPHRASE_MIN) && (x <= PASSPHRASE_MAX)) || (x == 0)) ? TRUE: FALSE)
/** Validate the beacon interval */
#define IS_VALID_BEACON(x) (((x >= BCN_INTERVAL_MIN) && (x <= BCN_INTERVAL_MAX)) ? TRUE: FALSE)
/** Validate the DTIM period */
#define IS_VALID_DTIM_PERIOD(x) (((x >= DTIM_PERIOD_MIN) && (x <= DTIM_PERIOD_MAX)) ? TRUE: FALSE)
/** Validate the WEP index */
#define IS_VALID_WEP_KEY_IDX(x) ((x >= 0) && (x < 4) ? TRUE : FALSE)
/** Validate the pairwise encryption */
#define IS_VALID_PAIRWISE(x) (((!strcmp(x, "TKIP")) || (!strcmp(x, "CCMP")) || \
(!strcmp(x, "TKIP CCMP")) || (!strcmp(x, "CCMP TKIP")) || (!strcmp(x, "GCMP"))) ? TRUE : FALSE)
/** Validate the WMM status */
#define IS_VALID_WMM_STATE(x) (((x >= WMM_AUTO_IN_INI) && (x <= WMM_DISABLED_IN_INI)) ? TRUE: FALSE)
/** Validate the WPS status */
#define IS_VALID_WPS_STATE(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
/** Validate the fragmentation threshold */
#define IS_VALID_FRAG_THRESHOLD(x) (((x >= FRAG_THRESHOLD_MIN) && (x <= FRAG_THRESHOLD_MAX)) ? TRUE: FALSE)
/** Validate the RTS threshold value */
#define IS_VALID_RTS_THRESHOLD(x) (((x >= RTS_THRESHOLD_MIN) && (x <= RTS_THRESHOLD_MAX)) ? TRUE: FALSE)
/** Validate the GTK */
#define IS_VALID_GTK(x) ((x >= GTK_MIN) ? TRUE: FALSE)
/** Validate the intra-bss forwarding status */
#define IS_VALID_INTRA_BSS_STATUS(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
/** Validate the protection flag */
#define IS_VALID_PROTECTION(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
/** Validate the UUID length */
#define IS_VALID_UUID_LEN(x) (((x >= MIN_UUID_LEN) && (x <= MAX_UUID_LEN)) ? TRUE : FALSE)
/** Validate the device name length */
#define IS_VALID_DEVICENAME_LEN(x) (((x >= MIN_DEVICENAME_LEN) && (x <= MAX_DEVICENAME_LEN)) ? TRUE : FALSE)
/** Validate the Manufacturer length */
#define IS_VALID_MANUFACTURER_LEN(x) (((x >= MIN_MANUFACTURER_LEN) && (x <= MAX_MANUFACTURER_LEN)) ? TRUE : FALSE)
/** Validate the Model name length */
#define IS_VALID_MODELNAME_LEN(x) (((x >= MIN_MODELNAME_LEN) && (x <= MAX_MODELNAME_LEN)) ? TRUE : FALSE)
/** Validate the Model number length */
#define IS_VALID_MODELNUM_LEN(x) (((x >= MIN_MODELNUM_LEN) && (x <= MAX_MODELNUM_LEN)) ? TRUE : FALSE)
/** Validate the Model serial number length */
#define IS_VALID_SERIALNUM_LEN(x) (((x >= MIN_SERIALNUM_LEN) && (x <= MAX_SERIALNUM_LEN)) ? TRUE : FALSE)
/** Validate the Primary device type length */
#define IS_VALID_DEV_TYPE_LEN(x) (((x >= MIN_DEV_TYPE_LEN) && (x <= MAX_DEV_TYPE_LEN)) ? TRUE : FALSE)
/** Validate the OS version length */
#define IS_VALID_OS_VERSION_LEN(x) (((x >= MIN_OS_VERSION_LEN) && (x <= MAX_OS_VERSION_LEN)) ? TRUE : FALSE)
/** Validate the friendly name length */
#define IS_VALID_FRIENDLY_NAME_LEN(x) (((x >= MIN_FRIENDLY_NAME_LEN) && (x <= MAX_FRIENDLY_NAME_LEN)) ? TRUE : FALSE)
/** Validate the URL length */
#define IS_VALID_URL_LEN(x) (((x > 0) && (x <= MAX_URL_LEN)) ? TRUE : FALSE)
/** Validate the model description length */
#define IS_VALID_MODEL_DESC_LEN(x) (((x > MIN_MODEL_DESC_LEN) && (x <= MAX_MODEL_DESC_LEN)) ? TRUE : FALSE)
/** Validate the Universal Product Code (UPC) length */
#define IS_VALID_UPC_LEN(x) (((x > MIN_UPC_LEN) && (x <= MAX_UPC_LEN)) ? TRUE : FALSE)
/** Validate the Tx power index */
#define IS_VALID_TX_POWER(x) (((x >= MIN_TX_POWER ) && (x <= MAX_TX_POWER)) ? TRUE : FALSE)
/** Validate the Data rate */
#define IS_VALID_DATA_RATE_IDX(x) (((x >= MIN_DATA_RATE_IDX) && (x <= MAX_DATA_RATE_IDX)) ? TRUE : FALSE )
/** Validate WPS config */
#define IS_VALID_WPS_CONFIG(x) (((x == WPS_CONFIG_PBC) || (x == WPS_CONFIG_PIN)) ? TRUE : FALSE)
/** Validate the 802dot11d state */
#define IS_VALID_802DOT11D_STATE(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
/** Validate the AP shutoff time */
#define IS_VALID_APSHUTOFFTIME(x) (((x >= AP_SHUTOFF_MIN) && (x <= AP_SHUTOFF_MAX)) ? TRUE : FALSE)
/** Validate the AP shutoff time */
#define IS_VALID_ENERGY_DETECT_TH(x) ((((x >= AP_ENERGY_DETECT_TH_MIN) && (x <= AP_ENERGY_DETECT_TH_MAX)) ||( x == 128)) ? TRUE : FALSE)
/** Validate the 802dot11h state */
#define IS_VALID_DFS_STATE(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
/** Function declartion */
int qsap_hostd_exec(int argc, char ** argv);
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);
int qsapsetSoftap(int argc, char *argv[]);
int qsap_add_or_remove_interface(const char *iface_name, int create_iface);
void qsap_del_ctrl_iface(void);
s16 wifi_qsap_reset_to_default(s8 *pcfgfile, s8 *pdefault);
void check_for_configuration_files(void);
void qsap_set_ini_filename(void);
int qsap_set_channel_range(s8 * cmd);
int qsap_get_sap_auto_channel_slection(s32 *pautochan);
int qsap_get_mode(s32 *pmode);
int qsap_prepare_softap(void);
int qsap_unprepare_softap(void);
int qsap_is_fst_enabled(void);
int qsap_control_bridge(int argc, char ** argv);
int linux_get_ifhwaddr(const char *ifname, char *addr);
#if __cplusplus
}; // extern "C"
#endif
#endif

View File

@ -514,6 +514,8 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/wifi/p2p_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant_overlay.conf \ $(LOCAL_PATH)/wifi/p2p_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant_overlay.conf \
$(LOCAL_PATH)/wifi/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf $(LOCAL_PATH)/wifi/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf
PRODUCT_VENDOR_MOVE_ENABLED := true
# WiFi Display # WiFi Display
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
libavservices_minijail \ libavservices_minijail \