summaryrefslogtreecommitdiff
path: root/wl1271/CUDK/os/linux
diff options
context:
space:
mode:
Diffstat (limited to 'wl1271/CUDK/os/linux')
-rw-r--r--wl1271/CUDK/os/linux/src/Android.mk12
-rw-r--r--wl1271/CUDK/os/linux/src/ParsEvent.c2
-rw-r--r--wl1271/CUDK/os/linux/src/cu_wext.c5
-rw-r--r--wl1271/CUDK/os/linux/src/ipc_event.c18
-rw-r--r--wl1271/CUDK/os/linux/src/ipc_sta.c2
-rw-r--r--wl1271/CUDK/os/linux/src/ipc_wpa.c68
-rw-r--r--wl1271/CUDK/os/linux/src/osapi.c20
7 files changed, 77 insertions, 50 deletions
diff --git a/wl1271/CUDK/os/linux/src/Android.mk b/wl1271/CUDK/os/linux/src/Android.mk
index 0fc7c7e1..3ae1e403 100644
--- a/wl1271/CUDK/os/linux/src/Android.mk
+++ b/wl1271/CUDK/os/linux/src/Android.mk
@@ -3,7 +3,7 @@ include $(CLEAR_VARS)
STATIC_LIB ?= y
DEBUG ?= y
-BUILD_SUPPL ?= y
+BUILD_SUPPL ?= n
WPA_ENTERPRISE ?= y
ifeq ($(DEBUG),y)
@@ -29,7 +29,7 @@ ifeq ($(BUILD_SUPPL), y)
endif
endif
-LOCAL_CFLAGS+= \
+LOCAL_CFLAGS += \
-Wall -Wstrict-prototypes $(DEBUGFLAGS) -D__LINUX__ $(DK_DEFINES) -D__BYTE_ORDER_LITTLE_ENDIAN -fno-common #-pipe
LOCAL_SRC_FILES:= \
@@ -39,8 +39,12 @@ LOCAL_SRC_FILES:= \
ipc_wpa.c \
os_trans.c \
ParsEvent.c \
- osapi.c
+ osapi.c
+ifeq ($(BUILD_SUPPL), y)
+LOCAL_SRC_FILES += \
+ $(TI_SUPP_LIB_DIR)/wpa_ctrl.c
+endif
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../inc \
@@ -60,7 +64,7 @@ LOCAL_C_INCLUDES := \
external/wpa_supplicant \
$(LOCAL_PATH)/$(CUDK_ROOT)/configurationutility/inc
-LOCAL_MODULE:=libtiOsLib
+LOCAL_MODULE := libtiOsLib
include $(BUILD_STATIC_LIBRARY)
diff --git a/wl1271/CUDK/os/linux/src/ParsEvent.c b/wl1271/CUDK/os/linux/src/ParsEvent.c
index b75070bf..43d65b01 100644
--- a/wl1271/CUDK/os/linux/src/ParsEvent.c
+++ b/wl1271/CUDK/os/linux/src/ParsEvent.c
@@ -38,7 +38,7 @@
#include <netinet/if_ether.h>
#endif
#include <linux/rtnetlink.h>
-#include <linux/if.h>
+#include <net/if.h>
#include <linux/wireless.h>
#include "ParsEvent.h"
#include "cu_osapi.h"
diff --git a/wl1271/CUDK/os/linux/src/cu_wext.c b/wl1271/CUDK/os/linux/src/cu_wext.c
index 3294a430..39189ad0 100644
--- a/wl1271/CUDK/os/linux/src/cu_wext.c
+++ b/wl1271/CUDK/os/linux/src/cu_wext.c
@@ -32,10 +32,11 @@
/************/
#include "cu_osapi.h"
#include "oserr.h"
-#include <linux/if.h>
+#include <net/if.h>
#include <linux/rtnetlink.h>
#include <linux/wireless.h>
#include <string.h>
+#include <stdlib.h>
#include "TWDriver.h"
#include "STADExternalIf.h"
@@ -81,7 +82,7 @@ static S32 CuWext_FillBssidList(struct iw_event *iwe, OS_802_11_BSSID_EX* bssidL
break;
case SIOCGIWNAME:
{
- int i;
+ unsigned i;
S8 buffer[IFNAMSIZ];
static const char *ieee80211_modes[] = {
"?",
diff --git a/wl1271/CUDK/os/linux/src/ipc_event.c b/wl1271/CUDK/os/linux/src/ipc_event.c
index ede0a4b6..e8be9910 100644
--- a/wl1271/CUDK/os/linux/src/ipc_event.c
+++ b/wl1271/CUDK/os/linux/src/ipc_event.c
@@ -32,21 +32,21 @@
/************/
#include <sys/types.h>
#include <sys/socket.h>
-#include <linux/if.h>
+#include <net/if.h>
#include <linux/rtnetlink.h>
#include <signal.h>
#include <sys/mman.h>
#include <unistd.h>
#include <linux/wireless.h>
-
#include "cu_osapi.h"
#include "oserr.h"
+
#include "TWDriver.h"
#include "STADExternalIf.h"
+
#include "ParsEvent.h"
#include "ipc_event.h"
-
/* defines */
/***********/
#define PIPE_READ 0
@@ -132,8 +132,6 @@ static VOID IpcEvent_PrintEvent(IpcEvent_Child_t* pIpcEventChild, U32 EventId, T
{
switch(EventId)
{
-
-
case IPC_EVENT_DISASSOCIATED:
{
OS_802_11_DISASSOCIATE_REASON_T *pDisAssoc;
@@ -335,7 +333,7 @@ static VOID IpcEvent_wext_event_wireless(IpcEvent_Child_t* pIpcEventChild, PS8 d
(iwe.u.ap_addr.sa_data[4] == 0) &&
(iwe.u.ap_addr.sa_data[5] == 0))
{
- EventId=IPC_EVENT_DISASSOCIATED;
+ EventId=IPC_EVENT_DISASSOCIATED;
IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0);
}
else
@@ -344,16 +342,16 @@ static VOID IpcEvent_wext_event_wireless(IpcEvent_Child_t* pIpcEventChild, PS8 d
/* Send a signal to the udhcpc application to trigger the renew request */
system("killall -SIGUSR1 udhcpc");
#endif
- EventId=IPC_EVENT_ASSOCIATED;
+ EventId=IPC_EVENT_ASSOCIATED;
IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0);
}
break;
case IWEVMICHAELMICFAILURE:
- EventId=IPC_EVENT_MEDIA_SPECIFIC;
+ EventId=IPC_EVENT_MEDIA_SPECIFIC;
IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0);
break;
case IWEVCUSTOM:
- pEvent = (IPC_EV_DATA*)iwe.u.data.pointer;
+ pEvent = (IPC_EV_DATA*)iwe.u.data.pointer;
if (pEvent)
{
EventId = (U32)pEvent->EvParams.uEventType;
@@ -361,7 +359,7 @@ static VOID IpcEvent_wext_event_wireless(IpcEvent_Child_t* pIpcEventChild, PS8 d
}
break;
case SIOCGIWSCAN:
- EventId=IPC_EVENT_SCAN_COMPLETE;
+ EventId=IPC_EVENT_SCAN_COMPLETE;
IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0);
break;
case IWEVASSOCREQIE:
diff --git a/wl1271/CUDK/os/linux/src/ipc_sta.c b/wl1271/CUDK/os/linux/src/ipc_sta.c
index 51fa239c..53ecef06 100644
--- a/wl1271/CUDK/os/linux/src/ipc_sta.c
+++ b/wl1271/CUDK/os/linux/src/ipc_sta.c
@@ -32,7 +32,7 @@
/************/
#include <sys/types.h>
#include <sys/socket.h>
-#include <linux/if.h>
+#include <net/if.h>
#include <linux/rtnetlink.h>
#include <errno.h>
#include <sys/ioctl.h>
diff --git a/wl1271/CUDK/os/linux/src/ipc_wpa.c b/wl1271/CUDK/os/linux/src/ipc_wpa.c
index 5fd3d263..03f050da 100644
--- a/wl1271/CUDK/os/linux/src/ipc_wpa.c
+++ b/wl1271/CUDK/os/linux/src/ipc_wpa.c
@@ -47,9 +47,9 @@
/* Module control block */
typedef struct TIpcWpa
{
- struct wpa_ctrl *pWpaCtrl;
+ struct wpa_ctrl *pWpaCtrl;
#if 0
- S32 socket;
+ S32 socket;
struct sockaddr_in local;
struct sockaddr_in dest;
#endif
@@ -62,7 +62,8 @@ typedef struct TIpcWpa
/*******************/
static S32 IpcWpa_Sockets_Open(TIpcWpa* pIpcWpa, PS8 pSupplIfFile)
{
- S32 i;
+#ifdef WPA_SUPPLICANT
+ S32 i;
for(i=0; i< IPC_WPA_CTRL_OPEN_RETRIES; i++)
{
@@ -70,19 +71,23 @@ static S32 IpcWpa_Sockets_Open(TIpcWpa* pIpcWpa, PS8 pSupplIfFile)
if(pIpcWpa->pWpaCtrl)
break;
}
-
+#else
+ pIpcWpa->pWpaCtrl = NULL;
+#endif
if(pIpcWpa->pWpaCtrl == NULL)
- {
+ {
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcWpa_Sockets_Open - can't connect the socket\n");
- return EOALERR_IPC_WPA_ERROR_CANT_CONNECT_TO_SUPPL;
+ return EOALERR_IPC_WPA_ERROR_CANT_CONNECT_TO_SUPPL;
}
- return OK;
+ return OK;
}
static VOID IpcWpa_Sockets_Close(TIpcWpa* pIpcWpa)
{
+#ifdef WPA_SUPPLICANT
wpa_ctrl_close(pIpcWpa->pWpaCtrl);
+#endif
}
@@ -100,7 +105,7 @@ THandle IpcWpa_Create(PS32 pRes, PS8 pSupplIfFile)
*pRes = IpcWpa_Sockets_Open(pIpcWpa, pSupplIfFile);
if(*pRes)
- {
+ {
IpcWpa_Destroy(pIpcWpa);
return NULL;
}
@@ -120,54 +125,61 @@ VOID IpcWpa_Destroy(THandle hIpcWpa)
S32 IpcWpa_Command(THandle hIpcWpa, PS8 cmd, S32 print)
{
+#ifdef WPA_SUPPLICANT
TIpcWpa* pIpcWpa = (TIpcWpa*)hIpcWpa;
- S8 Resp[IPC_WPA_RESP_MAX_LEN];
- TI_SIZE_T RespLen = IPC_WPA_RESP_MAX_LEN - 1;
- S32 ret;
+ S8 Resp[IPC_WPA_RESP_MAX_LEN];
+ TI_SIZE_T RespLen = IPC_WPA_RESP_MAX_LEN - 1;
+ S32 ret;
ret = wpa_ctrl_request(pIpcWpa->pWpaCtrl, (char*)cmd, os_strlen(cmd), (char*)Resp, (size_t*)&RespLen, NULL);
- if (ret == -2)
+ if (ret == -2)
{
os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command timed out.\n", cmd);
- return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT;
- }
- else if (ret < 0)
+ return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT;
+ }
+ else if (ret < 0)
{
os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command failed (%d).\n", cmd, ret);
- return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
+ return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
}
- if (print)
+ if (print)
{
Resp[RespLen] = '\0';
- os_error_printf(CU_MSG_INFO2, (PS8)"%s", Resp);
+ os_error_printf(CU_MSG_INFO2, (PS8)"%s", Resp);
}
return OK;
+#else
+ return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
+#endif
}
S32 IpcWpa_CommandWithResp(THandle hIpcWpa, PS8 cmd, S32 print, PS8 pResp, PU32 pRespLen)
{
- TIpcWpa* pIpcWpa = (TIpcWpa*)hIpcWpa;
- S32 ret;
+#ifdef WPA_SUPPLICANT
+ TIpcWpa* pIpcWpa = (TIpcWpa*)hIpcWpa;
+ S32 ret;
*pRespLen = IPC_WPA_RESP_MAX_LEN - 1;
ret = wpa_ctrl_request(pIpcWpa->pWpaCtrl, (char*)cmd, os_strlen(cmd), (char*)pResp, (size_t*)pRespLen, NULL);
- if (ret == -2)
+ if (ret == -2)
{
os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command timed out.\n", cmd);
- return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT;
- }
- else if (ret < 0)
+ return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT;
+ }
+ else if (ret < 0)
{
os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command failed.\n", cmd);
- return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
+ return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
}
- if (print)
+ if (print)
{
pResp[*pRespLen] = '\0';
- os_error_printf(CU_MSG_INFO2, (PS8)"%s", pResp);
+ os_error_printf(CU_MSG_INFO2, (PS8)"%s", pResp);
}
return OK;
+#else
+ return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
+#endif
}
-
diff --git a/wl1271/CUDK/os/linux/src/osapi.c b/wl1271/CUDK/os/linux/src/osapi.c
index c088fbac..b1242112 100644
--- a/wl1271/CUDK/os/linux/src/osapi.c
+++ b/wl1271/CUDK/os/linux/src/osapi.c
@@ -78,20 +78,32 @@ RETURN: None
*****************************************************************************************/
VOID os_error_printf(S32 debug_level, const PS8 arg_list ,...)
{
- static int g_debug_level = CU_MSG_ERROR;
- va_list ap;
+ static int g_debug_level = CU_MSG_ERROR; /* TODO ronen: create debug logic for CLI */
S8 msg[MAX_HOST_MESSAGE_SIZE];
+ va_list ap;
+#ifdef OS_CLI_LOG_TO_FILE
+ char file_name[30]="/cli.log";
+ FILE *ftmp;
+#endif
if (debug_level < g_debug_level)
return;
/* Format the message */
va_start(ap, arg_list);
- vsprintf((char*)msg, (char*)arg_list, ap);
+ vsprintf((char *)msg, (char *)arg_list, ap);
va_end(ap);
/* print the message */
- fprintf(stderr, (char*)msg);
+ fprintf(stderr, (char *)msg);
+
+#ifdef OS_CLI_LOG_TO_FILE
+ ftmp = fopen(file_name, "a");
+ if (ftmp != NULL) {
+ fprintf(ftmp,(char *)msg);
+ fclose(ftmp);
+ }
+#endif
}
/****************************************************************************************