delete drivers/net/wireless/ar6003/host/tools/ dir
authorhwg <hwg@I7-CH.(none)>
Thu, 1 Dec 2011 01:44:09 +0000 (09:44 +0800)
committerhwg <hwg@I7-CH.(none)>
Thu, 1 Dec 2011 01:44:09 +0000 (09:44 +0800)
88 files changed:
drivers/net/wireless/ar6003/host/tools/Android.mk [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/Android.mk [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/Android_Readme [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/Android.mk [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/Makefile [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus.c [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus.h [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus_glib.c [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus_glib.h [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_hciutils.c [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_core.c [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_int.h [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_main.c [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_utils.c [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_wlan.c [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btdefs.h [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btfilter_action.c [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btfilter_core.c [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btfilter_core.h [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/hciutils.h [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/sample.conf [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/bthmonoheadset.py [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/bthstereoheadset.py [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/btmonoloop.sh [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/btplaywav.sh [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/fc9_setup_readme.txt [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/linux_setup_readme.txt [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/wireless.h [deleted file]
drivers/net/wireless/ar6003/host/tools/athbtfilter/filter.sh [deleted file]
drivers/net/wireless/ar6003/host/tools/drvdebugctrl/Android.mk [deleted file]
drivers/net/wireless/ar6003/host/tools/drvdebugctrl/Makefile [deleted file]
drivers/net/wireless/ar6003/host/tools/drvdebugctrl/debugctrl.c [deleted file]
drivers/net/wireless/ar6003/host/tools/recEvent/Android.mk [deleted file]
drivers/net/wireless/ar6003/host/tools/recEvent/Makefile [deleted file]
drivers/net/wireless/ar6003/host/tools/recEvent/dbgFormatter.c [deleted file]
drivers/net/wireless/ar6003/host/tools/recEvent/recEvent.c [deleted file]
drivers/net/wireless/ar6003/host/tools/recEvent/restore.sh [deleted file]
drivers/net/wireless/ar6003/host/tools/recEvent/wireless_copy.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/Android.mk [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/Makefile [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/ap.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/atheros.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/basic.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/cmds_reg.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/os_unix.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/p2p.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/powerswitch.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/sigma_dut.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/sigma_dut.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/sta.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/traffic.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/traffic_agent.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_agt.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_agtctrl.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_ca.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_cmds.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_cmdtbl.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_cs.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_debug.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_main.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_miscs.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_p2p.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_portall.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_rsp.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_sock.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_stdincs.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tg.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tg.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_thr.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tlv.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tlv.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_types.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_utils.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_ver.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_wmmps.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_wmmps.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wlantest.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wlantest_ctrl.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_ctrl.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_ctrl.h [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_helpers.c [deleted file]
drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_helpers.h [deleted file]
drivers/net/wireless/ar6003/host/tools/wlan_tool/Android.mk [deleted file]
drivers/net/wireless/ar6003/host/tools/wlan_tool/wlan_tool [deleted file]
drivers/net/wireless/ar6003/host/tools/wmiconfig/Android.mk [deleted file]
drivers/net/wireless/ar6003/host/tools/wmiconfig/Makefile [deleted file]
drivers/net/wireless/ar6003/host/tools/wmiconfig/wmiconfig.c [deleted file]
drivers/net/wireless/ar6003/host/tools/wmiconfig/wmiconfig.h [deleted file]

diff --git a/drivers/net/wireless/ar6003/host/tools/Android.mk b/drivers/net/wireless/ar6003/host/tools/Android.mk
deleted file mode 100644 (file)
index b3c34c5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2010 Atheros Corporation.  All rights reserved.
-# 
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-
-
-ifneq ($(TARGET_SIMULATOR),true)
-  include $(call all-subdir-makefiles)
-endif
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/Android.mk b/drivers/net/wireless/ar6003/host/tools/athbtfilter/Android.mk
deleted file mode 100644 (file)
index 2af8bc3..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2010 Atheros Corporation.  All rights reserved.
-# 
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-
-ifneq ($(TARGET_SIMULATOR),true)
-ifeq ($(BOARD_HAVE_BLUETOOTH),true)
-  include $(call all-subdir-makefiles)
-endif
-endif
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/Android_Readme b/drivers/net/wireless/ar6003/host/tools/athbtfilter/Android_Readme
deleted file mode 100644 (file)
index 0c5eb5b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-#
-#  To generate the Android buildable files/directory
-#  execute the filter.sh script ONLY ONCE and move the
-#  whole athbtfilter directory to Android external
-#  directoy for compilation.
-#
\ No newline at end of file
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/Android.mk b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/Android.mk
deleted file mode 100644 (file)
index fc1882e..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2010 Atheros Corporation.  All rights reserved.
-#  
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-#
-# link or copy whole olca driver into external/athwlan/olca/
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-ifeq ($(BT_ALT_STACK),true)
-# Define AR6K_PREBUILT_HCIUTILS_LIB:= true if you want to force to enable HCIUTILS
-# Otherwise, we will try to load the hciutil.so dynamically to determinate whether we use hciutils or hci socket
-# Uncomment the following if you want to use static library
-
-#AR6K_PREBUILT_HCIUTILS_LIB := true
-
-endif
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := abtfilt_bluez_dbus.c \
-               abtfilt_core.c \
-               abtfilt_main.c \
-               abtfilt_utils.c \
-               abtfilt_wlan.c \
-               btfilter_action.c \
-               btfilter_core.c
-
-ifeq ($(BT_ALT_STACK),true)
-LOCAL_SRC_FILES += abtfilt_bluez_hciutils.c
-
-ifeq ($(AR6K_PREBUILT_HCIUTILS_LIB),true)
-LOCAL_STATIC_LIBRARIES := hciutils
-LOCAL_CFLAGS += -DSTATIC_LINK_HCILIBS
-endif
-AR6K_PREBUILT_HCIUTILS_LIB :=
-
-else
-LOCAL_CFLAGS += -DCONFIG_NO_HCILIBS
-endif
-
-LOCAL_SHARED_LIBRARIES := \
-               libdbus \
-               libbluetooth \
-               libcutils \
-               libdl
-
-ifeq ($(AR6K_PREBUILT_HCIUTILS_LIB),true)
-LOCAL_STATIC_LIBRARIES := hciutils
-LOCAL_CFLAGS += -DSTATIC_LINK_HCILIBS
-endif
-AR6K_PREBUILT_HCIUTILS_LIB :=
-
-LOCAL_C_INCLUDES := \
-       $(LOCAL_PATH) \
-       $(LOCAL_PATH)/../../../include \
-       $(LOCAL_PATH)/../../../tools/athbtfilter/bluez \
-       $(LOCAL_PATH)/../../../../include \
-       $(LOCAL_PATH)/../../../os/linux/include \
-        $(LOCAL_PATH)/../../../btfilter \
-        $(LOCAL_PATH)/../../.. \
-       $(call include-path-for, dbus) \
-       $(call include-path-for, bluez-libs)
-
-ifneq ($(PLATFORM_VERSION),$(filter $(PLATFORM_VERSION),1.5 1.6))
-LOCAL_C_INCLUDES += external/bluetooth/bluez/include/bluetooth external/bluetooth/bluez/lib/bluetooth 
-LOCAL_CFLAGS+=-DBLUEZ4_3
-else
-LOCAL_C_INCLUDES += external/bluez/libs/include/bluetooth
-endif
-
-LOCAL_CFLAGS+= \
-       -DDBUS_COMPILATION -DABF_DEBUG
-
-
-LOCAL_MODULE := abtfilt
-LOCAL_MODULE_TAGS := debug eng optional
-#LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
-
-include $(BUILD_EXECUTABLE)
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/Makefile b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/Makefile
deleted file mode 100644 (file)
index 7d48c4c..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2008 Atheros Corporation.  All rights reserved.
-# 
-# The software source and binaries included in this development package are
-# licensed, not sold. You, or your company, received the package under one
-# or more license agreements. The rights granted to you are specifically
-# listed in these license agreement(s). All other rights remain with Atheros
-# Communications, Inc., its subsidiaries, or the respective owner including
-# those listed on the included copyright notices.  Distribution of any
-# portion of this package must be in strict compliance with the license
-# agreement(s) terms.
-# </copyright>
-# 
-# <summary>
-#      Wifi driver for AR6002
-# </summary>
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-
-#USE_GLIB=1
-#USE_HCIUTILS=1
-
-ifdef V210     
-V210_DIR=/tftpboot/ubuntu-taiwan
-endif
-
-ifdef V210     
-CC=            $(ATH_CROSS_COMPILE_TYPE)gcc
-LD=            $(ATH_CROSS_COMPILE_TYPE)ld
-else
-CC=            $(ATH_CROSSS_COMPILE_TYPE)gcc
-LD=            $(ATH_CROSSS_COMPILE_TYPE)ld
-endif
-SOURCES=abtfilt_main.c \
-               abtfilt_wlan.c \
-               abtfilt_core.c \
-               abtfilt_utils.c \
-               btfilter_action.c\
-               btfilter_core.c
-       
-INCLUDES=      -I../../../include \
-               -I../../../os/linux/include \
-               -I../../../../include \
-               -I../../../ \
-               -I$(V210_DIR)/usr/include/dbus-1.0/ \
-               -I$(V210_DIR)/usr/lib/dbus-1.0/include \
-               -I$(V210_DIR)/usr/include/bluetooth \
-                       
-CFLAGS=                -Wall -g -DABF_DEBUG
-#LIBS=                 -ldbus-1 -lpthread -lbtfilt -lrt -lbluetooth
-LIBS=          -ldbus-1 -lpthread -lrt -lbluetooth
-
-ifdef USE_HCIUTILS
-SOURCES += abtfilt_bluez_hciutils.c
-LIBS += -ldl
-else
-CFLAGS += -DCONFIG_NO_HCILIBS
-endif
-
-ifdef USE_GLIB 
-SOURCES += abtfilt_bluez_dbus_glib.c
-
-LIBS += -lgobject-2.0 -lglib-2.0 -ldbus-glib-1
-
-INCLUDES += -I/usr/include/glib-2.0     \
-                       -I/usr/lib/glib-2.0/include \
-
-OBJECTS=       $(SOURCES:.c=.o)                        
-
-else   
-SOURCES += abtfilt_bluez_dbus.c
-
-OBJECTS=       $(SOURCES:.c=.o)
-endif
-
-
-
-#LDFLAGS=      -L$(WORKAREA)/host/btfilter
-#copy libbluetooth.so from /tftpboot/ubuntu-taiwan/usr/lib to /tftpboot/ubuntu-taiwan/lib [for V210]
-ifdef V210     
-LDFLAGS=       -L/tftpboot/ubuntu-taiwan/lib
-endif
-FILTERAPP=     abtfilt
-
-all: $(OBJECTS)
-       $(CC) -o $(FILTERAPP) $(OBJECTS) $(LDFLAGS) $(LIBS)
-
-.c.o:
-       $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@
-
-clean:
-       rm -f $(FILTERAPP) $(OBJECTS)
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus.c b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus.c
deleted file mode 100644 (file)
index be7b6d8..0000000
+++ /dev/null
@@ -1,2634 +0,0 @@
-
-//------------------------------------------------------------------------------
-// <copyright file="abtfilt_bluez_dbus.c" company="Atheros">
-//    Copyright (c) 2007 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-
-/*
- * Bluetooth Filter - BT module
- *
- */
-
-#include "abtfilt_bluez_dbus.h"
-
-#undef HCI_INQUIRY
-#include <bluetooth.h>
-#include <hci.h>
-#include <hci_lib.h>
-#include <sys/poll.h>
-
-/* Definitions */
-
-#define BLUEZ_NAME                        "org.bluez"
-#define ADAPTER_INTERFACE                 "org.bluez.Adapter"
-#define MANAGER_INTERFACE                 "org.bluez.Manager"
-
-#ifndef ANDROID
-/* This should be undef'ed if compiled at FC9 using BlueZ 3.x */
-#define BLUEZ4_3
-#endif /* ANDROID */
-
-#define ABTH_MAX_CONNECTIONS 16
-
-#ifdef BLUEZ4_3
-
-#define BLUEZ_PATH                        "/"
-#define AUDIO_MANAGER_PATH                "/org/bluez/"
-#define AUDIO_MANAGER_INTERFACE           "org.bluez"
-#define AUDIO_SINK_INTERFACE              "org.bluez.AudioSink"
-#define AUDIO_SOURCE_INTERFACE            "org.bluez.AudioSource"
-#define AUDIO_HEADSET_INTERFACE           "org.bluez.Headset"
-#define AUDIO_GATEWAY_INTERFACE           "org.bluez.Gateway"
-#define AUDIO_DEVICE_INTERFACE            "org.bluez.Device"
-
-#else
-
-#define BLUEZ_PATH                        "/org/bluez"
-#define AUDIO_MANAGER_PATH                "/org/bluez/audio"
-#define AUDIO_SINK_INTERFACE              "org.bluez.audio.Sink"
-#define AUDIO_SOURCE_INTERFACE            "org.bluez.audio.Source"
-#define AUDIO_HEADSET_INTERFACE           "org.bluez.audio.Headset"
-#define AUDIO_GATEWAY_INTERFACE           "org.bluez.audio.Gateway"
-#define AUDIO_MANAGER_INTERFACE           "org.bluez.audio.Manager"
-#define AUDIO_DEVICE_INTERFACE            "org.bluez.audio.Device"
-#endif
-
-#define INVALID_INTERFACE                 NULL
-
-#define BTEV_GET_BT_CONN_LINK_TYPE(p)   ((p)[9])
-#define BTEV_GET_TRANS_INTERVAL(p)      ((p)[10])
-#define BTEV_GET_RETRANS_INTERVAL(p)    ((p)[11])
-#define BTEV_GET_RX_PKT_LEN(p)          ((A_UINT16)((p)[12]) | (((A_UINT16)((p)[13])) << 8))
-#define BTEV_GET_TX_PKT_LEN(p)          ((A_UINT16)((p)[14]) | (((A_UINT16)((p)[15])) << 8))
-#define BTEV_CMD_COMPLETE_GET_OPCODE(p) ((A_UINT16)((p)[1]) | (((A_UINT16)((p)[2])) << 8))          
-#define BTEV_CMD_COMPLETE_GET_STATUS(p) ((p)[3])
-
-#define DBUS_METHOD_CALL_TIMEOUT   (-1)   /* no timeout */
-#define DBUS_MESSAGE_RECV_TIMEOUT  (-1)   /* no timeout */
-
-#define USE_DBUS_FOR_HEADSET_PROFILE(pInfo) (!((pInfo)->Flags & ABF_USE_HCI_FILTER_FOR_HEADSET_PROFILE))
-#define MAKE_BTSTATE_MASK(state) (1 << (state))
-
-typedef enum {
-    ARG_INVALID = 0,
-    ARG_NONE,
-    ARG_STRING,
-} BT_CB_TYPE;
-
-typedef struct _BT_NOTIFICATION_CONFIG_PARAMS {
-    const char        *signal_name;
-    const char        *interface;
-    BT_CB_TYPE         arg;
-} BT_NOTIFICATION_CONFIG_PARAMS;
-
-
-ABF_BT_INFO    * g_pAbfBtInfo = NULL;
-
-static BT_NOTIFICATION_CONFIG_PARAMS g_NotificationConfig[BT_EVENTS_NUM_MAX] =
-{
-    /* BT_ADAPTER_ADDED */
-    {"AdapterAdded", MANAGER_INTERFACE, ARG_STRING},
-    /* BT_ADAPTER_REMOVED */
-    {"AdapterRemoved", MANAGER_INTERFACE, ARG_STRING},
-    /* DEVICE_DISCOVERY_STARTED */
-    {"DiscoveryStarted", ADAPTER_INTERFACE, ARG_NONE},
-    /* DEVICE_DISCOVERY_FINISHED */
-    {"DiscoveryCompleted", ADAPTER_INTERFACE, ARG_NONE},
-    /* REMOTE_DEVICE_CONNECTED */
-    {"RemoteDeviceConnected", ADAPTER_INTERFACE, ARG_STRING},
-    /* REMOTE_DEVICE_DISCONNECTED */
-    {"RemoteDeviceDisconnected", ADAPTER_INTERFACE, ARG_STRING},
-    /* AUDIO_DEVICE_ADDED */
-    {"DeviceCreated", AUDIO_MANAGER_INTERFACE, ARG_STRING},
-    /* AUDIO_DEVICE_REMOVED */
-    {"DeviceRemoved", AUDIO_MANAGER_INTERFACE, ARG_STRING},
-    /* AUDIO_HEADSET_CONNECTED */
-    {"Connected", AUDIO_HEADSET_INTERFACE, ARG_NONE},
-    /* AUDIO_HEADSET_DISCONNECTED */
-    {"Disconnected", AUDIO_HEADSET_INTERFACE, ARG_NONE},
-    /* AUDIO_HEADSET_STREAM_STARTED */
-    {"Playing", AUDIO_HEADSET_INTERFACE, ARG_NONE},
-    /* AUDIO_HEADSET_STREAM_STOPPED */
-    {"Stopped", AUDIO_HEADSET_INTERFACE, ARG_NONE},
-    /* AUDIO_GATEWAY_CONNECTED */
-    {NULL, INVALID_INTERFACE, ARG_INVALID},
-    /* AUDIO_GATEWAY_DISCONNECTED */
-    {NULL, INVALID_INTERFACE, ARG_INVALID},
-    /* AUDIO_SINK_CONNECTED */
-    {"Connected", AUDIO_SINK_INTERFACE, ARG_NONE},
-    /* AUDIO_SINK_DISCONNECTED */
-    {"Disconnected", AUDIO_SINK_INTERFACE, ARG_NONE},
-    /* AUDIO_SINK_STREAM_STARTED */
-    {"Playing", AUDIO_SINK_INTERFACE, ARG_NONE},
-    /* AUDIO_SINK_STREAM_STOPPED */
-    {"Stopped", AUDIO_SINK_INTERFACE, ARG_NONE},
-    /* AUDIO_SOURCE_CONNECTED */
-    {NULL, INVALID_INTERFACE, ARG_INVALID},
-    /* AUDIO_SOURCE_DISCONNECTED */
-    {NULL, INVALID_INTERFACE, ARG_INVALID},
-};
-
-typedef struct {
-        char *str;
-        unsigned int val;
-} hci_map;
-
-static const hci_map ver_map[] = {
-        { "1.0b",       0x00 },
-        { "1.1",        0x01 },
-        { "1.2",        0x02 },
-        { "2.0",        0x03 },
-        { "2.1",        0x04 },
-        { NULL }
-};
-
-/* Function Prototypes */
-static void BtAdapterAdded(const char *string,
-                           void * user_data);
-static void BtAdapterRemoved(const char *string,
-                             void * user_data);
-static A_STATUS AcquireBtAdapter(ABF_BT_INFO *pAbfBtInfo);
-static void ReleaseBTAdapter(ABF_BT_INFO *pAbfBtInfo);
-static void *BtEventThread(void *arg);
-static void RegisterBtStackEventCb(ABF_BT_INFO *pAbfBtInfo,
-                                   BT_STACK_EVENT event, BT_EVENT_HANDLER handler);
-static void DeRegisterBtStackEventCb(ABF_BT_INFO *pAbfBtInfo, BT_STACK_EVENT event);
-static A_STATUS GetAdapterInfo(ABF_BT_INFO *pAbfBtInfo);
-static void RemoteDeviceDisconnected(const char *string,
-                                     void * user_data);
-static void RemoteDeviceConnected(const char *string,
-                                  void * user_data);
-static void AudioDeviceAdded(const char *string,
-                             void * user_data);
-static void AudioDeviceRemoved(const char *string,
-                               void * user_data);
-static void DeviceDiscoveryStarted(void *arg, void * user_data);
-static void DeviceDiscoveryFinished(void *arg, void * user_data);
-static void AudioHeadsetConnected(void *arg, void * user_data);
-static void AudioHeadsetDisconnected(void *arg, void * user_data);
-static void AudioHeadsetStreamStarted(void *arg, void * user_data);
-static void AudioHeadsetStreamStopped(void *arg, void * user_data);
-static void AudioGatewayConnected(void *arg, void * user_data);
-static void AudioGatewayDisconnected(void *arg, void * user_data);
-static void AudioSinkConnected(void *arg, void * user_data);
-static void AudioSinkDisconnected(void *arg, void * user_data);
-static void AudioSinkStreamStarted(void *arg, void * user_data);
-static void AudioSinkStreamStopped(void *arg, void * user_data);
-static void AudioSourceConnected(void *arg, void * user_data);
-static void AudioSourceDisconnected(void *arg, void * user_data);
-static A_STATUS CheckAndAcquireDefaultAdapter(ABF_BT_INFO *pAbfBtInfo);
-static void ReleaseDefaultAdapter(ABF_BT_INFO *pAbfBtInfo);
-static void AcquireDefaultAudioDevice(ABF_BT_INFO *pAbfBtInfo);
-static void ReleaseDefaultAudioDevice(ABF_BT_INFO *pAbfBtInfo);
-static void GetBtAudioConnectionProperties(ABF_BT_INFO              *pAbfBtInfo,
-                                           ATHBT_STATE_INDICATION   Indication);
-static void GetBtAudioDeviceProperties(ABF_BT_INFO  *pAbfBtInfo);
-
-static A_STATUS SetupHciEventFilter(ABF_BT_INFO *pAbfBtInfo);
-static void CleanupHciEventFilter(ABF_BT_INFO *pAbfBtInfo);
-static void CheckHciEventFilter(ABF_BT_INFO   *pAbfBtInfo);
-
-static A_STATUS IssueHCICommand(ABF_BT_INFO *pAbfBtInfo,
-                                A_UINT16    OpCode, 
-                                A_UCHAR     *pCmdData, 
-                                int         CmdLength,
-                                int         EventRecvTimeoutMS,
-                                A_UCHAR     *pEventBuffer,
-                                int         MaxLength,
-                                A_UCHAR     **ppEventPtr,
-                                int         *pEventLength);
-     
-     /* method call that involves only 1 input string (can be NULL) and/or 1 output string */                           
-static A_STATUS DoMethodCall(DBusConnection *Bus,
-                             char           *BusName,
-                             char           *Path,
-                             char           *Interface,
-                             char           *Method,
-                             void           *InputArg,
-                             int             InputType,
-                             int             MaxInLength,
-                             void           *OutputArg,
-                             int             OutputType,
-                             int             MaxOutLength);
-
-static A_STATUS ProcessDBusMessage(ABF_BT_INFO *pAbfBtInfo, DBusMessage *Msg);
-static A_STATUS CheckRemoteDeviceEDRCapable(ABF_BT_INFO *pAbfBtInfo, A_BOOL *pEDRCapable);
-
-/* New function to check Remote LMP version */
-static A_STATUS GetRemoteDeviceLMPVersion(ABF_BT_INFO *pAbfBtInfo);
-
-static void *HCIFilterThread(void *arg);
-
-A_BOOL g_AppShutdown = FALSE;
-
-
-#define ForgetRemoteAudioDevice(pA)     \
-{                                       \
-    A_MEMZERO((pA)->DefaultRemoteAudioDeviceAddress,sizeof((pA)->DefaultRemoteAudioDeviceAddress)); \
-    (pA)->DefaultRemoteAudioDevicePropsValid = FALSE;                                               \
-}
-
-/* APIs exported to other modules */
-A_STATUS
-Abf_BtStackNotificationInit(ATH_BT_FILTER_INSTANCE *pInstance, A_UINT32 Flags)
-{
-    A_STATUS status = A_ERROR;
-    ATHBT_FILTER_INFO *pInfo;
-    ABF_BT_INFO *pAbfBtInfo;
-    DBusError       error;
-
-    pInfo = (ATHBT_FILTER_INFO *)pInstance->pContext;
-    if (pInfo->pBtInfo) {
-        return A_OK;
-    }
-
-    if (g_AppShutdown) {
-        A_ERR (" App was already shutdown cannot call Abf_BtStackNotificationInit again!!!");
-        return A_ERROR;
-    }
-
-    pAbfBtInfo = (ABF_BT_INFO *)A_MALLOC(sizeof(ABF_BT_INFO));
-    A_MEMZERO(pAbfBtInfo,sizeof(ABF_BT_INFO));
-
-    A_MUTEX_INIT(&pAbfBtInfo->hWaitEventLock);
-    A_MEMZERO(pAbfBtInfo, sizeof(ABF_BT_INFO));
-
-    pInfo->Flags = Flags;
-
-    if (pInfo->Flags & ABF_ENABLE_AFH_CHANNEL_CLASSIFICATION) {
-        A_INFO("AFH Classification Command will be issued on WLAN connect/disconnect \n");
-    }
-
-    if (pInfo->Flags & ABF_USE_HCI_FILTER_FOR_HEADSET_PROFILE) {
-        A_INFO("Headset Profile notifications will use HCI filter instead of DBUS \n");
-
-#ifdef BLUEZ4_3
-            /* We don't want to ignore INQUIRY message to implement "DiscoveryStarted" (deprecated in BlueZ 4.x) */
-        pInfo->FilterCore.StateFilterIgnore = MAKE_BTSTATE_MASK(ATH_BT_A2DP); //| MAKE_BTSTATE_MASK(ATH_BT_CONNECT);
-#else
-            /* ignore certain state detections that we can handle through dbus */
-        pInfo->FilterCore.StateFilterIgnore = MAKE_BTSTATE_MASK(ATH_BT_CONNECT) |
-                                              MAKE_BTSTATE_MASK(ATH_BT_INQUIRY) |
-                                              MAKE_BTSTATE_MASK(ATH_BT_A2DP);
-#endif
-
-    }
-
-    pAbfBtInfo->AdapterAvailable = FALSE;
-    pAbfBtInfo->pInfo = pInfo;
-    pAbfBtInfo->HCIEventListenerSocket = -1;
-    pInfo->pBtInfo = pAbfBtInfo;
-
-    dbus_error_init(&error);
-
-    do {
-
-        pAbfBtInfo->Bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
-        if (NULL == pAbfBtInfo->Bus ) {
-            A_ERR("[%s] Couldn't connect to system bus: %s\n",
-                  __FUNCTION__, error.message);
-            break;
-        }
-
-            /* check for default adapter at startup */
-        CheckAndAcquireDefaultAdapter(pAbfBtInfo);
-        RegisterBtStackEventCb(pAbfBtInfo, BT_ADAPTER_ADDED, (BT_EVENT_HANDLER)BtAdapterAdded);
-        RegisterBtStackEventCb(pAbfBtInfo, BT_ADAPTER_REMOVED, (BT_EVENT_HANDLER)BtAdapterRemoved);
-
-        if(pInfo->Flags & ABF_USE_ONLY_DBUS_FILTERING) {
-           Abf_RegisterToHciLib(pAbfBtInfo);
-        }
-
-        /* Spawn a thread which will be used to process events from dbus */
-        status = A_TASK_CREATE(&pInfo->hBtThread, BtEventThread, pAbfBtInfo);
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to spawn a BT thread\n", __FUNCTION__);
-            break;
-        }
-
-        pAbfBtInfo->ThreadCreated = TRUE;
-        status = A_OK;
-
-    } while (FALSE);
-
-    dbus_error_free(&error);
-
-    if (A_FAILED(status)) {
-        Abf_BtStackNotificationDeInit(pInstance);
-    }
-    A_INFO("BT Stack Notification init complete\n");
-
-    return status;
-}
-
-void
-Abf_BtStackNotificationDeInit(ATH_BT_FILTER_INSTANCE *pInstance)
-{
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pInstance->pContext;
-    ABF_BT_INFO *pAbfBtInfo = pInfo->pBtInfo;
-
-    g_AppShutdown = TRUE;
-
-    if (!pAbfBtInfo) return;
-
-        /* acquire lock to sync with thread */
-    A_MUTEX_LOCK(&pAbfBtInfo->hWaitEventLock);
-
-    if (pAbfBtInfo->Bus != NULL) {
-        A_INFO("Cleaning up dbus connection ... \n");
-
-        /* NOTE: there is really no need to de-register callbacks and cleanup state since we
-         * are exiting the application and cleaning up the bus connection.  When the dbus conneciont
-         * is cleaned up, all signal registrations are cleanedup by the dbus library anyways.
-         *
-        DeRegisterBtStackEventCb(pAbfBtInfo, BT_ADAPTER_ADDED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, BT_ADAPTER_REMOVED);
-        ReleaseDefaultAdapter(pAbfBtInfo);
-        */
-
-        /* Release the system bus */
-        dbus_connection_unref(pAbfBtInfo->Bus);
-        pAbfBtInfo->Bus = NULL;
-    }
-
-    Abf_UnRegisterToHciLib(pAbfBtInfo);
-
-    /* Flush all the BT actions from the filter core TODO */
-
-    /* Free the remaining resources */
-    pAbfBtInfo->AdapterAvailable = FALSE;
-    pInfo->pBtInfo = NULL;
-    A_MUTEX_DEINIT(&pAbfBtInfo->hWaitEventLock);
-    A_MEMZERO(pAbfBtInfo, sizeof(ABF_BT_INFO));
-    A_FREE(pAbfBtInfo);
-
-    A_INFO("BT Stack Notification de-init complete\n");
-}
-
-static void *
-BtEventThread(void *arg)
-{
-    ABF_BT_INFO     *pAbfBtInfo = (ABF_BT_INFO *)arg;
-    DBusMessage     *msg = NULL;
-    A_BOOL          error = FALSE;
-
-    g_pAbfBtInfo = (ABF_BT_INFO *) arg;
-    A_INFO("Starting the BT Event Handler task\n");
-
-    A_INFO("Entering DBus Message loop \n");
-
-    Abf_WlanGetSleepState(pAbfBtInfo->pInfo);
-
-    while (!g_AppShutdown && !error) {
-
-        dbus_connection_read_write(pAbfBtInfo->Bus, DBUS_MESSAGE_RECV_TIMEOUT);
-
-        if (g_AppShutdown) {
-            break;
-        }
-            /* while we retrieve and process messages we don't want this thread killed */
-        A_MUTEX_LOCK(&pAbfBtInfo->hWaitEventLock);
-
-        while (!error) {
-            msg = dbus_connection_pop_message(pAbfBtInfo->Bus);
-            if (NULL == msg) {
-                break;
-            }
-            A_DEBUG(" Got DBus Message ... \n");
-            if (A_FAILED(ProcessDBusMessage(pAbfBtInfo, msg))) {
-                error = TRUE;
-            }
-            dbus_message_unref(msg);
-            msg = NULL;
-        }
-
-        A_MUTEX_UNLOCK(&pAbfBtInfo->hWaitEventLock);
-
-    }
-
-    A_INFO("Leaving DBus Message loop \n");
-    A_INFO("Leaving the BT Event Handler task\n");
-
-    return NULL;
-}
-
-static A_STATUS
-CheckAndAcquireDefaultAdapter(ABF_BT_INFO *pAbfBtInfo)
-{
-    A_STATUS status = A_OK;
-
-    do {
-
-        if (pAbfBtInfo->AdapterAvailable) {
-                /* already available */
-            break;
-        }
-
-            /* acquire the adapter */
-        status = AcquireBtAdapter(pAbfBtInfo);
-
-    } while (FALSE);
-
-    return status;
-}
-
-static void ReleaseDefaultAdapter(ABF_BT_INFO *pAbfBtInfo)
-{
-
-    if (pAbfBtInfo->AdapterAvailable) {
-            /* Release the BT adapter */
-        ReleaseBTAdapter(pAbfBtInfo);
-        A_INFO("[%s] BT Adapter Removed\n",pAbfBtInfo->HCI_AdapterName);
-    }
-
-    A_MEMZERO(pAbfBtInfo->HCI_AdapterName, sizeof(pAbfBtInfo->HCI_AdapterName));
-
-}
-/* Event Notifications */
-static void
-BtAdapterAdded(const char *string, void * user_data)
-{
-    A_DEBUG("BtAdapterAdded (%s) Callback ... \n", (string != NULL) ? string : "UNKNOWN");
-
-    /* BUG!!!, the BtAdapterAdded callback is indicated too early by the BT service, on some systems
-     * the method call to "DefaultAdapter" through the Manager interface will fail because no
-     * default adapter exist yet even though this callback was indicated (there should be a default)
-     *
-     * Workaround is to delay before acquiring the default adapter.
-     * Acquiring the BT adapter should not be very infrequent though.
-     *
-     * */
-    sleep(5);
-    CheckAndAcquireDefaultAdapter((ABF_BT_INFO *)user_data);
-}
-
-
-static void
-BtAdapterRemoved(const char *string, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-
-    A_DEBUG("BtAdapterRemoved (%s) Callback ... \n", (string != NULL) ? string : "UNKNOWN");
-    
-    if (!pAbfBtInfo->AdapterAvailable) return;
-
-    if ((string != NULL) && strcmp(string,pAbfBtInfo->HCI_AdapterName) == 0) {
-            /* the adapter we are watching has been removed */
-        ReleaseDefaultAdapter(pAbfBtInfo);
-    }
-
-}
-
-static void
-DeviceDiscoveryStarted(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Device Inquiry Started\n");
-    AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_ON);
-}
-
-static void
-DeviceDiscoveryFinished(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Device Inquiry Completed\n");
-    AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_OFF);
-}
-
-static void
-RemoteDeviceConnected(const char *string, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Device Connected: %s\n", string);
-    A_STR2ADDR(string, pAbfBtInfo->RemoteDevice);
-    AthBtIndicateState(pInstance, ATH_BT_CONNECT, STATE_ON);
-}
-
-static void
-RemoteDeviceDisconnected(const char *string, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Device Disconnected: %s\n", string);
-    A_MEMZERO(pAbfBtInfo->RemoteDevice, sizeof(pAbfBtInfo->RemoteDevice));
-    AthBtIndicateState(pInstance, ATH_BT_CONNECT, STATE_OFF);
-}
-
-static void ReleaseDefaultAudioDevice(ABF_BT_INFO *pAbfBtInfo)
-{
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-
-    if (pAbfBtInfo->AudioCbRegistered) {
-        if (USE_DBUS_FOR_HEADSET_PROFILE(pInfo)) {
-            DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_CONNECTED);
-            DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_DISCONNECTED);
-            DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_STREAM_STARTED);
-            DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_STREAM_STOPPED);
-        }
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_GATEWAY_CONNECTED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_GATEWAY_DISCONNECTED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_CONNECTED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_DISCONNECTED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_STREAM_STARTED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_STREAM_STOPPED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SOURCE_CONNECTED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SOURCE_DISCONNECTED);
-        pAbfBtInfo->AudioCbRegistered = FALSE;
-    }
-    
-    if (pAbfBtInfo->DefaultAudioDeviceAvailable) {
-        pAbfBtInfo->DefaultAudioDeviceAvailable = FALSE;
-        A_DEBUG("Default Audio Device Removed: %s\n", pAbfBtInfo->DefaultAudioDeviceName);
-        A_MEMZERO(pAbfBtInfo->DefaultAudioDeviceName,sizeof(pAbfBtInfo->DefaultAudioDeviceName));
-    }
-    
-}
-
-static A_STATUS DoMethodCall(DBusConnection *Bus,
-                             char           *BusName,
-                             char           *Path,
-                             char           *Interface,
-                             char           *Method,                                  
-                             void           *InputArg,
-                             int             InputType,
-                             int             InputLength,
-                             void           *OutputArg,
-                             int             OutputType,
-                             int             MaxOutLength)
-{
-    A_STATUS    status = A_ERROR;
-    DBusError   error;
-    DBusMessage *msg = NULL;
-    DBusMessage *reply = NULL;
-    void        *replyData;
-    DBusMessageIter args;
-    
-    dbus_error_init(&error);
-
-    do { 
-        msg = dbus_message_new_method_call(BusName, Path, Interface, Method);
-                                           
-        if (NULL == msg) {
-            A_ERR("[%s] failed new method call line \n", __FUNCTION__);
-            break;    
-        }
-        
-            /* see if caller is providing an argument */
-        if (InputArg != NULL) {           
-            dbus_message_iter_init_append(msg, &args);
-            if (InputType == DBUS_TYPE_STRING) { 
-                if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, (char **)&InputArg)) { 
-                    A_ERR("[%s] Failed to add string input argument \n", __FUNCTION__);
-                    break;  
-                }
-            } else {
-                A_ERR("[%s] unsupported input arg type: %c \n", __FUNCTION__, (char)InputType);
-                break;      
-            }
-        }
-              
-        reply = dbus_connection_send_with_reply_and_block(Bus, msg, DBUS_METHOD_CALL_TIMEOUT, &error);
-
-       
-        if (dbus_error_is_set(&error)) {
-            A_ERR("[%s] Failed to invoke method call (%s : method : %s) %s \n",
-                     __FUNCTION__, Interface, Method, error.message);
-            break;    
-        }
-
-            /* check if caller expects a return string */
-        if (OutputArg != NULL) {
-
-            replyData = NULL;
-
-
-            if (OutputType == DBUS_TYPE_ARRAY) {
-
-                DBusMessageIter iter,subIter;
-                dbus_message_iter_init (reply, &iter);
-                if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
-
-                        /* recurse into the array */
-                    dbus_message_iter_recurse(&iter, &subIter);
-                        /* get a pointer to the start of the array */
-
-                    dbus_message_iter_get_fixed_array(&subIter, &replyData, &MaxOutLength);
-                } else {
-                    A_ERR("[%s] ARG Type (%s) is not an array! \n", __FUNCTION__,
-                                                (char)dbus_message_iter_get_arg_type(&iter));
-                    break;
-                }
-
-            } else if (OutputType == DBUS_TYPE_STRING) {
-
-                dbus_message_get_args(reply, &error, OutputType, &replyData, DBUS_TYPE_INVALID);
-
-                if (dbus_error_is_set(&error)) {
-                    A_ERR("[%s] dbus_message_get_args failed (%s : method : %s) %s \n",
-                         __FUNCTION__, Interface, Method, error.message);
-                    break;
-                }
-
-            } else if (OutputType == DBUS_TYPE_OBJECT_PATH) {
-
-                dbus_message_get_args(reply, &error, OutputType, &replyData, DBUS_TYPE_INVALID);
-
-                if (dbus_error_is_set(&error)) {
-                    A_ERR("[%s] dbus_message_get_args failed (%s : method : %s) %s \n", 
-                         __FUNCTION__, Interface, Method, error.message);
-                    break;
-                }
-
-            } else {
-                A_ERR("[%s] unsupported output arg type: %c \n", __FUNCTION__,(char)OutputType);
-                break;
-            }
-
-            if (NULL == replyData) {
-                A_ERR("[%s] type %c data pointer was not returned from method call \n", 
-                    __FUNCTION__, (char)OutputType);
-                break;
-            }
-
-            if (OutputType == DBUS_TYPE_STRING) {
-                strncpy(OutputArg, (char *)replyData, MaxOutLength);
-            } else if (OutputType == DBUS_TYPE_ARRAY) {
-                A_ERR("  (p:0x%X) Array has %d elements: \n", replyData, MaxOutLength);
-                    /* just copy what the caller expects for data */
-
-                A_MEMCPY(OutputArg, replyData, MaxOutLength);  
-
-            } else if (OutputType == DBUS_TYPE_OBJECT_PATH) { /* Added by YG, November 19, 2009 */
-                strncpy(OutputArg, (char *)replyData, MaxOutLength);
-            }
-        }
-       
-        status = A_OK;     
-           
-    } while (FALSE);
-     
-    if (msg != NULL) {
-        dbus_message_unref(msg);
-    }
-    
-    if (reply != NULL) {
-        dbus_message_unref(reply);    
-    }
-
-    dbus_error_free(&error);
-   
-    return status;   
-}
-
-static void AcquireDefaultAudioDevice(ABF_BT_INFO *pAbfBtInfo)
-{
-    A_BOOL     success = FALSE;
-#ifndef BLUEZ4_3
-    A_STATUS   status;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-#endif
-
-    A_INFO("[%s]StartRegister\n", __FUNCTION__);
-    do {
-
-        if (pAbfBtInfo->DefaultAudioDeviceAvailable) {
-                /* already acquired */
-            success = TRUE;
-            break;
-        }
-#ifdef BLUEZ4_3
-        pAbfBtInfo->DefaultAudioDeviceAvailable = FALSE;
-#else
-        A_INFO("Checking for a default audio device .. \n");
-
-        status = DoMethodCall(pAbfBtInfo->Bus,
-                            BLUEZ_NAME,
-                            AUDIO_MANAGER_PATH,
-                            AUDIO_MANAGER_INTERFACE,
-                            "DefaultDevice",
-                            NULL,
-                            DBUS_TYPE_INVALID,
-                            0,
-                            pAbfBtInfo->DefaultAudioDeviceName,
-                            DBUS_TYPE_STRING,
-                            sizeof(pAbfBtInfo->DefaultAudioDeviceName));
-
-        if (A_FAILED(status)) {
-            break;
-        }
-
-        A_INFO("Default Audio Device: %s \n", pAbfBtInfo->DefaultAudioDeviceName);
-
-        pAbfBtInfo->DefaultAudioDeviceAvailable = TRUE;
-#endif /* BLUEZ4_3  */
-
-            /* Register for audio specific events */
-#ifdef BLUEZ4_3
-        if (1) {
-#else
-        if (USE_DBUS_FOR_HEADSET_PROFILE(pInfo)) {
-#endif
-            RegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_CONNECTED, AudioHeadsetConnected);
-            RegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_DISCONNECTED, AudioHeadsetDisconnected);
-            RegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_STREAM_STARTED, AudioHeadsetStreamStarted);
-            RegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_STREAM_STOPPED, AudioHeadsetStreamStopped);
-        }
-#ifndef BLUEZ4_3
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_GATEWAY_CONNECTED, AudioGatewayConnected);
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_GATEWAY_DISCONNECTED, AudioGatewayDisconnected);
-#endif /* !BLUEZ4_3 */
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_CONNECTED,AudioSinkConnected);
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_DISCONNECTED, AudioSinkDisconnected);
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_STREAM_STARTED,AudioSinkStreamStarted);
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_STREAM_STOPPED, AudioSinkStreamStopped);
-#ifndef BLUEZ4_3
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SOURCE_CONNECTED, AudioSourceConnected);
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SOURCE_DISCONNECTED, AudioSourceDisconnected);
-#endif /* !BLUEZ4_3 */
-
-        pAbfBtInfo->AudioCbRegistered = TRUE;
-
-        success = TRUE;
-
-        A_INFO("[%s]EndRegister\n", __FUNCTION__);
-    } while (FALSE);
-
-    if (!success) {
-            /* cleanup */
-        ReleaseDefaultAudioDevice(pAbfBtInfo);
-    }
-}
-
-static void
-AudioDeviceAdded(const char *string, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-
-    A_DEBUG("Audio Device Added: %s\n", string);
-        /* release current one if any */
-    ReleaseDefaultAudioDevice(pAbfBtInfo);
-        /* re-acquire the new default, it could be the same one */
-    AcquireDefaultAudioDevice(pAbfBtInfo);
-
-}
-
-static void
-AudioDeviceRemoved(const char *string, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-
-    A_DEBUG("Audio Device Removed: %s\n", string);
-    if (strcmp(string,pAbfBtInfo->DefaultAudioDeviceName) == 0) {
-            /* release current one  */
-        ReleaseDefaultAudioDevice(pAbfBtInfo);
-            /* re-acquire the new default (if any) */
-        AcquireDefaultAudioDevice(pAbfBtInfo);
-    }
-
-}
-
-
-static void
-AudioHeadsetConnected(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-
-    A_DEBUG("Audio Headset Connected \n");
-
-    if(!(pInfo->Flags & ABF_USE_ONLY_DBUS_FILTERING)) {
-        GetBtAudioDeviceProperties(pAbfBtInfo);
-    }
-}
-
-static void
-AudioHeadsetDisconnected(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO  *)user_data;
-    A_DEBUG("Audio Headset (%s) Disconnected\n",pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-    ForgetRemoteAudioDevice(pAbfBtInfo);
-}
-
-static void
-AudioHeadsetStreamStarted(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    if(!(pInfo->Flags & ABF_USE_ONLY_DBUS_FILTERING)) {
-        if (!pAbfBtInfo->DefaultRemoteAudioDevicePropsValid) {
-        GetBtAudioDeviceProperties(pAbfBtInfo);
-        }
-    }
-    A_DEBUG("Audio Headset (%s) Stream Started \n",pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-        /* make the indication */
-        /* get properties of this headset connection */
-    GetBtAudioConnectionProperties(pAbfBtInfo, ATH_BT_SCO);
-
-    AthBtIndicateState(pInstance,
-                       pAbfBtInfo->CurrentSCOLinkType == SCO_LINK ? ATH_BT_SCO : ATH_BT_ESCO,
-                       STATE_ON);
-}
-
-static void
-AudioHeadsetStreamStopped(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-        /* This event can also be used to indicate the SCO state */
-    A_DEBUG("Audio Headset (%s) Stream Stopped \n", pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-    AthBtIndicateState(pInstance,
-                       pAbfBtInfo->CurrentSCOLinkType == SCO_LINK ? ATH_BT_SCO : ATH_BT_ESCO,
-                       STATE_OFF);
-}
-
-static void
-AudioGatewayConnected(void *arg, void * user_data)
-{
-    /* Not yet implemented */
-    A_DEBUG("Audio Gateway Connected\n");
-}
-
-static void
-AudioGatewayDisconnected(void *arg, void * user_data)
-{
-    /* Not yet implemented */
-    A_DEBUG("Audio Gateway disconnected\n");
-}
-
-static void
-AudioSinkConnected(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    A_DEBUG("Audio Sink Connected \n");
-
-    if(!(pInfo->Flags & ABF_USE_ONLY_DBUS_FILTERING)) {
-        GetBtAudioDeviceProperties(pAbfBtInfo);
-    }
-}
-
-static void
-AudioSinkDisconnected(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-    A_DEBUG("Audio Sink (%s) Disconnected \n",pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-    AthBtIndicateState(pInstance, ATH_BT_A2DP, STATE_OFF);
-    ForgetRemoteAudioDevice(pAbfBtInfo);
-}
-
-static void
-AudioSinkStreamStarted(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    if (!pAbfBtInfo->DefaultRemoteAudioDevicePropsValid) {
-        GetBtAudioDeviceProperties(pAbfBtInfo);
-    }
-
-    A_DEBUG("Audio Sink (%s) Stream Started \n",pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-        /* get connection properties */
-    GetBtAudioConnectionProperties(pAbfBtInfo, ATH_BT_A2DP);
-    AthBtIndicateState(pInstance, ATH_BT_A2DP, STATE_ON);
-}
-
-static void
-AudioSinkStreamStopped(void *arg, void * user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Audio Sink (%s) Stream Stopped \n",pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-    AthBtIndicateState(pInstance, ATH_BT_A2DP, STATE_OFF);
-}
-
-static void
-AudioSourceConnected(void *arg, void * user_data)
-{
-    /* Not yet implemented */
-    A_DEBUG("Audio Source Connected \n");
-}
-
-static void
-AudioSourceDisconnected(void *arg, void * user_data)
-{
-    /* Not yet implemented */
-    A_DEBUG("Audio Source Disconnected \n");
-}
-
-
-static A_STATUS ProcessDBusMessage(ABF_BT_INFO *pAbfBtInfo, DBusMessage *Msg)
-{
-    A_STATUS                        status = A_OK;
-    BT_NOTIFICATION_CONFIG_PARAMS   *pNotificationConfig;
-    int                             i, argType;
-    DBusMessageIter                 msgiter;
-    char                            *argString;
-
-    pNotificationConfig = &g_NotificationConfig[0];
-
-    for (i = 0; i < BT_EVENTS_NUM_MAX; i++, pNotificationConfig++) {
-        if ((pNotificationConfig->interface != NULL) &&
-            (pNotificationConfig->signal_name != NULL)) {
-
-            if (dbus_message_is_signal(Msg,
-                                       pNotificationConfig->interface,
-                                       pNotificationConfig->signal_name)) {
-
-                    /* found a match */
-                break;
-            }
-        }
-
-    }
-
-    if (i >= BT_EVENTS_NUM_MAX) {
-        /* not a signal we registered for */
-        return A_OK;
-    }
-
-    do {
-        if (pAbfBtInfo->SignalHandlers[i] == NULL) {
-                /* no registered handler for this signal, just ignore */
-            break;
-        }
-        if (pNotificationConfig->arg == ARG_NONE) {
-                /* call zero-argument handler */
-            pAbfBtInfo->SignalHandlers[i](NULL, pAbfBtInfo);
-        } else if (pNotificationConfig->arg == ARG_STRING) {
-                /* we are expecting a string argument */
-            if (!dbus_message_iter_init(Msg, &msgiter)) {
-                A_ERR("[%s] event: %d (if:%s , sig: %s) expecting a string argument but there are none \n",
-                        __FUNCTION__, i, pNotificationConfig->interface,
-                        pNotificationConfig->signal_name );
-                break;
-            }
-
-            argType = dbus_message_iter_get_arg_type(&msgiter);
-            if(!((argType == DBUS_TYPE_STRING) || argType == DBUS_TYPE_OBJECT_PATH)) {
-                 A_ERR("[%s] event: %d (if:%s , sig: %s) expecting a string /object path argument !\n",
-                        __FUNCTION__, i, pNotificationConfig->interface,
-                        pNotificationConfig->signal_name);
-                break;
-            }
-
-            dbus_message_iter_get_basic(&msgiter, &argString);
-                /* call string arg handler */
-            pAbfBtInfo->SignalHandlers[i](argString, pAbfBtInfo);
-        }
-
-    } while (FALSE);
-
-    return status;
-}
-
-static void
-RegisterBtStackEventCb(ABF_BT_INFO *pAbfBtInfo, BT_STACK_EVENT event,
-                       BT_EVENT_HANDLER handler)
-{
-    BT_NOTIFICATION_CONFIG_PARAMS *pNotificationConfig;
-    DBusError                     error;
-    char                          tempStr[STRING_SIZE_MAX];
-    dbus_error_init(&error);
-
-    do {
-
-        if (event >= BT_EVENTS_NUM_MAX) {
-            A_ERR("[%s] Invalid Event: %d\n", __FUNCTION__, event);
-            break;
-        }
-        pNotificationConfig = &g_NotificationConfig[event];
-
-        if (pAbfBtInfo->SignalHandlers[event] != NULL) {
-            A_ERR("[%s] event: %d already in use \n", __FUNCTION__);
-            break;
-        }
-        if (pNotificationConfig->interface == NULL) {
-                /* no interface, may not be implemented yet */
-            A_ERR("[%s] Event: %d not implemented yet \n", __FUNCTION__, event);
-            break;
-        }
-
-        snprintf(tempStr, sizeof(tempStr), "type='signal',interface='%s'",pNotificationConfig->interface);
-
-        A_DEBUG(" rule to add: %s \n", tempStr);
-
-
-            /* add signal */
-        dbus_bus_add_match(pAbfBtInfo->Bus, tempStr, &error);
-
-        if (dbus_error_is_set(&error)) {
-            A_ERR("[%s] dbus_bus_add_match failed: %s n", __FUNCTION__, error.message);
-            break;
-        }
-        dbus_connection_flush(pAbfBtInfo->Bus);
-
-            /* install handler */
-        pAbfBtInfo->SignalHandlers[event] = handler;
-
-    } while (FALSE);
-
-    dbus_error_free(&error);
-}
-
-
-static void
-DeRegisterBtStackEventCb(ABF_BT_INFO *pAbfBtInfo, BT_STACK_EVENT event)
-{
-    BT_NOTIFICATION_CONFIG_PARAMS *pNotificationConfig;
-    DBusError                     error;
-    char                          tempStr[STRING_SIZE_MAX];
-    
-    dbus_error_init(&error);
-    
-    do {
-        
-        if (event >= BT_EVENTS_NUM_MAX) {
-            A_ERR("[%s] Invalid Event: %d\n", __FUNCTION__, event);
-            break;    
-        }
-       
-        pNotificationConfig = &g_NotificationConfig[event];
-           
-        if (pAbfBtInfo->SignalHandlers[event] == NULL) {
-            A_ERR("[%s] event: %d is not in use! \n", __FUNCTION__, event);
-            break;    
-        }
-        
-        snprintf(tempStr, sizeof(tempStr),"type='signal',interface='%s'",pNotificationConfig->interface);
-        
-        A_DEBUG(" rule to remove : %s \n", tempStr);
-        
-            /* remove rule */
-        dbus_bus_remove_match(pAbfBtInfo->Bus, tempStr, &error);
-        
-        if (dbus_error_is_set(&error)) { 
-            A_ERR("[%s] dbus_bus_remove_match failed: %s n", __FUNCTION__, error.message);
-            break;
-        }
-                    
-        dbus_connection_flush(pAbfBtInfo->Bus);
-
-            /* delete handler */
-        pAbfBtInfo->SignalHandlers[event] = NULL;
-
-    } while (FALSE);
-
-    dbus_error_free(&error);
-
-}
-
-/* Misc */
-static A_STATUS
-AcquireBtAdapter(ABF_BT_INFO *pAbfBtInfo)
-{
-    A_STATUS        status = A_ERROR;
-    char            *hciName;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-
-    do {
-
-        status = DoMethodCall(pAbfBtInfo->Bus,
-                              BLUEZ_NAME,
-                              BLUEZ_PATH,
-                              MANAGER_INTERFACE,
-                              "DefaultAdapter",
-                              NULL,
-                              DBUS_TYPE_INVALID,
-                              0,
-                              pAbfBtInfo->HCI_AdapterName,
-#ifdef BLUEZ4_3
-                              DBUS_TYPE_OBJECT_PATH,
-#else
-                              DBUS_TYPE_STRING,
-#endif
-                              sizeof(pAbfBtInfo->HCI_AdapterName));
-
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Get Default Adapter failed \n", __FUNCTION__);
-            break;
-        }
-
-            /* assume ID 0 */
-        pAbfBtInfo->AdapterId = 0;
-
-        if ((hciName = strstr(pAbfBtInfo->HCI_AdapterName, "hci")) != NULL) {
-                /* get the number following the hci name, this is the ID used for
-                 * socket calls to the HCI layer */
-            pAbfBtInfo->AdapterId = (int)hciName[3] - (int)'0';
-            if (pAbfBtInfo->AdapterId < 0) {
-                pAbfBtInfo->AdapterId = 0;
-            }
-        }
-
-        if(!(pInfo->Flags & ABF_USE_ONLY_DBUS_FILTERING)) {
-            if (!A_SUCCESS(SetupHciEventFilter(pAbfBtInfo))) {
-                break;
-            }
-            GetAdapterInfo(pAbfBtInfo);
-        }
-
-
-        pAbfBtInfo->pInfo->LMPVersion = pAbfBtInfo->HCI_LMPVersion;
-
-        pAbfBtInfo->AdapterAvailable = TRUE;
-        /* Register to get notified of different stack events */
-        RegisterBtStackEventCb(pAbfBtInfo, DEVICE_DISCOVERY_STARTED, DeviceDiscoveryStarted);
-        RegisterBtStackEventCb(pAbfBtInfo, DEVICE_DISCOVERY_FINISHED, DeviceDiscoveryFinished);
-        RegisterBtStackEventCb(pAbfBtInfo, REMOTE_DEVICE_CONNECTED, (BT_EVENT_HANDLER)RemoteDeviceConnected);
-        RegisterBtStackEventCb(pAbfBtInfo, REMOTE_DEVICE_DISCONNECTED, (BT_EVENT_HANDLER)RemoteDeviceDisconnected);
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_DEVICE_ADDED, (BT_EVENT_HANDLER)AudioDeviceAdded);
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_DEVICE_REMOVED, (BT_EVENT_HANDLER)AudioDeviceRemoved);
-
-        pAbfBtInfo->AdapterCbRegistered = TRUE;
-
-        A_INFO("[%s] BT Adapter Added\n",pAbfBtInfo->HCI_AdapterName);
-
-            /* acquire default audio device */
-        AcquireDefaultAudioDevice(pAbfBtInfo);
-
-        status = A_OK;
-
-    } while (FALSE);
-
-
-    return status;
-}
-
-static void
-ReleaseBTAdapter(ABF_BT_INFO *pAbfBtInfo)
-{
-
-    if (pAbfBtInfo->AdapterCbRegistered) {
-        pAbfBtInfo->AdapterCbRegistered = FALSE;
-            /* Free the resources held for the event handlers */
-        DeRegisterBtStackEventCb(pAbfBtInfo, DEVICE_DISCOVERY_STARTED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, DEVICE_DISCOVERY_FINISHED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, REMOTE_DEVICE_CONNECTED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, REMOTE_DEVICE_DISCONNECTED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_DEVICE_ADDED);
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_DEVICE_REMOVED);    
-    }
-   
-    ReleaseDefaultAudioDevice(pAbfBtInfo);  
-     
-    CleanupHciEventFilter(pAbfBtInfo);
-    
-    A_MEMZERO(pAbfBtInfo->HCI_DeviceAddress, 
-              sizeof(pAbfBtInfo->HCI_DeviceAddress));
-    A_MEMZERO(pAbfBtInfo->HCI_DeviceName, 
-              sizeof(pAbfBtInfo->HCI_DeviceName));
-    A_MEMZERO(pAbfBtInfo->HCI_ManufacturerName, 
-              sizeof(pAbfBtInfo->HCI_ManufacturerName));
-    A_MEMZERO(pAbfBtInfo->HCI_ProtocolVersion, 
-              sizeof(pAbfBtInfo->HCI_ProtocolVersion));
-    pAbfBtInfo->HCI_LMPVersion = 0;
-
-    pAbfBtInfo->AdapterAvailable = FALSE;
-}
-
-#ifdef BLUEZ4_3
-
-static A_STATUS
-GetAdapterInfo(ABF_BT_INFO *pAbfBtInfo)
-{
-
-    A_STATUS status;
-
-    int i;
-    A_UCHAR eventBuffer[HCI_MAX_EVENT_SIZE];
-    A_UCHAR *eventPtr;
-    int eventLen; 
-        
-        /* Get adapter/device address by issuing HCI command, Read_BD_ADDR */
-    status = IssueHCICommand(pAbfBtInfo,
-                cmd_opcode_pack(OGF_INFO_PARAM, OCF_READ_BD_ADDR), 
-                0,
-                0,
-                2000,
-                eventBuffer,
-                sizeof(eventBuffer),
-                &eventPtr,
-                &eventLen);          
-
-    if (A_FAILED(status)) {
-        A_ERR("[%s] Failed to get BD_ADDR \n", __FUNCTION__);
-        return status;
-    }
-
-    if (eventBuffer[6] == 0) { /* READ_BD_ADDR was a success */
-        for (i = 0; i < BD_ADDR_SIZE; i++) { 
-            pAbfBtInfo->HCI_DeviceAddress[i] = eventBuffer[i+7];
-        }
-        A_DEBUG("BT-HCI Device Address: (%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X)\n", 
-               pAbfBtInfo->HCI_DeviceAddress[0], pAbfBtInfo->HCI_DeviceAddress[1], 
-               pAbfBtInfo->HCI_DeviceAddress[2], pAbfBtInfo->HCI_DeviceAddress[3], 
-               pAbfBtInfo->HCI_DeviceAddress[4], pAbfBtInfo->HCI_DeviceAddress[5]);
-    }
-
-    status = A_OK; 
-
-    return status;
-}
-
-#else
-
-static A_STATUS
-GetAdapterInfo(ABF_BT_INFO *pAbfBtInfo)
-{
-    int         count;
-    A_STATUS    status = A_OK;
-    char        tempStr[STRING_SIZE_MAX];
-
-    do {
-            /* device name */       
-        status = DoMethodCall(pAbfBtInfo->Bus,
-                              BLUEZ_NAME,
-                              pAbfBtInfo->HCI_AdapterName,
-                              ADAPTER_INTERFACE,
-                              "GetName",
-                              NULL,
-                              DBUS_TYPE_INVALID,
-                              0,
-                              pAbfBtInfo->HCI_DeviceName,
-                              DBUS_TYPE_STRING,
-                              sizeof(pAbfBtInfo->HCI_DeviceName));
-        
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to complete GetName \n", __FUNCTION__);
-            break;    
-        }
-
-            /* Manufacturer name */
-        status = DoMethodCall(pAbfBtInfo->Bus,
-                              BLUEZ_NAME,
-                              pAbfBtInfo->HCI_AdapterName,
-                              ADAPTER_INTERFACE,
-                              "GetManufacturer",
-                              NULL,
-                              DBUS_TYPE_INVALID,
-                              0,
-                              pAbfBtInfo->HCI_ManufacturerName,
-                              DBUS_TYPE_STRING,
-                              sizeof(pAbfBtInfo->HCI_ManufacturerName));
-        
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to complete GetManufacturer \n", __FUNCTION__);
-            break;    
-        }
-            /* get LMP version */ 
-        status = DoMethodCall(pAbfBtInfo->Bus,
-                              BLUEZ_NAME,
-                              pAbfBtInfo->HCI_AdapterName,
-                              ADAPTER_INTERFACE,
-                              "GetVersion",
-                              NULL,
-                              DBUS_TYPE_INVALID,
-                              0,
-                              pAbfBtInfo->HCI_ProtocolVersion,
-                              DBUS_TYPE_STRING,
-                              sizeof(pAbfBtInfo->HCI_ProtocolVersion));
-        
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to complete GetVersion \n", __FUNCTION__);
-            break;    
-        }
-
-
-        for (count = 0; 
-             ((count < sizeof(ver_map)/sizeof(hci_map)) && (ver_map[count].str)); 
-             count++)
-        {
-            if (strstr(pAbfBtInfo->HCI_ProtocolVersion, ver_map[count].str)) {
-                pAbfBtInfo->HCI_LMPVersion = ver_map[count].val;
-                break;
-            }
-        }
-
-            /* Device address */        
-        status = DoMethodCall(pAbfBtInfo->Bus,
-                              BLUEZ_NAME,
-                              pAbfBtInfo->HCI_AdapterName,
-                              ADAPTER_INTERFACE,
-                              "GetAddress",
-                              NULL,
-                              DBUS_TYPE_INVALID,
-                              0,
-                              tempStr,
-                              DBUS_TYPE_STRING,
-                              sizeof(tempStr));
-        
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to get Address \n", __FUNCTION__);
-            break;    
-        }
-        
-        A_STR2ADDR(tempStr, pAbfBtInfo->HCI_DeviceAddress);
-   
-    } while (FALSE);
-
-    
-    if (A_SUCCESS(status)) {
-        A_INFO("BT-HCI Device Address: (%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X)\n", 
-               pAbfBtInfo->HCI_DeviceAddress[0], pAbfBtInfo->HCI_DeviceAddress[1], 
-               pAbfBtInfo->HCI_DeviceAddress[2], pAbfBtInfo->HCI_DeviceAddress[3], 
-               pAbfBtInfo->HCI_DeviceAddress[4], pAbfBtInfo->HCI_DeviceAddress[5]);
-        A_INFO("BT-HCI Device Name: %s\n", pAbfBtInfo->HCI_DeviceName);
-        A_INFO("BT-HCI Manufacturer Name: %s\n", pAbfBtInfo->HCI_ManufacturerName);
-        A_INFO("BT-HCI Protocol Version: %s\n", pAbfBtInfo->HCI_ProtocolVersion);
-        A_INFO("BT-HCI LMP Version: %d\n", pAbfBtInfo->HCI_LMPVersion);
-
-    }
-
-    return status;
-}
-#endif
-
-
-static A_STATUS GetConnectedDeviceRole(ABF_BT_INFO   *pAbfBtInfo,
-                                       A_CHAR        *Address,
-                                       A_BOOL        IsSCO,
-                                       A_UCHAR       *pRole)
-{
-    A_STATUS                    status = A_ERROR;
-    struct hci_conn_list_req    *connList = NULL;
-    struct hci_conn_info        *connInfo = NULL;
-    int                         i, sk = -1;
-    int                         len;
-
-    do {
-
-        sk = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-
-        if (sk < 0) {
-            A_ERR("[%s] Failed to get raw BT socket: %d \n", __FUNCTION__, errno);
-            break;
-        }
-
-        len = (sizeof(*connInfo)) * ABTH_MAX_CONNECTIONS + sizeof(*connList);
-
-        connList = (struct hci_conn_list_req *)A_MALLOC(len);
-        if (connList == NULL) {
-            break;
-        }
-
-        A_MEMZERO(connList,len);
-
-        connList->dev_id = pAbfBtInfo->AdapterId;
-        connList->conn_num = ABTH_MAX_CONNECTIONS;
-        connInfo = connList->conn_info;
-
-        if (ioctl(sk, HCIGETCONNLIST, (void *)connList)) {
-            A_ERR("[%s] Failed to get connection list %d \n", __FUNCTION__, errno);
-            break;
-        }
-           /* walk through connection list */
-        for (i = 0; i < connList->conn_num; i++, connInfo++) {
-            char addr[32];
-
-                /* convert to a string to compare */
-            ba2str(&connInfo->bdaddr, addr);
-
-            if (strcmp(addr,Address) != 0) {
-                continue;
-            }
-
-            if (IsSCO) {
-                    /* look for first non-ACL connection */
-                if (connInfo->type == ACL_LINK) {
-                    continue;
-                }
-                pAbfBtInfo->CurrentSCOLinkType = connInfo->type;
-            } else {
-                    /* look for first ACL connection */
-                if (connInfo->type != ACL_LINK) {
-                    continue;
-                }
-            }
-            /* if we get here we have a connection we are interested in */
-            if (connInfo->link_mode & HCI_LM_MASTER) {
-                    /* master */
-                *pRole = 0;
-            }  else {
-                    /* slave */
-                *pRole = 1;
-            }
-
-            A_INFO("[%s] Found Connection (Link-Type : %d), found role:%d \n",
-                    Address, connInfo->type, *pRole);
-            break;
-        }
-
-        if (i == connList->conn_num) {
-            A_ERR("[%s] Could not find connection info for %s %d \n", __FUNCTION__, Address);
-            break;
-        }
-        status = A_OK;
-
-    } while (FALSE);
-
-    if (sk >= 0) {
-        close(sk);
-    }
-
-    if (connList != NULL) {
-        A_FREE(connList);
-    }
-
-    return status;
-}
-
-#ifdef BLUEZ4_3
-
-static void GetBtAudioDeviceProperties(ABF_BT_INFO  *pAbfBtInfo)
-{
-    A_STATUS    status;
-
-    pAbfBtInfo->DefaultRemoteAudioDevicePropsValid = FALSE;
-
-    do {
-
-            /* Need RemoteDeviceAddress */
-
-
-        status = GetRemoteDeviceLMPVersion(pAbfBtInfo);
-
-            /* assume 2.1 or later */
-        pAbfBtInfo->DefaultAudioDeviceLmpVersion = 4;
-
-        if (strstr(pAbfBtInfo->DefaultRemoteAudioDeviceVersion,"1.0") != NULL) {
-            pAbfBtInfo->DefaultAudioDeviceLmpVersion = 0;
-        } else if (strstr(pAbfBtInfo->DefaultRemoteAudioDeviceVersion,"1.1") != NULL) {
-            pAbfBtInfo->DefaultAudioDeviceLmpVersion = 1;
-        } else if (strstr(pAbfBtInfo->DefaultRemoteAudioDeviceVersion,"1.2") != NULL) {
-            pAbfBtInfo->DefaultAudioDeviceLmpVersion = 2;
-        } else if (strstr(pAbfBtInfo->DefaultRemoteAudioDeviceVersion,"2.0") != NULL) {
-            /* NOTE: contrary to what the DBUS documentation says, the BT string will
-             * not indicate +EDR to indiate the remote device is EDR capable!
-             * */
-            pAbfBtInfo->DefaultAudioDeviceLmpVersion = 3;
-        }
-
-        if (pAbfBtInfo->DefaultAudioDeviceLmpVersion >= 3) {
-            A_BOOL EDRCapable = FALSE;
-                /* double check that the device is EDR capable, a 2.0 device can be EDR or non EDR */
-            status = CheckRemoteDeviceEDRCapable(pAbfBtInfo, &EDRCapable);
-            if (A_SUCCESS(status)) {
-                if (!EDRCapable) {
-                     A_INFO("Remote Audio Device (%s) is not EDR Capable, downgrading lmp version.. \n",
-                                pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-                        /* for audio coex, treat this like a 1.2 device */
-                    pAbfBtInfo->DefaultAudioDeviceLmpVersion = 2;
-                }
-            }
-        }
-        pAbfBtInfo->DefaultRemoteAudioDevicePropsValid = TRUE;
-
-    } while (FALSE);
-
-}
-
-#else
-
-static void GetBtAudioDeviceProperties(ABF_BT_INFO  *pAbfBtInfo)
-{
-    A_STATUS    status;
-
-    pAbfBtInfo->DefaultRemoteAudioDevicePropsValid = FALSE;
-
-    do {
-            /* Device address */
-        status = DoMethodCall(pAbfBtInfo->Bus,
-                              BLUEZ_NAME,
-                              pAbfBtInfo->DefaultAudioDeviceName,
-                              AUDIO_DEVICE_INTERFACE,
-                              "GetAddress",
-                              NULL,
-                              DBUS_TYPE_INVALID,
-                              0,
-                              pAbfBtInfo->DefaultRemoteAudioDeviceAddress,
-                              DBUS_TYPE_STRING,
-                              sizeof(pAbfBtInfo->DefaultRemoteAudioDeviceAddress));
-
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to get address \n", __FUNCTION__);
-            break;
-        }
-
-        A_INFO("Connected audio device address: %s  \n", pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-        status = DoMethodCall(pAbfBtInfo->Bus,
-                              BLUEZ_NAME,
-                              pAbfBtInfo->HCI_AdapterName,
-                              ADAPTER_INTERFACE,
-                              "GetRemoteVersion",
-                              pAbfBtInfo->DefaultRemoteAudioDeviceAddress,
-                              DBUS_TYPE_STRING,
-                              strlen(pAbfBtInfo->DefaultRemoteAudioDeviceAddress) + 1,
-                              pAbfBtInfo->DefaultRemoteAudioDeviceVersion,
-                              DBUS_TYPE_STRING,
-                              sizeof(pAbfBtInfo->DefaultRemoteAudioDeviceVersion));
-
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to get remote version \n", __FUNCTION__);
-            break;
-        }
-
-        A_INFO("Connected audio device remote version: %s \n",
-                pAbfBtInfo->DefaultRemoteAudioDeviceVersion);
-
-
-            /* assume 2.1 or later */
-        pAbfBtInfo->DefaultAudioDeviceLmpVersion = 4;
-
-        if (strstr(pAbfBtInfo->DefaultRemoteAudioDeviceVersion,"1.0") != NULL) {
-            pAbfBtInfo->DefaultAudioDeviceLmpVersion = 0;
-        } else if (strstr(pAbfBtInfo->DefaultRemoteAudioDeviceVersion,"1.1") != NULL) {
-            pAbfBtInfo->DefaultAudioDeviceLmpVersion = 1;
-        } else if (strstr(pAbfBtInfo->DefaultRemoteAudioDeviceVersion,"1.2") != NULL) {
-            pAbfBtInfo->DefaultAudioDeviceLmpVersion = 2;
-        } else if (strstr(pAbfBtInfo->DefaultRemoteAudioDeviceVersion,"2.0") != NULL) {
-            /* NOTE: contrary to what the DBUS documentation says, the BT string will
-             * not indicate +EDR to indiate the remote device is EDR capable!
-             * */
-            pAbfBtInfo->DefaultAudioDeviceLmpVersion = 3;
-        }
-
-        if (pAbfBtInfo->DefaultAudioDeviceLmpVersion >= 3) {
-            A_BOOL EDRCapable = FALSE;
-                /* double check that the device is EDR capable, a 2.0 device can be EDR or non EDR */
-            status = CheckRemoteDeviceEDRCapable(pAbfBtInfo, &EDRCapable);
-            if (A_SUCCESS(status)) {
-                if (!EDRCapable) {
-                     A_INFO("Remote Audio Device (%s) is not EDR Capable, downgrading lmp version.. \n",
-                                pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-                        /* for audio coex, treat this like a 1.2 device */
-                    pAbfBtInfo->DefaultAudioDeviceLmpVersion = 2;
-                }
-            }
-        }
-
-        pAbfBtInfo->DefaultRemoteAudioDevicePropsValid = TRUE;
-
-    } while (FALSE);
-
-}
-
-#endif
-
-#define LMP_FEATURE_ACL_EDR_2MBPS_BYTE_INDEX  3
-#define LMP_FEATURE_ACL_EDR_2MBPS_BIT_MASK    0x2
-#define LMP_FEATURE_ACL_EDR_3MBPS_BYTE_INDEX  3
-#define LMP_FEATURE_ACL_EDR_3MBPS_BIT_MASK    0x4
-#define LMP_FEATURES_LENGTH                   8
-
-#ifdef BLUEZ4_3
-
-#define HCI_REMOTE_COMMAND_TIMEOUT 2000
-static A_STATUS GetRemoteAclDeviceHandle(ABF_BT_INFO *pAbfBtInfo, A_UINT16 *pConn_handle)
-{
-    A_STATUS status = A_OK;
-    int i, len, sk = -1;
-    struct hci_conn_list_req *connList = NULL;
-    struct hci_conn_info *connInfo = NULL;
-    do {
-        sk = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-
-        if (sk < 0) {
-            A_ERR("[%s] Failed to get raw BT socket: %d\n", __FUNCTION__, errno);
-            status = A_NO_RESOURCE;
-            break;
-        }
-
-        len = (sizeof(*connInfo)) * ABTH_MAX_CONNECTIONS + sizeof(*connList);
-        connList = (struct hci_conn_list_req *)A_MALLOC(len);
-
-        if (connList == NULL) {
-            A_DEBUG("No connection found during calling function [%s]\n", __FUNCTION__);
-            status = A_NO_MEMORY;
-            break;
-        }
-
-        A_MEMZERO(connList, len);
-
-        connList->dev_id = pAbfBtInfo->AdapterId;
-        connList->conn_num = ABTH_MAX_CONNECTIONS;
-        connInfo = connList->conn_info;
-
-        if (ioctl(sk, HCIGETCONNLIST, (void *)connList)) {
-            A_ERR("[%s] Failed to get connection list: %d\n", __FUNCTION__, errno);
-            status = A_EPERM;
-            break;
-        }
-
-        for (i = 0; i < connList->conn_num; i++, connInfo++) {
-            if (connInfo->type == ACL_LINK) {
-                *pConn_handle = connInfo->handle;
-                break;
-            }
-        }
-
-        if (i==connList->conn_num) {
-            status = A_ENOENT;
-            break;
-        }
-    } while (0);
-    if (connList != NULL) {
-        A_FREE(connList);
-    }
-    if (sk>=0) {
-        close(sk);
-    }
-    return status;
-}
-
-static A_STATUS CheckRemoteDeviceEDRCapable(ABF_BT_INFO *pAbfBtInfo, A_BOOL *pEDRCapable)
-{
-    A_STATUS status;
-    A_UINT16 conn_handle;
-    A_UCHAR evtBuffer[HCI_MAX_EVENT_SIZE];
-    A_UCHAR *eventPtr;
-    int eventLen;
-    A_UINT8 *lmp_features;
-    do {
-        status = GetRemoteAclDeviceHandle(pAbfBtInfo, &conn_handle);
-        if (A_FAILED(status)) {
-            break;
-        }
-        status = IssueHCICommand(pAbfBtInfo,
-                        cmd_opcode_pack(OGF_LINK_CTL, OCF_READ_REMOTE_FEATURES),
-                        (A_UCHAR *)&conn_handle,
-                        2,
-                        HCI_REMOTE_COMMAND_TIMEOUT,
-                        evtBuffer,
-                        sizeof(evtBuffer),
-                        &eventPtr,
-                        &eventLen);          
-
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to get remote features \n", __FUNCTION__);
-            break;
-        }
-
-        /* Process LMP Features */
-        lmp_features = &eventPtr[3];
-
-        A_DUMP_BUFFER(lmp_features,sizeof(lmp_features),"Remote Device LMP Features:");
-
-        if ((lmp_features[LMP_FEATURE_ACL_EDR_2MBPS_BYTE_INDEX] & LMP_FEATURE_ACL_EDR_2MBPS_BIT_MASK)  ||    
-                (lmp_features[LMP_FEATURE_ACL_EDR_3MBPS_BYTE_INDEX] & LMP_FEATURE_ACL_EDR_3MBPS_BIT_MASK)) {
-            A_INFO("Device (%s) is EDR capable \n", pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-            *pEDRCapable = TRUE;          
-        } else {
-            A_INFO("Device (%s) is NOT EDR capable \n", pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-            *pEDRCapable = FALSE;
-        }
-    } while (0);
-
-    return status;
-}
-
-/* This is new function to check remote device LMP version */
-static A_STATUS GetRemoteDeviceLMPVersion(ABF_BT_INFO *pAbfBtInfo)
-{
-    A_STATUS status;    
-    A_UINT16 conn_handle;
-    A_UCHAR evtBuffer[HCI_MAX_EVENT_SIZE];
-    A_UCHAR *eventPtr;
-    int eventLen; 
-
-    do {
-        status = GetRemoteAclDeviceHandle(pAbfBtInfo, &conn_handle);
-        if (A_FAILED(status)) {
-            break;
-        }
-        status = IssueHCICommand(pAbfBtInfo,
-                        cmd_opcode_pack(OGF_LINK_CTL, OCF_READ_REMOTE_VERSION),
-                        (A_UCHAR *)&conn_handle,
-                        2,
-                        HCI_REMOTE_COMMAND_TIMEOUT,
-                        evtBuffer,
-                        sizeof(evtBuffer),
-                        &eventPtr,
-                        &eventLen);          
-
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to get remote Version \n", __FUNCTION__);
-            break;
-        }
-
-        /* Process LMP Version */
-
-        if (eventPtr[3] == 0) {
-            strcpy(&pAbfBtInfo->DefaultRemoteAudioDeviceVersion[0], "1.0");
-        } else if (eventPtr[3] == 1) {
-            strcpy(&pAbfBtInfo->DefaultRemoteAudioDeviceVersion[0], "1.1");
-        } else if (eventPtr[3] == 2) {
-            strcpy(&pAbfBtInfo->DefaultRemoteAudioDeviceVersion[0], "1.2");
-        } else if (eventPtr[3] == 3) {
-            strcpy(&pAbfBtInfo->DefaultRemoteAudioDeviceVersion[0], "2.0");
-        }
-
-        A_INFO("[%s], Remote Device LMP Version: %d, in string format this is: %s\n", __FUNCTION__, eventPtr[3], 
-               pAbfBtInfo->DefaultRemoteAudioDeviceVersion);
-    } while (0);
-
-    return status;
-}
-
-
-#else
-
-static A_STATUS CheckRemoteDeviceEDRCapable(ABF_BT_INFO *pAbfBtInfo, A_BOOL *pEDRCapable)
-{
-    A_STATUS  status = A_OK; 
-    A_UINT8   lmp_features[LMP_FEATURES_LENGTH];
-    
-    do {
-        
-        A_MEMZERO(lmp_features,sizeof(lmp_features));
-        
-        status = DoMethodCall(pAbfBtInfo->Bus,
-                              BLUEZ_NAME,
-                              pAbfBtInfo->HCI_AdapterName,
-                              ADAPTER_INTERFACE,
-                              "GetRemoteFeatures",
-                              pAbfBtInfo->DefaultRemoteAudioDeviceAddress,
-                              DBUS_TYPE_STRING,
-                              strlen(pAbfBtInfo->DefaultRemoteAudioDeviceAddress) + 1,
-                              lmp_features,
-                              DBUS_TYPE_ARRAY,
-                              sizeof(lmp_features));
-        
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to get remote features \n", __FUNCTION__);
-            break;    
-        }
-        
-        A_DUMP_BUFFER(lmp_features,sizeof(lmp_features),"Remote Device LMP Features:");
-        
-        if ((lmp_features[LMP_FEATURE_ACL_EDR_2MBPS_BYTE_INDEX] & LMP_FEATURE_ACL_EDR_2MBPS_BIT_MASK)  ||    
-                (lmp_features[LMP_FEATURE_ACL_EDR_3MBPS_BYTE_INDEX] & LMP_FEATURE_ACL_EDR_3MBPS_BIT_MASK)) {
-            A_INFO("Device (%s) is EDR capable \n", pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-            *pEDRCapable = TRUE;          
-        } else {
-            A_INFO("Device (%s) is NOT EDR capable \n", pAbfBtInfo->DefaultRemoteAudioDeviceAddress);
-            *pEDRCapable = FALSE;
-        }
-        
-    } while (FALSE);
-
-    return status;  
-}
-
-#endif
-
-static void GetBtAudioConnectionProperties(ABF_BT_INFO              *pAbfBtInfo,
-                                           ATHBT_STATE_INDICATION   Indication)
-{
-    A_UCHAR     role = 0;
-    A_CHAR      *pDescr = NULL;
-    A_STATUS    status;
-
-    do {
-        if (!pAbfBtInfo->DefaultRemoteAudioDevicePropsValid) {
-            break;
-        }
-
-        /* Incases where HciX is not supported, don't check for the role */
-        if((pAbfBtInfo->pInfo->Flags & ABF_USE_ONLY_DBUS_FILTERING)) {
-               return;
-        }
-            /* get role */
-        status = GetConnectedDeviceRole(pAbfBtInfo,
-                                        pAbfBtInfo->DefaultRemoteAudioDeviceAddress,
-                                        Indication == ATH_BT_A2DP ?FALSE : TRUE,
-                                        &role);
-        if (A_FAILED(status)) {
-            role = 0;
-        }
-        if (Indication == ATH_BT_A2DP) {
-            pDescr = "A2DP";
-            pAbfBtInfo->pInfo->A2DPConnection_LMPVersion = pAbfBtInfo->DefaultAudioDeviceLmpVersion;
-            pAbfBtInfo->pInfo->A2DPConnection_Role = role;
-        } else if (Indication == ATH_BT_SCO) {
-            if (pAbfBtInfo->CurrentSCOLinkType == SCO_LINK) {
-                pDescr = "SCO";
-            } else {
-                pDescr = "eSCO";
-            }
-            pAbfBtInfo->pInfo->SCOConnection_LMPVersion = pAbfBtInfo->DefaultAudioDeviceLmpVersion;
-            pAbfBtInfo->pInfo->SCOConnection_Role = role;
-
-            if((pAbfBtInfo->pInfo->Flags & ABF_USE_ONLY_DBUS_FILTERING)) {
-
-                pAbfBtInfo->pInfo->SCOConnectInfo.Valid = TRUE;
-            }else{
-                /* for SCO connections check if the event filter captured
-                 * the SYNCH connection complete event */
-                CheckHciEventFilter(pAbfBtInfo);
-            }
-        } else {
-            pDescr = "UNKNOWN!!";
-        }
-
-        A_INFO("BT Audio connection properties:  (%s) (role: %s, lmp version: %d) \n",
-               pDescr, role ? "SLAVE" : "MASTER", pAbfBtInfo->DefaultAudioDeviceLmpVersion);
-
-    } while (FALSE);
-
-}
-
-
-static A_STATUS WaitForHCIEvent(int         Socket, 
-                                int         TimeoutMs, 
-                                A_UCHAR     *pBuffer,
-                                int         MaxLength,
-                                A_UCHAR     EventCode, 
-                                A_UINT16    OpCode,
-                                A_UCHAR     **ppEventPtr,
-                                int         *pEventLength)
-{
-    
-    int                     eventLen;
-    hci_event_hdr           *eventHdr;
-    struct pollfd           pfd;
-    int                     result;
-    A_UCHAR                 *eventPtr; 
-    A_STATUS                status = A_OK;
-    
-    *ppEventPtr = NULL;
-    A_MEMZERO(&pfd,sizeof(pfd));
-    pfd.fd = Socket;
-    pfd.events = POLLIN;
-
-    if (EventCode == EVT_CMD_COMPLETE) {
-        A_INFO("Waiting for HCI CMD Complete Event, Opcode: 0x%4.4X (%d MS) \n",OpCode, TimeoutMs);     
-    } else {
-        A_INFO("Waiting for HCI Event: %d (%d MS) \n",EventCode, TimeoutMs);
-    }
-
-    while (1) {
-
-            /* check socket for a captured event using a short timeout
-             * the caller usually calls this function when it knows there
-             * is an event that is likely to be captured */
-        result = poll(&pfd, 1, TimeoutMs);
-        
-        if (result < 0) {
-            if ((errno == EAGAIN) || (errno == EINTR)) {
-                /* interrupted */
-            } else {
-                A_ERR("[%s] Socket Poll Failed! : %d \n", __FUNCTION__, errno);
-                status = A_ERROR;
-            }
-            break;
-        }
-        
-        if (result == 0) {
-            A_ERR("[%s], poll returned with 0 \n",__FUNCTION__);
-            status = A_ERROR;
-            break;
-        }
-
-        if (!(pfd.revents & POLLIN)) {
-            A_ERR("[%s], POLLIN check failed\n",__FUNCTION__);
-            status = A_ERROR;
-            break;
-        }
-            /* get the packet */
-        eventLen = read(Socket, pBuffer, MaxLength);
-        if (eventLen == 0) {
-            /* no event */
-            A_INFO("[%s], No Event\n",__FUNCTION__);
-            status = A_ERROR;
-            break;
-        }
-        if(eventLen > MaxLength) {
-            A_ERR("[%s] Length longer than expected (%d) : %d \n", __FUNCTION__, MaxLength,
-                                                                  eventLen);
-            status = A_ERROR;
-            break;
-        }
-        if (eventLen < (1 + HCI_EVENT_HDR_SIZE)) {
-            A_ERR("[%s] Unknown receive packet! len : %d \n", __FUNCTION__, eventLen);
-            status = A_ERROR;
-            break;
-        }
-        if (pBuffer[0] != HCI_EVENT_PKT) {
-            A_ERR("[%s] Unsupported packet type : %d \n", __FUNCTION__, pBuffer[0]);
-            status = A_ERROR;
-            break;
-        }
-
-        eventPtr = &pBuffer[1];
-        eventLen--;
-        eventHdr = (hci_event_hdr *)eventPtr;
-        eventPtr += HCI_EVENT_HDR_SIZE;
-        eventLen -= HCI_EVENT_HDR_SIZE;
-
-        if (eventHdr->evt != EventCode) {
-                /* not interested in this one */
-            continue;
-        }
-        if(eventPtr == NULL) {
-            A_ERR("[%s] Socket read points to NULL\n", __FUNCTION__);
-            status = A_ERROR;
-            break;
-        }
-        if (eventHdr->evt == EVT_CMD_COMPLETE) {
-            if (eventLen < sizeof(evt_cmd_complete)) {
-                A_ERR("[%s] EVT_CMD_COMPLETE event is too small! len=%d \n", __FUNCTION__, eventLen);
-                status = A_ERROR;
-                break;
-            } else {
-                A_UINT16 evOpCode = btohs(BTEV_CMD_COMPLETE_GET_OPCODE(eventPtr));
-                    /* check for opCode match */
-                if (OpCode != evOpCode) {
-                    /* keep searching */
-                    continue;
-                }
-            }
-        }
-         /* found it */
-        *ppEventPtr = eventPtr;
-        *pEventLength = eventLen;
-
-        break;
-
-    }
-
-    return status;
-}
-
-static void CheckHciEventFilter(ABF_BT_INFO   *pAbfBtInfo)
-{
-    A_UCHAR     buffer[HCI_MAX_EVENT_SIZE];
-    A_STATUS    status;
-    A_UCHAR     *eventPtr;
-    int         eventLen;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-
-    do {
-
-        if (!USE_DBUS_FOR_HEADSET_PROFILE(pInfo)) {
-            A_ERR("Calling CheckHciEventFilter is not valid in this mode! \n");
-            break;
-        }
-
-        status = WaitForHCIEvent(pAbfBtInfo->HCIEventListenerSocket,
-                                 100,
-                                 buffer,
-                                 sizeof(buffer),
-                                 EVT_SYNC_CONN_COMPLETE,
-                                 0,
-                                 &eventPtr,
-                                 &eventLen);
-
-        if (A_FAILED(status)) {
-            break;
-        }
-
-        if (eventPtr == NULL) {
-            break;
-        }
-
-        if (eventLen < sizeof(evt_sync_conn_complete)) {
-            A_ERR("SYNC_CONN_COMPLETE Event is too small! : %d \n", eventLen);
-            break;
-        }
-
-        pAbfBtInfo->pInfo->SCOConnectInfo.LinkType = BTEV_GET_BT_CONN_LINK_TYPE(eventPtr);
-        pAbfBtInfo->pInfo->SCOConnectInfo.TransmissionInterval = BTEV_GET_TRANS_INTERVAL(eventPtr);
-        pAbfBtInfo->pInfo->SCOConnectInfo.RetransmissionInterval = BTEV_GET_RETRANS_INTERVAL(eventPtr);
-        pAbfBtInfo->pInfo->SCOConnectInfo.RxPacketLength = BTEV_GET_RX_PKT_LEN(eventPtr);
-        pAbfBtInfo->pInfo->SCOConnectInfo.TxPacketLength = BTEV_GET_TX_PKT_LEN(eventPtr);
-
-        A_INFO("HCI SYNC_CONN_COMPLETE event captured, conn info (%d, %d, %d, %d, %d) \n",
-                pAbfBtInfo->pInfo->SCOConnectInfo.LinkType,
-                pAbfBtInfo->pInfo->SCOConnectInfo.TransmissionInterval,
-                pAbfBtInfo->pInfo->SCOConnectInfo.RetransmissionInterval,
-                pAbfBtInfo->pInfo->SCOConnectInfo.RxPacketLength,
-                pAbfBtInfo->pInfo->SCOConnectInfo.TxPacketLength);
-
-            /* now valid */
-        pAbfBtInfo->pInfo->SCOConnectInfo.Valid = TRUE;
-
-    } while (FALSE);
-
-}
-
-static void CleanupHciEventFilter(ABF_BT_INFO *pAbfBtInfo)
-{
-    A_STATUS status;
-
-    if (pAbfBtInfo->HCIEventListenerSocket >= 0) {
-        pAbfBtInfo->HCIFilterThreadShutdown = TRUE;
-            /* close socket, if there is a thread waiting on this socket, it will error and then exit */
-        close(pAbfBtInfo->HCIEventListenerSocket);
-        pAbfBtInfo->HCIEventListenerSocket = -1;
-
-        if (pAbfBtInfo->HCIFilterThreadCreated) {
-            A_INFO("[%s] Waiting for HCI filter thread to exit... \n", 
-                      __FUNCTION__);
-                /* wait for thread to exit 
-                 * note: JOIN cleans up thread resources as per POSIX spec. */
-            status = A_TASK_JOIN(&pAbfBtInfo->hBtHCIFilterThread);
-            if (A_FAILED(status)) {
-                A_ERR("[%s] Failed to JOIN HCI filter thread \n", 
-                      __FUNCTION__);
-            }
-            A_MEMZERO(&pAbfBtInfo->hBtHCIFilterThread,sizeof(pAbfBtInfo->hBtHCIFilterThread));
-            pAbfBtInfo->HCIFilterThreadCreated = FALSE;     
-        }   
-        
-        pAbfBtInfo->HCIFilterThreadShutdown = FALSE; 
-    }    
-    
-}
-
-
-static A_STATUS SetupHciEventFilter(ABF_BT_INFO *pAbfBtInfo)
-{
-    A_STATUS            status = A_ERROR;
-    struct hci_filter   filterSetting;
-    struct sockaddr_hci addr;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    do {
-
-        if (pAbfBtInfo->HCIEventListenerSocket >= 0) {
-                /* close previous */
-            CleanupHciEventFilter(pAbfBtInfo);
-        }
-
-        pAbfBtInfo->HCIEventListenerSocket = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-
-        if (pAbfBtInfo->HCIEventListenerSocket < 0) {
-            A_ERR("[%s] Failed to get raw BT socket: %d \n", __FUNCTION__, errno);
-            break;
-        }
-
-        hci_filter_clear(&filterSetting);
-        hci_filter_set_ptype(HCI_EVENT_PKT,  &filterSetting);
-            /* To caputre INQUIRY command capture */
-        hci_filter_set_ptype(HCI_COMMAND_PKT, &filterSetting);
-
-        /* capture SYNC_CONN Complete */
-        hci_filter_set_event(EVT_SYNC_CONN_COMPLETE, &filterSetting);
-
-        /* Capture INQUIRY_COMPLETE event  */
-        hci_filter_set_event(EVT_INQUIRY_COMPLETE, &filterSetting);
-        hci_filter_set_event(EVT_CONN_REQUEST, &filterSetting);
-        hci_filter_set_event(EVT_PIN_CODE_REQ, &filterSetting);
-        hci_filter_set_event(EVT_LINK_KEY_REQ, &filterSetting);
-        hci_filter_set_event(EVT_CONN_COMPLETE, &filterSetting);
-        hci_filter_set_event(EVT_LINK_KEY_NOTIFY, &filterSetting);
-
-
-
-        if (!USE_DBUS_FOR_HEADSET_PROFILE(pInfo)) {
-                /* if we are not using DBUS for the headset profile, we need
-                 * to capture other HCI event packets */
-            hci_filter_set_event(EVT_DISCONN_COMPLETE, &filterSetting);
-            hci_filter_set_event(EVT_CONN_COMPLETE, &filterSetting);
-        }
-
-        if (setsockopt(pAbfBtInfo->HCIEventListenerSocket,
-                       SOL_HCI,
-                       HCI_FILTER,
-                       &filterSetting,
-                       sizeof(filterSetting)) < 0) {
-            A_ERR("[%s] Failed to set socket opt: %d \n", __FUNCTION__, errno);
-            break;
-        }
-
-        A_MEMZERO(&addr,sizeof(addr));
-            /* bind to the current adapter */
-        addr.hci_family = AF_BLUETOOTH;
-        addr.hci_dev = pAbfBtInfo->AdapterId;
-
-        if (bind(pAbfBtInfo->HCIEventListenerSocket,
-                 (struct sockaddr *)&addr,
-                 sizeof(addr)) < 0) {
-            A_ERR("[%s] Can't bind to hci:%d (err:%d) \n", __FUNCTION__, pAbfBtInfo->AdapterId, errno);
-            break;
-        }
-
-        A_INFO("BT Event Filter Set, Mask: 0x%8.8X:%8.8X \n",
-            filterSetting.event_mask[1], filterSetting.event_mask[0]);
-#ifdef BLUEZ4_3
-        if (1) {
-#else
-        if (!USE_DBUS_FOR_HEADSET_PROFILE(pInfo)) {
-#endif
-            /* spawn a thread that will capture HCI events from the adapter */
-            status = A_TASK_CREATE(&pAbfBtInfo->hBtHCIFilterThread, HCIFilterThread, pAbfBtInfo);
-            if (A_FAILED(status)) {
-                A_ERR("[%s] Failed to spawn a BT thread\n", __FUNCTION__);
-                break;
-            }
-            pAbfBtInfo->HCIFilterThreadCreated = TRUE;
-        }
-
-        status = A_OK;
-
-    } while (FALSE);
-
-    if (A_FAILED(status)) {
-        CleanupHciEventFilter(pAbfBtInfo);
-    }
-
-    return status;
-}
-
-
-    /* issue HCI command, currently this ONLY supports simple commands that
-     * only expect a command complete, the event pointer returned points to the command
-     * complete event structure for the caller to decode */
-static A_STATUS IssueHCICommand(ABF_BT_INFO *pAbfBtInfo,
-                                A_UINT16    OpCode,
-                                A_UCHAR     *pCmdData,
-                                int         CmdLength,
-                                int         EventRecvTimeoutMS,
-                                A_UCHAR     *pEventBuffer,
-                                int         MaxLength,
-                                A_UCHAR     **ppEventPtr,
-                                int         *pEventLength)
-{
-    A_STATUS            status = A_ERROR;
-    A_UCHAR             hciType = HCI_COMMAND_PKT;
-    hci_command_hdr     hciCommandHdr;
-    struct  iovec       iv[3];
-    int                 ivcount = 0;
-    int                 sk,result;
-    struct hci_filter   filterSetting;
-    struct sockaddr_hci addr;
-
-    do {
-
-        sk = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-
-        if (sk < 0) {
-            A_ERR("[%s] Failed to get raw BT socket: %d \n", __FUNCTION__, errno);
-            break;
-        }
-
-        hciCommandHdr.opcode = htobs(OpCode);
-        hciCommandHdr.plen= CmdLength;
-
-        iv[0].iov_base = &hciType;
-        iv[0].iov_len  = 1;
-        ivcount++;
-        iv[1].iov_base = &hciCommandHdr;
-        iv[1].iov_len  = HCI_COMMAND_HDR_SIZE;
-        ivcount++;
-
-        if (pCmdData != NULL) {
-            iv[2].iov_base = pCmdData;
-            iv[2].iov_len  = CmdLength;
-            ivcount++;
-        }
-
-            /* setup socket to capture the event */
-        if (OpCode == cmd_opcode_pack(OGF_LINK_CTL, OCF_READ_REMOTE_FEATURES)) {
-            hci_filter_clear(&filterSetting);
-            hci_filter_set_ptype(HCI_EVENT_PKT, &filterSetting);
-            hci_filter_set_event(EVT_READ_REMOTE_FEATURES_COMPLETE, &filterSetting);
-        } else if (OpCode == cmd_opcode_pack(OGF_LINK_CTL, OCF_READ_REMOTE_VERSION)) {
-            hci_filter_clear(&filterSetting);
-            hci_filter_set_ptype(HCI_EVENT_PKT, &filterSetting);
-            hci_filter_set_event(EVT_READ_REMOTE_VERSION_COMPLETE, &filterSetting); 
-        }
-        else {
-            hci_filter_clear(&filterSetting);
-            hci_filter_set_ptype(HCI_EVENT_PKT,  &filterSetting);
-            hci_filter_set_event(EVT_CMD_COMPLETE, &filterSetting);
-        }
-    
-        if (setsockopt(sk, SOL_HCI, HCI_FILTER, &filterSetting, sizeof(filterSetting)) < 0) {
-            A_ERR("[%s] Failed to set socket opt: %d \n", __FUNCTION__, errno);
-            break;
-        }
-    
-        A_MEMZERO(&addr,sizeof(addr));
-        addr.hci_family = AF_BLUETOOTH;
-        addr.hci_dev = pAbfBtInfo->AdapterId;
-        
-        if (bind(sk,(struct sockaddr *)&addr, sizeof(addr)) < 0) {
-            A_ERR("[%s] Can't bind to hci:%d (err:%d) \n", __FUNCTION__, pAbfBtInfo->AdapterId, errno);
-            break;
-        }
-        
-        while ((result = writev(sk, iv, ivcount)) < 0) {
-            if (errno == EAGAIN || errno == EINTR) {
-                continue;
-            }
-            break;            
-        }
-        
-        if (result <= 0) {
-            A_ERR("[%s] Failed to write to hci:%d (err:%d) \n", __FUNCTION__, pAbfBtInfo->AdapterId, errno);
-            break;    
-        }
-        
-        /* To support new HCI Commands */
-        switch (OpCode) {
-        case cmd_opcode_pack(OGF_LINK_CTL, OCF_READ_REMOTE_FEATURES):
-            status = WaitForHCIEvent(sk,
-                                     EventRecvTimeoutMS,
-                                     pEventBuffer,
-                                     MaxLength,
-                                     EVT_READ_REMOTE_FEATURES_COMPLETE,
-                                     OpCode,
-                                     ppEventPtr,
-                                     pEventLength); 
-            break;
-        case cmd_opcode_pack(OGF_LINK_CTL, OCF_READ_REMOTE_VERSION):
-            status = WaitForHCIEvent(sk,
-                                     EventRecvTimeoutMS,
-                                     pEventBuffer,
-                                     MaxLength,
-                                     EVT_READ_REMOTE_VERSION_COMPLETE,
-                                     OpCode,
-                                     ppEventPtr,
-                                     pEventLength); 
-            break;
-        default:              
-            status = WaitForHCIEvent(sk,
-                                     EventRecvTimeoutMS,
-                                     pEventBuffer,
-                                     MaxLength,
-                                     EVT_CMD_COMPLETE, 
-                                     OpCode,
-                                     ppEventPtr,
-                                     pEventLength);
-            break;
-        }
-                    
-        if (A_FAILED(status)) {
-            break;    
-        }
-        
-        status = A_OK;
-        
-    } while (FALSE);
-    
-    if (sk >= 0) {
-        close(sk);    
-    }
-    
-    return status;
-}
-
-#define AFH_CHANNEL_MAP_BYTES  10
-
-typedef struct _WLAN_CHANNEL_MAP {
-    A_UCHAR  Map[AFH_CHANNEL_MAP_BYTES];
-} WLAN_CHANNEL_MAP;
-
-#define MAX_WLAN_CHANNELS 14
-
-typedef struct _WLAN_CHANNEL_RANGE {
-    int    ChannelNumber;
-    int    Center;       /* in Mhz */
-} WLAN_CHANNEL_RANGE;
-
-const WLAN_CHANNEL_RANGE g_ChannelTable[MAX_WLAN_CHANNELS] = {
-    { 1  , 2412},
-    { 2  , 2417},
-    { 3  , 2422},
-    { 4  , 2427},
-    { 5  , 2432},
-    { 6  , 2437},
-    { 7  , 2442},
-    { 8  , 2447},
-    { 9  , 2452},
-    { 10 , 2457},
-    { 11 , 2462},
-    { 12 , 2467},
-    { 13 , 2472},
-    { 14 , 2484},
-};
-
-static WLAN_CHANNEL_MAP g_ChannelMapTable[MAX_WLAN_CHANNELS + 1] = {
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 0 -- no WLAN */
-    { {0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 1 */
-    { {0x0F,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 2 */
-    { {0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 3 */
-    { {0xFF,0x3F,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 4 */
-    { {0xFF,0xFF,0x07,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0x7F}}, /* 5 */
-    { {0xFF,0xFF,0xFF,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x7F}}, /* 6 */
-    { {0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xF0,0xFF,0xFF,0x7F}}, /* 7 */
-    { {0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFE,0xFF,0x7F}}, /* 8 */
-    { {0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0xC0,0xFF,0x7F}}, /* 9 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0xF8,0x7F}}, /* 10 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x7F}}, /* 11 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x60}}, /* 12 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00}}, /* 13 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00}}, /* 14 */
-};
-
-#define AFH_COMMAND_COMPLETE_TIMEOUT_MS 2000
-
-static int LookUpChannel(int FreqMhz)
-{
-    int i;
-    
-    if (FreqMhz == 0) {
-            /* not connected */
-        return 0;    
-    }
-    
-    for (i = 0; i < MAX_WLAN_CHANNELS; i++) {
-        if (FreqMhz <= g_ChannelTable[i].Center) {
-            break;
-        }
-    }
-    return (i < MAX_WLAN_CHANNELS) ? g_ChannelTable[i].ChannelNumber : 0;
-}
-
-static A_STATUS IssueAFHChannelClassification(ABF_BT_INFO *pAbfBtInfo, int CurrentWLANChannel)
-{  
-    A_UCHAR     evtBuffer[HCI_MAX_EVENT_SIZE];  
-    A_STATUS    status;
-    A_UCHAR     *eventPtr;
-    int         eventLen; 
-    A_UCHAR     *pChannelMap;
-    
-    A_INFO("WLAN Operating Channel: %d \n", CurrentWLANChannel);
-       
-    if (CurrentWLANChannel > MAX_WLAN_CHANNELS) {
-            /* check if this is expressed in Mhz */
-        if (CurrentWLANChannel >= 2412) {
-                /* convert Mhz into a channel number */
-            CurrentWLANChannel = LookUpChannel(CurrentWLANChannel);    
-        } else {
-            return A_ERROR;    
-        } 
-    }
-          
-    pChannelMap = &(g_ChannelMapTable[CurrentWLANChannel].Map[0]);    
-    
-    do {
-    
-        status = IssueHCICommand(pAbfBtInfo,
-                                 cmd_opcode_pack(3,0x3F),
-                                 pChannelMap, 
-                                 AFH_CHANNEL_MAP_BYTES,
-                                 AFH_COMMAND_COMPLETE_TIMEOUT_MS,
-                                 evtBuffer,
-                                 sizeof(evtBuffer),
-                                 &eventPtr,
-                                 &eventLen);
-                    
-        
-        if (A_FAILED(status)) {
-            break;    
-        }
-        
-        status = A_ERROR;
-        
-        if (eventPtr == NULL) {    
-            A_ERR("[%s] Failed to capture AFH command complete event \n", __FUNCTION__);
-            break;    
-        }
-        
-        if (eventLen < (sizeof(evt_cmd_complete) + 1)) {
-            A_ERR("[%s] not enough bytes in AFH command complete event %d \n", __FUNCTION__, eventLen);
-            break;    
-        }
-        
-            /* check status parameter that follows the command complete event body */
-        if (eventPtr[sizeof(evt_cmd_complete)] != 0) {
-            A_ERR("[%s] AFH command complete event indicated failure : %d \n", __FUNCTION__, 
-                eventPtr[sizeof(evt_cmd_complete)]);
-            break;
-        }
-        
-        A_INFO(" AFH Command successfully issued \n");
-        //A_DUMP_BUFFER(pChannelMap, AFH_CHANNEL_MAP_BYTES, "AFH Channel Classification Map");
-                  
-        status = A_OK;
-         
-    } while (FALSE);
-                                 
-    return status;              
-}
-
-void IndicateCurrentWLANOperatingChannel(ATHBT_FILTER_INFO *pFilterInfo, int CurrentWLANChannel)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)pFilterInfo->pBtInfo;
-    ATHBT_FILTER_INFO *pInfo = pAbfBtInfo->pInfo;
-
-    if (NULL == pAbfBtInfo) {
-        return;
-    }
-
-    if (pFilterInfo->Flags & ABF_ENABLE_AFH_CHANNEL_CLASSIFICATION) {
-        IssueAFHChannelClassification(pAbfBtInfo,CurrentWLANChannel);
-    }
-
-    if(pInfo->Flags & ABF_USE_ONLY_DBUS_FILTERING) {
-        Abf_IssueAFHViaHciLib(pAbfBtInfo, CurrentWLANChannel);
-    }
-}
-
-#ifdef BLUEZ4_3
-static void *HCIFilterThread(void *arg)
-{
-    ABF_BT_INFO            *pAbfBtInfo = (ABF_BT_INFO *)arg;
-    ATHBT_FILTER_INFO      *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-    A_UINT8                 buffer[300];
-    A_UINT8                 *pBuffer;
-    int                     eventLen;
-
-    A_INFO("[%s] starting up \n", __FUNCTION__);
-
-    while (1) {
-
-        pBuffer = buffer;
-
-        if (pAbfBtInfo->HCIFilterThreadShutdown) {
-            break;
-        }
-            /* get the packet */
-        eventLen = read(pAbfBtInfo->HCIEventListenerSocket, pBuffer, sizeof(buffer));
-
-        if (eventLen < 0) {
-            if (!pAbfBtInfo->HCIFilterThreadShutdown) {
-                A_ERR("[%s] socket error %d \n", __FUNCTION__, eventLen);
-            }
-            break;
-        }
-
-        if (eventLen == 0) {
-            /* no event */
-            continue;
-        }
-
-        if (eventLen < (1 + HCI_EVENT_HDR_SIZE)) {
-            A_ERR("[%s] Unknown receive packet! len : %d \n", __FUNCTION__, eventLen);
-            continue;
-        }
-
-            /* first byte is a tag for the HCI packet type, we only care about events */
-        if (pBuffer[0] == HCI_EVENT_PKT) {
-            /* pass this raw HCI event to the filter core */
-            AthBtFilterHciEvent(pInstance,&pBuffer[1],eventLen - 1);
-            A_UINT8 *eventCode = &pBuffer[1];
-                /* revive deprecated "DiscoveryCompleted" signal in BlueZ 4.x */
-            if (*eventCode == EVT_INQUIRY_COMPLETE) {
-                A_DEBUG("Device Inquiry Completed\n");
-                pAbfBtInfo->btInquiryState &= ~(1 << 0);
-                if(!pAbfBtInfo->btInquiryState) {
-                    AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_OFF);
-                }
-            }
-            if (*eventCode == EVT_PIN_CODE_REQ) {
-                A_DEBUG("Pin Code Request\n");
-                pAbfBtInfo->btInquiryState |= (1 << 0xF);
-                AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_ON);
-            }
-            if (*eventCode == EVT_LINK_KEY_NOTIFY) {
-                A_DEBUG("link key notify\n");
-                pAbfBtInfo->btInquiryState &= ~(1 << 0xF);
-                if(!pAbfBtInfo->btInquiryState) {
-                    AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_OFF);
-                }
-            }
-
-            if(*eventCode == EVT_CONN_COMPLETE) {
-                A_DEBUG("Conn complete\n");
-                pAbfBtInfo->btInquiryState &= ~(1 << 2);
-                if(!pAbfBtInfo->btInquiryState) {
-                    AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_OFF);
-                }
-            }
-                /* revive deprecated "DiscoveryStarted" signal by capturing INQUIRY commands */
-        } else if (pBuffer[0] == HCI_COMMAND_PKT) {
-            A_UINT16 *packedOpCode = (A_UINT16 *)&pBuffer[1];
-            if(cmd_opcode_ogf(*packedOpCode) == 0x1 &&
-               cmd_opcode_ocf(*packedOpCode) == 0x5 )
-            {
-                A_DEBUG("Bt-Connect\n");
-                pAbfBtInfo->btInquiryState |= (1 << 2);
-                AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_ON);
-            }
-
-
-            if (*packedOpCode == cmd_opcode_pack(OGF_LINK_CTL, OCF_INQUIRY)
-                || *packedOpCode == cmd_opcode_pack(OGF_LINK_CTL, OCF_PERIODIC_INQUIRY)) {
-   //             AthBtFilterHciEvent(pInstance,&pBuffer[1],eventLen - 1);
-                A_DEBUG("Device Inquiry Started\n");
-                pAbfBtInfo->btInquiryState |= (1 << 0);
-                AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_ON);
-            } else if (*packedOpCode == cmd_opcode_pack(OGF_LINK_CTL, OCF_CREATE_CONN)) {
-                    /* "Connected" signal is deprecated and won't record BD_ADDR of remote device connected */
-                ba2str((const bdaddr_t *)&pBuffer[4], &pAbfBtInfo->DefaultRemoteAudioDeviceAddress[0]);
-            }
-        } else {
-            A_ERR("[%s] Unsupported packet type : %d \n", __FUNCTION__, buffer[0]);
-            continue;
-        }
-    }
-
-    A_INFO("[%s] exiting \n", __FUNCTION__);
-
-    return NULL;
-}
-
-#else
-
-static void *HCIFilterThread(void *arg)
-{
-    ABF_BT_INFO            *pAbfBtInfo = (ABF_BT_INFO *)arg;
-    ATHBT_FILTER_INFO      *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-    A_UINT8                 buffer[300];
-    A_UINT8                 *pBuffer;
-    int                     eventLen;
-    
-    A_INFO("[%s] starting up \n", __FUNCTION__);
-    
-    while (1) {
-        
-        pBuffer = buffer;
-        
-        if (pAbfBtInfo->HCIFilterThreadShutdown) {
-            break;    
-        }
-        
-            /* get the packet */
-        eventLen = read(pAbfBtInfo->HCIEventListenerSocket, pBuffer, sizeof(buffer));
-        
-        if (eventLen < 0) {
-            if (!pAbfBtInfo->HCIFilterThreadShutdown) {
-                A_ERR("[%s] socket error %d \n", __FUNCTION__, eventLen);
-            }
-            break;    
-        }
-        
-        if (eventLen == 0) {
-            /* no event */
-            continue;
-        }
-                
-        if (eventLen < (1 + HCI_EVENT_HDR_SIZE)) {
-            A_ERR("[%s] Unknown receive packet! len : %d \n", __FUNCTION__, eventLen);
-            continue;
-        }
-        
-            /* first byte is a tag for the HCI packet type, we only care about events */
-        if (pBuffer[0] != HCI_EVENT_PKT) {
-            A_ERR("[%s] Unsupported packet type : %d \n", __FUNCTION__, buffer[0]);
-            continue;
-        }
-        
-            /* pass this raw HCI event to the filter core */
-        AthBtFilterHciEvent(pInstance,&pBuffer[1],eventLen - 1); 
-    }
-
-    A_INFO("[%s] exiting \n", __FUNCTION__);
-
-    return NULL;
-}
-
-#endif
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus.h b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus.h
deleted file mode 100644 (file)
index 4bc7c55..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="abtfilt_bluez_dbus.h" company="Atheros">
-//    Copyright (c) 2007 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-
-#ifndef ABTFILT_BTSTACK_DBUS_H_
-#define ABTFILT_BTSTACK_DBUS_H_
-#include "abtfilt_int.h"
-#include <dbus/dbus.h>
-
-/*-----------------------------------------------------------------------*/
-/* BT Section */
-#define STRING_SIZE_MAX             128
-#define BD_ADDR_SIZE                6
-
-
-typedef void (* BT_EVENT_HANDLER)(void *,void *);
-
-typedef enum {
-    BT_ADAPTER_ADDED = 0,
-    BT_ADAPTER_REMOVED,
-    DEVICE_DISCOVERY_STARTED,
-    DEVICE_DISCOVERY_FINISHED,
-    REMOTE_DEVICE_CONNECTED,
-    REMOTE_DEVICE_DISCONNECTED,
-    AUDIO_DEVICE_ADDED,
-    AUDIO_DEVICE_REMOVED,
-    AUDIO_HEADSET_CONNECTED,
-    AUDIO_HEADSET_DISCONNECTED,
-    AUDIO_HEADSET_STREAM_STARTED,
-    AUDIO_HEADSET_STREAM_STOPPED,
-    AUDIO_GATEWAY_CONNECTED, /* Not Implemented */
-    AUDIO_GATEWAY_DISCONNECTED, /* Not Implemented */
-    AUDIO_SINK_CONNECTED,
-    AUDIO_SINK_DISCONNECTED,
-    AUDIO_SINK_STREAM_STARTED,
-    AUDIO_SINK_STREAM_STOPPED,
-    AUDIO_SOURCE_CONNECTED, /* Not Implemented */
-    AUDIO_SOURCE_DISCONNECTED, /* Not Implemented */
-    BT_EVENTS_NUM_MAX,
-} BT_STACK_EVENT;
-
-typedef struct _ABF_BT_INFO {
-    ATHBT_FILTER_INFO              *pInfo;
-    A_MUTEX_OBJECT                  hWaitEventLock;
-    A_BOOL                          AdapterAvailable;
-    DBusConnection                 *Bus;
-    A_UINT8                         HCIVersion;
-    A_UINT16                        HCIRevision;
-    A_UINT8                         HCI_LMPVersion;
-    A_UINT16                        HCI_LMPSubVersion;
-    A_UINT8                         RemoteDevice[BD_ADDR_SIZE];
-    A_UINT8                         HCI_DeviceAddress[BD_ADDR_SIZE];
-    A_CHAR                          HCI_AdapterName[STRING_SIZE_MAX];
-    A_CHAR                          HCI_DeviceName[STRING_SIZE_MAX];
-    A_CHAR                          HCI_ManufacturerName[STRING_SIZE_MAX];
-    A_CHAR                          HCI_ProtocolVersion[STRING_SIZE_MAX];
-    A_BOOL                          AdapterCbRegistered;
-    A_CHAR                          DefaultAudioDeviceName[STRING_SIZE_MAX];
-    A_CHAR                          DefaultRemoteAudioDeviceAddress[32];
-    A_CHAR                          DefaultRemoteAudioDeviceVersion[32];
-    A_UINT8                         DefaultAudioDeviceLmpVersion;
-    A_BOOL                          DefaultAudioDeviceAvailable;
-    A_BOOL                          AudioCbRegistered;
-    A_UCHAR                         CurrentSCOLinkType;
-    int                             AdapterId;
-    int                             HCIEventListenerSocket;
-    A_TASK_HANDLE                   hBtHCIFilterThread;
-    A_BOOL                          HCIFilterThreadCreated;
-    A_BOOL                          HCIFilterThreadShutdown;
-    BT_EVENT_HANDLER                SignalHandlers[BT_EVENTS_NUM_MAX];
-    A_BOOL                          DefaultRemoteAudioDevicePropsValid;
-    A_BOOL                          ThreadCreated;
-    A_UINT32                        btInquiryState;
-} ABF_BT_INFO;
-
-#endif /*ABTFILT_BTSTACK_DBUS_H_*/
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus_glib.c b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus_glib.c
deleted file mode 100644 (file)
index c901836..0000000
+++ /dev/null
@@ -1,1855 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="abtfilt_bt.c" company="Atheros">
-//    Copyright (c) 2008 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// Author(s): ="Atheros"
-//==============================================================================
-
-/*
- * Bluetooth Filter - BT module
- *
- */
-static const char athId[] __attribute__ ((unused)) = "$Id: //depot/sw/releases/olca3.1-RC/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus_glib.c#1 $";
-
-#include "abtfilt_bluez_dbus_glib.h"
-
-#include <dbus/dbus-glib.h>
-#undef HCI_INQUIRY
-#include <bluetooth.h>
-#include <hci.h>
-#include <hci_lib.h>
-#include <sys/poll.h>
-
-/* Definitions */
-#define BLUEZ_NAME                        "org.bluez"
-#define BLUEZ_PATH                        "/org/bluez"
-#define ADAPTER_INTERFACE                 "org.bluez.Adapter"
-#define MANAGER_INTERFACE                 "org.bluez.Manager"
-#define AUDIO_MANAGER_PATH                "/org/bluez/audio"
-#define AUDIO_SINK_INTERFACE              "org.bluez.audio.Sink"
-#define AUDIO_SOURCE_INTERFACE            "org.bluez.audio.Source"
-#define AUDIO_MANAGER_INTERFACE           "org.bluez.audio.Manager"
-#define AUDIO_HEADSET_INTERFACE           "org.bluez.audio.Headset"
-#define AUDIO_GATEWAY_INTERFACE           "org.bluez.audio.Gateway"
-#define AUDIO_DEVICE_INTERFACE            "org.bluez.audio.Device"
-
-#define BTEV_GET_BT_CONN_LINK_TYPE(p)   ((p)[9])
-#define BTEV_GET_TRANS_INTERVAL(p)      ((p)[10])
-#define BTEV_GET_RETRANS_INTERVAL(p)    ((p)[11])
-#define BTEV_GET_RX_PKT_LEN(p)          ((A_UINT16)((p)[12]) | (((A_UINT16)((p)[13])) << 8))
-#define BTEV_GET_TX_PKT_LEN(p)          ((A_UINT16)((p)[14]) | (((A_UINT16)((p)[15])) << 8))
-#define BTEV_CMD_COMPLETE_GET_OPCODE(p) ((A_UINT16)((p)[1]) | (((A_UINT16)((p)[2])) << 8))          
-#define BTEV_CMD_COMPLETE_GET_STATUS(p) ((p)[3])
-
-typedef enum {
-    BT_ADAPTER_ADDED = 0,
-    BT_ADAPTER_REMOVED,
-    DEVICE_DISCOVERY_STARTED,
-    DEVICE_DISCOVERY_FINISHED,
-    REMOTE_DEVICE_CONNECTED,
-    REMOTE_DEVICE_DISCONNECTED,
-    AUDIO_DEVICE_ADDED,
-    AUDIO_DEVICE_REMOVED,
-    AUDIO_HEADSET_CONNECTED,
-    AUDIO_HEADSET_DISCONNECTED,
-    AUDIO_HEADSET_STREAM_STARTED,
-    AUDIO_HEADSET_STREAM_STOPPED,
-    AUDIO_GATEWAY_CONNECTED, /* Not Implemented */
-    AUDIO_GATEWAY_DISCONNECTED, /* Not Implemented */
-    AUDIO_SINK_CONNECTED,
-    AUDIO_SINK_DISCONNECTED,
-    AUDIO_SINK_STREAM_STARTED,
-    AUDIO_SINK_STREAM_STOPPED,
-    AUDIO_SOURCE_CONNECTED, /* Not Implemented */
-    AUDIO_SOURCE_DISCONNECTED, /* Not Implemented */
-    BT_EVENTS_NUM_MAX,
-} BT_STACK_EVENT;
-
-typedef enum {
-    PROXY_INVALID = 0,
-    DEVICE_MANAGER,
-    DEVICE_ADAPTER,
-    AUDIO_MANAGER,
-    AUDIO_HEADSET,
-    AUDIO_GATEWAY,
-    AUDIO_SOURCE,
-    AUDIO_SINK,
-} BT_PROXY_TYPE;
-
-typedef enum {
-    ARG_INVALID = 0,
-    ARG_NONE,
-    ARG_STRING,
-} BT_CB_TYPE;
-
-typedef struct _BT_NOTIFICATION_CONFIG_PARAMS {
-    const char        *name;
-    BT_PROXY_TYPE      proxy;
-    BT_CB_TYPE         arg;
-} BT_NOTIFICATION_CONFIG_PARAMS;
-
-static BT_NOTIFICATION_CONFIG_PARAMS g_NotificationConfig[BT_EVENTS_NUM_MAX] =
-{
-    /* BT_ADAPTER_ADDED */
-    {"AdapterAdded", DEVICE_MANAGER, ARG_STRING},
-    /* BT_ADAPTER_REMOVED */
-    {"AdapterRemoved", DEVICE_MANAGER, ARG_STRING},
-    /* DEVICE_DISCOVERY_STARTED */
-    {"DiscoveryStarted", DEVICE_ADAPTER, ARG_NONE},
-    /* DEVICE_DISCOVERY_FINISHED */
-    {"DiscoveryCompleted", DEVICE_ADAPTER, ARG_NONE},
-    /* REMOTE_DEVICE_CONNECTED */
-    {"RemoteDeviceConnected", DEVICE_ADAPTER, ARG_STRING},
-    /* REMOTE_DEVICE_DISCONNECTED */
-    {"RemoteDeviceDisconnected", DEVICE_ADAPTER, ARG_STRING},
-    /* AUDIO_DEVICE_ADDED */
-    {"DeviceCreated", AUDIO_MANAGER, ARG_STRING},
-    /* AUDIO_DEVICE_REMOVED */
-    {"DeviceRemoved", AUDIO_MANAGER, ARG_STRING},
-    /* AUDIO_HEADSET_CONNECTED */
-    {"Connected", AUDIO_HEADSET, ARG_NONE},
-    /* AUDIO_HEADSET_DISCONNECTED */
-    {"Disconnected", AUDIO_HEADSET, ARG_NONE},
-    /* AUDIO_HEADSET_STREAM_STARTED */
-    {"Playing", AUDIO_HEADSET, ARG_NONE},
-    /* AUDIO_HEADSET_STREAM_STOPPED */
-    {"Stopped", AUDIO_HEADSET, ARG_NONE},
-    /* AUDIO_GATEWAY_CONNECTED */
-    {NULL, PROXY_INVALID, ARG_INVALID},
-    /* AUDIO_GATEWAY_DISCONNECTED */
-    {NULL, PROXY_INVALID, ARG_INVALID},
-    /* AUDIO_SINK_CONNECTED */
-    {"Connected", AUDIO_SINK, ARG_NONE},
-    /* AUDIO_SINK_DISCONNECTED */
-    {"Disconnected", AUDIO_SINK, ARG_NONE},
-    /* AUDIO_SINK_STREAM_STARTED */
-    {"Playing", AUDIO_SINK, ARG_NONE},
-    /* AUDIO_SINK_STREAM_STOPPED */
-    {"Stopped", AUDIO_SINK, ARG_NONE},
-    /* AUDIO_SOURCE_CONNECTED */
-    {NULL, PROXY_INVALID, ARG_INVALID},
-    /* AUDIO_SOURCE_DISCONNECTED */
-    {NULL, PROXY_INVALID, ARG_INVALID},
-};
-
-typedef struct {
-        char *str;
-        unsigned int val;
-} hci_map;
-
-static const hci_map ver_map[] = {
-        { "1.0b",       0x00 },
-        { "1.1",        0x01 },
-        { "1.2",        0x02 },
-        { "2.0",        0x03 },
-        { "2.1",        0x04 },
-        { NULL }
-};
-
-/* Function Prototypes */
-static void BtAdapterAdded(DBusGProxy *proxy, const char *string, 
-                           gpointer user_data);
-static void BtAdapterRemoved(DBusGProxy *proxy, const char *string, 
-                             gpointer user_data);
-static A_STATUS AcquireBtAdapter(ABF_BT_INFO *pAbfBtInfo);
-static void ReleaseBTAdapter(ABF_BT_INFO *pAbfBtInfo);
-static void *BtEventThread(void *arg);
-static void RegisterBtStackEventCb(ABF_BT_INFO *pAbfBtInfo, 
-                                   BT_STACK_EVENT event, GCallback handler);
-static void DeRegisterBtStackEventCb(ABF_BT_INFO *pAbfBtInfo, 
-                                     BT_STACK_EVENT event, GCallback handler);
-static A_STATUS GetAdapterInfo(ABF_BT_INFO *pAbfBtInfo);
-static void RemoteDeviceDisconnected(DBusGProxy *proxy, const char *string, 
-                                     gpointer user_data);
-static void RemoteDeviceConnected(DBusGProxy *proxy, const char *string, 
-                                  gpointer user_data);
-static void AudioDeviceAdded(DBusGProxy *proxy, const char *string, 
-                             gpointer user_data);
-static void AudioDeviceRemoved(DBusGProxy *proxy, const char *string, 
-                               gpointer user_data);
-static void DeviceDiscoveryStarted(DBusGProxy *proxy, gpointer user_data);
-static void DeviceDiscoveryFinished(DBusGProxy *proxy, gpointer user_data);
-static void AudioHeadsetConnected(DBusGProxy *proxy, gpointer user_data);
-static void AudioHeadsetDisconnected(DBusGProxy *proxy, gpointer user_data);
-static void AudioHeadsetStreamStarted(DBusGProxy *proxy, gpointer user_data);
-static void AudioHeadsetStreamStopped(DBusGProxy *proxy, gpointer user_data);
-static void AudioGatewayConnected(DBusGProxy *proxy, gpointer user_data);
-static void AudioGatewayDisconnected(DBusGProxy *proxy, gpointer user_data);
-static void AudioSinkConnected(DBusGProxy *proxy, gpointer user_data);
-static void AudioSinkDisconnected(DBusGProxy *proxy, gpointer user_data);
-static void AudioSinkStreamStarted(DBusGProxy *proxy, gpointer user_data);
-static void AudioSinkStreamStopped(DBusGProxy *proxy, gpointer user_data);
-static void AudioSourceConnected(DBusGProxy *proxy, gpointer user_data);
-static void AudioSourceDisconnected(DBusGProxy *proxy, gpointer user_data);
-static A_STATUS CheckAndAcquireDefaultAdapter(ABF_BT_INFO *pAbfBtInfo);
-static void ReleaseDefaultAdapter(ABF_BT_INFO *pAbfBtInfo);
-static void AcquireDefaultAudioDevice(ABF_BT_INFO *pAbfBtInfo);
-static void ReleaseDefaultAudioDevice(ABF_BT_INFO *pAbfBtInfo);
-static void GetBtAudioConnectionProperties(ABF_BT_INFO              *pAbfBtInfo,
-                                           ATHBT_STATE_INDICATION   Indication);
-static A_STATUS SetupHciEventFilter(ABF_BT_INFO *pAbfBtInfo);
-static void CheckHciEventFilter(ABF_BT_INFO   *pAbfBtInfo);
-static A_STATUS IssueHCICommand(ABF_BT_INFO *pAbfBtInfo,
-                                A_UINT16    OpCode, 
-                                A_UCHAR     *pCmdData, 
-                                int         CmdLength,
-                                int         EventRecvTimeoutMS,
-                                A_UCHAR     *pEventBuffer,
-                                int         MaxLength,
-                                A_UCHAR     **ppEventPtr,
-                                int         *pEventLength);
-                                                                           
-/* APIs exported to other modules */
-A_STATUS
-Abf_BtStackNotificationInit(ATH_BT_FILTER_INSTANCE *pInstance, A_UINT32 Flags)
-{
-    A_STATUS status;
-    GMainLoop *mainloop;
-    ATHBT_FILTER_INFO *pInfo;
-    ABF_BT_INFO *pAbfBtInfo;
-
-    pInfo = (ATHBT_FILTER_INFO *)pInstance->pContext;
-    if (pInfo->pBtInfo) {
-        return A_OK;
-    }
-
-    pAbfBtInfo = (ABF_BT_INFO *)A_MALLOC(sizeof(ABF_BT_INFO));
-    A_MEMZERO(pAbfBtInfo,sizeof(ABF_BT_INFO));
-    
-    A_MUTEX_INIT(&pAbfBtInfo->hWaitEventLock);
-    A_COND_INIT(&pAbfBtInfo->hWaitEvent);
-    A_MEMZERO(pAbfBtInfo, sizeof(ABF_BT_INFO));
-
-    pAbfBtInfo->Flags = Flags;
-    
-    if (pAbfBtInfo->Flags & ABF_ENABLE_AFH_CHANNEL_CLASSIFICATION) {
-        A_INFO("AFH Classification Command will be issued on WLAN connect/disconnect \n");    
-    }
-    
-    /* Set up the main loop */
-    mainloop = g_main_loop_new(NULL, FALSE);
-    pAbfBtInfo->AdapterAvailable = FALSE;
-    pAbfBtInfo->Mainloop = mainloop;
-    pAbfBtInfo->Loop = TRUE;
-    pAbfBtInfo->pInfo = pInfo;
-    pAbfBtInfo->HCIEventListenerSocket = -1;
-    
-    /* Spawn a thread which will be used to process events from BT */
-    status = A_TASK_CREATE(&pInfo->hBtThread, BtEventThread, pAbfBtInfo);
-    if (A_FAILED(status)) {
-        A_ERR("[%s] Failed to spawn a BT thread\n", __FUNCTION__);
-        return A_ERROR;
-    }
-
-    pInfo->pBtInfo = pAbfBtInfo;
-    A_INFO("BT Stack Notification init complete\n");
-
-    return A_OK;
-}
-
-void
-Abf_BtStackNotificationDeInit(ATH_BT_FILTER_INSTANCE *pInstance)
-{
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pInstance->pContext;
-    ABF_BT_INFO *pAbfBtInfo = pInfo->pBtInfo;
-
-    if (!pAbfBtInfo) return;
-
-    if (pAbfBtInfo->Mainloop != NULL) {
-            /* Terminate and wait for the BT Event Handler task to finish */
-        A_MUTEX_LOCK(&pAbfBtInfo->hWaitEventLock);
-        if (pAbfBtInfo->Loop) {
-            pAbfBtInfo->Loop = FALSE;
-            A_COND_WAIT(&pAbfBtInfo->hWaitEvent, &pAbfBtInfo->hWaitEventLock, 
-                        WAITFOREVER);
-        }
-        A_MUTEX_UNLOCK(&pAbfBtInfo->hWaitEventLock);
-    }
-    
-    /* Flush all the BT actions from the filter core TODO */
-
-    /* Free the remaining resources */
-    g_main_loop_unref(pAbfBtInfo->Mainloop);
-    pAbfBtInfo->AdapterAvailable = FALSE;   
-    pInfo->pBtInfo = NULL;
-    A_MUTEX_DEINIT(&pAbfBtInfo->hWaitEventLock);
-    A_COND_DEINIT(&pAbfBtInfo->hWaitEvent);
-    A_MEMZERO(pAbfBtInfo, sizeof(ABF_BT_INFO));
-    A_FREE(pAbfBtInfo);
-
-    A_INFO("BT Stack Notification de-init complete\n");
-}
-
-/* Internal functions */
-
-static gboolean MainLoopQuitCheck(gpointer arg)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)arg;
-
-    /* this is the only way to end a glib main loop
-       without creating an external g_source, this check is periodically
-       made to check the shutdown flag  */
-    if (!pAbfBtInfo->Loop) {
-        g_main_loop_quit(pAbfBtInfo->Mainloop);
-        return FALSE;
-    }
-    
-        /* reschedule */
-    return TRUE;
-}
-
-static void *
-BtEventThread(void *arg)
-{
-    DBusGConnection *bus;
-    GError *error = NULL;
-    DBusGProxy *manager;
-    GLogLevelFlags fatal_mask;
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)arg;
-
-    A_INFO("Starting the BT Event Handler task\n");
-
-    g_type_init();
-
-    fatal_mask = g_log_set_always_fatal(G_LOG_FATAL_MASK);
-    fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
-    g_log_set_always_fatal(fatal_mask);
-
-    do {
-        bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
-        if (!bus) {
-            A_ERR("[%s] Couldn't connect to system bus: %d\n", 
-                  __FUNCTION__, error);
-            break;
-        }
-
-        pAbfBtInfo->Bus = bus;
-        manager = dbus_g_proxy_new_for_name(bus, BLUEZ_NAME, BLUEZ_PATH, 
-                                            MANAGER_INTERFACE);
-        if (!manager) {
-            A_ERR("[%s] Failed to get name owner\n", __FUNCTION__);
-            dbus_g_connection_unref(bus);
-            pAbfBtInfo->Bus = NULL;
-            break;
-        }
-        pAbfBtInfo->DeviceManager = manager;
-
-            /* check for default adapter at startup */
-        CheckAndAcquireDefaultAdapter(pAbfBtInfo);
-        
-        RegisterBtStackEventCb(pAbfBtInfo, BT_ADAPTER_ADDED, 
-                               G_CALLBACK(BtAdapterAdded));
-        RegisterBtStackEventCb(pAbfBtInfo, BT_ADAPTER_REMOVED, 
-                               G_CALLBACK(BtAdapterRemoved));     
-        g_timeout_add(1000, MainLoopQuitCheck, pAbfBtInfo);                       
-        g_main_loop_run(pAbfBtInfo->Mainloop);
-        
-        DeRegisterBtStackEventCb(pAbfBtInfo, BT_ADAPTER_ADDED, 
-                                 G_CALLBACK(BtAdapterAdded));
-        DeRegisterBtStackEventCb(pAbfBtInfo, BT_ADAPTER_REMOVED, 
-                                 G_CALLBACK(BtAdapterRemoved));
-        
-        ReleaseDefaultAdapter(pAbfBtInfo);
-        
-        g_object_unref(pAbfBtInfo->DeviceManager);
-        pAbfBtInfo->DeviceManager = NULL;
-        /* Release the system bus */
-        dbus_g_connection_unref(bus);
-        pAbfBtInfo->Bus = NULL;
-    } while (FALSE);
-
-    /* Clean up the resources allocated in this task */
-    A_INFO("Terminating the BT Event Handler task\n");
-    A_MUTEX_LOCK(&pAbfBtInfo->hWaitEventLock);
-    pAbfBtInfo->Loop = FALSE;
-    A_COND_SIGNAL(&pAbfBtInfo->hWaitEvent);
-    A_MUTEX_UNLOCK(&pAbfBtInfo->hWaitEventLock);
-
-    return NULL;
-}
-
-static A_STATUS
-CheckAndAcquireDefaultAdapter(ABF_BT_INFO *pAbfBtInfo)
-{
-    A_STATUS status = A_OK;
-    
-    do {
-        
-        if (pAbfBtInfo->AdapterAvailable) {
-                /* already available */
-            break;
-        }
-            
-            /* acquire the adapter */
-        status = AcquireBtAdapter(pAbfBtInfo);
-                
-    } while (FALSE);
-    
-    return status;
-}
-
-static void ReleaseDefaultAdapter(ABF_BT_INFO *pAbfBtInfo)
-{
-         
-    if (pAbfBtInfo->AdapterAvailable) {
-            /* Release the BT adapter */
-        ReleaseBTAdapter(pAbfBtInfo);
-        A_INFO("[%s] BT Adapter Removed\n",pAbfBtInfo->AdapterName);
-    }
-            
-    A_MEMZERO(pAbfBtInfo->AdapterName, sizeof(pAbfBtInfo->AdapterName));
-   
-}
-/* Event Notifications */
-static void
-BtAdapterAdded(DBusGProxy *proxy, const char *string, gpointer user_data)
-{
-    A_DEBUG("BtAdapterAdded Proxy Callback ... \n");
-    
-    /* BUG!!!, the BtAdapterAdded callback is indicated too early by the BT service, on some systems
-     * the method call to "DefaultAdapter" through the Manager interface will fail because no 
-     * default adapter exist yet even though this callback was indicated (there should be a default)
-     * 
-     * Workaround is to delay before acquiring the default adapter. 
-     * Acquiring the BT adapter should not be very infrequent though.
-     * 
-     * */
-    sleep(1);
-    CheckAndAcquireDefaultAdapter((ABF_BT_INFO *)user_data);
-}
-
-
-static void
-BtAdapterRemoved(DBusGProxy *proxy, const char *string, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-
-    A_DEBUG("BtAdapterRemoved Proxy Callback ... \n");
-    
-    if (!pAbfBtInfo->AdapterAvailable) return;
-
-    if (strcmp(string,pAbfBtInfo->AdapterName) == 0) {
-            /* the adapter we are watching has been removed */
-        ReleaseDefaultAdapter(pAbfBtInfo);
-    }
-
-}
-
-static void
-DeviceDiscoveryStarted(DBusGProxy *proxy, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Device Inquiry Started\n");
-    AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_ON);
-}
-
-static void
-DeviceDiscoveryFinished(DBusGProxy *proxy, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Device Inquiry Completed\n");
-    AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_OFF);
-}
-
-static void
-RemoteDeviceConnected(DBusGProxy *proxy, const char *string, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Device Connected: %s\n", string);
-    A_STR2ADDR(string, pAbfBtInfo->RemoteDevice);
-    AthBtIndicateState(pInstance, ATH_BT_CONNECT, STATE_ON);
-}
-
-static void
-RemoteDeviceDisconnected(DBusGProxy *proxy, const char *string, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Device Disconnected: %s\n", string);
-    A_MEMZERO(pAbfBtInfo->RemoteDevice, sizeof(pAbfBtInfo->RemoteDevice));
-    AthBtIndicateState(pInstance, ATH_BT_CONNECT, STATE_OFF);
-}
-
-static void ReleaseDefaultAudioDevice(ABF_BT_INFO *pAbfBtInfo)
-{
-        
-    if (pAbfBtInfo->AudioCbRegistered) {
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_CONNECTED, 
-                                 G_CALLBACK(AudioHeadsetConnected));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_DISCONNECTED, 
-                                 G_CALLBACK(AudioHeadsetDisconnected));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_STREAM_STARTED, 
-                                 G_CALLBACK(AudioHeadsetStreamStarted));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_STREAM_STOPPED, 
-                                 G_CALLBACK(AudioHeadsetStreamStopped));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_GATEWAY_CONNECTED, 
-                                 G_CALLBACK(AudioGatewayConnected));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_GATEWAY_DISCONNECTED, 
-                                 G_CALLBACK(AudioGatewayDisconnected));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_CONNECTED, 
-                                 G_CALLBACK(AudioSinkConnected));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_DISCONNECTED, 
-                                 G_CALLBACK(AudioSinkDisconnected));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_STREAM_STARTED, 
-                                 G_CALLBACK(AudioSinkStreamStarted));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_STREAM_STOPPED, 
-                                 G_CALLBACK(AudioSinkStreamStopped));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SOURCE_CONNECTED, 
-                                 G_CALLBACK(AudioSourceConnected));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_SOURCE_DISCONNECTED, 
-                                 G_CALLBACK(AudioSourceDisconnected));
-        pAbfBtInfo->AudioCbRegistered = FALSE;
-    }
-
-    if (pAbfBtInfo->AudioHeadset != NULL) {
-        g_object_unref(pAbfBtInfo->AudioHeadset);
-        pAbfBtInfo->AudioHeadset = NULL;
-    }
-
-    if (pAbfBtInfo->AudioGateway != NULL) {
-        g_object_unref(pAbfBtInfo->AudioGateway);
-        pAbfBtInfo->AudioGateway = NULL;
-    }
-    
-    if (pAbfBtInfo->AudioSource != NULL) {
-        g_object_unref(pAbfBtInfo->AudioSource);
-        pAbfBtInfo->AudioSource = NULL;
-    }
-    
-    if (pAbfBtInfo->AudioSink != NULL) {
-        g_object_unref(pAbfBtInfo->AudioSink);
-        pAbfBtInfo->AudioSink = NULL;
-    }
-    
-    if (pAbfBtInfo->AudioDevice != NULL) {
-        g_object_unref(pAbfBtInfo->AudioDevice);
-        pAbfBtInfo->AudioDevice = NULL;
-    }
-    
-    if (pAbfBtInfo->DefaultAudioDeviceAvailable) {
-        pAbfBtInfo->DefaultAudioDeviceAvailable = FALSE;
-        A_DEBUG("Default Audio Device Removed: %s\n", pAbfBtInfo->DefaultAudioDeviceName);
-        A_MEMZERO(pAbfBtInfo->DefaultAudioDeviceName,sizeof(pAbfBtInfo->DefaultAudioDeviceName));
-    }
-    
-}
-
-static void AcquireDefaultAudioDevice(ABF_BT_INFO *pAbfBtInfo)
-{
-    A_BOOL          success = FALSE;
-    char            *audioDevice;
-    GError          *error = NULL;
-    
-    do {
-        
-        if (pAbfBtInfo->DefaultAudioDeviceAvailable) {
-                /* already acquired */
-            success = TRUE;
-            break;    
-        }
-        
-        A_INFO("Checking for a default audio device .. \n");
-             
-        if (!dbus_g_proxy_call(pAbfBtInfo->AudioManager, 
-                               "DefaultDevice", 
-                               &error, 
-                               G_TYPE_INVALID, 
-                               G_TYPE_STRING, 
-                               &audioDevice, 
-                               G_TYPE_INVALID)) {
-            A_ERR("[%s] DefaultDevice method call failed \n", __FUNCTION__);
-            break;                     
-        }
-        
-        if (error != NULL) {
-            A_ERR("[%s] Failed to get default audio device: %s \n", __FUNCTION__, error->message);
-            g_free(error);
-            break;    
-        }
-                
-        strncpy(pAbfBtInfo->DefaultAudioDeviceName, 
-                audioDevice, 
-                sizeof(pAbfBtInfo->DefaultAudioDeviceName));
-        
-        g_free(audioDevice);
-       
-        A_INFO("Default Audio Device: %s \n", pAbfBtInfo->DefaultAudioDeviceName);
-        
-        pAbfBtInfo->DefaultAudioDeviceAvailable = TRUE;
-        
-        /* get various proxies for the audio device */
-                               
-        pAbfBtInfo->AudioHeadset = dbus_g_proxy_new_for_name(pAbfBtInfo->Bus, 
-                                                             BLUEZ_NAME, 
-                                                             pAbfBtInfo->DefaultAudioDeviceName, 
-                                                             AUDIO_HEADSET_INTERFACE);
-        if (NULL == pAbfBtInfo->AudioHeadset) {
-            A_ERR("[%s] Failed to get audio headset interface \n", __FUNCTION__);
-            break;    
-        }
-        
-        pAbfBtInfo->AudioGateway = dbus_g_proxy_new_for_name(pAbfBtInfo->Bus, 
-                                                             BLUEZ_NAME, 
-                                                             pAbfBtInfo->DefaultAudioDeviceName, 
-                                                             AUDIO_GATEWAY_INTERFACE);
-        if (NULL == pAbfBtInfo->AudioGateway) {
-            A_ERR("[%s] Failed to get audio gateway interface \n", __FUNCTION__);
-            break;    
-        }
-        
-        pAbfBtInfo->AudioSource = dbus_g_proxy_new_for_name(pAbfBtInfo->Bus, 
-                                                            BLUEZ_NAME, 
-                                                            pAbfBtInfo->DefaultAudioDeviceName, 
-                                                            AUDIO_SOURCE_INTERFACE);
-                                                            
-        if (NULL == pAbfBtInfo->AudioSource) {
-            A_ERR("[%s] Failed to get audio source interface \n", __FUNCTION__);
-            break;    
-        }
-           
-        pAbfBtInfo->AudioSink = dbus_g_proxy_new_for_name(pAbfBtInfo->Bus, 
-                                                          BLUEZ_NAME, 
-                                                          pAbfBtInfo->DefaultAudioDeviceName, 
-                                                          AUDIO_SINK_INTERFACE);
-
-        if (NULL == pAbfBtInfo->AudioSink) {
-            A_ERR("[%s] Failed to get audio sink interface \n", __FUNCTION__);
-            break;    
-        }
-        
-        pAbfBtInfo->AudioDevice = dbus_g_proxy_new_for_name(pAbfBtInfo->Bus, 
-                                                            BLUEZ_NAME, 
-                                                            pAbfBtInfo->DefaultAudioDeviceName, 
-                                                            AUDIO_DEVICE_INTERFACE);
-
-        if (NULL == pAbfBtInfo->AudioDevice) {
-            A_ERR("[%s] Failed to get audio device interface \n", __FUNCTION__);
-            break;    
-        }
-            /* Register for audio specific events */
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_CONNECTED, 
-                               G_CALLBACK(AudioHeadsetConnected));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_DISCONNECTED, 
-                               G_CALLBACK(AudioHeadsetDisconnected));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_STREAM_STARTED, 
-                               G_CALLBACK(AudioHeadsetStreamStarted));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_HEADSET_STREAM_STOPPED, 
-                               G_CALLBACK(AudioHeadsetStreamStopped));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_GATEWAY_CONNECTED, 
-                               G_CALLBACK(AudioGatewayConnected));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_GATEWAY_DISCONNECTED, 
-                               G_CALLBACK(AudioGatewayDisconnected));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_CONNECTED,
-                               G_CALLBACK(AudioSinkConnected));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_DISCONNECTED, 
-                               G_CALLBACK(AudioSinkDisconnected));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_STREAM_STARTED,
-                               G_CALLBACK(AudioSinkStreamStarted));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SINK_STREAM_STOPPED, 
-                               G_CALLBACK(AudioSinkStreamStopped));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SOURCE_CONNECTED, 
-                               G_CALLBACK(AudioSourceConnected));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_SOURCE_DISCONNECTED, 
-                               G_CALLBACK(AudioSourceDisconnected));
-                               
-        pAbfBtInfo->AudioCbRegistered = TRUE;
-        
-        success = TRUE;
-        
-    } while (FALSE);
-    
-    if (!success) {
-            /* cleanup */
-        ReleaseDefaultAudioDevice(pAbfBtInfo);       
-    }
-}
-
-static void
-AudioDeviceAdded(DBusGProxy *proxy, const char *string, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    
-    A_DEBUG("Audio Device Added: %s\n", string);
-        /* release current one if any */
-    ReleaseDefaultAudioDevice(pAbfBtInfo);
-        /* re-acquire the new default, it could be the same one */
-    AcquireDefaultAudioDevice(pAbfBtInfo);    
-    
-}
-
-static void
-AudioDeviceRemoved(DBusGProxy *proxy, const char *string, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-
-    A_DEBUG("Audio Device Removed: %s\n", string);
-    
-    if (strcmp(string,pAbfBtInfo->DefaultAudioDeviceName) == 0) {
-            /* release current one  */
-        ReleaseDefaultAudioDevice(pAbfBtInfo);
-            /* re-acquire the new default (if any) */
-        AcquireDefaultAudioDevice(pAbfBtInfo);        
-    }
-    
-}
-
-static void
-AudioHeadsetConnected(DBusGProxy *proxy, gpointer user_data)
-{
-    A_DEBUG("Audio Headset Connected\n");
-}
-
-static void
-AudioHeadsetDisconnected(DBusGProxy *proxy, gpointer user_data)
-{
-    A_DEBUG("Audio Headset Disconnected\n");
-}
-
-static void
-AudioHeadsetStreamStarted(DBusGProxy *proxy, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-    
-    A_DEBUG("Audio Headset Stream Started\n");   
-        /* get properties of this headset connection */
-    GetBtAudioConnectionProperties(pAbfBtInfo, ATH_BT_SCO);
-        /* make the indication */
-    AthBtIndicateState(pInstance, 
-                       pAbfBtInfo->CurrentSCOLinkType == SCO_LINK ? ATH_BT_SCO : ATH_BT_ESCO, 
-                       STATE_ON);
-}
-
-static void
-AudioHeadsetStreamStopped(DBusGProxy *proxy, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-    
-        /* This event can also be used to indicate the SCO state */
-    A_DEBUG("Audio Headset Stream Stopped\n");
-    AthBtIndicateState(pInstance, 
-                       pAbfBtInfo->CurrentSCOLinkType == SCO_LINK ? ATH_BT_SCO : ATH_BT_ESCO, 
-                       STATE_OFF);
-}
-
-static void
-AudioGatewayConnected(DBusGProxy *proxy, gpointer user_data)
-{
-    /* Not yet implemented */
-    A_DEBUG("Audio Gateway Connected\n");
-}
-
-static void
-AudioGatewayDisconnected(DBusGProxy *proxy, gpointer user_data)
-{
-    /* Not yet implemented */
-    A_DEBUG("Audio Gateway disconnected\n");
-}
-
-static void
-AudioSinkConnected(DBusGProxy *proxy, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    A_DEBUG("Audio Sink Connected\n");    
-        /* get connection properties */
-    GetBtAudioConnectionProperties(pAbfBtInfo, ATH_BT_A2DP);
-}
-
-static void
-AudioSinkDisconnected(DBusGProxy *proxy, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Audio Sink Disconnected\n");
-    AthBtIndicateState(pInstance, ATH_BT_A2DP, STATE_OFF);
-}
-
-static void
-AudioSinkStreamStarted(DBusGProxy *proxy, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-    A_DEBUG("Audio Sink Stream Started\n");
-    
-    AthBtIndicateState(pInstance, ATH_BT_A2DP, STATE_ON);
-}
-
-static void
-AudioSinkStreamStopped(DBusGProxy *proxy, gpointer user_data)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)user_data;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    A_DEBUG("Audio Sink Stream Stopped\n");
-    AthBtIndicateState(pInstance, ATH_BT_A2DP, STATE_OFF);   
-}
-
-static void
-AudioSourceConnected(DBusGProxy *proxy, gpointer user_data)
-{
-    /* Not yet implemented */
-    A_DEBUG("Audio Source Connected\n");
-}
-
-static void
-AudioSourceDisconnected(DBusGProxy *proxy, gpointer user_data)
-{
-    /* Not yet implemented */
-    A_DEBUG("Audio Source Disconnected\n");
-}
-
-/* (De)Registration */
-static DBusGProxy *
-GetDBusProxy(ABF_BT_INFO *pAbfBtInfo, BT_STACK_EVENT event)
-{
-    DBusGProxy *proxy = NULL;
-    BT_NOTIFICATION_CONFIG_PARAMS *pNotificationConfig;
-
-    pNotificationConfig = &g_NotificationConfig[event];
-    if (pNotificationConfig->proxy == DEVICE_MANAGER) {
-        proxy = pAbfBtInfo->DeviceManager;
-    } else if (pNotificationConfig->proxy == DEVICE_ADAPTER) {
-        proxy = pAbfBtInfo->DeviceAdapter;
-    } else if (pNotificationConfig->proxy == AUDIO_MANAGER) {
-        proxy = pAbfBtInfo->AudioManager;
-    } else if (pNotificationConfig->proxy == AUDIO_HEADSET) {
-        proxy = pAbfBtInfo->AudioHeadset;
-    } else if (pNotificationConfig->proxy == AUDIO_SINK) {
-        proxy = pAbfBtInfo->AudioSink;
-    } else {
-        A_ERR("[%s] Unknown proxy %d for event : %d \n", __FUNCTION__, pNotificationConfig->proxy, event);    
-    }
-
-    return proxy;
-}
-
-static void
-RegisterBtStackEventCb(ABF_BT_INFO *pAbfBtInfo, BT_STACK_EVENT event, 
-                       GCallback handler)
-{
-    const char *name;
-    DBusGProxy *proxy;
-    BT_NOTIFICATION_CONFIG_PARAMS *pNotificationConfig;
-
-    pNotificationConfig = &g_NotificationConfig[event];
-    name = pNotificationConfig->name;
-
-    if (event >= BT_EVENTS_NUM_MAX) {
-        A_ERR("[%s] Unknown Event: %d\n", __FUNCTION__, event);
-        return;
-    }
-
-    if (pNotificationConfig->proxy == PROXY_INVALID) {
-            /* not supported yet, so ignore registration */
-        return;    
-    }
-    
-    if ((proxy = GetDBusProxy(pAbfBtInfo, event)) == NULL) {
-        A_ERR("[%s] Unknown Proxy: %d (event:%d) \n", __FUNCTION__, 
-              pNotificationConfig->proxy, event);
-        return;
-    }
-
-    if (pNotificationConfig->arg == ARG_NONE) {
-        dbus_g_proxy_add_signal(proxy, name, G_TYPE_INVALID);
-    } else if (pNotificationConfig->arg == ARG_STRING) {
-        dbus_g_proxy_add_signal(proxy, name, G_TYPE_STRING, 
-                                G_TYPE_INVALID);
-    } else {
-        A_ERR("[%s] Unkown Arg Type: %d\n", __FUNCTION__, 
-              pNotificationConfig->arg);
-        return;
-    }
-
-    dbus_g_proxy_connect_signal(proxy, name, handler, (void *)pAbfBtInfo, 
-                                NULL);
-}
-
-static void
-DeRegisterBtStackEventCb(ABF_BT_INFO *pAbfBtInfo, BT_STACK_EVENT event, 
-                         GCallback handler)
-{
-    const char *name;
-    DBusGProxy *proxy;
-    BT_NOTIFICATION_CONFIG_PARAMS *pNotificationConfig;
-
-    pNotificationConfig = &g_NotificationConfig[event];
-    name = pNotificationConfig->name;
-
-    if (event >= BT_EVENTS_NUM_MAX) {
-        A_ERR("[%s] Unknown Event: %d\n", __FUNCTION__, event);
-        return;
-    }
-
-    if (pNotificationConfig->proxy == PROXY_INVALID) {
-            /* not supported yet, so ignore de-registration */
-        return;    
-    }
-    
-    if ((proxy = GetDBusProxy(pAbfBtInfo, event)) == NULL) {
-        A_ERR("[%s] Unknown Proxy: %d\n", __FUNCTION__, 
-              pNotificationConfig->proxy);
-        return;
-    }
-
-    dbus_g_proxy_disconnect_signal(proxy, name, handler, (void *)pAbfBtInfo);
-}
-
-/* Misc */
-static A_STATUS
-AcquireBtAdapter(ABF_BT_INFO *pAbfBtInfo)
-{
-    DBusGProxy *DeviceAdapter, *AudioManager;
-    DBusGConnection *bus = pAbfBtInfo->Bus;
-    A_STATUS        status = A_ERROR;
-    char            *adapterName;
-    GError          *error = NULL;
-    char            *hciName;
-    
-    do {
-                
-        if (!dbus_g_proxy_call(pAbfBtInfo->DeviceManager, 
-                               "DefaultAdapter", 
-                               &error, 
-                               G_TYPE_INVALID, 
-                               G_TYPE_STRING, 
-                               &adapterName, 
-                               G_TYPE_INVALID)) {
-            A_ERR("[%s] DefaultAdapter Method call failure \n", __FUNCTION__);
-            break;                     
-        }
-        
-        if (error != NULL) {
-            A_ERR("[%s] Failed to get default adapter: %s \n", __FUNCTION__, error->message);
-            g_free(error);
-            break;    
-        }
-        
-        strcpy(pAbfBtInfo->AdapterName, adapterName);   
-            
-            /* assume ID 0 */
-        pAbfBtInfo->AdapterId = 0;
-        
-        if ((hciName = strstr(pAbfBtInfo->AdapterName, "hci")) != NULL) {
-                /* get the number following the hci name, this is the ID used for
-                 * socket calls to the HCI layer */
-            pAbfBtInfo->AdapterId = (int)hciName[3] - (int)'0';
-            if (pAbfBtInfo->AdapterId < 0) {
-                pAbfBtInfo->AdapterId = 0;   
-            }
-        }
-        
-        if (!A_SUCCESS(SetupHciEventFilter(pAbfBtInfo))) {
-            break;    
-        }
-        
-        g_free(adapterName);
-               
-        DeviceAdapter = dbus_g_proxy_new_for_name(bus, BLUEZ_NAME,
-                                                  pAbfBtInfo->AdapterName, 
-                                                  ADAPTER_INTERFACE);
-        if (!DeviceAdapter) {
-            A_ERR("[%s] Failed to get device adapter (%s) \n", __FUNCTION__, pAbfBtInfo->AdapterName);
-            break;
-        }
-    
-        AudioManager = dbus_g_proxy_new_for_name(bus, BLUEZ_NAME, 
-                                                 AUDIO_MANAGER_PATH, 
-                                                 AUDIO_MANAGER_INTERFACE);
-        if (!AudioManager) {
-            A_ERR("[%s] Failed to get name owner\n", __FUNCTION__);
-            break;
-        }
-    
-        pAbfBtInfo->DeviceAdapter = DeviceAdapter;
-        pAbfBtInfo->AudioManager = AudioManager;
-    
-        GetAdapterInfo(pAbfBtInfo);
-        
-        pAbfBtInfo->pInfo->LMPVersion = pAbfBtInfo->LMPVersion;
-        pAbfBtInfo->AdapterAvailable = TRUE;
-    
-        /* Register to get notified of different stack events */
-        RegisterBtStackEventCb(pAbfBtInfo, DEVICE_DISCOVERY_STARTED, 
-                               G_CALLBACK(DeviceDiscoveryStarted));
-        RegisterBtStackEventCb(pAbfBtInfo, DEVICE_DISCOVERY_FINISHED, 
-                               G_CALLBACK(DeviceDiscoveryFinished));
-        RegisterBtStackEventCb(pAbfBtInfo, REMOTE_DEVICE_CONNECTED, 
-                               G_CALLBACK(RemoteDeviceConnected));
-        RegisterBtStackEventCb(pAbfBtInfo, REMOTE_DEVICE_DISCONNECTED, 
-                               G_CALLBACK(RemoteDeviceDisconnected));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_DEVICE_ADDED, 
-                               G_CALLBACK(AudioDeviceAdded));
-        RegisterBtStackEventCb(pAbfBtInfo, AUDIO_DEVICE_REMOVED, 
-                               G_CALLBACK(AudioDeviceRemoved));
-
-        pAbfBtInfo->AdapterCbRegistered = TRUE;
-        
-        A_INFO("[%s] BT Adapter Added\n",pAbfBtInfo->AdapterName);
-        
-            /* acquire default audio device */
-        AcquireDefaultAudioDevice(pAbfBtInfo);
-    
-    
-        status = A_OK;
-        
-    } while (FALSE);
-    
-    return status;
-}
-
-static void
-ReleaseBTAdapter(ABF_BT_INFO *pAbfBtInfo)
-{
-    
-    if (pAbfBtInfo->AdapterCbRegistered) {
-        pAbfBtInfo->AdapterCbRegistered = FALSE;
-            /* Free the resources held for the event handlers */
-        DeRegisterBtStackEventCb(pAbfBtInfo, DEVICE_DISCOVERY_STARTED, 
-                                 G_CALLBACK(DeviceDiscoveryStarted));
-        DeRegisterBtStackEventCb(pAbfBtInfo, DEVICE_DISCOVERY_FINISHED, 
-                                 G_CALLBACK(DeviceDiscoveryFinished));
-        DeRegisterBtStackEventCb(pAbfBtInfo, REMOTE_DEVICE_CONNECTED, 
-                                 G_CALLBACK(RemoteDeviceConnected));
-        DeRegisterBtStackEventCb(pAbfBtInfo, REMOTE_DEVICE_DISCONNECTED, 
-                                 G_CALLBACK(RemoteDeviceDisconnected));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_DEVICE_ADDED, 
-                                 G_CALLBACK(AudioDeviceAdded));
-        DeRegisterBtStackEventCb(pAbfBtInfo, AUDIO_DEVICE_REMOVED, 
-                                 G_CALLBACK(AudioDeviceRemoved));    
-    }
-   
-    ReleaseDefaultAudioDevice(pAbfBtInfo);
-    
-    if (pAbfBtInfo->HCIEventListenerSocket >= 0) {
-        close(pAbfBtInfo->HCIEventListenerSocket);
-        pAbfBtInfo->HCIEventListenerSocket = -1;    
-    }
-    
-    if (pAbfBtInfo->AudioManager != NULL) {
-        g_object_unref(pAbfBtInfo->AudioManager);
-        pAbfBtInfo->AudioManager = NULL;
-    }
-    
-    A_MEMZERO(pAbfBtInfo->DeviceAddress, 
-              sizeof(pAbfBtInfo->DeviceAddress));
-    A_MEMZERO(pAbfBtInfo->DeviceName, 
-              sizeof(pAbfBtInfo->DeviceName));
-    A_MEMZERO(pAbfBtInfo->ManufacturerName, 
-              sizeof(pAbfBtInfo->ManufacturerName));
-    A_MEMZERO(pAbfBtInfo->ProtocolVersion, 
-              sizeof(pAbfBtInfo->ProtocolVersion));
-    pAbfBtInfo->LMPVersion = 0;
-
-    if (pAbfBtInfo->DeviceAdapter != NULL) {
-        g_object_unref(pAbfBtInfo->DeviceAdapter);
-        pAbfBtInfo->DeviceAdapter = NULL;
-    }
-    pAbfBtInfo->AdapterAvailable = FALSE;
-}
-
-static A_STATUS
-GetAdapterInfo(ABF_BT_INFO *pAbfBtInfo)
-{
-    int count;
-    char *reply;
-    GError *error = NULL;
-    DBusGProxy *DeviceAdapter;
-
-    if ((DeviceAdapter = pAbfBtInfo->DeviceAdapter) == NULL) return A_ERROR;
-
-    /* Device name */
-    if (!dbus_g_proxy_call(DeviceAdapter, "GetName", &error, G_TYPE_INVALID, 
-                           G_TYPE_STRING, &reply, G_TYPE_INVALID))
-    {
-        A_ERR("[%s] Failed to complete GetName: %d\n", __FUNCTION__, error);
-        return A_ERROR;
-    }
-    strcpy(pAbfBtInfo->DeviceName, reply);
-    g_free(reply);
-
-    /* Manufacturer name */
-    if (!dbus_g_proxy_call(DeviceAdapter, "GetManufacturer", &error, 
-                           G_TYPE_INVALID, G_TYPE_STRING, &reply, 
-                           G_TYPE_INVALID)) 
-    {
-        A_ERR("[%s] Failed to complete GetManufacturer: %d\n", 
-              __FUNCTION__, error);
-        return A_ERROR;
-    }
-    strcpy(pAbfBtInfo->ManufacturerName, reply);
-    g_free(reply);
-
-    /* Bluetooth protocol Version */
-    if (!dbus_g_proxy_call(DeviceAdapter, "GetVersion", &error, G_TYPE_INVALID, 
-                           G_TYPE_STRING, &reply, G_TYPE_INVALID))
-    {
-        A_ERR("[%s] Failed to complete GetVersion: %d\n", __FUNCTION__, error);
-        return A_ERROR;
-    }
-    strcpy(pAbfBtInfo->ProtocolVersion, reply);
-    for (count = 0; 
-         ((count < sizeof(ver_map)/sizeof(hci_map)) && (ver_map[count].str)); 
-         count++)
-    {
-        if (strstr(pAbfBtInfo->ProtocolVersion, ver_map[count].str)) {
-            pAbfBtInfo->LMPVersion = ver_map[count].val;
-            break;
-        }
-    }
-    g_free(reply);
-
-    /* Device address */
-    if (!dbus_g_proxy_call(DeviceAdapter, "GetAddress", &error, G_TYPE_INVALID, 
-                           G_TYPE_STRING, &reply, G_TYPE_INVALID))
-    {
-        A_ERR("[%s] Failed to complete GetAddress: %d\n", __FUNCTION__, error);
-        return A_ERROR;
-    }
-    A_STR2ADDR(reply, pAbfBtInfo->DeviceAddress);
-    g_free(reply);
-
-    A_INFO("BT-HCI Device Address: (%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X)\n", 
-           pAbfBtInfo->DeviceAddress[0], pAbfBtInfo->DeviceAddress[1], 
-           pAbfBtInfo->DeviceAddress[2], pAbfBtInfo->DeviceAddress[3], 
-           pAbfBtInfo->DeviceAddress[4], pAbfBtInfo->DeviceAddress[5]);
-    A_INFO("BT-HCI Device Name: %s\n", pAbfBtInfo->DeviceName);
-    A_INFO("BT-HCI Manufacturer Name: %s\n", pAbfBtInfo->ManufacturerName);
-    A_INFO("BT-HCI Protocol Version: %s\n", pAbfBtInfo->ProtocolVersion);
-    A_INFO("BT-HCI LMP Version: %d\n", pAbfBtInfo->LMPVersion);
-
-    return A_OK;
-}
-
-#define ABTH_MAX_CONNECTIONS 16
-
-static A_STATUS GetConnectedDeviceRole(ABF_BT_INFO   *pAbfBtInfo,
-                                       A_CHAR        *Address,
-                                       A_BOOL        IsSCO,
-                                       A_UCHAR       *pRole)
-{
-    A_STATUS                    status = A_ERROR;
-    struct hci_conn_list_req    *connList = NULL;
-    struct hci_conn_info        *connInfo = NULL;
-    int                         i, sk = -1;
-    int                         len;
-
-    do {
-        
-        sk = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-        
-        if (sk < 0) {
-            A_ERR("[%s] Failed to get raw BT socket: %d \n", __FUNCTION__, errno);
-            break;    
-        }
-        
-        len = (sizeof(*connInfo)) * ABTH_MAX_CONNECTIONS + sizeof(*connList);
-        
-        connList = (struct hci_conn_list_req *)A_MALLOC(len);
-        
-        if (connList == NULL) {
-            break;    
-        }
-        
-        A_MEMZERO(connList,len);
-                
-        connList->dev_id = pAbfBtInfo->AdapterId;
-        connList->conn_num = ABTH_MAX_CONNECTIONS;
-        connInfo = connList->conn_info;
-    
-        if (ioctl(sk, HCIGETCONNLIST, (void *)connList)) {
-            A_ERR("[%s] Failed to get connection list %d \n", __FUNCTION__, errno);
-            break;
-        }
-    
-            /* walk through connection list */
-        for (i = 0; i < connList->conn_num; i++, connInfo++) {
-            char addr[32];
-            
-                /* convert to a string to compare */
-            ba2str(&connInfo->bdaddr, addr);
-            
-            if (strcmp(addr,Address) != 0) {
-                continue;    
-            }
-            
-            if (IsSCO) {
-                    /* look for first non-ACL connection */
-                if (connInfo->type == ACL_LINK) {
-                    continue;    
-                }    
-                pAbfBtInfo->CurrentSCOLinkType = connInfo->type;    
-                
-            } else {
-                    /* look for first ACL connection */
-                if (connInfo->type != ACL_LINK) {
-                    continue;    
-                }   
-            }
-          
-            /* if we get here we have a connection we are interested in */
-            if (connInfo->link_mode & HCI_LM_MASTER) {
-                    /* master */
-                *pRole = 0;
-            }  else {
-                    /* slave */
-                *pRole = 1;    
-            }    
-             
-            A_INFO("[%s] Found Connection (Link-Type : %d), found role:%d \n", 
-                    Address, connInfo->type, *pRole);  
-            break;
-        }
-        
-        if (i == connList->conn_num) {
-            A_ERR("[%s] Could not find connection info for %s %d \n", __FUNCTION__, Address);
-            break;    
-        }
-        
-        status = A_OK;
-        
-    } while (FALSE);
-    
-    if (sk >= 0) {
-        close(sk);    
-    }
-    
-    if (connList != NULL) {
-        A_FREE(connList);    
-    }
-    
-    return status;
-}
-
-static void GetBtAudioConnectionProperties(ABF_BT_INFO              *pAbfBtInfo,
-                                           ATHBT_STATE_INDICATION   Indication)
-{
-    A_UCHAR     role = 0;
-    A_UCHAR     lmpversion = 0;
-    A_CHAR      *pDescr = NULL;
-    char        *address = NULL;
-    char        *version = NULL;
-    GError      *error = NULL;
-    A_STATUS    status;
-    
-    do {
-       
-            /* get remote device address */                        
-        if (!dbus_g_proxy_call(pAbfBtInfo->AudioDevice, 
-                               "GetAddress", 
-                               &error, 
-                               G_TYPE_INVALID, 
-                               G_TYPE_STRING, 
-                               &address, 
-                               G_TYPE_INVALID)) {
-            A_ERR("[%s] GetAddress method call failed \n", __FUNCTION__);
-            break;                     
-        }
-        
-        if (error != NULL) {
-            A_ERR("[%s] Failed to GetAddress for audio device: %s \n", __FUNCTION__, error->message);
-            g_free(error);
-            break;    
-        }
-        
-        A_INFO("Connected audio device address: %s  \n", address);
-        
-        if (!dbus_g_proxy_call(pAbfBtInfo->DeviceAdapter, 
-                               "GetRemoteVersion", 
-                               &error, 
-                               G_TYPE_STRING,
-                               address,
-                               G_TYPE_INVALID, 
-                               G_TYPE_STRING, 
-                               &version, 
-                               G_TYPE_INVALID)) {
-            A_ERR("[%s] GetRemoteVersion method call failed \n", __FUNCTION__);
-            break;                     
-        }
-        
-        if (error != NULL) {
-            A_ERR("[%s] Failed to GetRemoteVersion for audio device: %s \n", __FUNCTION__, error->message);
-            g_free(error);
-            break;    
-        }
-        
-        A_INFO("Connected audio device remote version: %s \n", version);
-
-            /* assume 2.1 or later */
-        lmpversion = 4;       
-            
-        if (strstr(version,"1.0") != NULL) {
-            lmpversion = 0;    
-        } else if (strstr(version,"1.1") != NULL) {
-            lmpversion = 1;
-        } else if (strstr(version,"1.2") != NULL) {
-            lmpversion = 2;
-        } else if (strstr(version,"2.0") != NULL) {
-            lmpversion = 3;    
-        }
-           
-            /* get role */     
-        status = GetConnectedDeviceRole(pAbfBtInfo, 
-                                        address, 
-                                        Indication == ATH_BT_A2DP ? FALSE : TRUE,
-                                        &role);
-        
-        if (A_FAILED(status)) {
-            role = 0;    
-        }
-                                       
-        if (Indication == ATH_BT_A2DP) {
-            pDescr = "A2DP";  
-            pAbfBtInfo->pInfo->A2DPConnection_LMPVersion = lmpversion;
-            pAbfBtInfo->pInfo->A2DPConnection_Role = role;            
-        } else if (Indication == ATH_BT_SCO) {
-            if (pAbfBtInfo->CurrentSCOLinkType == SCO_LINK) {
-                pDescr = "SCO";
-            } else {
-                pDescr = "eSCO";
-            }
-            pAbfBtInfo->pInfo->SCOConnection_LMPVersion = lmpversion;
-            pAbfBtInfo->pInfo->SCOConnection_Role = role;
-            
-                /* for SCO connections check if the event filter captured 
-                 * the SYNCH connection complete event */
-            CheckHciEventFilter(pAbfBtInfo);
-            
-        } else {
-            pDescr = "UNKNOWN!!";    
-        }
-                
-        A_INFO("BT Audio connection properties:  (%s) (role: %s, lmp version: %d) \n", 
-               pDescr, role ? "SLAVE" : "MASTER", lmpversion);
-                
-    } while (FALSE);
-                                       
-    if (address != NULL) {
-        g_free(address);    
-    }
-    
-    if (version != NULL) {
-        g_free(version);    
-    }
-    
-}
-
-
-static A_STATUS WaitForHCIEvent(int         Socket, 
-                                int         TimeoutMs, 
-                                A_UCHAR     *pBuffer,
-                                int         MaxLength,
-                                A_UCHAR     EventCode, 
-                                A_UINT16    OpCode,
-                                A_UCHAR     **ppEventPtr,
-                                int         *pEventLength)
-{
-    
-    int                     eventLen;
-    hci_event_hdr           *eventHdr;
-    struct pollfd           pfd;
-    int                     result;
-    A_UCHAR                 *eventPtr; 
-    A_STATUS                status = A_OK;
-    
-    *ppEventPtr = NULL;
-    A_MEMZERO(&pfd,sizeof(pfd));
-    pfd.fd = Socket; 
-    pfd.events = POLLIN;
-    
-    if (EventCode == EVT_CMD_COMPLETE) {
-        A_INFO("Waiting for HCI CMD Complete Event, Opcode:0x%4.4X (%d MS) \n",OpCode, TimeoutMs);     
-    } else {
-        A_INFO("Waiting for HCI Event: %d (%d MS) \n",EventCode, TimeoutMs);  
-    }
-    
-    while (1) {
-        
-            /* check socket for a captured event using a short timeout
-             * the caller usually calls this function when it knows there
-             * is an event that is likely to be captured */
-        result = poll(&pfd, 1, TimeoutMs);
-        
-        if (result < 0) {
-            if ((errno == EAGAIN) || (errno == EINTR)) {
-                /* interrupted */
-            } else {
-                A_ERR("[%s] Socket Poll Failed! : %d \n", __FUNCTION__, errno);
-                status = A_ERROR;
-            }
-            break;
-        }
-        
-        if (result == 0) {
-                /* no event*/
-            break;
-        } 
-        
-        if (!(pfd.revents & POLLIN)) {
-            break;    
-        }         
-            /* get the packet */
-        eventLen = read(Socket, pBuffer, MaxLength);
-        
-        if (eventLen == 0) {
-            /* no event */
-            break;    
-        }
-                
-        if (eventLen < (1 + HCI_EVENT_HDR_SIZE)) {
-            A_ERR("[%s] Unknown receive packet! len : %d \n", __FUNCTION__, eventLen);
-            status = A_ERROR;
-            break;
-        }
-        
-        if (pBuffer[0] != HCI_EVENT_PKT) {
-            A_ERR("[%s] Unsupported packet type : %d \n", __FUNCTION__, pBuffer[0]);
-            status = A_ERROR;
-            break;   
-        }
-        
-        eventPtr = &pBuffer[1];
-        eventLen--;
-        eventHdr = (hci_event_hdr *)eventPtr;
-        eventPtr += HCI_EVENT_HDR_SIZE; 
-        eventLen -= HCI_EVENT_HDR_SIZE;
-         
-        if (eventHdr->evt != EventCode) {
-                /* not interested in this one */
-            continue;    
-        }
-        
-        if (eventHdr->evt == EVT_CMD_COMPLETE) {               
-            if (eventLen < sizeof(evt_cmd_complete)) {
-                A_ERR("[%s] EVT_CMD_COMPLETE event is too small! len=%d \n", __FUNCTION__, eventLen);
-                status = A_ERROR;
-                break;    
-            } else {
-                A_UINT16 evOpCode = btohs(BTEV_CMD_COMPLETE_GET_OPCODE(eventPtr));
-                    /* check for opCode match */
-                if (OpCode != evOpCode) {
-                    /* keep searching */
-                    continue;        
-                }    
-            }
-        }   
-        
-        /* found it */
-        *ppEventPtr = eventPtr;
-        *pEventLength = eventLen;
-        
-        break;
-             
-    }
-    
-    return status;
-}
-
-
-
-
-static void CheckHciEventFilter(ABF_BT_INFO   *pAbfBtInfo)
-{ 
-    A_UCHAR     buffer[HCI_MAX_EVENT_SIZE];   
-    A_STATUS    status;
-    A_UCHAR     *eventPtr;
-    int         eventLen;
-    
-    
-    do {
-        
-        status = WaitForHCIEvent(pAbfBtInfo->HCIEventListenerSocket,
-                                 100,
-                                 buffer,
-                                 sizeof(buffer),
-                                 EVT_SYNC_CONN_COMPLETE, 
-                                 0,
-                                 &eventPtr,
-                                 &eventLen);
-                    
-        if (A_FAILED(status)) {
-            break;    
-        }
-        
-        if (eventPtr == NULL) {
-            break;    
-        }
-        
-        if (eventLen < sizeof(evt_sync_conn_complete)) {
-            A_ERR("SYNC_CONN_COMPLETE Event is too small! : %d \n", eventLen);
-            break;    
-        }
-                
-        pAbfBtInfo->pInfo->SCOConnectInfo.LinkType = BTEV_GET_BT_CONN_LINK_TYPE(eventPtr);
-        pAbfBtInfo->pInfo->SCOConnectInfo.TransmissionInterval = BTEV_GET_TRANS_INTERVAL(eventPtr);
-        pAbfBtInfo->pInfo->SCOConnectInfo.RetransmissionInterval = BTEV_GET_RETRANS_INTERVAL(eventPtr);
-        pAbfBtInfo->pInfo->SCOConnectInfo.RxPacketLength = BTEV_GET_RX_PKT_LEN(eventPtr);
-        pAbfBtInfo->pInfo->SCOConnectInfo.TxPacketLength = BTEV_GET_TX_PKT_LEN(eventPtr);
-        
-        A_INFO("HCI SYNC_CONN_COMPLETE event captured, conn info (%d, %d, %d, %d, %d) \n", 
-                pAbfBtInfo->pInfo->SCOConnectInfo.LinkType,
-                pAbfBtInfo->pInfo->SCOConnectInfo.TransmissionInterval,
-                pAbfBtInfo->pInfo->SCOConnectInfo.RetransmissionInterval,
-                pAbfBtInfo->pInfo->SCOConnectInfo.RxPacketLength,
-                pAbfBtInfo->pInfo->SCOConnectInfo.TxPacketLength);
-            
-            /* now valid */
-        pAbfBtInfo->pInfo->SCOConnectInfo.Valid = TRUE;
-        
-    } while (FALSE);                
-        
-}
-
-static A_STATUS SetupHciEventFilter(ABF_BT_INFO *pAbfBtInfo)
-{
-    A_STATUS            status = A_ERROR;
-    struct hci_filter   filterSetting;
-    struct sockaddr_hci addr;
-        
-    do {
-        
-        if (pAbfBtInfo->HCIEventListenerSocket >= 0) {
-                /* close previous */
-            close(pAbfBtInfo->HCIEventListenerSocket);    
-        }
-        
-        pAbfBtInfo->HCIEventListenerSocket = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-        
-        if (pAbfBtInfo->HCIEventListenerSocket < 0) {
-            A_ERR("[%s] Failed to get raw BT socket: %d \n", __FUNCTION__, errno);
-            break;    
-        }
-        
-        hci_filter_clear(&filterSetting);
-        hci_filter_set_ptype(HCI_EVENT_PKT,  &filterSetting);
-        
-            /* capture SYNC_CONN Complete */
-        hci_filter_set_event(EVT_SYNC_CONN_COMPLETE, &filterSetting);
-    
-        if (setsockopt(pAbfBtInfo->HCIEventListenerSocket, 
-                       SOL_HCI, 
-                       HCI_FILTER, 
-                       &filterSetting, 
-                       sizeof(filterSetting)) < 0) {
-            A_ERR("[%s] Failed to set socket opt: %d \n", __FUNCTION__, errno);
-            break;
-        }
-    
-        A_MEMZERO(&addr,sizeof(addr));
-            /* bind to the current adapter */
-        addr.hci_family = AF_BLUETOOTH;
-        addr.hci_dev = pAbfBtInfo->AdapterId;
-        
-        if (bind(pAbfBtInfo->HCIEventListenerSocket, 
-                 (struct sockaddr *)&addr,
-                 sizeof(addr)) < 0) {
-            A_ERR("[%s] Can't bind to hci:%d (err:%d) \n", __FUNCTION__, pAbfBtInfo->AdapterId, errno);
-            break;
-        }
-    
-        A_INFO("BT Event Filter Set, Mask: 0x%8.8X:%8.8X \n", 
-            filterSetting.event_mask[1], filterSetting.event_mask[0]);
-        
-        status = A_OK;
-        
-    } while (FALSE);
-    
-    if (A_FAILED(status)) {
-        if (pAbfBtInfo->HCIEventListenerSocket >= 0) {
-            close(pAbfBtInfo->HCIEventListenerSocket);
-            pAbfBtInfo->HCIEventListenerSocket = -1;    
-        }    
-    }
-    
-    return status; 
-}
-
-    /* issue HCI command, currently this ONLY supports simple commands that
-     * only expect a command complete, the event pointer returned points to the command
-     * complete event structure for the caller to decode */
-static A_STATUS IssueHCICommand(ABF_BT_INFO *pAbfBtInfo,
-                                A_UINT16    OpCode, 
-                                A_UCHAR     *pCmdData, 
-                                int         CmdLength,
-                                int         EventRecvTimeoutMS,
-                                A_UCHAR     *pEventBuffer,
-                                int         MaxLength,
-                                A_UCHAR     **ppEventPtr,
-                                int         *pEventLength)
-{
-    A_STATUS            status = A_ERROR;
-    A_UCHAR             hciType = HCI_COMMAND_PKT;
-    hci_command_hdr     hciCommandHdr;
-    struct  iovec       iv[3];
-    int                 ivcount = 0;
-    int                 sk,result;
-    struct hci_filter   filterSetting;
-    struct sockaddr_hci addr;
-    
-    do {
-        
-        sk = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-          
-        if (sk < 0) {
-            A_ERR("[%s] Failed to get raw BT socket: %d \n", __FUNCTION__, errno);
-            break;    
-        }
-        
-        hciCommandHdr.opcode = htobs(OpCode);
-        hciCommandHdr.plen= CmdLength;
-    
-        iv[0].iov_base = &hciType;
-        iv[0].iov_len  = 1;
-        ivcount++;
-        iv[1].iov_base = &hciCommandHdr;
-        iv[1].iov_len  = HCI_COMMAND_HDR_SIZE;
-        ivcount++;
-    
-        if (pCmdData != NULL) {
-            iv[2].iov_base = pCmdData;
-            iv[2].iov_len  = CmdLength;
-            ivcount++;
-        }
-    
-            /* setup socket to capture the event */
-        hci_filter_clear(&filterSetting);
-        hci_filter_set_ptype(HCI_EVENT_PKT,  &filterSetting);
-        hci_filter_set_event(EVT_CMD_COMPLETE, &filterSetting);
-    
-        if (setsockopt(sk, SOL_HCI, HCI_FILTER, &filterSetting, sizeof(filterSetting)) < 0) {
-            A_ERR("[%s] Failed to set socket opt: %d \n", __FUNCTION__, errno);
-            break;
-        }
-    
-        A_MEMZERO(&addr,sizeof(addr));
-        addr.hci_family = AF_BLUETOOTH;
-        addr.hci_dev = pAbfBtInfo->AdapterId;
-        
-        if (bind(sk,(struct sockaddr *)&addr, sizeof(addr)) < 0) {
-            A_ERR("[%s] Can't bind to hci:%d (err:%d) \n", __FUNCTION__, pAbfBtInfo->AdapterId, errno);
-            break;
-        }
-        
-        while ((result = writev(sk, iv, ivcount)) < 0) {
-            if (errno == EAGAIN || errno == EINTR) {
-                continue;
-            }
-            break;            
-        }
-        
-        if (result <= 0) {
-            A_ERR("[%s] Failed to write to hci:%d (err:%d) \n", __FUNCTION__, pAbfBtInfo->AdapterId, errno);
-            break;    
-        }
-        
-        
-        status = WaitForHCIEvent(sk,
-                                 EventRecvTimeoutMS,
-                                 pEventBuffer,
-                                 MaxLength,
-                                 EVT_CMD_COMPLETE, 
-                                 OpCode,
-                                 ppEventPtr,
-                                 pEventLength);
-                    
-        if (A_FAILED(status)) {
-            break;    
-        }
-        
-        status = A_OK;
-        
-    } while (FALSE);
-    
-    if (sk >= 0) {
-        close(sk);    
-    }
-    
-    return status;
-}
-
-#define AFH_CHANNEL_MAP_BYTES  10
-
-typedef struct _WLAN_CHANNEL_MAP {
-    A_UCHAR  Map[AFH_CHANNEL_MAP_BYTES];
-} WLAN_CHANNEL_MAP;
-
-#define MAX_WLAN_CHANNELS 14
-
-typedef struct _WLAN_CHANNEL_RANGE {
-    int    ChannelNumber;
-    int    Center;       /* in Mhz */
-} WLAN_CHANNEL_RANGE;
-
-const WLAN_CHANNEL_RANGE g_ChannelTable[MAX_WLAN_CHANNELS] = {
-    { 1  , 2412},
-    { 2  , 2417},
-    { 3  , 2422},
-    { 4  , 2427},
-    { 5  , 2432},
-    { 6  , 2437},
-    { 7  , 2442},
-    { 8  , 2447},
-    { 9  , 2452},
-    { 10 , 2457},
-    { 11 , 2462},
-    { 12 , 2467},
-    { 13 , 2472},
-    { 14 , 2484},
-};
-
-static WLAN_CHANNEL_MAP g_ChannelMapTable[MAX_WLAN_CHANNELS + 1] = {
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 0 -- no WLAN */
-    { {0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 1 */
-    { {0x0F,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 2 */
-    { {0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 3 */
-    { {0xFF,0x3F,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 4 */
-    { {0xFF,0xFF,0x07,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0x7F}}, /* 5 */
-    { {0xFF,0xFF,0xFF,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x7F}}, /* 6 */
-    { {0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xF0,0xFF,0xFF,0x7F}}, /* 7 */
-    { {0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFE,0xFF,0x7F}}, /* 8 */
-    { {0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0xC0,0xFF,0x7F}}, /* 9 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0xF8,0x7F}}, /* 10 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x7F}}, /* 11 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x60}}, /* 12 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00}}, /* 13 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00}}, /* 14 */
-};
-
-#define AFH_COMMAND_COMPLETE_TIMEOUT_MS 2000
-
-static int LookUpChannel(int FreqMhz)
-{
-    int i;
-    
-    if (FreqMhz == 0) {
-            /* not connected */
-        return 0;    
-    }
-    
-    for (i = 0; i < MAX_WLAN_CHANNELS; i++) {
-        if (FreqMhz <= g_ChannelTable[i].Center) {
-            break;
-        }
-    }
-    return (i < MAX_WLAN_CHANNELS) ? g_ChannelTable[i].ChannelNumber : 0;
-}
-
-static A_STATUS IssueAFHChannelClassification(ABF_BT_INFO *pAbfBtInfo, int CurrentWLANChannel)
-{  
-    A_UCHAR     evtBuffer[HCI_MAX_EVENT_SIZE];  
-    A_STATUS    status;
-    A_UCHAR     *eventPtr;
-    int         eventLen; 
-    A_UCHAR     *pChannelMap;
-    
-    A_INFO("WLAN Operating Channel: %d \n", CurrentWLANChannel);
-       
-    if (CurrentWLANChannel > MAX_WLAN_CHANNELS) {
-            /* check if this is expressed in Mhz */
-        if (CurrentWLANChannel >= 2412) {
-                /* convert Mhz into a channel number */
-            CurrentWLANChannel = LookUpChannel(CurrentWLANChannel);    
-        } else {
-            return A_ERROR;    
-        } 
-    }
-          
-    pChannelMap = &(g_ChannelMapTable[CurrentWLANChannel].Map[0]);    
-    
-    do {
-    
-        status = IssueHCICommand(pAbfBtInfo,
-                                 cmd_opcode_pack(3,0x3F),
-                                 pChannelMap, 
-                                 AFH_CHANNEL_MAP_BYTES,
-                                 AFH_COMMAND_COMPLETE_TIMEOUT_MS,
-                                 evtBuffer,
-                                 sizeof(evtBuffer),
-                                 &eventPtr,
-                                 &eventLen);
-                    
-        
-        if (A_FAILED(status)) {
-            break;    
-        }
-        
-        status = A_ERROR;
-        
-        if (eventPtr == NULL) {    
-            A_ERR("[%s] Failed to capture AFH command complete event \n", __FUNCTION__);
-            break;    
-        }
-        
-        if (eventLen < (sizeof(evt_cmd_complete) + 1)) {
-            A_ERR("[%s] not enough bytes in AFH command complete event %d \n", __FUNCTION__, eventLen);
-            break;    
-        }
-        
-            /* check status parameter that follows the command complete event body */
-        if (eventPtr[sizeof(evt_cmd_complete)] != 0) {
-            A_ERR("[%s] AFH command complete event indicated failure : %d \n", __FUNCTION__, 
-                eventPtr[sizeof(evt_cmd_complete)]);
-            break;
-        }
-        
-        A_INFO(" AFH Command successfully issued \n");
-        //A_DUMP_BUFFER(pChannelMap, AFH_CHANNEL_MAP_BYTES, "AFH Channel Classification Map");
-                  
-        status = A_OK;
-         
-    } while (FALSE);
-                                 
-    return status;              
-}
-
-
-void IndicateCurrentWLANOperatingChannel(ATHBT_FILTER_INFO *pFilterInfo, int CurrentWLANChannel)
-{
-    ABF_BT_INFO *pAbfBtInfo = (ABF_BT_INFO *)pFilterInfo->pBtInfo;
-    
-    if (NULL == pAbfBtInfo) {
-        return;    
-    }
-    
-    if (pAbfBtInfo->Flags & ABF_ENABLE_AFH_CHANNEL_CLASSIFICATION) {
-        IssueAFHChannelClassification(pAbfBtInfo,CurrentWLANChannel);
-    }
-}
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus_glib.h b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_dbus_glib.h
deleted file mode 100644 (file)
index f9bb327..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="abtfilt_bluez_glib.h" company="Atheros">
-//    Copyright (c) 2007 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-
-#ifndef ABTFILT_BTSTACK_DBUS_GLIB_H_
-#define ABTFILT_BTSTACK_DBUS_GLIB_H_
-#include "abtfilt_int.h"
-#include <dbus/dbus-glib.h>
-
-/*-----------------------------------------------------------------------*/
-/* BT Section */
-#define STRING_SIZE_MAX             64
-#define BD_ADDR_SIZE                6
-
-typedef struct _ABF_BT_INFO {
-    ATHBT_FILTER_INFO              *pInfo;
-    A_COND_OBJECT                   hWaitEvent;
-    A_MUTEX_OBJECT                  hWaitEventLock;
-    A_BOOL                          Loop;
-    A_BOOL                          AdapterAvailable;
-    GMainLoop                      *Mainloop;
-    DBusGConnection                *Bus;
-    DBusGProxy                     *DeviceAdapter;
-    DBusGProxy                     *DeviceManager;
-    DBusGProxy                     *AudioManager;
-    DBusGProxy                     *AudioHeadset;
-    DBusGProxy                     *AudioGateway;
-    DBusGProxy                     *AudioSink;
-    DBusGProxy                     *AudioSource;
-    DBusGProxy                     *AudioDevice;
-    A_UINT8                         HCIVersion;
-    A_UINT16                        HCIRevision;
-    A_UINT8                         LMPVersion;
-    A_UINT16                        LMPSubVersion;
-    A_UINT8                         RemoteDevice[BD_ADDR_SIZE];
-    A_UINT8                         DeviceAddress[BD_ADDR_SIZE];
-    A_CHAR                          AdapterName[STRING_SIZE_MAX];
-    A_CHAR                          DeviceName[STRING_SIZE_MAX];
-    A_CHAR                          ManufacturerName[STRING_SIZE_MAX];
-    A_CHAR                          ProtocolVersion[STRING_SIZE_MAX];
-    A_BOOL                          AdapterCbRegistered;
-    A_CHAR                          DefaultAudioDeviceName[STRING_SIZE_MAX];
-    A_BOOL                          DefaultAudioDeviceAvailable;
-    A_BOOL                          AudioCbRegistered;
-    A_UCHAR                         CurrentSCOLinkType;
-    int                             AdapterId;
-    int                             HCIEventListenerSocket;
-    A_UINT32                        Flags;
-} ABF_BT_INFO;
-
-#endif /*ABTFILT_BTSTACK_DBUS_GLIB_H_*/
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_hciutils.c b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_bluez_hciutils.c
deleted file mode 100644 (file)
index 6939c07..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="abtfilt_bluez_hciutils.c" company="Atheros">
-//    Copyright (c) 2011 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-
-#include "abtfilt_bluez_dbus.h"
-
-#undef HCI_INQUIRY
-#include <bluetooth.h>
-#include <hci.h>
-#include <hci_lib.h>
-
-#include "hciutils.h"
-#include <dlfcn.h>
-
-extern ABF_BT_INFO    * g_pAbfBtInfo;
-
-#define ForgetRemoteAudioDevice(pA)     \
-{                                       \
-    A_MEMZERO((pA)->DefaultRemoteAudioDeviceAddress,sizeof((pA)->DefaultRemoteAudioDeviceAddress)); \
-    (pA)->DefaultRemoteAudioDevicePropsValid = FALSE;                                               \
-}
-
-#if !defined(STATIC_LINK_HCILIBS)
-static void *g_hciHandle;
-#endif
-
-static tHCIUTILS_STATUS  (* pfn_HCIUTILS_RegisterHCINotification) ( tHCIUTILS_NOTIFICATION_TYPE t_type, int  nOpCode, tHCIUTILS_EVENT_CALLBACK  eventNotificationCallback ,void * p_appdata ) = NULL;
-static void ( *pfn_HCIUTILS_SendCmd) (tHCIUTILS_HCI_CMD   tCmd, void *  p_hci_cmd_params) = NULL;
-static void (*pfn_HCIUTILS_UnRegisterHCINotification)(tHCIUTILS_NOTIFICATION_TYPE t_type,int nOpCode) = NULL;
-
-static A_UINT32 hciEventList[] =
-{
-    HCI_EVT_REMOTE_DEV_LMP_VERSION, /* 0xb*/
-    HCI_EVT_REMOTE_DEV_VERSION, /* 0xc */
-    EVT_INQUIRY_COMPLETE,
-    EVT_PIN_CODE_REQ,
-    EVT_LINK_KEY_NOTIFY,
-    HCI_EVT_ROLE_CHANGE, /* 0x12*/
-    EVT_CONN_COMPLETE,
-    HCI_EVT_SCO_CONNECT_COMPLETE,
-    HCI_EVT_DISCONNECT,
-};
-
-static A_UINT32 hciCmdList[] =
-{
-    HCI_CMD_OPCODE_INQUIRY_START,
-    HCI_CMD_OPCODE_INQUIRY_CANCEL,
-    HCI_CMD_OPCODE_CONNECT,
-} ;
-
-static void eventNotificationCallback ( tHCIUTILS_NOTIFICATION * pEvent)
-{
-    ABF_BT_INFO     *pAbfBtInfo = (ABF_BT_INFO *)g_pAbfBtInfo;
-    ATHBT_FILTER_INFO *pInfo = pAbfBtInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-
-    if(pEvent->tType == HCIUTILS_COMMAND) {
-        if(pEvent->nOpCode == HCI_CMD_OPCODE_INQUIRY_START) {
-               A_DEBUG("Device Inquiry Started \n");
-            pAbfBtInfo->btInquiryState |= (1 << 0);
-            AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_ON);
-        }
-        if(pEvent->nOpCode == HCI_CMD_OPCODE_INQUIRY_CANCEL  ) {
-               A_DEBUG("Device Inquiry cancelled \n");
-            if(pAbfBtInfo->btInquiryState) {
-                   pAbfBtInfo->btInquiryState &= ~(1 << 0);
-                AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_OFF);
-               }
-           }
-        if(pEvent->nOpCode == HCI_CMD_OPCODE_CONNECT) {
-            A_DEBUG("Bt-Connect\n");
-        }
-    }
-       if(pEvent->tType == HCIUTILS_EVENT) {
-
-#define LMP_FEATURE_ACL_EDR_2MBPS_BYTE_INDEX  3
-#define LMP_FEATURE_ACL_EDR_2MBPS_BIT_MASK    0x2
-#define LMP_FEATURE_ACL_EDR_3MBPS_BYTE_INDEX  3
-#define LMP_FEATURE_ACL_EDR_3MBPS_BIT_MASK    0x4
-#define LMP_FEATURES_LENGTH                   8
-           if(pEvent->nOpCode == HCI_EVT_REMOTE_DEV_LMP_VERSION) {
-               A_UINT32 i = 0;
-            A_UINT32 len = pEvent->n_data_length;
-               A_UCHAR * eventPtr = (A_UCHAR *)pEvent->p_notification_data_buf;
-            A_UINT8 *lmp_features;
-
-          /* Process LMP Features */
-
-
-            A_DUMP_BUFFER(eventPtr, len,"Remote Device LMP Features:");
-
-            eventPtr += 1;
-            len -= 1 ;
-            lmp_features = &eventPtr[3];
-            A_DUMP_BUFFER(lmp_features, sizeof(lmp_features),"Remote Device LMP Features:");
-
-            if ((lmp_features[LMP_FEATURE_ACL_EDR_2MBPS_BYTE_INDEX] & LMP_FEATURE_ACL_EDR_2MBPS_BIT_MASK)  ||    
-                (lmp_features[LMP_FEATURE_ACL_EDR_3MBPS_BYTE_INDEX] & LMP_FEATURE_ACL_EDR_3MBPS_BIT_MASK)) 
-            {
-                A_DEBUG("Device is EDR capable \n");
-                pAbfBtInfo->DefaultAudioDeviceLmpVersion = 3;
-            } else {
-                A_DEBUG("Device is NOT EDR capable \n");
-                pAbfBtInfo->DefaultAudioDeviceLmpVersion = 2;
-            }
-            pAbfBtInfo->DefaultRemoteAudioDevicePropsValid = TRUE;
-            pInfo->A2DPConnection_LMPVersion =  pInfo->SCOConnection_LMPVersion = 
-                                                pAbfBtInfo->DefaultAudioDeviceLmpVersion;
-        }
-        if(pEvent->nOpCode ==  HCI_EVT_REMOTE_DEV_VERSION) {
-               A_UCHAR * eventPtr = (A_UCHAR *)pEvent->p_notification_data_buf;
-            A_UINT32 len = pEvent->n_data_length;
-
-            A_DUMP_BUFFER(eventPtr, len,"Remote Device Version");
-            eventPtr += 1;
-            len -= 1;
-            A_DUMP_BUFFER(eventPtr, len,"Remote Device Version");
-
-               if (eventPtr[3] == 0) {
-                strcpy(&pAbfBtInfo->DefaultRemoteAudioDeviceVersion[0], "1.0");
-                pAbfBtInfo->DefaultAudioDeviceLmpVersion = 0;
-                       A_DEBUG("Its 1.0 \n");
-               } else if (eventPtr[3] == 1) {
-                   strcpy(&pAbfBtInfo->DefaultRemoteAudioDeviceVersion[0], "1.1");
-                pAbfBtInfo->DefaultAudioDeviceLmpVersion = 1;
-                       A_DEBUG("Its 1.1 \n");
-               } else if (eventPtr[3] == 2) {
-                   strcpy(&pAbfBtInfo->DefaultRemoteAudioDeviceVersion[0], "1.2");
-                pAbfBtInfo->DefaultAudioDeviceLmpVersion = 2;
-                   A_DEBUG("Its 1.2 \n");
-               } else if (eventPtr[3] == 3) {
-                   strcpy(&pAbfBtInfo->DefaultRemoteAudioDeviceVersion[0], "2.0");
-/*                    pAbfBtInfo->DefaultAudioDeviceLmpVersion = 3; */
-                   A_DEBUG("Its 2.0 \n");
-               }else {
-                   strcpy(&pAbfBtInfo->DefaultRemoteAudioDeviceVersion[0], "2.1");
-/*                    pAbfBtInfo->DefaultAudioDeviceLmpVersion = 4; */
-                       A_DEBUG("Its 2.1 \n");
-            }
-           
-            pInfo->A2DPConnection_LMPVersion =  pInfo->SCOConnection_LMPVersion = 
-                                                pAbfBtInfo->DefaultAudioDeviceLmpVersion;
-           }
-        if (pEvent->nOpCode == EVT_INQUIRY_COMPLETE) {
-            A_DEBUG("Device Inquiry Completed\n");
-            if(pAbfBtInfo->btInquiryState) {
-               pAbfBtInfo->btInquiryState &= ~(1 << 0);
-                AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_OFF);
-            }
-        }
-        if (pEvent->nOpCode == EVT_PIN_CODE_REQ) {
-            A_DEBUG("Pin Code Request\n");
-        }
-
-        if (pEvent->nOpCode == EVT_LINK_KEY_NOTIFY) {
-           A_DEBUG("link key notify\n");
-        }
-           if(pEvent->nOpCode == HCI_EVT_ROLE_CHANGE) {
-               A_DEBUG("Role Change\n");
-           A_UCHAR * eventPtr = (A_UCHAR *)pEvent->p_notification_data_buf;
-            A_UINT32 len = pEvent->n_data_length;
-
-            A_DUMP_BUFFER(eventPtr, len,"Remote Device Role ");
-            eventPtr += 8;
-            len -= 8;
-               if(*eventPtr == 0x00) {
-                   A_DEBUG("ROLE IS MASTER \n");
-                pAbfBtInfo->pInfo->A2DPConnection_Role = 0x0;
-            }
-           if(*eventPtr == 0x01) {
-                   A_DEBUG("ROLE IS SLAVE \n");
-                pAbfBtInfo->pInfo->A2DPConnection_Role = 0x1;
-            }
-        }
-        if(pEvent->nOpCode == EVT_CONN_COMPLETE) {
-            A_DEBUG("Conn complete\n");
-            if(pAbfBtInfo->btInquiryState) {
-               pAbfBtInfo->btInquiryState &= ~(1 << 1);
-                AthBtIndicateState(pInstance, ATH_BT_INQUIRY, STATE_OFF);
-            }
-        }
-
-        if(pEvent->nOpCode == HCI_EVT_SCO_CONNECT_COMPLETE) {
-            A_UINT32 len = pEvent->n_data_length;
-               A_UCHAR * eventPtr = (A_UCHAR*)pEvent->p_notification_data_buf;
-
-            A_DUMP_BUFFER(eventPtr, len,"SCO CONNECT_COMPLETE");
-               A_DEBUG("SCO CONNECT COMPLETE \n");
-            pInfo->SCOConnection_LMPVersion =
-                               pAbfBtInfo->DefaultAudioDeviceLmpVersion;
-
-            pInfo->SCOConnectInfo.LinkType = eventPtr[10];
-            pInfo->SCOConnectInfo.TransmissionInterval = eventPtr[11];
-            pInfo->SCOConnectInfo.RetransmissionInterval = eventPtr[12];
-            pInfo->SCOConnectInfo.RxPacketLength = eventPtr[13];
-            pInfo->SCOConnectInfo.TxPacketLength = eventPtr[15];
-            pInfo->SCOConnectInfo.Valid = TRUE;
-
-            A_INFO("HCI SYNC_CONN_COMPLETE event captured, conn info (%d, %d, %d, %d, %d) \n",
-                pInfo->SCOConnectInfo.LinkType,
-                pInfo->SCOConnectInfo.TransmissionInterval,
-                pInfo->SCOConnectInfo.RetransmissionInterval,
-                pInfo->SCOConnectInfo.RxPacketLength,
-                pInfo->SCOConnectInfo.TxPacketLength);
-
-            AthBtIndicateState(pInstance,
-                             pInfo->SCOConnectInfo.LinkType == BT_LINK_TYPE_ESCO? ATH_BT_ESCO: ATH_BT_SCO,
-                              STATE_ON);
-        }
-        if(pEvent->nOpCode == HCI_EVT_DISCONNECT) {
-           A_UINT32 bitmap = FCore_GetCurrentBTStateBitMap(&pInfo->FilterCore);
-
-               A_DEBUG("HCI_EVT_DISCONNECT event \n");
-
-            if( (bitmap & (1 << ATH_BT_SCO))|| (bitmap & (1 << ATH_BT_ESCO))) {
-                AthBtIndicateState(pInstance,
-                             pInfo->SCOConnectInfo.LinkType == BT_LINK_TYPE_ESCO? ATH_BT_ESCO: ATH_BT_SCO,
-                              STATE_OFF);
-            }
-            ForgetRemoteAudioDevice(pAbfBtInfo);
-            pInfo->SCOConnectInfo.Valid = FALSE;
-            pAbfBtInfo->pInfo->A2DPConnection_Role = 0x0;
-        }
-   }
-}
-
-void
-Abf_RegisterToHciLib( ABF_BT_INFO * pAbfBtInfo)
-{
-    void *                                      handle = 0;
-    tHCIUTILS_STATUS                            ret;
-
-    char * pparam = NULL;
-    int n_opcode = 0, n_type = 0;
-    int i;
-    A_INFO("Register To HCI LIB \n");
-
-    if (pfn_HCIUTILS_RegisterHCINotification) {
-        for (i=0; i <= 2;i++) {
-            ret = (*pfn_HCIUTILS_RegisterHCINotification)
-                  (
-                  HCIUTILS_COMMAND,
-                  hciCmdList[i],
-                  eventNotificationCallback,
-                  (void *) pAbfBtInfo
-                  );
-            A_DEBUG("Registered for HCI cmd %x, ret= %d\n", hciCmdList[i],ret);
-        }
-        for (i=0; i <= 8; i++) {
-            ret = (*pfn_HCIUTILS_RegisterHCINotification)
-                  (
-                  HCIUTILS_EVENT,
-                  hciEventList[i],
-                  eventNotificationCallback,
-                  (void *)pAbfBtInfo
-                  );
-            A_DEBUG("Hcievent List[%d] =%x, ret =%x\n",i, hciEventList[i], ret);
-        }
-    }
-}
-
-void
-Abf_UnRegisterToHciLib( ABF_BT_INFO * pAbfBtInfo)
-{
-    A_DEBUG("Unregistering HCI library handler\n");
-    if(pfn_HCIUTILS_UnRegisterHCINotification) {
-        int i;
-        for (i=0; i <= 2;i++) {
-            (*pfn_HCIUTILS_UnRegisterHCINotification)
-                  (
-                  HCIUTILS_COMMAND,
-                  hciCmdList[i]
-                  );
-            A_DEBUG("Unregistered for HCI cmd %x\n", hciCmdList[i]);
-        }
-        for (i=0; i <= 8; i++) {
-            (*pfn_HCIUTILS_UnRegisterHCINotification)
-                  (
-                  HCIUTILS_EVENT,
-                  hciEventList[i]
-                  );
-            A_DEBUG("Unregistered Hcievent List[%d] =%x\n",i, hciEventList[i]);
-        }
-    }
-}
-
-A_STATUS  Abf_IssueAFHViaHciLib (ABF_BT_INFO  * pAbfBtInfo,
-                                int CurrentWLANChannel)
-{
-    A_UINT32 center;
-    tHCIUTILS_HCICMD_SET_AFH_CHANNELS setChannels;
-
-    A_INFO("WLAN Operating Channel: %d \n", CurrentWLANChannel);
-
-    if(!CurrentWLANChannel) {
-        setChannels.first = 79;
-        setChannels.last = 79;
-        center = 0;
-   }else {
-        if( (CurrentWLANChannel < 2412) || 
-           (CurrentWLANChannel >  2470))
-        {
-            return A_ERROR;
-        }
-        center = CurrentWLANChannel;
-        center = center - 2400;
-        setChannels.first = center - 10;
-        setChannels.last = center + 10;
-  }
-
-    if (pfn_HCIUTILS_SendCmd) {
-        (*pfn_HCIUTILS_SendCmd) (HCIUTILS_SET_AFH_CHANNELS, &setChannels);
-        A_DEBUG("Issue AFH first =%x, last = %x, center =%x\n",
-                setChannels.first, setChannels.last, center);
-    } else {
-        A_ERR( "%s : Fail to issue AFH due to NULL pointer of pfn_HCIUTILS_SendCmd\n", __FUNCTION__);
-        return A_ERROR;
-    }
-
-   return A_OK;
-}
-
-A_STATUS Abf_HciLibInit(A_UINT32 *btfiltFlags)
-{        
-#ifdef STATIC_LINK_HCILIBS
-    pfn_HCIUTILS_RegisterHCINotification = HCIUTILS_RegisterHCINotification;
-    pfn_HCIUTILS_SendCmd = HCIUTILS_SendCmd;
-    pfn_HCIUTILS_UnRegisterHCINotification = HCIUTILS_UnRegisterHCINotification;
-    /* We don't force to set ONLY DBUS flags here since we are static linking */
-    return A_OK;
-#else
-    g_hciHandle = dlopen("hciutils.so", RTLD_NOW);
-    if( g_hciHandle == NULL){
-        A_ERR( "%s : Error loading library hciutils.so %s\n", __FUNCTION__, dlerror());
-        return A_ERROR;
-    } else {
-        A_DEBUG( "Load hciutils.so successfully\n");
-        pfn_HCIUTILS_RegisterHCINotification = dlsym(g_hciHandle, "HCIUTILS_RegisterHCINotification");
-        pfn_HCIUTILS_SendCmd = dlsym(g_hciHandle, "HCIUTILS_SendCmd");
-        pfn_HCIUTILS_UnRegisterHCINotification = dlsym(g_hciHandle, "HCIUTILS_UnRegisterHCINotification");
-        if ( (NULL == pfn_HCIUTILS_RegisterHCINotification) || (NULL == pfn_HCIUTILS_SendCmd) || 
-              (NULL == pfn_HCIUTILS_UnRegisterHCINotification) )
-        {
-                   A_ERR("ERROR GETTING HCIUTILS SYMBOLS \n");
-            dlclose(g_hciHandle);
-            g_hciHandle = NULL;
-            return A_ERROR;
-        }
-        /* Make sure we enable ONLY DBUS flags */
-        *btfiltFlags |= ABF_USE_ONLY_DBUS_FILTERING;
-        return A_OK;
-    }
-#endif
-}
-
-void Abf_HciLibDeInit(void)
-{
-#ifndef STATIC_LINK_HCILIBS
-    if(g_hciHandle) {
-        dlclose(g_hciHandle);
-        g_hciHandle = NULL;
-    }
-#endif
-}
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_core.c b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_core.c
deleted file mode 100644 (file)
index 14fd286..0000000
+++ /dev/null
@@ -1,1422 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="abtfilt_core.c" company="Atheros">
-//    Copyright (c) 2011 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-
-//==============================================================================
-/*
- * Bluetooth Filter Front End
- *
- */
-
-#include "abtfilt_int.h"
-
-/* Defines */
-#define MAX_VAL_DATA_LENGTH     128
-
-const A_CHAR *g_IndicationStrings[ATH_BT_MAX_STATE_INDICATION] =
-{
-   "NOP",
-   "INQUIRY",
-   "CONNECT",
-   "SCO",
-   "ACL",
-   "A2DP",
-   "ESCO",
-};
-
-extern A_FILE_HANDLE gConfigFile;
-
-/* Function Prototypes */
-static void BtStateActionProper(ATHBT_FILTER_INFO *pInfo,
-                                ATHBT_STATE_INDICATION Indication,
-                                ATHBT_STATE State);
-static void DoBtStateAction(ATHBT_FILTER_INFO *pInfo,
-                            ATHBT_STATE_INDICATION Indication,
-                            ATHBT_STATE State);
-static void AthFilterCmdEventsCallback(void *pContext,
-                                       ATHBT_HCI_CTRL_TYPE Type,
-                                       unsigned char *pBuffer, int Length);
-static void AthFilterIndicateStateCallback(void *pContext,
-                                           ATHBT_STATE_INDICATION Indication, 
-                                           ATHBT_STATE State, 
-                                           unsigned char LMPVersion);
-static void AthFilterAclDataOutCallback(void *pContext,
-                                        unsigned char *pBuffer, int Length);
-static void AthFilterAclDataInCallback(void *pContext, 
-                                       unsigned char *pBuffer, int Length);
-static void ProcessBTActionMessages(ATHBT_FILTER_INFO      *pInfo, 
-                                    BTACTION_QUEUE_PROC    Process,
-                                    ATHBT_STATE_INDICATION StateToFlush);
-static void ExecuteBtAction(ATHBT_FILTER_INFO *pInfo, 
-                            BT_ACTION_MSG *pBtActionMsg);
-static ATHBT_STATE_INDICATION IndicateA2DP(ATHBT_FILTER_INFO *pInfo , 
-                                           ATHBT_STATE_INDICATION Indication,
-                                           ATHBT_STATE State,
-                                           unsigned char *pACLBuffer);
-static void *FilterThread(void *arg);
-static void SyncBTState(ATHBT_FILTER_INFO *pInfo);
-static void ProcessActionOverride(ATHBT_FILTER_INFO *pInfo, 
-                                  A_CHAR            *pIndicationStr, 
-                                  A_CHAR            *pModifyAction,
-                                  A_CHAR            *pAction);
-static void GetActionStringOverrides(ATHBT_FILTER_INFO *pInfo);
-
-/* APIs exported to other modules */
-void 
-AthBtFilter_State_Off(ATHBT_FILTER_INFO *pInfo)
-{
-            /*
-             * before we exit we need to counter-act the coexistence
-             * settings. Currently we just indicate that each state is now
-             * OFF (if they are ON). This state synchronization is typically
-             * required on HOT-removable BT adapters or where the low level
-             * adapter can be surprise removed before the BT stack can clean
-             * up HCI connections and states
-             */
-            if (pInfo->AdapterAvailable) {
-                int         indication, newIndication;
-                ATHBT_STATE newState;
-
-                /*
-                 * the BT adapter is going away, indicate that all indications
-                 * are now in the OFF state, this may queue up control action
-                 * messages, which is okay
-                 */
-                for (indication = 0; indication < ATH_BT_MAX_STATE_INDICATION;
-                     indication++)
-                {
-                    A_LOCK_FILTER(pInfo);
-                    newIndication =
-                        FCore_FilterIndicatePreciseState(&pInfo->FilterCore,
-                                          indication, STATE_OFF, &newState);
-                    A_UNLOCK_FILTER(pInfo);
-
-                    if (newIndication == ATH_BT_NOOP) {
-                        continue;
-                    }
-
-                    DoBtStateAction(pInfo, indication, newState);
-                }
-
-                /* issue control actions */
-                ProcessBTActionMessages(pInfo, BTACTION_QUEUE_SYNC_STATE,
-                                        ATH_BT_NOOP);
-            }
-
-       
-}
-
-int
-AthBtFilter_Attach(ATH_BT_FILTER_INSTANCE *pInstance, A_UINT32 flags)
-{
-    int                             i;
-    int                             retVal = -1;
-    ATHBT_FILTER_INFO              *pInfo = NULL;
-    BT_ACTION_MSG                  *pBTActionMsg;
-    A_UINT32                        maxBTActionMsgs = MAX_BT_ACTION_MESSAGES;
-    A_STATUS                        status;
-    BT_FILTER_CORE_INFO         *   pCoreInfo = NULL;
-
-    do {
-        pInfo = (ATHBT_FILTER_INFO *)A_MALLOC(sizeof(ATHBT_FILTER_INFO) +
-                                   maxBTActionMsgs * (sizeof(BT_ACTION_MSG)));
-        if (NULL == pInfo) {
-            A_ERR("[%s] Failed to allocate BT filter info\n", __FUNCTION__);
-            break;
-        }
-        A_MEMZERO(pInfo, sizeof(ATHBT_FILTER_INFO));
-
-        pInstance->pContext = pInfo;
-        pInfo->pInstance = pInstance;
-        pInfo->MaxBtActionMessages = (int)maxBTActionMsgs;
-        pInfo->AdapterAvailable = FALSE;
-        pInfo->Shutdown = FALSE;
-
-        status = A_MUTEX_INIT(&pInfo->CritSection);
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to initialize critical section\n",
-                  __FUNCTION__);
-            break;
-        }
-
-        DL_LIST_INIT(&pInfo->BTActionMsgList);
-        DL_LIST_INIT(&pInfo->FreeActionMsgList);
-        pCoreInfo = &pInfo->FilterCore;
-        pCoreInfo->FilterState.btFilterFlags = flags;
-
-        A_DEBUG("Calling Fcore Init\n");
-        if (!FCore_Init(pCoreInfo)) {
-            A_DEBUG(" Fcore Init failed \n");
-            break;
-        }
-
-        GetActionStringOverrides(pInfo);
-
-        status = FCore_RefreshActionList(&pInfo->FilterCore);
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed refresh action list (status:%d)\n",
-                  __FUNCTION__, status);
-            break;
-        }
-
-        /* message buffers are at the end of our context blob */
-        pBTActionMsg = (BT_ACTION_MSG *)((A_UCHAR *)pInfo +
-                                         sizeof(ATHBT_FILTER_INFO));
-
-        for (i = 0; i < pInfo->MaxBtActionMessages; i++, pBTActionMsg++) {
-            /* create the event for blocking requests */
-            status = A_COND_INIT(&pBTActionMsg->hWaitEvent);
-            if (A_FAILED(status)) {
-                A_ERR("[%s] Failed to allocate BT action event wait object\n",
-                      __FUNCTION__);
-                /* if we are running out of memory we'll fail farther down */
-                break;
-            }
-
-            status = A_MUTEX_INIT(&pBTActionMsg->hWaitEventLock);
-            if (A_FAILED(status)) {
-                A_ERR("[%s] Failed to initialize the mutex\n", __FUNCTION__);
-                /* if we are running out of memory we'll fail farther down */
-                break;
-            }
-
-            /* free to list */
-            FREE_BT_ACTION_MSG(pInfo, pBTActionMsg);
-        }
-
-        /* create the wake event for our dispatcher thread */
-        status = A_COND_INIT(&pInfo->hWakeEvent);
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to allocate wakeup event\n", __FUNCTION__);
-            break;
-        }
-
-        status = A_MUTEX_INIT(&pInfo->hWakeEventLock);
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to initialize critical section\n",
-                  __FUNCTION__);
-            break;
-        }
-
-        /*
-         * get the event types that the filter core can ignore. The BT
-         * notification side can handle them TODO
-         */
-        pInfo->FilterCore.StateFilterIgnore = 0;
-
-        pInstance->pFilterCmdEvents = AthFilterCmdEventsCallback;
-        pInstance->pIndicateState = AthFilterIndicateStateCallback;
-        pInstance->pFilterAclDataOut = AthFilterAclDataOutCallback;
-        pInstance->pFilterAclDataIn = AthFilterAclDataInCallback;
-
-        /*
-         * We are fully initialized and ready to filter. The filter core
-         * needs to stay in sync with the BT radio state until the WLAN
-         * driver comes up, when the WLAN driver comes on-line the filter
-         * will issue operating parameters for the current BT radio state
-         * (see HandleAdapterEvent)
-         */
-        pInstance->FilterEnabled = TRUE;
-
-        status = A_TASK_CREATE(&pInfo->hFilterThread, FilterThread, pInfo);
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to create filter thread\n", __FUNCTION__);
-            break;
-        }
-
-        pInfo->FilterThreadValid = TRUE;
-
-        retVal = 0;
-        A_INFO("BT Filter Core init complete\n");
-    } while (FALSE);
-
-    if (retVal < 0) {
-        AthBtFilter_Detach(pInstance);
-    }
-
-    return retVal;
-}
-
-void
-AthBtFilter_Detach(ATH_BT_FILTER_INSTANCE *pInstance)
-{
-    A_STATUS           status;
-    ATHBT_FILTER_INFO  *pInfo = (ATHBT_FILTER_INFO  *)pInstance->pContext;
-    BT_ACTION_MSG      *pBTActionMsg;
-    int                i;
-
-    /* make sure filter is disabled */
-    pInstance->FilterEnabled = FALSE;
-
-    if (NULL == pInfo) {
-        return;    
-    }
-
-    pInfo->Shutdown = TRUE;
-
-        /* wake filter thread */
-    A_MUTEX_LOCK(&pInfo->hWakeEventLock);
-    A_COND_SIGNAL(&pInfo->hWakeEvent);
-    A_MUTEX_UNLOCK(&pInfo->hWakeEventLock);
-   
-    if (pInfo->FilterThreadValid) {
-        pInfo->FilterThreadValid = FALSE;
-            /* wait for thread to exit */
-        status = A_TASK_JOIN(&pInfo->hFilterThread);
-        if (A_FAILED(status)) {
-            A_ERR("[%s] Failed to JOIN filter thread \n",
-                  __FUNCTION__);
-        }
-    }
-
-    A_COND_DEINIT(&pInfo->hWakeEvent);
-    A_MUTEX_DEINIT(&pInfo->hWakeEventLock);
-
-    pBTActionMsg = (BT_ACTION_MSG *)((A_UCHAR *)pInfo +
-                                     sizeof(ATHBT_FILTER_INFO));
-    /* close all action message wait objects */
-    for (i = 0; i < pInfo->MaxBtActionMessages; i++, pBTActionMsg++) {
-        A_COND_DEINIT(&pBTActionMsg->hWaitEvent);
-        A_MUTEX_DEINIT(&pBTActionMsg->hWaitEventLock);
-    }
-
-    pInstance->pContext = NULL;
-    A_MUTEX_DEINIT(&pInfo->CritSection);
-    FCore_Cleanup(&pInfo->FilterCore);
-    A_FREE(pInfo);
-
-    A_INFO("BT Filter Core de-init complete\n");
-}
-
-/* Internal functions */
-static void
-AdjustBtControlAction(ATHBT_FILTER_INFO      *pInfo,
-                      BT_ACTION_MSG          *pActionMsg)
-{
-
-#define A2DP_CONFIG_ALLOW_OPTIMIZATION        ( 1 << 0)
-#define A2DP_CONFIG_EDR_CAPABLE               ( 1 << 1)
-#define A2DP_CONFIG_IS_COLOCATED_IS_MASTER    ( 1 << 2)
-#define A2DP_CONFIG_A2DP_IS_HIGH_PRI          ( 1 << 3)
-
-    if (pActionMsg->StateForControlAction != STATE_ON) {
-         /* nothing to adjust in OFF case */
-         return;
-    }
-
-    if (pActionMsg->ControlAction.Type != BT_CONTROL_ACTION_PARAMS) {
-         /* only modify action that issues a PARAMS control action */
-            return;
-    }
-
-    if(pInfo->Flags & ABF_WIFI_CHIP_IS_VENUS) {
-
-        if (pActionMsg->IndicationForControlAction == ATH_BT_A2DP) {
-            WMI_SET_BTCOEX_A2DP_CONFIG_CMD *pA2dpParamsCmd =
-                               (WMI_SET_BTCOEX_A2DP_CONFIG_CMD *)
-                               (pActionMsg->ControlAction.Buffer);
-            BTCOEX_A2DP_CONFIG *pA2dpGenericConfig =
-                                            &pA2dpParamsCmd->a2dpConfig;
-            BTCOEX_PSPOLLMODE_A2DP_CONFIG * pA2dpPspollConfig =
-                                            &pA2dpParamsCmd->a2dppspollConfig;
-            BTCOEX_OPTMODE_A2DP_CONFIG * pA2dpOptModeConfig =
-                                            &pA2dpParamsCmd->a2dpOptConfig;
-
-            pA2dpGenericConfig->a2dpFlags = 0;
-            /*Role =0 is Master, Role =1, is slave */
-            if(pInfo->A2DPConnection_Role == 0) {
-                 pA2dpGenericConfig->a2dpFlags |= A2DP_CONFIG_IS_COLOCATED_IS_MASTER;
-            }else {
-                pA2dpGenericConfig->a2dpFlags &= ~A2DP_CONFIG_IS_COLOCATED_IS_MASTER;
-            }
-
-            switch (pInfo->A2DPConnection_LMPVersion) {
-                case 0: // 1.0
-                case 1: // 1.1
-                case 2: // 1.2
-                    pA2dpPspollConfig->a2dpWlanMaxDur = 30;
-                    pA2dpOptModeConfig->a2dpMaxAggrSize = 1;
-                    pA2dpOptModeConfig->a2dpMinlowRateMbps =52;
-                   pA2dpPspollConfig->a2dpDataRespTimeout = 10;
-                    pA2dpPspollConfig->a2dpMinBurstCnt = 4;
-                    break;
-                case 3: // 2.0
-                case 4: // 2.1
-                default:
-                   pA2dpPspollConfig->a2dpDataRespTimeout = 20;
-                    pA2dpPspollConfig->a2dpWlanMaxDur = 50;
-                    pA2dpOptModeConfig->a2dpMaxAggrSize = 16;
-                    pA2dpOptModeConfig->a2dpMinlowRateMbps =36;
-#ifdef MSM_7230
-                    if(pA2dpGenericConfig->a2dpFlag & A2DP_CONFIG_IS_COLOCATED_IS_MASTER) {
-                    pA2dpPspollConfig->a2dpMinBurstCnt = 1;
-                   }else{
-                    pA2dpPspollConfig->a2dpMinBurstCnt = 2;
-                   }
-
-                    
-#else
-                    pA2dpPspollConfig->a2dpMinBurstCnt = 2;
-
-#endif
-                    /* Indicate that remote device is EDR capable */
-                    pA2dpGenericConfig->a2dpFlags |= A2DP_CONFIG_EDR_CAPABLE;
-                    break;
-            }
-            if(pInfo->Flags & ABF_BT_CHIP_IS_ATHEROS) {
-                pA2dpGenericConfig->a2dpFlags |= A2DP_CONFIG_A2DP_IS_HIGH_PRI ;
-                /* Enable optmization for all the modes */
-                pA2dpGenericConfig->a2dpFlags |= A2DP_CONFIG_ALLOW_OPTIMIZATION;
-            }else {
-                /* Enable optmization for only for master role */
-                if(pInfo->A2DPConnection_Role == 0) {
-                    pA2dpGenericConfig->a2dpFlags |= A2DP_CONFIG_ALLOW_OPTIMIZATION;
-                }else {
-                    pA2dpGenericConfig->a2dpFlags &= ~A2DP_CONFIG_ALLOW_OPTIMIZATION;
-                    pA2dpPspollConfig->a2dpWlanMaxDur = 30;
-                }
-
-            }
-            pA2dpOptModeConfig->a2dpLowRateCnt =5;
-            pA2dpOptModeConfig->a2dpHighPktRatio = 5;
-            pA2dpOptModeConfig->a2dpPktStompCnt = 6;
-         /* Continuation of addressing EV#80876 and EV#80859. Disabling OPT mode always as
-          * device is forced to SLAVE */  
-           pA2dpGenericConfig->a2dpFlags &= ~A2DP_CONFIG_ALLOW_OPTIMIZATION;
-
-            A_DEBUG(("ATHBT: BT PARAMS A2DP Adjustments :\r\n"));
-            A_DEBUG(("    a2dpWlanUsageLimit  : %d\r\n"),
-                            pA2dpPspollConfig->a2dpWlanMaxDur);
-            A_DEBUG(("    a2dpBurstCntMin     : %d\r\n"),
-                              pA2dpPspollConfig->a2dpMinBurstCnt);
-            A_DEBUG(("    a2dpDataRespTimeout : %d\r\n"),
-                                pA2dpPspollConfig->a2dpDataRespTimeout);
-            A_DEBUG(("    A2DP OptMode Config-MaxAggrSize : %d\r\n"),
-                                 pA2dpOptModeConfig->a2dpMaxAggrSize);
-            A_DEBUG(("   A2DP Flags : %d\r\n"),
-                             pA2dpGenericConfig->a2dpFlags);
-#if 0
-            A_DEBUG(("   A2DP OptMode Config - MinLowRateMbps : %d\r\n"),
-                            pA2dpOptModeConfig->a2dpMinlowRateMbps);
-            A_DEBUG(("   A2DP OptMode Config - LowRateCnt : %d\r\n"),
-                            pA2dpOptModeConfig->a2dpLowRateCnt );
-            A_DEBUG(("   A2DP High Pkt Ratio Config- PktRatio : %d\r\n"),
-                            pA2dpOptModeConfig->a2dpHighPktRatio );
-            A_DEBUG(("   A2DP High Pkt Ratio Config- StompCnt : %d\r\n"),
-                            pA2dpOptModeConfig->a2dpPktStompCnt );
-#endif
-        }
-        /* adjust control action for BT_PARAMS_SCO control action  */
-        if ((pActionMsg->IndicationForControlAction == ATH_BT_SCO) ||
-            (pActionMsg->IndicationForControlAction == ATH_BT_ESCO))
-        {
-            WMI_SET_BTCOEX_SCO_CONFIG_CMD *pScoParamsCmd =
-                               (WMI_SET_BTCOEX_SCO_CONFIG_CMD *)
-                               (pActionMsg->ControlAction.Buffer);
-            BTCOEX_SCO_CONFIG *pScoGenericConfig =
-                                            &pScoParamsCmd->scoConfig;
-            BTCOEX_PSPOLLMODE_SCO_CONFIG * pScoPspollConfig =
-                                            &pScoParamsCmd->scoPspollConfig;
-            BTCOEX_OPTMODE_SCO_CONFIG * pScoOptModeConfig =
-                                            &pScoParamsCmd->scoOptModeConfig;
-            BTCOEX_WLANSCAN_SCO_CONFIG * pScoWlanScanConfig = 
-                                            &pScoParamsCmd->scoWlanScanConfig;
-
-            pScoGenericConfig->scoFlags = 0;
-            do {
-                if ((pInfo->SCOConnectInfo.LinkType == BT_LINK_TYPE_ESCO) &&
-                    (pInfo->SCOConnectInfo.Valid))
-                {
-                    A_UCHAR scoSlots;
-                    /* decode packet length to get packet type */
-                    if (pInfo->SCOConnectInfo.TxPacketLength <= 30) {
-                     /* EV3 */
-                        scoSlots = 1;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 60) {
-                        /* 2-EV3 */
-                        scoSlots = 1;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 90) {
-                        /*3-EV3 */
-                        scoSlots = 1;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 120) {
-                        /* EV4: */
-                        scoSlots = 3;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 180) {
-                        /* EV5: */
-                        scoSlots = 3;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 360) {
-                        /* 2-EV5 */
-                        scoSlots = 3;
-                    } else {
-                        /* 3-EV5 */
-                        scoSlots = 3;
-                    }
-
-                    scoSlots *= 2;
-                    pScoGenericConfig->scoSlots = scoSlots;
-
-                    if (pInfo->SCOConnectInfo.TransmissionInterval >= scoSlots) {
-                        pScoGenericConfig->scoIdleSlots =
-                        pInfo->SCOConnectInfo.TransmissionInterval - scoSlots;
-                    } else {
-                        A_DEBUG(("Invalid scoSlot,  got:%d, transInt: %d\n"),
-                                    scoSlots,
-                                    pInfo->SCOConnectInfo.TransmissionInterval);
-                   }
-                } else {
-                       /* legacy SCO */
-                    pScoGenericConfig->scoSlots = 2;
-                    pScoGenericConfig->scoIdleSlots = 4;
-                }
- //               pScoGenericConfig->scoFlags |= WMI_SCO_CONFIG_FLAG_ALLOW_OPTIMIZATION;
-                if(pInfo->SCOConnectInfo.LinkType == BT_LINK_TYPE_ESCO) {
-                    pScoGenericConfig->scoFlags |= WMI_SCO_CONFIG_FLAG_IS_EDR_CAPABLE;
-                }
-                if(pScoGenericConfig->scoIdleSlots >= 10) {
-                    pScoPspollConfig->scoPsPollLatencyFraction = 2;
-                    pScoPspollConfig->scoStompDutyCyleVal = 2;
-                    pScoWlanScanConfig->scanInterval = 100;
-                    pScoWlanScanConfig->maxScanStompCnt = 2;
-                }else {
-                    pScoPspollConfig->scoPsPollLatencyFraction = 1;
-                    pScoPspollConfig->scoStompDutyCyleVal = 5;
-                    pScoWlanScanConfig->scanInterval = 100;
-                    pScoWlanScanConfig->maxScanStompCnt = 4;
-                }
-            }while(FALSE);
-            pScoPspollConfig->scoCyclesForceTrigger = 10;
-            pScoPspollConfig->scoDataResponseTimeout = 10;
-            pScoPspollConfig->scoStompDutyCyleMaxVal = 6;
-
-             A_DEBUG(("ATHBT: BT PARAMS SCO adjustment (%s) \n"),
-                pInfo->SCOConnectInfo.LinkType == BT_LINK_TYPE_ESCO ? "eSCO":"SCO");
-             A_DEBUG(("    numScoCyclesForceTrigger : %d \n"),
-                      pScoPspollConfig->scoCyclesForceTrigger);
-             A_DEBUG(("    dataResponseTimeout      : %d \n"),
-                    pScoPspollConfig->scoDataResponseTimeout = 20);
-             A_DEBUG(("    stompDutyCyleVal         : %d \n"),
-                    pScoPspollConfig->scoStompDutyCyleVal);
-             A_DEBUG(("    psPollLatencyFraction    : %d \n"),
-                pScoPspollConfig->scoPsPollLatencyFraction);
-             A_DEBUG(("    noSCOSlots               : %d \n"),
-                pScoGenericConfig->scoSlots);
-             A_DEBUG(("    noIdleSlots              : %d \n"),
-                pScoGenericConfig->scoIdleSlots);
-           A_DEBUG((" scoFlags                      : %d \n"),
-                pScoGenericConfig->scoFlags);
-
-             pScoOptModeConfig->scoStompCntIn100ms = 3;
-             pScoOptModeConfig->scoContStompMax = 3;
-             pScoOptModeConfig->scoMinlowRateMbps = 36;
-             pScoOptModeConfig->scoLowRateCnt = 5;
-             pScoOptModeConfig->scoHighPktRatio = 5;
-
-             if(pScoGenericConfig->scoIdleSlots >= 10) {
-                 pScoOptModeConfig->scoMaxAggrSize = 8;
-             }else {
-                 pScoOptModeConfig->scoMaxAggrSize = 1;
-             }
-
-        }
-    }
-    else
-    {
-        WMI_SET_BT_PARAMS_CMD   *pParamsCmd;
-        if (pActionMsg->IndicationForControlAction == ATH_BT_A2DP) {
-            do {
-                pParamsCmd =
-                   (WMI_SET_BT_PARAMS_CMD *)(pActionMsg->ControlAction.Buffer);
-
-                if (pParamsCmd->paramType != BT_PARAM_A2DP) {
-                        /* only modify A2DP params */
-                    break;
-                }
-                /*Role =0 is Master, Role =1, is slave */
-                if(pInfo->A2DPConnection_Role == 0) {
-                    pParamsCmd->info.a2dpParams.isCoLocatedBtRoleMaster = 1;
-                }else {
-                    pParamsCmd->info.a2dpParams.isCoLocatedBtRoleMaster = 0;
-                    /* workaround for local BT radio that disables EDR
-                     * rates when operating as a slave. We downgrade
-                     * the remote lmp version to protect A2DP as if the radio was 1.2 */
-                     pInfo->A2DPConnection_LMPVersion = 2;
-                }
-
-                switch (pInfo->A2DPConnection_LMPVersion) {
-                case 0: // 1.0
-                case 1: // 1.1
-                case 2: // 1.2
-                    pParamsCmd->info.a2dpParams.a2dpWlanUsageLimit = 30;
-                    pParamsCmd->info.a2dpParams.a2dpBurstCntMin = 3;
-                    pParamsCmd->info.a2dpParams.a2dpDataRespTimeout =10;
-                    break;
-                case 3: // 2.0
-                case 4: // 2.1
-                default:
-                    if( pParamsCmd->info.a2dpParams.isCoLocatedBtRoleMaster) {
-                        /* allow close range optimization for newer BT radios */
-                    }
-                    pParamsCmd->info.a2dpParams.a2dpWlanUsageLimit = 100;
-                    pParamsCmd->info.a2dpParams.a2dpBurstCntMin = 1;
-                    pParamsCmd->info.a2dpParams.a2dpDataRespTimeout =10;
-                    break;
-                }
-
-                A_DEBUG(("ATHBT: BT PARAMS A2DP Adjustments :\r\n"));
-                A_DEBUG(("    a2dpWlanUsageLimit  : %d\r\n"),
-                        pParamsCmd->info.a2dpParams.a2dpWlanUsageLimit);
-                A_DEBUG(("    a2dpBurstCntMin     : %d\r\n"),
-                        pParamsCmd->info.a2dpParams.a2dpBurstCntMin);
-                A_DEBUG(("    a2dpDataRespTimeout : %d\r\n"),
-                        pParamsCmd->info.a2dpParams.a2dpDataRespTimeout);
-            }while (FALSE);
-        }
-
-        /* adjust control action for BT_PARAMS_SCO control action  */
-        if ((pActionMsg->IndicationForControlAction == ATH_BT_SCO) ||
-            (pActionMsg->IndicationForControlAction == ATH_BT_ESCO))
-        {
-            do {
-                pParamsCmd =
-                    (WMI_SET_BT_PARAMS_CMD *)(pActionMsg->ControlAction.Buffer);
-
-                if (pParamsCmd->paramType != BT_PARAM_SCO) {
-                    /* only modify SCO params */
-                    break;
-                }
-
-                if ((pInfo->SCOConnectInfo.LinkType == BT_LINK_TYPE_ESCO) &&
-                    (pInfo->SCOConnectInfo.Valid)) {
-                    A_UCHAR scoSlots;
-                    pInfo->SCOConnectInfo.Valid = FALSE;
-                    /* decode packet length to get packet type */
-                    if (pInfo->SCOConnectInfo.TxPacketLength <= 30) {
-                        /* EV3 */
-                        scoSlots = 1;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 60) {
-                        /* 2-EV3 */
-                        scoSlots = 1;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 90) {
-                        /*3-EV3 */
-                        scoSlots = 1;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 120) {
-                        /* EV4: */
-                        scoSlots = 3;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 180) {
-                        /* EV5: */
-                        scoSlots = 3;
-                    } else if (pInfo->SCOConnectInfo.TxPacketLength <= 360) {
-                        /* 2-EV5 */
-                        scoSlots = 3;
-                    } else {
-                        /* 3-EV5 */
-                        scoSlots = 3;
-                    }
-
-                    /* account for RX/TX */
-                    scoSlots *= 2;
-                    pParamsCmd->info.scoParams.noSCOSlots =  scoSlots;
-
-                    if (pInfo->SCOConnectInfo.TransmissionInterval >= scoSlots) {
-                        pParamsCmd->info.scoParams.noIdleSlots =
-                            pInfo->SCOConnectInfo.TransmissionInterval - scoSlots;
-                    } else {
-                        A_DEBUG(("Invalid scoSlot,  got:%d, transInt: %d\n"),
-                                scoSlots,
-                                pInfo->SCOConnectInfo.TransmissionInterval);
-                    }
-                } else {
-                   /* legacy SCO */
-                    pParamsCmd->info.scoParams.noSCOSlots = 2;
-                    pParamsCmd->info.scoParams.noIdleSlots = 4;
-                }
-
-                A_DEBUG(("ATHBT: BT PARAMS SCO adjustment (%s) \n"),
-                        pInfo->SCOConnectInfo.LinkType == BT_LINK_TYPE_ESCO ? "eSCO":"SCO");
-                A_DEBUG(("    numScoCyclesForceTrigger : %d \n"),
-                        pParamsCmd->info.scoParams.numScoCyclesForceTrigger);
-                A_DEBUG(("    dataResponseTimeout      : %d \n"),
-                        pParamsCmd->info.scoParams.dataResponseTimeout);
-                A_DEBUG(("    stompScoRules            : %d \n"),
-                        pParamsCmd->info.scoParams.stompScoRules);
-                A_DEBUG(("    stompDutyCyleVal         : %d \n"),
-                        pParamsCmd->info.scoParams.stompDutyCyleVal);
-                A_DEBUG(("    psPollLatencyFraction    : %d \n"),
-                        pParamsCmd->info.scoParams.psPollLatencyFraction);
-                A_DEBUG(("    noSCOSlots               : %d \n"),
-                        pParamsCmd->info.scoParams.noSCOSlots);
-                A_DEBUG(("    noIdleSlots              : %d \n"),
-                        pParamsCmd->info.scoParams.noIdleSlots);
-            } while (FALSE);
-        }
-    }
-}
-
-static void
-BtStateActionProper(ATHBT_FILTER_INFO *pInfo,
-                    ATHBT_STATE_INDICATION Indication, ATHBT_STATE State)
-{
-    A_COND_OBJECT           *hWait = NULL;
-    BT_ACTION_MSG           *pActionMsg;
-    DL_LIST                 *pListEntry;
-    BT_CONTROL_ACTION_ITEM  *pBtControlAction;
-    int                     queued = 0;
-
-    A_LOCK_FILTER(pInfo);
-
-    pBtControlAction = FCore_GetControlAction(&pInfo->FilterCore,
-                                              Indication,
-                                              State,
-                                              NULL);
-
-    A_DEBUG("[%s], Indication =%d, state=%d,ControlAction.Length=%d\n",
-            __FUNCTION__, Indication, State,
-           ( (pBtControlAction == NULL)? 0 : pBtControlAction->ControlAction.Length));
-
-    while (pBtControlAction != NULL) {
-        /* allocate an action message */
-        pListEntry = DL_ListRemoveItemFromHead(&pInfo->FreeActionMsgList);
-
-        if (NULL == pListEntry) {
-            A_DEBUG("action messages exhausted\n");
-            break;
-        }
-
-        pActionMsg = A_CONTAINING_STRUCT(pListEntry, BT_ACTION_MSG,
-                                         ListEntry);
-
-        /* save state for later flushing */
-        pActionMsg->StateForControlAction = State;
-        pActionMsg->IndicationForControlAction = Indication;
-
-        /* we need to buffer the control actions */
-        A_MEMCPY(&pActionMsg->ControlAction,
-                 &pBtControlAction->ControlAction,
-                 sizeof(pActionMsg->ControlAction));
-
-        /* When is it ever set to blocking TODO */
-        if (pActionMsg->Blocking) {
-            /* this is the action to wait on */
-            hWait = &pActionMsg->hWaitEvent;
-            A_COND_RESET(hWait);
-        }
-        /* allow for adjustments to the control action beyond the defaults */
-        AdjustBtControlAction(pInfo, pActionMsg);
-
-        /* queue action */
-        QUEUE_BT_ACTION_MSG(pInfo, pActionMsg);
-        queued++;
-
-        /* get the next action using the current one as a starter */
-        pBtControlAction = FCore_GetControlAction(&pInfo->FilterCore,
-                                                  Indication,
-                                                  State,
-                                                  pBtControlAction);
-    }
-
-    A_UNLOCK_FILTER(pInfo);
-
-    if (queued > 0) {
-        /* wake thread to process all the queued up actions */
-        A_MUTEX_LOCK(&pInfo->hWakeEventLock);
-        A_COND_SIGNAL(&pInfo->hWakeEvent);
-        A_MUTEX_UNLOCK(&pInfo->hWakeEventLock);
-    }
-
-    /* check if we need to block until the dispatch thread issued the
-     * last action if the adapter becomes unavailable we cannot block
-     * the thread (queue will stall), so only block if the adapter is
-     * available and use a reasonable timeout
-     */
-    if (hWait) {
-        A_COND_WAIT(hWait, &pInfo->CritSection, ACTION_WAIT_TIMEOUT);
-    }
-}
-
-static void DoBtStateAction(ATHBT_FILTER_INFO *pInfo, ATHBT_STATE_INDICATION Indication, ATHBT_STATE State)
-{
-    A_UINT32 bitmap = FCore_GetCurrentBTStateBitMap(&pInfo->FilterCore);
-
-    if ((Indication == ATH_BT_INQUIRY) && (State == STATE_ON)) {
-        int i;
-        for (i=0; i<ATH_BT_MAX_STATE_INDICATION; ++i) {
-            if ((i!=Indication) && (bitmap & (1<<i))) {
-                BtStateActionProper(pInfo,i,STATE_OFF);
-            }
-        }
-    }
-
-    if ((Indication == ATH_BT_A2DP) && ((bitmap & (1<<ATH_BT_SCO)) || (bitmap & (1<<ATH_BT_ESCO)))) {
-        /* SCO protection is running, don't take any actions */
-        return;
-    }
-
-    if ((Indication == ATH_BT_A2DP) && (bitmap & (1<<ATH_BT_INQUIRY))) {
-        BtStateActionProper(pInfo,ATH_BT_INQUIRY, STATE_OFF);
-    }
-
-    if (((Indication == ATH_BT_SCO) || (Indication == ATH_BT_ESCO)) && (State == STATE_ON)) {
-        if (bitmap & (1<<ATH_BT_A2DP)) {
-            BtStateActionProper(pInfo,ATH_BT_A2DP,STATE_OFF);
-        }
-    }
-
-    BtStateActionProper(pInfo, Indication, State);
-
-    if ((Indication == ATH_BT_INQUIRY) && (State == STATE_OFF)) {
-        SyncBTState(pInfo);
-    }
-
-    if (((Indication == ATH_BT_SCO) || (Indication == ATH_BT_ESCO)) && (State == STATE_OFF)) {
-        if (bitmap & (1<<ATH_BT_A2DP)) {
-            BtStateActionProper(pInfo,ATH_BT_A2DP,STATE_ON);
-        }
-    }
-}
-
-static void
-AthFilterCmdEventsCallback(void *pContext, ATHBT_HCI_CTRL_TYPE Type,
-                           unsigned char *pBuffer, int Length)
-{
-    ATHBT_STATE_INDICATION  indication;
-    ATHBT_FILTER_INFO       *pInfo = (ATHBT_FILTER_INFO *)pContext;
-    ATHBT_STATE             state;
-
-    if (Type == ATHBT_HCI_EVENT) {
-        if (HCI_GET_EVENT_CODE(pBuffer) == HCI_EVT_NUM_COMPLETED_PKTS) {
-            /* don't delays these packets, we don't act on them anyways */
-            return;
-        }
-    }
-
-    if (pInfo->Shutdown) {
-        return;
-    }
-
-   /*
-    * the filter state machine needs to be protected in case the HCI layer
-    * can process commands and events in an unserialize manner
-    */
-    A_LOCK_FILTER(pInfo);
-
-    if (Type == ATHBT_HCI_COMMAND) {
-        A_DUMP_BUFFER(pBuffer, Length, "BT HCI Command");
-        indication = FCore_FilterBTCommand(&pInfo->FilterCore, pBuffer,
-                                           Length, &state);
-    } else {
-        A_DUMP_BUFFER(pBuffer, Length, "BT HCI Event");
-        indication = FCore_FilterBTEvent(&pInfo->FilterCore, pBuffer,
-                                         Length, &state);
-        /* check SCO and ESCO connection events */
-        if ((indication == ATH_BT_SCO) || (indication == ATH_BT_ESCO)) {
-            if (HCI_GET_EVENT_CODE(pBuffer) == HCI_EVT_SCO_CONNECT_COMPLETE) {
-                A_DEBUG(("SCO_CONNECT_COMPLETE (%s)\n"),
-                        (state == STATE_ON) ? "ON" : "OFF");
-                if (state == STATE_ON) {
-                    /* save these off for the BT Action adjustment */
-                    pInfo->SCOConnectInfo.LinkType =
-                        GET_BT_CONN_LINK_TYPE(pBuffer);
-                    pInfo->SCOConnectInfo.TransmissionInterval =
-                        GET_TRANS_INTERVAL(pBuffer);
-                    pInfo->SCOConnectInfo.RetransmissionInterval =
-                        GET_RETRANS_INTERVAL(pBuffer);
-                    pInfo->SCOConnectInfo.RxPacketLength =
-                        GET_RX_PKT_LEN(pBuffer);
-                    pInfo->SCOConnectInfo.TxPacketLength =
-                        GET_TX_PKT_LEN(pBuffer);
-                    A_DEBUG(("ATHBT: SCO conn info (%d, %d, %d, %d, %d))\n"),
-                            pInfo->SCOConnectInfo.LinkType,
-                            pInfo->SCOConnectInfo.TransmissionInterval,
-                            pInfo->SCOConnectInfo.RetransmissionInterval,
-                            pInfo->SCOConnectInfo.RxPacketLength,
-                            pInfo->SCOConnectInfo.TxPacketLength);
-                    /* now valid */
-                    pInfo->SCOConnectInfo.Valid = TRUE;
-                } else {
-                    /* disconnected, invalidate */
-                    pInfo->SCOConnectInfo.Valid = FALSE; 
-                }             
-            }
-        }
-    }
-    
-    A_UNLOCK_FILTER(pInfo);
-    
-    if (indication == ATH_BT_NOOP) {
-        return;    
-    }
-
-    A_DEBUG(("New Indication :%d State:%s (map:0x%X)\n"), 
-            indication, (state == STATE_ON) ? "ON" : "OFF", 
-            FCore_GetCurrentBTStateBitMap(&pInfo->FilterCore)); 
-
-    if (pInfo->AdapterAvailable) {
-        DoBtStateAction(pInfo, indication, state);
-    }
-}
-
-static ATHBT_STATE_INDICATION 
-IndicateA2DP(ATHBT_FILTER_INFO        *pInfo, 
-             ATHBT_STATE_INDICATION   Indication,
-             ATHBT_STATE              State,
-             unsigned char            *pACLBuffer)
-{
-    A_ERR("[%s] Not yet implemented\n", __FUNCTION__);
-
-    return ATH_BT_NOOP; /* TODO */
-}
-
-static void 
-AthFilterAclDataOutCallback(void *pContext, unsigned char *pBuffer, int Length)
-{
-    ATHBT_STATE_INDICATION  indication;
-    ATHBT_FILTER_INFO       *pInfo = (ATHBT_FILTER_INFO *)pContext;
-    ATHBT_STATE             state;
-    
-    if (pInfo->Shutdown) {
-        return;    
-    }
-    
-    A_LOCK_FILTER(pInfo);
-    
-    indication = FCore_FilterACLDataOut(&pInfo->FilterCore,
-                                        pBuffer, 
-                                        Length, 
-                                        &state);
-                                        
-    if (indication == ATH_BT_A2DP) {
-        indication = IndicateA2DP(pInfo, 
-                                  ATH_BT_A2DP,
-                                  state,
-                                  pBuffer);   
-    }
-    
-    A_UNLOCK_FILTER(pInfo);
-    
-    if (indication == ATH_BT_NOOP) {
-        return;    
-    }
-
-    A_DEBUG(("New Indication :%d State:%s (map:0x%X)\n"), 
-            indication, (state == STATE_ON) ? "ON" : "OFF", 
-            FCore_GetCurrentBTStateBitMap(&pInfo->FilterCore));
-
-    if (pInfo->AdapterAvailable) {
-        DoBtStateAction(pInfo, indication, state);
-    }
-    
-}
-
-static void 
-AthFilterAclDataInCallback(void *pContext, unsigned char *pBuffer, int Length)
-{   
-    ATHBT_STATE_INDICATION  indication;
-    ATHBT_FILTER_INFO       *pInfo = (ATHBT_FILTER_INFO *)pContext;
-    ATHBT_STATE             state;
-
-    if (pInfo->Shutdown) {
-        return;
-    }
-
-    A_LOCK_FILTER(pInfo);
-
-    indication = FCore_FilterACLDataIn(&pInfo->FilterCore,
-                                        pBuffer,
-                                        Length,
-                                        &state);
-
-    if (indication == ATH_BT_A2DP) {
-        indication = IndicateA2DP(pInfo,
-                                  ATH_BT_A2DP,
-                                  state,
-                                  pBuffer);
-    }
-
-    A_UNLOCK_FILTER(pInfo);
-
-    if (indication == ATH_BT_NOOP) {
-        return;
-    }
-
-    A_DEBUG(("New Indication :%d State:%s (map:0x%X)\n"),
-            indication, (state == STATE_ON) ? "ON" : "OFF",
-            FCore_GetCurrentBTStateBitMap(&pInfo->FilterCore));
-
-    if (pInfo->AdapterAvailable) {
-        DoBtStateAction(pInfo, indication, state);
-    }
-}
-
-static void
-AthFilterIndicateStateCallback(void *pContext,
-                               ATHBT_STATE_INDICATION Indication,
-                               ATHBT_STATE State, unsigned char LMPVersion)
-{
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pContext;
-    ATHBT_STATE             newState;
-
-    if (pInfo->Shutdown) {
-        return;
-    }
-
-    A_LOCK_FILTER(pInfo);
-    Indication = FCore_FilterIndicatePreciseState(&pInfo->FilterCore,
-                                            Indication, State, &newState);
-    A_UNLOCK_FILTER(pInfo);
-
-    if (Indication == ATH_BT_NOOP) {
-        return;
-    }
-
-    A_DEBUG(("New Indication :%d State:%s (map:0x%X) \r\n"),
-            Indication, (newState == STATE_ON) ? "ON" : "OFF",
-            FCore_GetCurrentBTStateBitMap(&pInfo->FilterCore));
-
-    if ((newState == STATE_ON) && (LMPVersion < 5)) {
-        pInfo->LMPVersion = LMPVersion;
-    }
-
-    if (pInfo->AdapterAvailable) {
-        DoBtStateAction(pInfo, Indication, newState);
-    }
-}
-
-static void *
-FilterThread(void *pContext)
-{
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pContext;
-
-    A_INFO("Starting the BT Filter task\n");
-    while (1) {
-        /* Wait to be woken up the BT thread */
-        A_MUTEX_LOCK(&pInfo->hWakeEventLock);
-        A_COND_WAIT(&pInfo->hWakeEvent, &pInfo->hWakeEventLock, WAITFOREVER);
-        A_MUTEX_UNLOCK(&pInfo->hWakeEventLock);
-
-        if (pInfo->AdapterAvailable) {
-            ProcessBTActionMessages(pInfo, BTACTION_QUEUE_NORMAL, ATH_BT_NOOP);
-        }
-
-        if (pInfo->Shutdown) {
-            /*
-             * before we exit we need to counter-act the coexistence
-             * settings. Currently we just indicate that each state is now 
-             * OFF (if they are ON). This state synchronization is typically 
-             * required on HOT-removable BT adapters or where the low level 
-             * adapter can be surprise removed before the BT stack can clean 
-             * up HCI connections and states 
-             */
-            if (pInfo->AdapterAvailable) {
-                int         indication, newIndication;
-                ATHBT_STATE newState;
-                
-                /* 
-                 * the BT adapter is going away, indicate that all indications 
-                 * are now in the OFF state, this may queue up control action 
-                 * messages, which is okay 
-                 */
-                for (indication = 0; indication < ATH_BT_MAX_STATE_INDICATION;
-                     indication++) 
-                {
-                    A_LOCK_FILTER(pInfo);
-                    newIndication = 
-                        FCore_FilterIndicatePreciseState(&pInfo->FilterCore, 
-                                          indication, STATE_OFF, &newState);
-                    A_UNLOCK_FILTER(pInfo);
-
-                    if (newIndication == ATH_BT_NOOP) {
-                        continue;
-                    }
-                    
-                    DoBtStateAction(pInfo, indication, newState);
-                }
-                
-                /* issue control actions */
-                ProcessBTActionMessages(pInfo, BTACTION_QUEUE_SYNC_STATE, 
-                                        ATH_BT_NOOP);
-            }
-
-            break;    
-        } 
-    }
-
-    A_INFO("Terminating the BT Filter task\n");
-    return NULL;
-}
-
-static void
-ProcessBTActionMessages(ATHBT_FILTER_INFO      *pInfo,
-                        BTACTION_QUEUE_PROC    Process,
-                        ATHBT_STATE_INDICATION StateToFlush)
-{
-    BT_ACTION_MSG *pActionMsg = NULL;
-    DL_LIST       *pListEntry = NULL;
-
-    A_LOCK_FILTER(pInfo);
-
-    while (1) {
-        /* determine how we want to pull the message out */
-        if (BTACTION_QUEUE_FLUSH_STATE == Process) {
-            if (NULL == pListEntry) {
-                /* first time through */
-                if (!DL_LIST_IS_EMPTY(&pInfo->BTActionMsgList)) {
-                    /* get the entry at the head of the list , don't remove */
-                    pListEntry =
-                        DL_LIST_GET_ITEM_AT_HEAD(&pInfo->BTActionMsgList);
-                }
-            } else {
-                /* move onto the next one */
-                pListEntry = pListEntry->pNext;
-                if (pListEntry == &pInfo->BTActionMsgList) {
-                    /* reached the end */
-                    pListEntry = NULL;
-                }
-            }
-        } else {
-            /*
-             * for all others we are removing items from the head of the
-             * queue
-             */
-            pListEntry = DL_ListRemoveItemFromHead(&pInfo->BTActionMsgList);
-        }
-
-        if (NULL == pListEntry) {
-            /* queue was empty */
-            break;
-        }
-
-        pActionMsg = A_CONTAINING_STRUCT(pListEntry, BT_ACTION_MSG, ListEntry);
-
-        /* now determine what to do with the message that was found */
-        switch (Process) {
-            case BTACTION_QUEUE_FLUSH_STATE:
-                /*
-                 * caller wants to just flush action messages matching a
-                 * state
-                 */
-                if (pActionMsg->StateForControlAction == StateToFlush) {
-                    A_DEBUG(("Removed action for state=%d from queue\n"),
-                            StateToFlush);
-
-                    /* remove from list, it will get freed below */
-                    DL_ListRemove(&pActionMsg->ListEntry);
-
-                    /*
-                     * this would re-start the scan to the head of the list
-                     * each time we found one.  This type of flush doesn't
-                     * happen very often so restarting from the head of the
-                     * list and rescanning isn't time consuming
-                     */
-                    pListEntry = NULL;
-                } else {
-                    /* not the one we are interested in */
-                    pActionMsg = NULL;
-                }
-                break;
-
-            case BTACTION_QUEUE_NORMAL:
-            case BTACTION_QUEUE_SYNC_STATE:
-                /* issue/execute actions */
-                A_UNLOCK_FILTER(pInfo);
-                A_DEBUG(("Processing action for indication=%d (%s) (%s)\n"),
-                        pActionMsg->IndicationForControlAction,
-                        (pActionMsg->StateForControlAction == STATE_ON) ?
-                        "ON" : "OFF", (BTACTION_QUEUE_SYNC_STATE == Process) ?
-                        "Sync State" : "Normal");
-
-                if (BTACTION_QUEUE_SYNC_STATE == Process) {
-                    /* let's not issue these too fast ... */
-                    usleep(10000);
-                }
-
-                ExecuteBtAction(pInfo, pActionMsg);
-
-                if (pActionMsg->Blocking) {
-                    pActionMsg->Blocking = FALSE;
-
-                    /* set the event to unblock the caller */
-                    A_MUTEX_LOCK(&pActionMsg->hWaitEventLock);
-                    A_COND_SIGNAL(&pActionMsg->hWaitEvent);
-                    A_MUTEX_UNLOCK(&pActionMsg->hWaitEventLock);
-                }
-                A_LOCK_FILTER(pInfo); 
-                break;
-
-            case BTACTION_QUEUE_FLUSH_ALL:
-                A_DEBUG(("Flushed action for state=%d from queue\n"),
-                        pActionMsg->StateForControlAction);
-                /* 
-                 * nothing to do here, the action message will get 
-                 * recycled below 
-                 */
-                break;
-
-            default:
-                break;
-        }
-
-        if (pActionMsg) {
-            /* recycle message */        
-            FREE_BT_ACTION_MSG(pInfo, pActionMsg);
-        }
-    }
-
-    A_UNLOCK_FILTER(pInfo);
-}
-    
-static void 
-SyncBTState(ATHBT_FILTER_INFO *pInfo)
-{
-    int      stateIndication;
-    A_UINT32 stateBitMap;
-
-    A_LOCK_FILTER(pInfo);
-    stateBitMap = FCore_GetCurrentBTStateBitMap(&pInfo->FilterCore);
-    A_UNLOCK_FILTER(pInfo);
-    
-    /* 
-     * the state bit map is a simple STATE ON/OFF bit map, if we detect 
-     * that one of the states is ON we process the BT action to synchronize 
-     * the WLAN side with the BT radio state 
-     */
-    for (stateIndication = 0; stateIndication < ATH_BT_MAX_STATE_INDICATION; 
-         stateIndication++)
-    {
-        if (stateBitMap & (1 << stateIndication)) {
-            /* this state is ON */
-            DoBtStateAction(pInfo, stateIndication, STATE_ON);
-        }
-    }
-
-}
-
-void
-HandleAdapterEvent(ATHBT_FILTER_INFO *pInfo, ATH_ADAPTER_EVENT Event)
-{
-    A_UINT32 btfiltFlags;
-    switch (Event) {
-        case ATH_ADAPTER_ARRIVED:
-            A_INFO("BT Filter Core : WLAN Arrived \n");
-            btfiltFlags = pInfo->Flags;
-            Abf_WlanCheckSettings(pInfo->pWlanInfo->IfName, &btfiltFlags);
-            if (btfiltFlags != pInfo->Flags) {
-                A_STATUS status;
-                BT_FILTER_CORE_INFO *pCoreInfo = &pInfo->FilterCore;
-                pInfo->Flags &= ~ABF_WIFI_CHIP_IS_VENUS;
-                pInfo->Flags |= (btfiltFlags & ABF_WIFI_CHIP_IS_VENUS);
-                pCoreInfo->FilterState.btFilterFlags &= ~ABF_WIFI_CHIP_IS_VENUS;
-                pCoreInfo->FilterState.btFilterFlags |= (btfiltFlags & ABF_WIFI_CHIP_IS_VENUS);
-                FCore_ResetActionDescriptors(pCoreInfo);
-                GetActionStringOverrides(pInfo);
-                status = FCore_RefreshActionList(pCoreInfo);
-                if (A_FAILED(status)) {
-                    A_ERR("[%s] Failed refresh action list (status:%d)\n",
-                        __FUNCTION__, status);
-                }
-            }
-
-            pInfo->AdapterAvailable = TRUE;
-
-            Abf_WlanIssueFrontEndConfig(pInfo);
-
-               Abf_WlanGetCurrentWlanOperatingFreq(pInfo);
-            /* sync BT state */
-            SyncBTState(pInfo);
-
-#if 0
-            /*
-             * the call to sync BT state may queue a bunch of actions to
-             * the action queue, we want to issues these differently
-             */
-            ProcessBTActionMessages(pInfo, BTACTION_QUEUE_SYNC_STATE,
-                                    ATH_BT_NOOP);
-#endif
-            break;
-
-        case ATH_ADAPTER_REMOVED:
-            A_INFO("BT Filter Core : WLAN removed \n");
-            pInfo->AdapterAvailable = FALSE;
-
-            /* flush messages */
-            ProcessBTActionMessages(pInfo, BTACTION_QUEUE_FLUSH_ALL,
-                                    ATH_BT_NOOP);
-            break;
-        default:
-            break;
-    }
-}
-
-/* execute the BT action
- * this function is called by the single dispatcher thread
- */
-static void
-ExecuteBtAction(ATHBT_FILTER_INFO *pInfo, BT_ACTION_MSG *pBtActionMsg)
-{
-    A_UINT32 size;
-    A_UINT32 controlCode;
-    A_STATUS status;
-
-
-    if(pInfo->Flags & ABF_WIFI_CHIP_IS_VENUS) {
-        if (pBtActionMsg->ControlAction.Type == BT_CONTROL_ACTION_STATUS) {
-            /* this action issues a STATUS OID command */
-            controlCode = AR6000_XIOCTL_WMI_SET_BT_OPERATING_STATUS;
-            size = sizeof(WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD);
-        } else {
-            if(pBtActionMsg->IndicationForControlAction == ATH_BT_SCO ||
-               pBtActionMsg->IndicationForControlAction == ATH_BT_ESCO)
-            {
-                controlCode = AR6000_XIOCTL_WMI_SET_BTCOEX_SCO_CONFIG;
-                size = sizeof(WMI_SET_BTCOEX_SCO_CONFIG_CMD);
-            }
-            if(pBtActionMsg->IndicationForControlAction == ATH_BT_A2DP){
-                controlCode = AR6000_XIOCTL_WMI_SET_BTCOEX_A2DP_CONFIG;
-                size = sizeof(WMI_SET_BTCOEX_A2DP_CONFIG_CMD);
-            }
-        }
-    }else {
-        if (pBtActionMsg->ControlAction.Type == BT_CONTROL_ACTION_STATUS) {
-            /* this action issues a STATUS OID command */
-            controlCode = AR6000_XIOCTL_WMI_SET_BT_STATUS;
-        } else {
-            /* this action issues a PARAMS OID command */
-            controlCode = AR6000_XIOCTL_WMI_SET_BT_PARAMS;
-        }
-        size  = sizeof(WMI_SET_BT_PARAMS_CMD);
-    }
-    if (pBtActionMsg->ControlAction.Length > size) {
-       A_ERR("Bad control action length : %d \n", pBtActionMsg->ControlAction.Length);
-       return;
-    }
-    do
-    {
-        A_UCHAR  buf[sizeof(A_UINT32) + size];
-
-        A_MEMZERO(buf, sizeof(buf));
-        A_MEMCPY(buf, &controlCode, sizeof(A_UINT32));
-        A_MEMCPY((buf + sizeof(A_UINT32)), (void *)pBtActionMsg->ControlAction.Buffer,
-                 pBtActionMsg->ControlAction.Length);
-        status = Abf_WlanDispatchIO(pInfo, AR6000_IOCTL_EXTENDED, (void *)buf,
-                                    pBtActionMsg->ControlAction.Length + sizeof(A_UINT32));
-
-        if (A_FAILED(status)) {
-          /* these can actually fail if the device powers down */
-            A_ERR("[%s] BT Action issue failed, Ioctl: 0x%x, Len: %d\n",
-                   __FUNCTION__, ((int *)buf)[0],
-                  pBtActionMsg->ControlAction.Length);
-        } else {
-            A_DEBUG("BT Action issued to WLAN Adapter, Ioctl: 0x%x, Len: %d\n",
-                        ((int *)buf)[0], pBtActionMsg->ControlAction.Length);
-            A_DUMP_BUFFER(pBtActionMsg->ControlAction.Buffer,
-                           pBtActionMsg->ControlAction.Length,
-                           "BT Control Action");
-        }
-    }while(FALSE);
-}
-
-static void
-ProcessActionOverride(ATHBT_FILTER_INFO *pInfo,
-                      A_CHAR            *pIndicationStr,
-                      A_CHAR            *pModifyAction,
-                      A_CHAR            *pAction)
-{
-    int                          i;
-    ATHBT_STATE_INDICATION       indication;
-    ATHBT_STATE                  state = STATE_MAX;
-    ATHBT_MODIFY_CONTROL_ACTION  modifyAction =
-                                 ATHBT_MODIFY_CONTROL_ACTION_NOOP;
-    char                         charBuffer[MAX_VAL_DATA_LENGTH];
-
-    /*
-     * parse the indication string to figure which indication and state
-     * to change i.e.  <indication>-ON or <indication>-OFF
-     */
-    for (indication = 0; indication < ATH_BT_MAX_STATE_INDICATION;
-         indication++)
-    {
-        if (strstr(pIndicationStr, g_IndicationStrings[indication]) != NULL) {
-            /* found one */
-            if (strstr(pIndicationStr, "-ON") != NULL) {
-                state = STATE_ON;    
-            }    
-
-            if (strstr(pIndicationStr, "-OFF") != NULL) {
-                state = STATE_OFF;
-            }  
-
-            if (strstr(pModifyAction, "REPLACE") != NULL) {
-                modifyAction = ATHBT_MODIFY_CONTROL_ACTION_REPLACE;
-            }     
-
-            if (strstr(pModifyAction, "APPEND") != NULL) {
-                modifyAction = ATHBT_MODIFY_CONTROL_ACTION_APPEND;
-            } 
-
-            break;    
-        }
-    }    
-
-    if ((indication == ATH_BT_MAX_STATE_INDICATION) || 
-        (state == STATE_MAX)               || 
-        (modifyAction == ATHBT_MODIFY_CONTROL_ACTION_NOOP)) 
-    {
-        return;    
-    }
-
-    A_DEBUG("Found Action override : %s (%s) (%s)\n", 
-            pIndicationStr, pModifyAction, pAction);
-
-    A_MEMZERO(charBuffer, sizeof(charBuffer));
-
-    for (i = 0; (i < (int)strlen(pAction)) && (i < (MAX_VAL_DATA_LENGTH - 1)); 
-         i++)
-    {
-        charBuffer[i] = (char)pAction[i];    
-    }
-
-    FCore_ModifyControlActionString(&pInfo->FilterCore, 
-                                    indication,
-                                    state,
-                                    charBuffer,
-                                    i,
-                                    modifyAction);
-}
-
-static void 
-GetActionStringOverrides(ATHBT_FILTER_INFO *pInfo)
-{
-    A_CHAR *ptr, *indication, *modify, *action;
-    A_CHAR *string = (A_CHAR *)A_MALLOC(MAX_VAL_DATA_LENGTH);
-
-    if (!(gConfigFile)) return;
-
-    fgets(string, MAX_VAL_DATA_LENGTH, gConfigFile);
-    while (!(feof(gConfigFile))) {
-        ptr = string;
-        indication = strsep(&string, ":");
-        modify = strsep(&string, ":");
-        action = string;
-        ProcessActionOverride(pInfo, indication, modify, action);
-        string = ptr;
-        fgets(string, MAX_VAL_DATA_LENGTH, gConfigFile);
-    }
-
-    A_FREE(string);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_int.h b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_int.h
deleted file mode 100644 (file)
index a8e51e2..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="abtfilt_int.h" company="Atheros">
-//    Copyright (c) 2008 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// Author(s): ="Atheros"
-//==============================================================================
-
-/*
- * Bluetooth filter internal definitions
- * 
- */
-
-#ifndef ABTFILT_INT_H_
-#define ABTFILT_INT_H_
-
-#include <stdio.h>
-#include <stddef.h>
-#include <sys/types.h>
-#include <linux/types.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <linux/rtnetlink.h>
-#include <linux/if.h>
-#include <linux/wireless.h>
-#include <sys/ioctl.h>
-#include <syslog.h>
-#include <stdarg.h>
-#include <pthread.h>
-#include <time.h>
-#include <signal.h>
-#include <ctype.h>
-#include "a_config.h"
-#include "a_osapi.h"
-#include "athdefs.h"
-#include "a_types.h"
-#include "a_debug.h"
-#include "dl_list.h"
-#include "athbtfilter.h"
-#include "btfilter_core.h"
-#include "athdrv_linux.h"
-#include "wmi.h"
-
-#ifndef IW_EV_LCP_PK_LEN
-#define IW_EV_LCP_PK_LEN (4)
-#define IW_EV_POINT_PK_LEN (IW_EV_LCP_PK_LEN + 4)
-#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
-                          (char *) NULL)
-#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
-                         IW_EV_POINT_OFF)
-#endif
-
-/* Forward Declarations */
-struct _ABF_BT_INFO;
-struct _ABF_WLAN_INFO;
-
-/*-----------------------------------------------------------------------*/
-/* Utils Section */
-
-/* Task Management operations and definitions */
-#define WAITFOREVER             -1
-#define A_TASK_HANDLE           pthread_t
-#define A_COND_OBJECT           pthread_cond_t
-#define A_MUTEX_OBJECT          pthread_mutex_t
-#define A_FILE_HANDLE           FILE *
-
-/* Function Prototypes */
-INLINE A_STATUS A_TASK_CREATE(A_TASK_HANDLE *handle, 
-                              void *(*func)(void *), void *arg);
-INLINE A_STATUS A_TASK_JOIN(A_TASK_HANDLE *handle);
-INLINE void A_TASK_CLEANUP(void);
-
-INLINE A_STATUS A_MUTEX_INIT(A_MUTEX_OBJECT *mutex);
-INLINE void A_MUTEX_LOCK(A_MUTEX_OBJECT *mutex);
-INLINE void A_MUTEX_UNLOCK(A_MUTEX_OBJECT *mutex);
-INLINE void A_MUTEX_DEINIT(A_MUTEX_OBJECT *mutex);
-
-INLINE A_STATUS A_COND_INIT(A_COND_OBJECT *cond);
-INLINE A_STATUS A_COND_WAIT(A_COND_OBJECT *cond, 
-                            A_MUTEX_OBJECT *mutex, int timeout);
-INLINE void A_COND_SIGNAL(A_COND_OBJECT *cond);
-INLINE void A_COND_DEINIT(A_COND_OBJECT *cond);
-INLINE A_STATUS A_COND_RESET(A_COND_OBJECT *cond);
-
-INLINE void A_STR2ADDR(const char *str, A_UINT8 *addr);
-
-#ifdef ABF_DEBUG
-INLINE void A_DBG_INIT(const char *ident, const char *message, ...);
-INLINE void A_DEBUG(const char *format, ...);
-INLINE void A_INFO(const char *format, ...);
-INLINE void A_ERR(const char *format, ...);
-INLINE void A_SET_DEBUG(int enable);
-INLINE void A_DBG_DEINIT(void);
-void A_DUMP_BUFFER(A_UCHAR *buffer, int length, char *pDescription);
-void A_DBG_SET_OUTPUT_TO_CONSOLE(void);
-#else
-#define A_DBG_INIT(args...) 
-#define A_DEBUG(args...)
-#define A_INFO(args...)
-#define A_ERR(args...)
-#define A_SET_DEBUG(arg)
-#define A_DBG_DEINIT()
-#define A_DUMP_BUFFER(buffer, length, pDescription)
-#define A_DBG_SET_OUTPUT_TO_CONSOLE() 
-
-#endif /* ABF_DEBUG */
-/*-----------------------------------------------------------------------*/
-
-/*-----------------------------------------------------------------------*/
-/* Filter Section */
-#define MAX_BT_ACTION_MESSAGES      16
-#define ACTION_WAIT_TIMEOUT         100
-
-#define QUEUE_BT_ACTION_MSG(p,a) \
-    DL_ListInsertTail(&(p)->BTActionMsgList,&(a)->ListEntry)
-#define FREE_BT_ACTION_MSG(p,a) \
-    DL_ListInsertTail(&(p)->FreeActionMsgList,&(a)->ListEntry)
-
-#define A_LOCK_FILTER(p) \
-    A_MUTEX_LOCK(&((p)->CritSection))
-
-#define A_UNLOCK_FILTER(p) \
-    A_MUTEX_UNLOCK(&((p)->CritSection))
-
-typedef enum _BTACTION_QUEUE_PROC {
-    BTACTION_QUEUE_NORMAL      = 0, /* normal processing of the action queue */
-    BTACTION_QUEUE_FLUSH_ALL   = 1, /* flush all actions for shutdown */ 
-    BTACTION_QUEUE_FLUSH_STATE,     /* flush all actions associated with a 
-                                       specific state */     
-    BTACTION_QUEUE_SYNC_STATE       /* issue queued actions when we are 
-                                       syncing radio state on adapter 
-                                       available */         
-} BTACTION_QUEUE_PROC;
-
-typedef enum _ATH_ADAPTER_EVENT {
-   ATH_ADAPTER_ARRIVED = 0,
-   ATH_ADAPTER_REMOVED = 1,
-} ATH_ADAPTER_EVENT;
-    
-typedef struct _BT_ACTION_MSG {
-    DL_LIST                         ListEntry;
-    A_COND_OBJECT                   hWaitEvent;      /* wait object for 
-                                                        blocking requests */
-    A_MUTEX_OBJECT                  hWaitEventLock;
-    A_BOOL                          Blocking;        /* this action requires 
-                                                        the calling thread to 
-                                                        block until the 
-                                                        dispatcher submits 
-                                                        the command */
-    ATHBT_STATE_INDICATION          IndicationForControlAction; /* indication
-                                                                   associated 
-                                                                   with the 
-                                                                   control 
-                                                                   action */
-    ATHBT_STATE                     StateForControlAction;
-    BT_CONTROL_ACTION               ControlAction;
-} BT_ACTION_MSG; 
-
-typedef struct _ATHBT_SCO_CONNECTION_INFO {
-    A_BOOL                          Valid;
-    A_UCHAR                         LinkType;
-    A_UCHAR                         TransmissionInterval;
-    A_UCHAR                         RetransmissionInterval;
-    A_UINT16                        RxPacketLength;
-    A_UINT16                        TxPacketLength;
-} ATHBT_SCO_CONNECTION_INFO;
-
-typedef struct _ATHBT_FILTER_INFO {
-    ATH_BT_FILTER_INSTANCE         *pInstance;
-    A_UINT32                        MaxBtActionMessages;
-    A_MUTEX_OBJECT                  CritSection;
-    DL_LIST                         BTActionMsgList;
-    DL_LIST                         FreeActionMsgList;
-    BT_FILTER_CORE_INFO             FilterCore;
-    A_BOOL                          Shutdown;
-    A_COND_OBJECT                   hWakeEvent;
-    A_MUTEX_OBJECT                  hWakeEventLock;
-    A_TASK_HANDLE                   hFilterThread;
-    A_BOOL                          FilterThreadValid;
-    ATHBT_SCO_CONNECTION_INFO       SCOConnectInfo;
-    A_UCHAR                         LMPVersion;
-    A_BOOL                          AdapterAvailable;
-    A_TASK_HANDLE                   hBtThread;
-    A_TASK_HANDLE                   hWlanThread;
-    struct _ABF_WLAN_INFO          *pWlanInfo;
-    struct _ABF_BT_INFO            *pBtInfo;
-    A_UCHAR                        SCOConnection_LMPVersion;   /* lmp version of remote SCO device */
-    A_UCHAR                        A2DPConnection_LMPVersion;  /* lmp version of remote A2DP device */ 
-    A_UCHAR                        SCOConnection_Role;         /* role of remote SCO device */
-    A_UCHAR                        A2DPConnection_Role;        /* role of remote A2DP device */
-    A_UINT32                       Flags;
-} ATHBT_FILTER_INFO;
-
-/* Function Prototypes */
-void HandleAdapterEvent(ATHBT_FILTER_INFO *pInfo, ATH_ADAPTER_EVENT Event);
-/*-----------------------------------------------------------------------*/
-
-/*-----------------------------------------------------------------------*/
-/* WLAN Section */
-#define WLAN_ADAPTER_NAME_SIZE_MAX  31
-
-#define WLAN_GET_HOME_CHANNEL(pInfo) \
-    (pInfo)->pAbfWlanInfo->Channel
-
-typedef struct _ABF_WLAN_INFO {
-    ATHBT_FILTER_INFO              *pInfo;
-    A_INT32                         Handle;
-    A_UINT8                         PhyCapability;
-    A_UCHAR                         AdapterName[WLAN_ADAPTER_NAME_SIZE_MAX+1];
-    A_UINT32                        HostVersion;
-    A_UINT32                        TargetVersion;
-    A_CHAR                          IfName[IFNAMSIZ];
-    A_INT32                         IfIndex;
-    A_BOOL                          Loop;
-    A_COND_OBJECT                   hWaitEvent;
-    A_MUTEX_OBJECT                  hWaitEventLock;
-    A_UINT16                        Channel;
-} ABF_WLAN_INFO;
-
-/* Function Prototypes */
-void Abf_WlanCheckSettings(A_CHAR *wifname, A_UINT32 *btfiltFlags);
-A_STATUS Abf_WlanStackNotificationInit(ATH_BT_FILTER_INSTANCE *pInstance, A_UINT32 flags);
-void Abf_WlanStackNotificationDeInit(ATH_BT_FILTER_INSTANCE *pInstance);
-A_STATUS Abf_WlanDispatchIO(ATHBT_FILTER_INFO *pInfo, unsigned long int req,
-                            void *data, int size);
-/*-----------------------------------------------------------------------*/
-
-/* Function Prototypes */
-
-#define ABF_ENABLE_AFH_CHANNEL_CLASSIFICATION   (1 << 0)
-#define ABF_USE_HCI_FILTER_FOR_HEADSET_PROFILE  (1 << 1)
-#define ABF_WIFI_CHIP_IS_VENUS                  (1 << 2)
-#define ABF_BT_CHIP_IS_ATHEROS                  (1 << 3)
-#define ABF_USE_ONLY_DBUS_FILTERING             (1 << 4)
-#define ABF_FE_ANT_IS_SA                        (1 << 5)
-
-A_STATUS Abf_BtStackNotificationInit(ATH_BT_FILTER_INSTANCE *pInstance, A_UINT32 Flags);
-void Abf_BtStackNotificationDeInit(ATH_BT_FILTER_INSTANCE *pInstance);
-
-#ifdef CONFIG_NO_HCILIBS
-#define Abf_HciLibInit(_flags) (A_ERROR)
-#define Abf_HciLibDeInit()
-#define Abf_RegisterToHciLib(_pInfo) 
-#define Abf_UnRegisterToHciLib(_pInfo)
-#define Abf_IssueAFHViaHciLib(_pInfo, _ch) do { } while (0)
-#else
-A_STATUS Abf_HciLibInit(A_UINT32 *flags);
-void Abf_HciLibDeInit(void);
-void Abf_RegisterToHciLib(struct _ABF_BT_INFO * pAbfBtInfo);
-void Abf_UnRegisterToHciLib(struct _ABF_BT_INFO * pAbfBtInfo);
-A_STATUS  Abf_IssueAFHViaHciLib (struct _ABF_BT_INFO  * pAbfBtInfo, int CurrentWLANChannel);
-#endif
-
-/* WLAN channel number can be expressed as either 1-14 or expressed in Mhz (i.e. 2412) */ 
-void IndicateCurrentWLANOperatingChannel(ATHBT_FILTER_INFO *pFilterInfo, int CurrentWLANChannel);
-
-/*-----------------------------------------------------------------------*/
-
-A_STATUS Abf_WlanGetSleepState(ATHBT_FILTER_INFO * pInfo);
-A_STATUS Abf_WlanGetCurrentWlanOperatingFreq(ATHBT_FILTER_INFO * pInfo);
-A_STATUS Abf_WlanIssueFrontEndConfig(ATHBT_FILTER_INFO * pInfo);
-#endif /* ABTFILT_INT_H_ */
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_main.c b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_main.c
deleted file mode 100644 (file)
index ceec73e..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="abtfilt_main.c" company="Atheros">
-//    Copyright (c) 2008 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// Author(s): ="Atheros"
-//==============================================================================
-
-/*
- * Bluetooth Filter Main Routine
- *
- */
-#include "abtfilt_int.h"
-
-const char *progname;
-A_CHAR wifname[IFNAMSIZ];
-static ATH_BT_FILTER_INSTANCE g_AthBtFilterInstance;
-A_FILE_HANDLE gConfigFile;
-static volatile sig_atomic_t terminated;
-ATHBT_FILTER_INFO *GpInfo=NULL;
-static void 
-usage(void)
-{
-    fprintf(stderr, "usage:\n%s [options] \n", progname);
-    fprintf(stderr, "  -n   : do not run as a daemon \n");
-    fprintf(stderr, "  -d   : enable debug logging \n");
-    fprintf(stderr, "  -c   : output debug logs to the console \n");
-    fprintf(stderr, "  -a   : issue AFH channel classification when WLAN connects \n");
-    fprintf(stderr, "  -f <config file>  : specify configuration file with overrides \n");
-    fprintf(stderr, "  -z   : use HCI filtering for headset profile state notifications (Android-Only) \n");
-    fprintf(stderr, "  -x   : co-located bt is Atheros \n");
-    fprintf(stderr, "  -w <wlan interface>  : wlan adapter name (wlan0/eth1, etc.)\n");
-    fprintf(stderr, "  -b   : Use only d-bus filtering (on interfaces which doesnt support hciX\n");
-    fprintf(stderr, "  -s   : Front End is single antenna (if not specified, its assumed to be dual antenna with atleast 25 dB of isolation)\n");
-}
-
-void
-Abf_ShutDown(void)
-{
-    A_INFO("Shutting Down\n");
-
-    /* Clean up all the resources */
-    Abf_BtStackNotificationDeInit(&g_AthBtFilterInstance);
-    Abf_WlanStackNotificationDeInit(&g_AthBtFilterInstance);
-    AthBtFilter_Detach(&g_AthBtFilterInstance);
-    
-    A_INFO("Shutting Down Complete\n");
-}
-
-static void
-Abf_SigTerm(int sig)
-{
-        /* unblock main thread */
-    terminated = 1;
-}
-
-int
-main(int argc, char *argv[])
-{
-    int ret;
-    char *config_file = NULL;
-    int opt = 0, daemonize = 1, debug = 0, console_output=0;
-    progname = argv[0];
-    A_STATUS status;
-    struct sigaction sa;
-    ATHBT_FILTER_INFO *pInfo;
-    A_UINT32 btfiltFlags = 0;
-
-    A_MEMZERO(&g_AthBtFilterInstance, sizeof(ATH_BT_FILTER_INSTANCE));
-
-    /*
-     * Keep an option to specify the wireless extension. By default,
-     * assume it to be equal to WIRELESS_EXT TODO
-     */
-
-    /* Get user specified options */
-    while ((opt = getopt(argc, argv, "bsvandczxf:w:")) != EOF) {
-        switch (opt) {
-        case 'n':
-            daemonize = 0;
-            break;
-
-        case 'd':
-            debug = 1;
-            break;
-
-        case 'f':
-            if (optarg) {
-                config_file = strdup(optarg);
-            }
-            break;
-        case 'c':
-            console_output = 1;
-            break;
-        case 'a':
-            btfiltFlags |= ABF_ENABLE_AFH_CHANNEL_CLASSIFICATION;
-            break;
-        case 'z':
-            btfiltFlags |= ABF_USE_HCI_FILTER_FOR_HEADSET_PROFILE;
-            break;
-        case 'v':
-            btfiltFlags |= ABF_WIFI_CHIP_IS_VENUS ;
-            A_DEBUG("wifi chip is venus\n");
-            break;
-        case 'x':
-            btfiltFlags |= ABF_BT_CHIP_IS_ATHEROS ;
-            A_DEBUG("bt chip is atheros\n");
-            break;
-        case 's':
-            btfiltFlags |= ABF_FE_ANT_IS_SA ;
-            A_DEBUG("Front End Antenna Configuration is single antenna \n");
-            break;
-        case 'w':
-            memset(wifname, '\0', IFNAMSIZ);
-            strcpy(wifname, optarg);
-            g_AthBtFilterInstance.pWlanAdapterName = (A_CHAR *)&wifname;
-            break;
-       case 'b':
-           btfiltFlags |= ABF_USE_ONLY_DBUS_FILTERING;
-           break;
-        default:
-            usage();
-            exit(1);
-        }
-    }
-
-    /* Launch the daemon if desired */
-    if (daemonize && daemon(0, console_output ? 1 : 0)) {
-        printf("Can't daemonize: %s\n", strerror(errno));
-        exit(1);
-    }
-
-    /* Initialize the debug infrastructure */
-    A_DBG_INIT("ATHBT", "Ath BT Filter Daemon");
-    if (debug) {
-        if (console_output) {
-            A_DBG_SET_OUTPUT_TO_CONSOLE();
-        }
-       // setlogmask(LOG_INFO | LOG_DEBUG | LOG_ERR);
-        A_INFO("Enabling Debug Information\n");
-        A_SET_DEBUG(1);
-    }
-
-    if (config_file) {
-        A_DEBUG("Config file: %s\n", config_file);
-        if (!(gConfigFile = fopen(config_file, "r")))
-        {
-            A_ERR("[%s] fopen failed\n", __FUNCTION__);
-        }
-    }
-
-    A_MEMZERO(&sa, sizeof(struct sigaction));
-    sa.sa_flags = SA_NOCLDSTOP;
-    sa.sa_handler = Abf_SigTerm;
-    sigaction(SIGTERM, &sa, NULL);
-    sigaction(SIGINT,  &sa, NULL);
-
-    sa.sa_handler = SIG_IGN;
-    sigaction(SIGPIPE, &sa, NULL);
-
-    Abf_HciLibInit(&btfiltFlags);
-
-    /* Initialize the Filter core */
-    do {
-        Abf_WlanCheckSettings(wifname, &btfiltFlags);
-        ret = AthBtFilter_Attach(&g_AthBtFilterInstance, btfiltFlags );
-        if (ret) {
-            A_ERR("Filter initialization failed\n");
-            break;
-        }
-
-        /* Initialize the WLAN notification mechanism */
-        status = Abf_WlanStackNotificationInit(&g_AthBtFilterInstance, btfiltFlags );
-        if (A_FAILED(status)) {
-            AthBtFilter_Detach(&g_AthBtFilterInstance);
-            A_ERR("WLAN stack notification init failed\n");
-            break;
-        }
-
-        /* Initialize the BT notification mechanism */
-        status = Abf_BtStackNotificationInit(&g_AthBtFilterInstance,btfiltFlags);
-        if (A_FAILED(status)) {
-            Abf_WlanStackNotificationDeInit(&g_AthBtFilterInstance);
-            AthBtFilter_Detach(&g_AthBtFilterInstance);
-            A_ERR("BT stack notification init failed\n");
-            break;
-        }
-
-        /* Check for errors on the return value TODO */
-        pInfo = g_AthBtFilterInstance.pContext;
-        GpInfo = pInfo;
-
-        A_DEBUG("Service running, waiting for termination .... \n");
-
-            /* wait for termination signal */
-        while (!terminated) {
-            sleep(1);
-        }
-    } while(FALSE);
-
-    /* Initiate the shutdown sequence */
-    if(GpInfo != NULL) {
-        AthBtFilter_State_Off(GpInfo);
-    }
-    Abf_ShutDown();
-
-    Abf_HciLibDeInit();
-    /* Shutdown */
-    if (gConfigFile) {
-        fclose(gConfigFile);
-    }
-
-    if (config_file) {
-        A_FREE(config_file);
-    }
-
-    A_DEBUG("Service terminated \n");
-    A_MEMZERO(&g_AthBtFilterInstance, sizeof(ATH_BT_FILTER_INSTANCE));
-    A_DBG_DEINIT();
-
-    return 0;
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_utils.c b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_utils.c
deleted file mode 100644 (file)
index 99b7bab..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="abtfilt_utils.c" company="Atheros">
-//    Copyright (c) 2008 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// Author(s): ="Atheros"
-//==============================================================================
-
-/*
- * Bluetooth Filter utils
- *
- */
-static const char athId[] __attribute__ ((unused)) = "$Id: //depot/sw/releases/olca3.1-RC/host/tools/athbtfilter/bluez/abtfilt_utils.c#2 $";
-
-#include "abtfilt_int.h"
-#ifdef ANDROID
-#include <cutils/log.h>
-#endif
-
-#ifdef ANDROID
-#define LOG_TAGS "abtfilt"
-#define A_LOG_INFO  ANDROID_LOG_INFO
-#define A_LOG_ERR   ANDROID_LOG_ERROR
-#define A_LOG_DEBUG ANDROID_LOG_DEBUG
-#define A_VSYSLOG(level, msg, ap) __android_log_vprint(level, LOG_TAGS, msg, ap);
-#define A_SYSLOG(level, msg, args...) __android_log_print(level, LOG_TAGS, msg, ##args);
-#else
-#define A_LOG_INFO  LOG_INFO
-#define A_LOG_ERR   LOG_ERR
-#define A_LOG_DEBUG LOG_DEBUG
-#define A_VSYSLOG(level, msg, ap) vsyslog(LOG_ERR, msg, ap)
-#define A_SYSLOG syslog
-#endif
-
-/* Task specific operations */
-INLINE A_STATUS
-A_TASK_CREATE(A_TASK_HANDLE *handle, void *(*func)(void *), void *arg)
-{
-    int ret;
-    pthread_attr_t attr;
-
-    pthread_attr_init(&attr);
-    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
-    ret = pthread_create(handle, &attr, func, arg);
-    if (ret) {
-        A_ERR("%s Failed: %d\n", __FUNCTION__, ret);
-        return A_ERROR;
-    }
-
-    pthread_attr_destroy(&attr);
-    return A_OK;
-}
-
-INLINE A_STATUS
-A_TASK_JOIN(A_TASK_HANDLE *handle)
-{
-    int ret;
-
-    ret = pthread_join(*handle, NULL);
-    if (ret) {
-        A_ERR("%s Failed: %d\n", __FUNCTION__, ret);
-        return A_ERROR;
-    }
-
-    return A_OK;
-}
-
-INLINE void
-A_TASK_CLEANUP(void)
-{
-    pthread_exit(NULL);
-}
-
-/* Mutual exclusion operations */
-INLINE A_STATUS
-A_MUTEX_INIT(A_MUTEX_OBJECT *mutex)
-{
-    int ret;
-
-    ret = pthread_mutex_init(mutex, NULL);
-    if (ret) {
-        A_ERR("%s Failed: %d\n", __FUNCTION__, ret);
-        return A_ERROR;
-    }
-
-    return A_OK;
-}
-
-INLINE void
-A_MUTEX_LOCK(A_MUTEX_OBJECT *mutex)
-{
-    pthread_mutex_lock(mutex);
-}
-
-INLINE void
-A_MUTEX_UNLOCK(A_MUTEX_OBJECT *mutex)
-{
-    pthread_mutex_unlock(mutex);
-}
-
-INLINE void
-A_MUTEX_DEINIT(A_MUTEX_OBJECT *mutex)
-{
-    pthread_mutex_destroy(mutex);
-}
-
-/* Conditional Variable operations */
-INLINE A_STATUS
-A_COND_INIT(A_COND_OBJECT *cond)
-{
-    int ret;
-
-    ret = pthread_cond_init(cond, NULL);
-    if (ret) {
-        A_ERR("%s Failed: %d\n", __FUNCTION__, ret);
-        return A_ERROR;
-    }
-
-    return A_OK;
-}
-
-INLINE A_STATUS
-A_COND_WAIT(A_COND_OBJECT *cond, A_MUTEX_OBJECT *mutex, int timeout)
-{
-    int ret;
-    struct timespec ts;
-
-    if (timeout != WAITFOREVER) {
-        /* TODO: support for values equal to or more than a second */
-        clock_gettime(CLOCK_REALTIME, &ts);
-        ts.tv_nsec += (timeout * 1000000);
-        ret = pthread_cond_timedwait(cond, mutex, &ts);
-    } else {
-        ret = pthread_cond_wait(cond, mutex);
-    }
-
-    if (ret) {
-        A_ERR("%s Failed: %d\n", __FUNCTION__, ret);
-        return A_ERROR;
-    }
-
-    return A_OK;
-}
-
-INLINE void
-A_COND_SIGNAL(A_COND_OBJECT *cond)
-{
-    pthread_cond_signal(cond);
-}
-
-INLINE void
-A_COND_DEINIT(A_COND_OBJECT *cond)
-{
-    pthread_cond_destroy(cond);
-}
-
-INLINE A_STATUS
-A_COND_RESET(A_COND_OBJECT *cond)
-{
-    A_COND_DEINIT(cond);
-    return (A_COND_INIT(cond));
-}
-
-/* Debug Infrastructure */
-#ifdef ABF_DEBUG
-static volatile int debug_enabled = 0;
-int dump_console = 0;
-
-void A_DBG_SET_OUTPUT_TO_CONSOLE(void)
-{
-    dump_console = 1;    
-}
-
-
-INLINE void
-A_DBG_INIT(const char *ident, const char *message, ...)
-{
-    va_list ap;
-
-    openlog(ident, LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_DAEMON);
-
-    va_start(ap, message);
-    A_VSYSLOG(A_LOG_INFO, message, ap);
-    va_end(ap);
-}
-
-static void dump_to_console(const char *format, va_list args)
-{
-    char buffer[384];
-    
-    vsprintf(buffer,format,args);
-    printf("%s", buffer);    
-    
-}
-
-INLINE void
-A_DEBUG(const char *format, ...)
-{
-    va_list ap;
-
-    if (!debug_enabled)
-        return;
-
-    va_start(ap, format);
-    if (dump_console) {
-        dump_to_console(format,ap);
-    } else {
-        A_VSYSLOG(A_LOG_DEBUG, format, ap);
-    }
-    
-    va_end(ap);
-}
-
-INLINE void
-A_INFO(const char *format, ...)
-{
-    va_list ap;
-
-    va_start(ap, format);
-    if (dump_console) {
-        dump_to_console(format,ap);
-    } else {
-        A_VSYSLOG(A_LOG_INFO, format, ap);
-    }
-    va_end(ap);
-}
-
-INLINE void
-A_ERR(const char *format, ...)
-{
-    va_list ap;
-
-    va_start(ap, format);
-    if (dump_console) {
-        dump_to_console(format,ap);
-    } else {
-        A_VSYSLOG(A_LOG_ERR, format, ap);
-        A_SYSLOG(A_LOG_ERR, "Last Error: %s\n", strerror(errno));
-    }
-    va_end(ap);
-}
-
-INLINE void
-A_SET_DEBUG(int enable)
-{
-    debug_enabled = enable;
-}
-
-INLINE void
-A_DBG_DEINIT(void)
-{
-    A_SET_DEBUG(0);
-    closelog();
-}
-
-void 
-A_DUMP_BUFFER(A_UCHAR *buffer, int length, char *pDescription)
-{
-    A_CHAR    stream[60];
-    int       i;
-    int       offset, count;
-
-    if (!debug_enabled) {
-        return;    
-    }
-    
-    A_DEBUG("<---------Dumping %d Bytes : %s ------>\n", length, pDescription);
-
-    count = 0;
-    offset = 0;
-    for(i = 0; i < length; i++) {
-        sprintf(stream + offset, "%2.2X ", buffer[i]);
-        count ++;
-        offset += 3;
-
-        if (count == 16) {
-            count = 0;
-            offset = 0;
-            A_DEBUG("[H]: %s\n", stream);
-            A_MEMZERO(stream, sizeof(stream));
-        }
-    }
-
-    if (offset != 0) {
-        A_DEBUG("[H]: %s\n", stream);
-    }
-    
-    A_DEBUG("<------------------------------------------------->\n");
-}
-#endif /* ABF_DEBUG */
-
-INLINE void
-A_STR2ADDR(const char *str, A_UINT8 *addr)
-{
-    const char *ptr = str;
-    int i;
-
-    for (i = 0; i < 6; i++) {
-        addr[i] = (A_UINT8) strtol(ptr, NULL, 16);
-        if (i != 5 && !(ptr = strchr(ptr, ':'))) {
-            ptr = ":00:00:00:00:00";
-        }
-        ptr++;
-    }
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_wlan.c b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/abtfilt_wlan.c
deleted file mode 100644 (file)
index 2b534c9..0000000
+++ /dev/null
@@ -1,836 +0,0 @@
-
-//------------------------------------------------------------------------------
-// <copyright file="abfilt_wlan.c" company="Atheros">
-//    Copyright (c) 2007 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// Bluetooth filter core action tables and action lookup
-//
-// Author(s): ="Atheros"
-//==============================================================================
-/*
- * Bluetooth Filter - WLAN module
- *
- */
-
-#include "abtfilt_int.h"
-#ifdef ANDROID
-#include "cutils/properties.h"
-#endif 
-
-/* Definitions */
-#define WLAN_EVENT_SIZE_MAX            1024
-#define IW_HEADER_TYPE_POINT           8
-
-/* Function Prototypes */
-static void NewLinkEvent(ATH_BT_FILTER_INSTANCE *pInstance, 
-                         struct nlmsghdr *h, int len);
-static void DelLinkEvent(ATH_BT_FILTER_INSTANCE *pInstance, 
-                         struct nlmsghdr *h, int len);
-static void WirelessEvent(ATH_BT_FILTER_INSTANCE *pInstance, 
-                          char *data, int len);
-static A_STATUS WirelessCustomEvent(ATH_BT_FILTER_INSTANCE *pInstance, 
-                                    char *buf, int len);
-static A_STATUS AcquireWlanAdapter(ABF_WLAN_INFO *pAbfWlanInfo);
-static void ReleaseWlanAdapter(ABF_WLAN_INFO *pAbfWlanInfo);
-static void *WlanEventThread(void *arg);
-static A_STATUS GetAdapterInfo(ABF_WLAN_INFO *pAbfWlanInfo);
-
-/* APIs exported to other modules */
-A_STATUS
-Abf_WlanStackNotificationInit(ATH_BT_FILTER_INSTANCE *pInstance, A_UINT32 flags)
-{
-    A_STATUS status;
-    ATHBT_FILTER_INFO *pInfo;
-    ABF_WLAN_INFO *pAbfWlanInfo;
-
-    pInfo = (ATHBT_FILTER_INFO *)pInstance->pContext;
-    if (pInfo->pWlanInfo) {
-        return A_OK;
-    }
-
-    pAbfWlanInfo = (ABF_WLAN_INFO *)A_MALLOC(sizeof(ABF_WLAN_INFO));
-    A_MEMZERO(pAbfWlanInfo,sizeof(ABF_WLAN_INFO));
-
-    A_MUTEX_INIT(&pAbfWlanInfo->hWaitEventLock);
-    A_COND_INIT(&pAbfWlanInfo->hWaitEvent);
-    A_MEMZERO(pAbfWlanInfo, sizeof(ABF_WLAN_INFO));
-    pAbfWlanInfo->pInfo = pInfo;
-    pAbfWlanInfo->Loop = TRUE;
-    pInfo->pWlanInfo = pAbfWlanInfo;
-
-    /* Spawn a thread which will be used to process events from WLAN */
-    status = A_TASK_CREATE(&pInfo->hWlanThread, WlanEventThread, pAbfWlanInfo);
-    if (A_FAILED(status)) {
-        A_ERR("[%s] Failed to spawn a WLAN thread\n", __FUNCTION__);
-        return A_ERROR;
-    }
-
-    A_INFO("WLAN Stack Notification init complete\n");
-
-    return A_OK;
-}
-
-void
-Abf_WlanStackNotificationDeInit(ATH_BT_FILTER_INSTANCE *pInstance)
-{
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pInstance->pContext;
-    ABF_WLAN_INFO *pAbfWlanInfo = pInfo->pWlanInfo;
-
-    if (!pAbfWlanInfo) return;
-
-    /* Terminate and wait for the WLAN Event Handler task to finish */
-    A_MUTEX_LOCK(&pAbfWlanInfo->hWaitEventLock);
-    if (pAbfWlanInfo->Loop) {
-        pAbfWlanInfo->Loop = FALSE;
-        A_COND_WAIT(&pAbfWlanInfo->hWaitEvent, &pAbfWlanInfo->hWaitEventLock, 
-                    WAITFOREVER);
-    }
-    A_MUTEX_UNLOCK(&pAbfWlanInfo->hWaitEventLock);
-
-    /* Flush all the BT actions from the filter core */
-    HandleAdapterEvent(pInfo, ATH_ADAPTER_REMOVED);
-    pInfo->pWlanInfo = NULL;
-    A_MUTEX_DEINIT(&pAbfWlanInfo->hWaitEventLock);
-    A_COND_DEINIT(&pAbfWlanInfo->hWaitEvent);
-    A_MEMZERO(pAbfWlanInfo, sizeof(ABF_WLAN_INFO));
-    A_FREE(pAbfWlanInfo);
-
-    A_INFO("WLAN Stack Notification de-init complete\n");
-}
-
-A_STATUS
-Abf_WlanDispatchIO(ATHBT_FILTER_INFO *pInfo, unsigned long int req, 
-                   void *data, int size)
-{
-    int ret;
-    struct ifreq ifr;
-    char ifname[IFNAMSIZ], *ethIf;
-    ABF_WLAN_INFO *pAbfWlanInfo = pInfo->pWlanInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-    if (!pAbfWlanInfo->Handle) {
-        /* No adapter to issue ioctl on */
-        return A_DEVICE_NOT_FOUND;
-    }
-
-    /* Get the adpater name from command line if specified */
-    if (pInstance->pWlanAdapterName != NULL) {
-        ethIf = pInstance->pWlanAdapterName;
-    } else {
-        if ((ethIf = getenv("NETIF")) == NULL) {
-            ethIf = pAbfWlanInfo->IfName;
-        }
-    }
-    /* Frame and issue the requested ioctl to the WLAN adapter */
-    A_MEMZERO(ifname, IFNAMSIZ);
-    strcpy(ifname, ethIf);
-    strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-    ifr.ifr_data = (void *)data;
-    if ((ret = ioctl(pAbfWlanInfo->Handle, req, &ifr)) < 0) {
-        A_ERR("[%s] [%s] IOCTL (req:0x%X, data: 0x%X size:%d) call failed!: %d\n", 
-            __FUNCTION__, ifr.ifr_name, req, (A_UINT32)ifr.ifr_data, size, ret);
-        return A_ERROR;
-    }
-    return A_OK;
-}
-
-/* Internal functions */
-static void *
-WlanEventThread(void *arg)
-{
-    int left, ret, sd;
-    struct timeval tv;
-    socklen_t fromlen;
-    struct nlmsghdr *h;
-    fd_set readfds, tempfds;
-    char buf[WLAN_EVENT_SIZE_MAX];
-    struct sockaddr_nl from, local;
-    ABF_WLAN_INFO *pAbfWlanInfo = (ABF_WLAN_INFO *)arg;
-    ATHBT_FILTER_INFO *pInfo = pAbfWlanInfo->pInfo;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-    A_STATUS status;
-    
-    A_INFO("Starting the WLAN Event Handler task\n");
-
-    A_INFO("Checking WLAN adapter on startup .. \n");
-
-    if (!pInstance->pWlanAdapterName) {
-        Abf_WlanCheckSettings(pAbfWlanInfo->IfName, NULL);
-        if (pAbfWlanInfo->IfName[0]) {
-            pAbfWlanInfo->IfIndex = if_nametoindex(pAbfWlanInfo->IfName);
-        }
-    }
-    status = AcquireWlanAdapter(pAbfWlanInfo);
-    if (A_FAILED(status)) {
-        A_INFO("No WLAN adapter on startup (OKAY) \n");
-    }else {
-        /* Communicate this to the Filter task */
-        HandleAdapterEvent(pInfo, ATH_ADAPTER_ARRIVED);
-        A_INFO("WLAN Adapter Added\n");
-    }
-
-
-    do {
-        sd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
-        if (sd < 0) {
-            A_ERR("[%s] socket(PF_NETLINK,SOCK_RAW,NETLINK_ROUTE): %d\n", 
-                  __FUNCTION__, sd);
-            break;
-        }
-
-        A_MEMZERO(&local, sizeof(struct sockaddr_nl));
-        local.nl_family = AF_NETLINK;
-        local.nl_groups = RTMGRP_LINK;
-        if ((ret = bind(sd, (struct sockaddr *) &local, sizeof(local))) < 0) {
-            A_ERR("[%s] bind(netlink): %d\n", __FUNCTION__, ret);
-            close(sd);
-            break;
-        }
-
-        FD_ZERO(&readfds);
-        FD_SET(sd, &readfds);
-        while (pAbfWlanInfo->Loop) {
-            A_MEMCPY(&tempfds, &readfds, sizeof(fd_set));
-            tv.tv_sec = 1;
-            tv.tv_usec = 0;
-            ret = select(sd+1, &tempfds, NULL, NULL, &tv);
-            if ((ret < 0) && (errno != EINTR)) {
-                A_ERR("[%s] select failed: %d\n", __FUNCTION__, ret);
-                break;
-            } else if ((ret > 0) && (FD_ISSET(sd, &tempfds))) {
-                fromlen = sizeof(from);
-                do {
-                    left = recvfrom(sd, buf, sizeof(buf), 0,
-                                    (struct sockaddr *) &from, &fromlen);
-                } while (left == -1 && errno == EINTR);
-
-                if (left < 0) {
-                    A_ERR("[%s] recvfrom(netlink)\n", __FUNCTION__);
-                    continue;
-                 //   break;
-                }
-
-                h = (struct nlmsghdr *) buf;
-                while (left >= sizeof(*h)) {
-                    int len, plen;
-
-                    len = h->nlmsg_len;
-                    plen = len - sizeof(*h);
-                    if (len > left || plen < 0) {
-                        A_ERR("[%s] malformed netlink message\n", __FUNCTION__);
-                        continue;
-                    }
-
-                    //A_DEBUG("RTM Message Type: %s\n", 
-                    //        ((h->nlmsg_type == RTM_NEWLINK) ? 
-                    //         "RTM_NEWLINK" : ((h->nlmsg_type == RTM_DELLINK) ? 
-                    //         "RTM_DELLINK" : "RTM_OTHER")));
-                    switch (h->nlmsg_type) {
-                    case RTM_NEWLINK:
-                        NewLinkEvent(pInstance, h, plen);
-                        break;
-                    case RTM_DELLINK:
-                        DelLinkEvent(pInstance, h, plen);
-                        break;
-                    default:
-                        break;
-                    }
-
-                    len = NLMSG_ALIGN(len);
-                    left -= len;
-                    h = (struct nlmsghdr *) ((char *) h + len);
-                }
-            }
-        }
-
-        close(sd);
-    } while (FALSE);
-
-    /* Clean up the resources allocated in this task */
-    A_INFO("Terminating the WLAN Event Handler task\n");
-    A_MUTEX_LOCK(&pAbfWlanInfo->hWaitEventLock);
-    pAbfWlanInfo->Loop = FALSE;
-    A_COND_SIGNAL(&pAbfWlanInfo->hWaitEvent);
-    A_MUTEX_UNLOCK(&pAbfWlanInfo->hWaitEventLock);
-
-    return NULL;
-}
-
-A_STATUS
-Abf_WlanIssueFrontEndConfig(ATHBT_FILTER_INFO * pInfo)
-{
-    WMI_SET_BTCOEX_FE_ANT_CMD btcoexFeAntCmd;
-    WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD btcoexCoLocatedBtCmd;
-    A_UINT32  buf_fe_ant_cmd[sizeof(A_UINT32) + sizeof(WMI_SET_BTCOEX_FE_ANT_CMD)];
-    A_UINT32  buf_co_located_bt_cmd[sizeof(A_UINT32) + sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD)];
-    A_STATUS status;
-
-    /* Set co-located bt type to 1, generic for any PTA based bluetooth */
-    buf_co_located_bt_cmd[0] = AR6000_XIOCTL_WMI_SET_BTCOEX_COLOCATED_BT_DEV;
-
-    btcoexCoLocatedBtCmd.btcoexCoLocatedBTdev = 1;
-    A_MEMCPY(&buf_co_located_bt_cmd[1], (void *)&btcoexCoLocatedBtCmd,
-             sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD));
-
-    status = Abf_WlanDispatchIO(pInfo, AR6000_IOCTL_EXTENDED,
-                                (void *)buf_co_located_bt_cmd,
-                                (sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD) + sizeof(A_UINT32)));
-
-    if (A_FAILED(status)) {
-        A_ERR("[%s] Failed to issue Co-located BT configuration\n", __FUNCTION__);
-        return A_ERROR;
-    }
-
-    if(pInfo->Flags & ABF_FE_ANT_IS_SA) {
-        /* Indicate front end antenna configuration as single antenna  */
-        A_INFO("FLAGS = %x, Issue FE antenna configuration as single \n", pInfo->Flags);
-        btcoexFeAntCmd.btcoexFeAntType = WMI_BTCOEX_FE_ANT_SINGLE;
-    }else {
-        A_INFO("FLAGS = %x, Issue FE antenna configuration as dual \n", pInfo->Flags);
-        btcoexFeAntCmd.btcoexFeAntType = WMI_BTCOEX_FE_ANT_DUAL;
-    }
-
-    buf_fe_ant_cmd[0] = AR6000_XIOCTL_WMI_SET_BTCOEX_FE_ANT;
-
-    A_MEMCPY(&buf_fe_ant_cmd[1], (void *)&btcoexFeAntCmd, sizeof(WMI_SET_BTCOEX_FE_ANT_CMD));
-
-
-    status = Abf_WlanDispatchIO(pInfo, AR6000_IOCTL_EXTENDED,
-                                (void *)buf_fe_ant_cmd,
-                                (sizeof(WMI_SET_BTCOEX_FE_ANT_CMD) + sizeof(A_UINT32)));
-
-    if (A_FAILED(status)) {
-        A_ERR("[%s] Failed to issue FE ant configuration\n", __FUNCTION__);
-        return A_ERROR;
-    }
-
-    return A_OK;
-
-}
-
-A_STATUS
-Abf_WlanGetSleepState(ATHBT_FILTER_INFO * pInfo)
-{
-    /* setup ioctl cmd */
-    A_UINT32 cmd = AR6000_XIOCTL_GET_WLAN_SLEEP_STATE;
-
-    A_STATUS status = Abf_WlanDispatchIO(pInfo, AR6000_IOCTL_EXTENDED,
-                                         (void *)&cmd,
-                                         sizeof(A_UINT32));
-
-    if (A_FAILED(status)) {
-        A_ERR("[%s] Failed to issue get WLAN sleep state\n", __FUNCTION__);
-        return A_ERROR;
-    }
-
-    return A_OK;
-}
-
-A_STATUS
-Abf_WlanGetCurrentWlanOperatingFreq( ATHBT_FILTER_INFO * pInfo)
-{
-    A_STATUS status;
-    struct iwreq wrq;
-    char ifname[IFNAMSIZ], *ethIf;
-    ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
-    ABF_WLAN_INFO *pAbfWlanInfo = pInfo->pWlanInfo;
-
-    /* Get the adpater name from command line if specified */
-    if (pInstance->pWlanAdapterName != NULL) {
-        ethIf = pInstance->pWlanAdapterName;
-    } else {
-        if ((ethIf = getenv("NETIF")) == NULL) {
-            ethIf = pAbfWlanInfo->IfName;
-        }
-    }
-    A_MEMZERO(ifname, IFNAMSIZ);
-    strcpy(ifname, ethIf);
-    strncpy(wrq.ifr_name, ifname, sizeof(wrq.ifr_name));
-    if ((status = ioctl(pAbfWlanInfo->Handle, SIOCGIWFREQ, &wrq)) < 0) {
-        return A_ERROR;
-    }
-    /*Freq is in Hz, converted into to MhZ */
-    pAbfWlanInfo->Channel = (wrq.u.freq.m/100000);
-
-    IndicateCurrentWLANOperatingChannel(pInfo, pAbfWlanInfo->Channel);
-    return status;
-}
-
-static void
-NewLinkEvent(ATH_BT_FILTER_INSTANCE *pInstance, struct nlmsghdr *h, int len)
-{
-    struct ifinfomsg *ifi;
-    struct rtattr * attr;
-    int attrlen, nlmsg_len, rta_len;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pInstance->pContext;
-    ABF_WLAN_INFO *pAbfWlanInfo = (ABF_WLAN_INFO *)pInfo->pWlanInfo;
-
-    if (len < sizeof(*ifi)) {
-        A_DEBUG("packet too short\n");
-        return;
-    }
-
-    ifi = NLMSG_DATA(h);
-
-    nlmsg_len = NLMSG_ALIGN(sizeof(struct ifinfomsg));
-
-    attrlen = h->nlmsg_len - nlmsg_len;
-    if (attrlen < 0) {
-        A_DEBUG("bad attrlen\n");
-        return;
-    }
-
-    attr = (struct rtattr *) (((char *) ifi) + nlmsg_len);
-
-    rta_len = RTA_ALIGN(sizeof(struct rtattr));
-    while (RTA_OK(attr, attrlen)) {
-        if (attr->rta_type == IFLA_WIRELESS) {
-            /* 
-             * We need to ensure that the event is from the WLAN instance 
-             * that we are interested in TODO 
-             */
-            WirelessEvent(pInstance, ((char*)attr) + rta_len, 
-                          attr->rta_len - rta_len);
-        } else if (attr->rta_type == IFLA_IFNAME) {
-            /* 
-             * Shall be used to get the socket descriptor. Also we should do 
-             * it only until we get the adapter we are interested in 
-             */
-            if (!pAbfWlanInfo->Handle) {
-                A_DEBUG("WLAN Adapter Interface: %s, Len: %d\n", 
-                        (((char *)attr) + rta_len), attr->rta_len - rta_len);
-                A_MEMCPY(pAbfWlanInfo->IfName, ((char *)attr + rta_len), 
-                         attr->rta_len - rta_len);
-                pAbfWlanInfo->IfIndex = if_nametoindex(pAbfWlanInfo->IfName);
-            } else if (ifi->ifi_change && pAbfWlanInfo->IfIndex == ifi->ifi_index) {
-                A_CHAR ifName[IFNAMSIZ];                
-                A_MEMCPY(ifName, ((char *)attr + rta_len), attr->rta_len - rta_len);
-                if (A_MEMCMP(pAbfWlanInfo->IfName, ifName, sizeof(ifName))!=0) {
-                    A_MEMCPY(pAbfWlanInfo->IfName, ifName, sizeof(ifName));
-                }
-            }
-        }
-        attr = RTA_NEXT(attr, attrlen);
-    }
-}
-
-static void
-DelLinkEvent(ATH_BT_FILTER_INSTANCE *pInstance, struct nlmsghdr *h, int len)
-{
-    A_BOOL found;
-    struct ifinfomsg *ifi;
-    struct rtattr * attr;
-    int attrlen, nlmsg_len, rta_len;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pInstance->pContext;
-    ABF_WLAN_INFO *pAbfWlanInfo = (ABF_WLAN_INFO *)pInfo->pWlanInfo;
-
-    if (!pAbfWlanInfo->Handle) return;
-
-    if (len < sizeof(*ifi)) {
-        A_DEBUG("packet too short\n");
-        return;
-    }
-
-    ifi = NLMSG_DATA(h);
-
-    nlmsg_len = NLMSG_ALIGN(sizeof(struct ifinfomsg));
-
-    attrlen = h->nlmsg_len - nlmsg_len;
-    if (attrlen < 0) {
-        A_DEBUG("bad attrlen\n");
-        return;
-    }
-
-    attr = (struct rtattr *) (((char *) ifi) + nlmsg_len);
-
-    rta_len = RTA_ALIGN(sizeof(struct rtattr));
-    found = FALSE;
-    while (RTA_OK(attr, attrlen)) {
-        if (attr->rta_type == IFLA_IFNAME) {
-            /* 
-             * Shall be used to get the socket descriptor. Also we should do 
-             * it only until we get the adapter we are interested in 
-             */
-            if (!(strcmp(pAbfWlanInfo->IfName, ((char *)attr + rta_len)))) {
-                found = TRUE;
-            }
-        }
-
-        attr = RTA_NEXT(attr, attrlen);
-    }
-
-    if (!found) return;
-
-    /* Flush all the BT actions from the filter core */
-    HandleAdapterEvent(pInfo, ATH_ADAPTER_REMOVED);
-
-    ReleaseWlanAdapter(pAbfWlanInfo);
-
-    /* Reset the WLAN adapter specific info */
-    A_MEMZERO(pAbfWlanInfo->AdapterName, WLAN_ADAPTER_NAME_SIZE_MAX);
-    pAbfWlanInfo->PhyCapability = 0;
-
-    A_INFO("WLAN Adapter Removed\n");
-}
-
-static void
-WirelessEvent(ATH_BT_FILTER_INSTANCE *pInstance, char *data, int len)
-{
-    A_STATUS status = A_OK;
-    struct iw_event iwe_buf, *iwe = &iwe_buf;
-    char *pos, *end, *custom, *buf;
-
-    pos = data;
-    end = data + len;
-
-    while ((pos + IW_EV_LCP_PK_LEN <= end) && (status == A_OK)) {
-        /* Event data may be unaligned, so make a local, aligned copy
-         * before processing. */
-        A_MEMCPY(&iwe_buf, pos, IW_EV_LCP_LEN);
-        if (iwe->len <= IW_EV_LCP_LEN) {
-            status = A_ERROR;
-            break;
-        }
-
-        custom = pos + IW_EV_POINT_LEN;
-        if (WIRELESS_EXT > 18 &&
-            (iwe->cmd == IWEVMICHAELMICFAILURE ||
-             iwe->cmd == IWEVCUSTOM ||
-             iwe->cmd == IWEVASSOCREQIE ||
-             iwe->cmd == IWEVASSOCRESPIE ||
-             iwe->cmd == IWEVPMKIDCAND ||
-             iwe->cmd == IWEVGENIE)) {
-            /* WE-19 removed the pointer from struct iw_point */
-            char *dpos = (char *) &iwe_buf.u.data.length;
-            int dlen = dpos - (char *) &iwe_buf;
-            A_MEMCPY(dpos, pos + IW_EV_LCP_LEN,
-                   sizeof(struct iw_event) - dlen);
-        } else {
-            A_MEMCPY(&iwe_buf, pos, sizeof(struct iw_event));
-            custom += IW_EV_POINT_OFF;
-        }
-
-        switch (iwe->cmd) {
-        case SIOCGIWAP:
-            break;
-        case IWEVCUSTOM:
-            if (custom + iwe->u.data.length > end) {
-                A_ERR("[%s:%d] Check Failed\n", __FUNCTION__, __LINE__);
-                status = A_ERROR;
-                break;
-            }
-            buf = A_MALLOC(iwe->u.data.length + 1);
-            if (buf == NULL) {
-                A_ERR("[%s:%d] Check Failed\n", __FUNCTION__, __LINE__);
-                status = A_ERROR;
-                break;
-            }
-            A_MEMCPY(buf, custom, iwe->u.data.length);
-            status = WirelessCustomEvent(pInstance, buf, iwe->u.data.length);
-            A_FREE(buf);
-            break;
-        case SIOCGIWSCAN:
-            break;
-        case SIOCSIWESSID:
-            break;
-        case IWEVGENIE:
-            if (custom + iwe->u.data.length > end || (iwe->u.data.length < 2)) {
-                A_ERR("event = IWEVGENIE with wrong length %d remain %d\n", 
-                                      iwe->u.data.length, (end-custom));
-                status = A_ERROR;
-                break;
-            }
-            buf = A_MALLOC(iwe->u.data.length + 1);
-            if (buf == NULL) {
-                A_ERR("[%s:%d] Check Failed\n", __FUNCTION__, __LINE__);
-                status = A_ERROR;
-                break;
-            }
-            A_MEMCPY(buf, custom, iwe->u.data.length);
-            status = WirelessCustomEvent(pInstance, buf, iwe->u.data.length);
-            A_FREE(buf);
-            break;
-        default:
-            break;
-        }
-
-        pos += iwe->len;
-    }
-}
-
-static A_STATUS
-WirelessCustomEvent(ATH_BT_FILTER_INSTANCE *pInstance, char *buf, int len)
-{
-    char *ptr;
-    int length, i;
-    A_UINT16 eventid;
-    WMI_READY_EVENT *ev1;
-    WMI_CONNECT_EVENT *ev2;
-    WMI_REPORT_SLEEP_STATE_EVENT * ev3;
-    A_STATUS status = A_OK;
-    ATHBT_FILTER_INFO *pInfo = (ATHBT_FILTER_INFO *)pInstance->pContext;
-    ABF_WLAN_INFO *pAbfWlanInfo = pInfo->pWlanInfo;
-
-    do {
-        eventid = *((A_UINT16 *)buf);
-        ptr = buf + 2; //Skip the event id
-        length = len - 2;
-        switch (eventid) {
-        case (WMI_READY_EVENTID):
-            if (length < sizeof(WMI_READY_EVENT)) {
-                A_ERR("[%s:%d] Check Failed\n", __FUNCTION__, __LINE__);
-                status = A_ERROR;
-                break;
-            }
-            ev1 = (WMI_READY_EVENT *)ptr;
-            A_MEMCPY(pAbfWlanInfo->AdapterName, ev1->macaddr, ATH_MAC_LEN);
-            pAbfWlanInfo->PhyCapability = ev1->phyCapability;
-            A_DEBUG("WMI READY: Capability: %d, Address: %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", 
-                    pAbfWlanInfo->PhyCapability, 
-                    (pAbfWlanInfo->AdapterName[0]), 
-                    (pAbfWlanInfo->AdapterName[1]),
-                    (pAbfWlanInfo->AdapterName[2]),
-                    (pAbfWlanInfo->AdapterName[3]), 
-                    (pAbfWlanInfo->AdapterName[4]),
-                    (pAbfWlanInfo->AdapterName[5]));
-
-            /*
-             * Open a handle for the ioctls that will be issued later
-             * Try 10 times because the driver may not yet be ready to receive
-             * IOCTLs, so we give the driver time to get ready by looping here
-             */
-            for (i = 0; i <= 10; i++) {
-                status = AcquireWlanAdapter(pAbfWlanInfo);
-                if (A_SUCCESS(status)) {
-                    break; /* Break out of FOR loop, but not out of switch case statement */
-               }
-                sleep(1);
-            }
-
-            if (A_FAILED(status)) {
-                A_ERR("[%s] Failed to acquire WLAN adapter\n", __FUNCTION__);
-                break;
-            }
-
-            /* Communicate this to the Filter task */
-            HandleAdapterEvent(pInfo, ATH_ADAPTER_ARRIVED);
-            A_INFO("WLAN Adapter Added\n");
-            break;    
-        case (WMI_CONNECT_EVENTID):
-            if (length < sizeof(WMI_CONNECT_EVENT)) {
-                A_ERR("[%s:%d] Check Failed\n", __FUNCTION__, __LINE__);
-                status = A_ERROR;
-                break;
-            }
-            ev2 = (WMI_CONNECT_EVENT *)ptr;
-            pAbfWlanInfo->Channel = ev2->u.infra_ibss_bss.channel;
-            A_DEBUG("WMI CONNECT: Channel: %d\n", ev2->u.infra_ibss_bss.channel);
-            IndicateCurrentWLANOperatingChannel(pInfo, pAbfWlanInfo->Channel);
-            break;
-        case (WMI_DISCONNECT_EVENTID):
-            A_DEBUG("WMI DISCONNECT: %d\n", len);
-            IndicateCurrentWLANOperatingChannel(pInfo, 0);
-            break;
-        case (WMI_ERROR_REPORT_EVENTID):
-            A_DEBUG("WMI ERROR REPORT: %d\n", len);
-            break;
-        case (WMI_SCAN_COMPLETE_EVENTID):
-            A_DEBUG("WMI SCAN COMPLETE: %d\n", len);
-            break;
-        case (WMI_REPORT_SLEEP_STATE_EVENTID):
-            A_DEBUG("WMI_REPORT_SLEEP_STATE_EVENTID: %d\n", len);
-            if(length < sizeof(WMI_REPORT_SLEEP_STATE_EVENT)) {
-                A_ERR("[%s]Incorrect length passed - length = %d, len =%d\n", __FUNCTION__, length, len);
-            }
-            ev3 = (WMI_REPORT_SLEEP_STATE_EVENT *)ptr;
-            switch(ev3->sleepState) {
-                case  WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP:
-                    HandleAdapterEvent(pInfo, ATH_ADAPTER_REMOVED);
-                    break;
-                case WMI_REPORT_SLEEP_STATUS_IS_AWAKE:
-                    Abf_WlanIssueFrontEndConfig( pInfo);
-                    HandleAdapterEvent(pInfo, ATH_ADAPTER_ARRIVED);
-                    break;
-            }
-            break;
-        default:
-            //A_DEBUG("Event: 0x%x, Not Handled\n", eventid);
-            break;
-        }
-    } while (FALSE);
-
-    return status;
-}
-
-static A_STATUS
-AcquireWlanAdapter(ABF_WLAN_INFO *pAbfWlanInfo)
-{
-    int sd;
-    A_STATUS status;
-
-    if (pAbfWlanInfo->Handle != 0) {
-        return A_OK;    
-    }
-
-    if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
-        A_ERR("[%s] Error creating socket: %d\n", __FUNCTION__, sd);
-        return A_ERROR;
-    }
-
-    pAbfWlanInfo->Handle = sd;
-    status = GetAdapterInfo(pAbfWlanInfo);
-    if (A_FAILED(status)) {
-        A_ERR("[%s] Failed to get Adapter Info\n", __FUNCTION__);
-        close(sd);
-        pAbfWlanInfo->Handle = 0;
-        return A_ERROR;
-    } else {
-        /* Try to get RTS to determinate that wlan is enabled */
-        A_UCHAR buf[sizeof(int)+sizeof(WMI_SET_RTS_CMD)];
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_RTS;
-        status = Abf_WlanDispatchIO(pAbfWlanInfo->pInfo, AR6000_IOCTL_EXTENDED, 
-                                (void *)buf, sizeof(buf));
-        if (A_FAILED(status)) {
-            A_INFO("WMI is ready but wlan is disabled.\n");
-            return A_ERROR;
-        }
-    }
-
-    return A_OK;
-}
-
-static A_STATUS
-GetAdapterInfo(ABF_WLAN_INFO *pAbfWlanInfo)
-{
-    A_STATUS status;
-    struct ar6000_version *revinfo;
-
-    revinfo = (struct ar6000_version *)A_MALLOC(sizeof(struct ar6000_version));
-
-    if (revinfo == NULL) {
-        A_ERR("[%s] Failed to alloc WLAN revision info\n", __FUNCTION__);
-        return A_ERROR;    
-    }
-
-    /* Get the revision info */
-    status = Abf_WlanDispatchIO(pAbfWlanInfo->pInfo, AR6000_IOCTL_WMI_GETREV, 
-                                (void *)revinfo, sizeof(struct ar6000_version));
-    if (A_FAILED(status)) {
-        A_ERR("[%s] Failed to get WLAN revision\n", __FUNCTION__);
-        return A_ERROR;
-    }
-
-    pAbfWlanInfo->HostVersion = revinfo->host_ver;
-    pAbfWlanInfo->TargetVersion = revinfo->target_ver;
-    A_INFO("Host Rev: 0x%x(%u.%u.%u.%u), Target Rev: 0x%x(%u.%u.%u.%u)\n",
-           revinfo->host_ver,
-           ((revinfo->host_ver)&0xf0000000)>>28,
-           ((revinfo->host_ver)&0x0f000000)>>24,
-           ((revinfo->host_ver)&0x00ff0000)>>16,
-           ((revinfo->host_ver)&0x0000ffff),
-           revinfo->target_ver,
-           ((revinfo->target_ver)&0xf0000000)>>28,
-           ((revinfo->target_ver)&0x0f000000)>>24,
-           ((revinfo->target_ver)&0x00ff0000)>>16,
-           ((revinfo->target_ver)&0x0000ffff));
-
-    A_FREE(revinfo);
-
-    return A_OK;
-}
-
-static void
-ReleaseWlanAdapter(ABF_WLAN_INFO *pAbfWlanInfo)
-{
-    close(pAbfWlanInfo->Handle);
-    pAbfWlanInfo->Handle = 0;
-    pAbfWlanInfo->HostVersion = 0;
-    pAbfWlanInfo->TargetVersion = 0;
-}
-
-void Abf_WlanCheckSettings(A_CHAR *wifname, A_UINT32 *btfiltFlags)
-{
-    int sd;
-    A_CHAR ifname[IFNAMSIZ];
-#ifdef ANDROID 
-    char ifprop[PROPERTY_VALUE_MAX];
-    if (wifname[0] == '\0' && property_get("wifi.interface", ifprop, NULL)) {
-        strcpy(wifname, ifprop);
-    }
-#endif
-
-    {
-        A_BOOL found = FALSE;
-        A_CHAR linebuf[1024];
-        FILE *f = fopen("/proc/net/wireless", "r");
-        if (f) {
-            while(fgets(linebuf, sizeof(linebuf)-1, f)) {
-                if (strchr(linebuf, ':')) {
-                    char *dest = ifname;
-                    char *p = linebuf;
-                    while(*p && isspace(*p)) ++p;
-                    while (*p && *p != ':')
-                        *dest++ = *p++;
-                    *dest = '\0';
-                    if (strcmp(wifname, ifname)==0) {
-                        found = TRUE;
-                        break;
-                    }
-                }
-            }
-            if (!found && ifname[0]!='\0') {                
-                strcpy(wifname, ifname);
-            }
-            fclose(f);
-        }
-    }
-    A_DEBUG("%s : wlan: %s\n", __FUNCTION__, wifname);
-    if (wifname[0] == '\0' || !btfiltFlags) {
-        return;
-    }
-
-    if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
-        A_ERR("[%s] Error creating socket: %d\n", __FUNCTION__, sd);
-        return;
-    }
-
-    do {
-        A_UINT32 flags = *btfiltFlags;
-        struct ifreq ifr;
-        struct ar6000_version revinfo;
-        A_MEMZERO(&revinfo, sizeof(revinfo));
-        strncpy(ifr.ifr_name, wifname, sizeof(ifr.ifr_name));
-        ifr.ifr_data = (void *)&revinfo;
-        if (ioctl(sd, AR6000_IOCTL_WMI_GETREV, &ifr) < 0) {
-            break;              
-        }                       
-        if ( (revinfo.target_ver & 0xf0000000)==0x30000000) {
-            *btfiltFlags |= ABF_WIFI_CHIP_IS_VENUS;
-        } else {
-            *btfiltFlags &= ~ABF_WIFI_CHIP_IS_VENUS;
-        }
-        if (*btfiltFlags != flags) {
-            A_DEBUG("Change btfilt flags from %u to %u isVenus %d\n", flags, *btfiltFlags, 
-                        (*btfiltFlags & ABF_WIFI_CHIP_IS_VENUS) ? "yes" : "no");
-        }
-    } while (0);
-    close(sd);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btdefs.h b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btdefs.h
deleted file mode 100644 (file)
index 0f51e56..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="btdefs.h" company="Atheros">
-//    Copyright (c) 2007 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// Bluetooth spec definitions
-//
-// Author(s): ="Atheros"
-//==============================================================================
-
-
-#ifndef BTDEFS_H_
-#define BTDEFS_H_
-
-#define OGF_SHIFT                   10
-#define OGF_MASK                    0xFC
-
-#define MAKE_HCI_COMMAND(ogf,ocf)   (((ogf) << OGF_SHIFT) | (ocf))
-#define HCI_GET_OP_CODE(p)          (((A_UINT16)((p)[1])) << 8) | ((A_UINT16)((p)[0]))
-#define HCI_TEST_OGF(p,ogf)         (((p)[1] & OGF_MASK) == ((ogf) << 2))
-
-#define HCI_LINK_CONTROL_OGF        0x01
-#define IS_LINK_CONTROL_CMD(p)      HCI_TEST_OGF(p,HCI_LINK_CONTROL_OGF)
-#define HCI_INQUIRY                 MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x0001)
-#define HCI_INQUIRY_CANCEL          MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x0002)
-#define HCI_PER_INQUIRY             MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x0003)
-#define HCI_PER_INQUIRY_CANCEL      MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x0004)
-#define HCI_CREATE_CONNECTION       MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x0005)
-#define HCI_DISCONNECT              MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x0006)
-#define HCI_ADD_SCO                 MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x0007)
-#define HCI_ACCEPT_CONN_REQ         MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x0009)
-#define HCI_REJECT_CONN_REQ         MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x000A)
-#define HCI_SETUP_SCO_CONN          MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, 0x0028) /* BT 2.0 */
-
-//#define HCI_    MAKE_HCI_COMMAND(HCI_LINK_CONTROL_OGF, x)
-
-#define HCI_GET_EVENT_CODE(p)       ((p)[0])
-#define GET_BT_EVENT_LENGTH(p)      ((p)[1])
-#define HCI_EVT_INQUIRY_COMPLETE       0x01
-#define HCI_EVT_CONNECT_COMPLETE               0x03
-#define HCI_EVT_CONNECT_REQUEST        0x04
-#define HCI_EVT_REMOTE_DEV_LMP_VERSION  0x0b
-#define HCI_EVT_REMOTE_DEV_VERSION             0x0c
-#define HCI_EVT_DISCONNECT             0x05
-#define HCI_EVT_REMOTE_NAME_REQ        0x07
-#define HCI_EVT_ROLE_CHANGE            0x12
-#define HCI_EVT_NUM_COMPLETED_PKTS     0x13
-#define HCI_EVT_MODE_CHANGE         0x14
-#define HCI_EVT_SCO_CONNECT_COMPLETE 0x2C  /* new to 2.0 */
-
-
-#define HCI_CMD_OPCODE_INQUIRY_START   0x401
-#define HCI_CMD_OPCODE_INQUIRY_CANCEL  0x402
-#define HCI_CMD_OPCODE_CONNECT        0x405
-
-/* HCI Connection Complete Event macros */
-#define GET_BT_CONN_EVENT_STATUS(p) ((p)[2])
-#define GET_BT_CONN_HANDLE(p)       ((A_UINT16)((p)[3]) | (((A_UINT16)((p)[4])) << 8))
-#define GET_BT_CONN_LINK_TYPE(p)    ((p)[11])
-#define BT_CONN_EVENT_STATUS_SUCCESS(p) (GET_BT_CONN_EVENT_STATUS(p) == 0)
-#define INVALID_BT_CONN_HANDLE      0xFFFF
-#define BT_LINK_TYPE_SCO            0x00
-#define BT_LINK_TYPE_ACL            0x01
-#define BT_LINK_TYPE_ESCO           0x02
-
-
-/* SCO Connection Complete Event macros */
-#define GET_TRANS_INTERVAL(p)   ((p)[12])
-#define GET_RETRANS_INTERVAL(p) ((p)[13])
-#define GET_RX_PKT_LEN(p)       ((A_UINT16)((p)[14]) | (((A_UINT16)((p)[15])) << 8))
-#define GET_TX_PKT_LEN(p)       ((A_UINT16)((p)[16]) | (((A_UINT16)((p)[17])) << 8))
-
-
-/* L2CAP Definitions */
-#define SIGNALING        0x0001
-#define CONNECTIONLESS   0x0002
-#define NULL_ID          0x0000
-
-#define CONNECT_REQ      0x02
-#define CONNECT_RSP      0x03
-#define DISCONNECT_REQ   0x06
-#define DISCONNECT_RSP   0x07
-
-#define STATE_SUCCESS 0
-#define STATE_PENDING 1
-
-#define STATE_DISCONNECT 0x00
-#define STATE_CONNECTING 0x01
-#define STATE_CONNECTED  0x02
-
-#define TYPE_ACPT 0x02
-#define TYPE_REJ  0x03
-
-#define A2DP_TYPE      0x0019
-#define RFCOMM_TYPE    0x0003
-#define SDP_TYPE       0x0001
-#define AVDTP_START   0x07
-#define AVDTP_SUSPEND 0x08
-#define AVDTP_CLOSE   0x09
-#define AVDTP_OPEN    0x06
-
-#define GETUINT16(p)(((A_UINT16)((p)[1])) << 8) | ((A_UINT16)((p)[0]))
-    
-#include "athstartpack.h"
-
-typedef PREPACK struct _ACL_HEADER{
-    A_UINT16 HANDLE;
-    A_UINT16 Length;
-} POSTPACK ACL_HEADER, *PACL_HEADER;
-
-typedef PREPACK struct _L2CAP_HEADER{
-    A_UINT16 Length;
-    A_UINT16 CID;
-} POSTPACK L2CAP_HEADER, *PL2CAP_HEADER;
-
-typedef PREPACK struct _L2CAP_CONTROL{
-    A_UINT8  CODE;
-    A_UINT8  ID;
-    A_UINT16 Length;
-    A_UINT16 PSM;
-    A_UINT16 DESTINATION_CID;
-    A_UINT16 SOURCE_CID;
-    A_UINT16 RESULT;
-    A_UINT16 STATUS;
-} POSTPACK L2CAP_CONTROL, *PL2CAP_CONTROL;
-
-typedef PREPACK struct _AVDTP_HEADER{
-    A_UINT8  MESSAGE_TYPE;
-    A_UINT8  CMD_ID;
-} POSTPACK AVDTP_HEADER, *PAVDTP_HEADER;
-
-#include "athendpack.h"
-
-#endif /*BTDEFS_H_*/
-
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btfilter_action.c b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btfilter_action.c
deleted file mode 100644 (file)
index 1a54361..0000000
+++ /dev/null
@@ -1,640 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="btfilter_action.c" company="Atheros">
-//    Copyright (c) 2007 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// Bluetooth filter core action tables and action lookup
-//
-// Author(s): ="Atheros"
-//==============================================================================
-
-#include <stdlib.h>
-#include <string.h>
-#include "athdefs.h"
-#define  ATH_MODULE_NAME btfilt
-#include "a_debug.h"
-#include "a_types.h"
-#include "a_osapi.h"
-#include "wmi.h"
-#include "athbtfilter.h"
-#include "btfilter_core.h"
-
-#include "abtfilt_int.h"
-#define ACTION_NOOP          NULL
-#define ACTION_TODO_TBD      NULL
-
-static void CleanupModifiedControlActionDescChain(BT_CONTROL_ACTION_DESC  *pDesc);
-
-/* default actions descriptor table
- *
- * NOTE: the pNext member of each entry must be set to NULL, when this table is copied
- *  to a RAM table so that the pNext field can be altered at run time in case the entry must be
- *  extended or overridden by the user */
-static const BT_CONTROL_ACTION_DESC_STATE g_ActionDefaults[ATH_BT_MAX_STATE_INDICATION] =
-{
-                                        /* STATE OFF */                     /* STATE ON */
-    /* ATH_BT_NOOP    */      {{{ ACTION_NOOP,          0, NULL }, { ACTION_NOOP,          0, NULL }}},
-    /* ATH_BT_INQUIRY */      {{{ "-s 3 2",             0, NULL }, { "-s 3 1",             0, NULL }}},
-    /* ATH_BT_CONNECT */      {{{ ACTION_TODO_TBD,      0, NULL }, { ACTION_TODO_TBD,      0, NULL }}},
-    /* ATH_BT_SCO     */      {{{ "-s 1 2",             0, NULL }, { "-pSCO 10 20 2 0 2 6 1 0 0 60 50 5; -s 1 1", 0, NULL }}},
-    /* ATH_BT_ACL     */      {{{ ACTION_TODO_TBD,      0, NULL }, { ACTION_TODO_TBD,      0, NULL }}},
-    /* ATH_BT_A2DP    */      {{{ "-s 2 2",             0, NULL }, { "-pA2DP 30 3 20 0 0 60 50 20; -s 2 1", 0, NULL }}},
-    /* ATH_BT_ESCO    */      {{{ "-s 4 2",             0, NULL }, { "-pSCO 1 20 2 0 2 6 3 0 0 60 50 5 ; -s 4 1",0, NULL }}},
-};
-
-
-static const BT_CONTROL_ACTION_DESC_STATE g_ActionDefaultsVenus[ATH_BT_MAX_STATE_INDICATION] =
-{
-                                        /* STATE OFF */                     /* STATE ON */
-    /* ATH_BT_NOOP    */      {{{ ACTION_NOOP,          0, NULL }, { ACTION_NOOP,          0, NULL }}},
-    /* ATH_BT_INQUIRY */      {{{ "-s 3 2 0",             0, NULL }, { "-s 3 1 0",             0, NULL }}},
-    /* ATH_BT_CONNECT */      {{{ ACTION_TODO_TBD,      0, NULL }, { ACTION_TODO_TBD,      0, NULL }}},
-    /* ATH_BT_SCO     */      {{{ "-s 1 2 0",             0, NULL }, { "-pSCO 2 4 1 0 10 20 2 6 2 3 3 36 5 5 1 100 2; -s 1 1 0 ", 0, NULL }}},
-    /* ATH_BT_ACL     */      {{{ ACTION_TODO_TBD,      0, NULL }, { ACTION_TODO_TBD,      0, NULL }}},
-    /* ATH_BT_A2DP    */      {{{ "-s 2 2 0",             0, NULL }, { "-pA2DP 5 0 30 3 20 36 5 5 1 3; -s 2 1 0", 0, NULL }}},
-    /* ATH_BT_ESCO     */     {{{ "-s 4 2 0",             0, NULL }, { "-pSCO 2 10 1 0 10 20 2 6 2 3 3 36 5 5 1 100 2; -s 4 1 0", 0, NULL }}},
-};
-
-typedef enum _BT_COMMAND_TAG {
-    BT_STATUS_TAG               = 0,
-    BT_PARAM_SCO_TAG            = 1,
-    BT_PARAM_A2DP_TAG,
-    /* add new tags here */
-    BT_COMMAND_TAGS_MAX
-} BT_COMMAND_TAG;
-
-
-static const A_CHAR *g_TagStrings[BT_COMMAND_TAGS_MAX] = {
-    "-s",
-    "-pSCO",
-    "-pA2DP",
-};
-
-static int FindActionString(A_CHAR *pString, A_CHAR **ppStart)
-{
-    int     count = 0;
-    A_BOOL    found = FALSE;
-
-    if (*pString == ';') {
-            /* skip if this is the first one we hit */
-        pString++;
-    }
-
-    while ((*pString != '\0') && (*pString != ';')) {
-        if (!found) {
-            if (*pString == '-') {
-                    /* found start of one action string */
-                *ppStart = pString;
-                found = TRUE;
-                count++;
-            }
-        } else {
-            count++;
-        }
-        pString++;
-    }
-
-    return count;
-}
-
-#define ACTION_STRING_DELIMIT  ' '
-
-    /* assemble an array of pointers to each argument in the string */
-static int GetArgStrings(A_CHAR *pString,
-                         A_CHAR  Delimit,
-                         A_CHAR  *pArgArray[],
-                         int     MaxArgs)
-{
-    int     totalArgs = 0;
-    int     length;
-    A_BOOL  done = FALSE;
-
-    while (!done && (totalArgs < MaxArgs)) {
-
-        pArgArray[totalArgs] = pString;
-        length = 0;
-
-            /* walk through the string and assemble substrings */
-        while (1) {
-
-            if ((*pString == '\0') || (*pString == Delimit)) {
-
-                if (*pString == '\0') {
-                        /* reached the end of the string */
-                    done = TRUE;
-                } else {
-                        /* terminate */
-                    *pString = (A_CHAR)0;
-                }
-                    /* advance pass NULL */
-                pString++;
-
-                if (length) {
-                        /* only increment arg if we found a non-zero length string */
-                    totalArgs++;
-                }
-
-                break;
-            }
-
-            pString++;
-            length++;
-        }
-
-    }
-
-    return totalArgs;
-}
-
-static int GetArguments(A_CHAR *pString, A_INT32 *pArgArray, int MaxArgs)
-{
-    int     i;
-    int     totalArgs;
-    int     argsFound;
-    A_CHAR  *argStrings[BT_ACTION_MAX_ARGS];
-
-
-    totalArgs = GetArgStrings(pString,
-                              ACTION_STRING_DELIMIT,
-                              argStrings,
-                              BT_ACTION_MAX_ARGS);
-
-    argsFound = 0;
-
-    for (i = 0; (i < totalArgs); i++) {
-
-        if (argStrings[i][0] == '-') {
-            /* skip the action tag */
-            continue;
-        }
-        if (argsFound < MaxArgs) {
-                /* got an arg */
-            pArgArray[argsFound] = atol(argStrings[i]);
-            argsFound++;
-        }
-    }
-
-    return argsFound;
-}
-
-static A_STATUS BuildActionFromString(BT_FILTER_CORE_INFO * pCore, A_CHAR *pActionString, int Length,
-                                      BT_CONTROL_ACTION_ITEM **pControlItem)
-{
-    A_CHAR                  stringBuf[BT_ACTION_STRING_MAX_LENGTH + 1];
-    int                     stringLength = min(Length,BT_ACTION_STRING_MAX_LENGTH);
-    BT_COMMAND_TAG          tag = BT_COMMAND_TAGS_MAX;
-    BT_CONTROL_ACTION_ITEM  *pItem = NULL;
-    A_STATUS                status = A_OK;
-    A_INT32                 args[BT_ACTION_MAX_ARGS];
-    int                     argCount;
-
-
-    pItem = (BT_CONTROL_ACTION_ITEM *)A_MALLOC(sizeof(BT_CONTROL_ACTION_ITEM));
-
-    if (NULL == pItem) {
-        return A_NO_MEMORY;
-    }
-
-    A_MEMZERO(pItem,sizeof(BT_CONTROL_ACTION_ITEM));
-        /* copy string to temp buffer */
-    A_MEMCPY(stringBuf, pActionString, stringLength);
-    stringBuf[stringLength] = '\0';
-
-        /* Parse string for command type */
-    for (tag = 0; tag < BT_COMMAND_TAGS_MAX; tag++) {
-        if (strstr(stringBuf, g_TagStrings[tag]) != NULL) {
-            argCount = GetArguments(stringBuf,args,BT_ACTION_MAX_ARGS);
-            break;
-        }
-    }
-
-/*
- * BT STATUS:
- *      "-s <streamtype> <status>"
- *
- * BT PARAM SCO:
- *      "-pSCO <numScoCyclesForceTrigger> <dataResponseTimeout> <stompDutyCyleVal> <psPollLatencyFraction>
- *                  <stompScoRules>  <noSCOSlots> <noIdleSlots> "
- *
- * BT PARAM A2DP
- *      "-pA2DP <a2dpWlanUsageLimit> <a2dpBurstCntMin> <a2dpDataRespTimeout "
- *
- */
-
-    switch (tag) {
-        case BT_STATUS_TAG:
-           /* set up item and struct pointer */
-            pItem->ControlAction.Type = BT_CONTROL_ACTION_STATUS;
-            if(pCore->FilterState.btFilterFlags & ABF_WIFI_CHIP_IS_VENUS) {
-                WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD   *pOperatingStatus =
-                       (WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD *)pItem->ControlAction.Buffer;
-
-                pItem->ControlAction.Length = sizeof(WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD);
-
-                if (argCount != 3) {
-                    status = A_EINVAL;
-                    break;
-                }
-
-                pOperatingStatus->btProfileType = (A_UINT8)args[0];
-                pOperatingStatus->btOperatingStatus =(A_UINT8)args[1];
-                pOperatingStatus->btLinkId =(A_UINT8)args[2];
-            }else {
-
-                WMI_SET_BT_STATUS_CMD *pStatusCmd = (WMI_SET_BT_STATUS_CMD *)pItem->ControlAction.Buffer;
-                pItem->ControlAction.Length = sizeof(WMI_SET_BT_STATUS_CMD);
-
-                if (argCount != 2) {
-                    status = A_EINVAL;
-                    break;
-                }
-
-                pStatusCmd->streamType = (A_UINT8)args[0];
-                pStatusCmd->status =     (A_UINT8)args[1];
-            }
-            break;
-
-        case BT_PARAM_SCO_TAG:
-                pItem->ControlAction.Type = BT_CONTROL_ACTION_PARAMS;
-                if(pCore->FilterState.btFilterFlags & ABF_WIFI_CHIP_IS_VENUS) {
-                    WMI_SET_BTCOEX_SCO_CONFIG_CMD * pScoConfigCmd =
-                                        (WMI_SET_BTCOEX_SCO_CONFIG_CMD *)pItem->ControlAction.Buffer;
-                    pItem->ControlAction.Length = sizeof(WMI_SET_BTCOEX_SCO_CONFIG_CMD);
-                    BTCOEX_SCO_CONFIG * pScoGenericConfig = &pScoConfigCmd->scoConfig;
-                    BTCOEX_PSPOLLMODE_SCO_CONFIG  * pScoPspollConfig = &pScoConfigCmd->scoPspollConfig;
-                    BTCOEX_OPTMODE_SCO_CONFIG  * pScoOptModeConfig = &pScoConfigCmd->scoOptModeConfig;
-                    BTCOEX_WLANSCAN_SCO_CONFIG * pScoWlanScanConfig = &pScoConfigCmd->scoWlanScanConfig;
-                    if (argCount != 17) {
-                        status = A_EINVAL;
-                        break;
-                    }
-                    pScoGenericConfig->scoSlots                = (A_UINT32) args[0];
-                    pScoGenericConfig->scoIdleSlots            = (A_UINT32) args[1];
-                    pScoGenericConfig->scoFlags                = (A_UINT32) args[2];
-                    pScoGenericConfig->linkId                  = (A_UINT32) args[3];
-                    pScoPspollConfig->scoCyclesForceTrigger    = (A_UINT32) args[4];
-                    pScoPspollConfig->scoDataResponseTimeout   = (A_UINT32) args[5];
-                    pScoPspollConfig->scoStompDutyCyleVal      = (A_UINT32) args[6];
-                    pScoPspollConfig->scoStompDutyCyleMaxVal   = (A_UINT32) args[7];
-                    pScoPspollConfig->scoPsPollLatencyFraction = (A_UINT32) args[8];
-                    pScoOptModeConfig->scoStompCntIn100ms      = (A_UINT32) args[9];
-                    pScoOptModeConfig->scoContStompMax         = (A_UINT32) args[10];
-                    pScoOptModeConfig->scoMinlowRateMbps       = (A_UINT32) args[11];
-                    pScoOptModeConfig->scoLowRateCnt           = (A_UINT32) args[12];
-                    pScoOptModeConfig->scoHighPktRatio         = (A_UINT32) args[13];
-                    pScoOptModeConfig->scoMaxAggrSize          = (A_UINT32) args[14];
-                    pScoWlanScanConfig->scanInterval           = (A_UINT32) args[15];
-                    pScoWlanScanConfig->maxScanStompCnt        = (A_UINT32) args[16];
-                } else {
-                    pItem->ControlAction.Type = BT_CONTROL_ACTION_PARAMS;
-                    pItem->ControlAction.Length = sizeof(WMI_SET_BT_PARAMS_CMD);
-                    WMI_SET_BT_PARAMS_CMD   *pParamsCmd =
-                                    (WMI_SET_BT_PARAMS_CMD *)pItem->ControlAction.Buffer;
-
-                    pParamsCmd->paramType = BT_PARAM_SCO;
-                    pParamsCmd->info.scoParams.numScoCyclesForceTrigger =
-                                                    (A_UINT8)args[0];
-                    pParamsCmd->info.scoParams.dataResponseTimeout =
-                                                         (A_UINT8)args[1];
-                    pParamsCmd->info.scoParams.stompScoRules =
-                                                        (A_UINT8)args[2];
-                    pParamsCmd->info.scoParams.scoOptFlags =  (A_UINT8)args[3];
-                    pParamsCmd->info.scoParams.stompDutyCyleVal =
-                                                        (A_UINT8)args[4];
-                    pParamsCmd->info.scoParams.stompDutyCyleMaxVal =
-                                                            (A_UINT8)args[5];
-                    pParamsCmd->info.scoParams.psPollLatencyFraction =
-                                                            (A_UINT8)args[6];
-                    pParamsCmd->info.scoParams.noSCOSlots =  (A_UINT8)args[7];
-                    pParamsCmd->info.scoParams.noIdleSlots =  (A_UINT8)args[8];
-                    /*only a place holder. modify num args if scoOpt flag bits
-                    need to be modified here*/
-                    pParamsCmd->info.scoParams.scoOptOffRssi= (A_UINT8)args[9];
-                    pParamsCmd->info.scoParams.scoOptOnRssi = (A_UINT8)args[10];
-                    pParamsCmd->info.scoParams.scoOptRtsCount =(A_UINT8)args[11];
-                }
-                break;
-        case BT_PARAM_A2DP_TAG:
-                pItem->ControlAction.Type = BT_CONTROL_ACTION_PARAMS;
-                if(pCore->FilterState.btFilterFlags & ABF_WIFI_CHIP_IS_VENUS) {
-                    WMI_SET_BTCOEX_A2DP_CONFIG_CMD * pA2dpConfigCmd =
-                                        (WMI_SET_BTCOEX_A2DP_CONFIG_CMD *)pItem->ControlAction.Buffer;
-                    pItem->ControlAction.Length = sizeof(WMI_SET_BTCOEX_A2DP_CONFIG_CMD);
-                    BTCOEX_A2DP_CONFIG * pA2dpGenericConfig = &pA2dpConfigCmd->a2dpConfig;
-                    BTCOEX_PSPOLLMODE_A2DP_CONFIG  * pA2dpPspollConfig = &pA2dpConfigCmd->a2dppspollConfig;
-                    BTCOEX_OPTMODE_A2DP_CONFIG  * pA2dpOptModeConfig = &pA2dpConfigCmd->a2dpOptConfig;
-                    if (argCount != 10) {
-                        status = A_EINVAL;
-                        break;
-                    }
-                    pA2dpGenericConfig->a2dpFlags          = (A_UINT32) args[0];
-                    pA2dpGenericConfig->linkId             = (A_UINT32) args[1];
-                    pA2dpPspollConfig->a2dpWlanMaxDur      = (A_UINT32) args[2];
-                    pA2dpPspollConfig->a2dpMinBurstCnt     = (A_UINT32) args[3];
-                    pA2dpPspollConfig->a2dpDataRespTimeout = (A_UINT32) args[4];
-                    pA2dpOptModeConfig->a2dpMinlowRateMbps = (A_UINT32) args[5];
-                    pA2dpOptModeConfig->a2dpLowRateCnt     = (A_UINT32) args[6];
-                    pA2dpOptModeConfig->a2dpHighPktRatio   = (A_UINT32) args[7];
-                    pA2dpOptModeConfig->a2dpMaxAggrSize    = (A_UINT32) args[8];
-                    pA2dpOptModeConfig->a2dpPktStompCnt    = (A_UINT32) args[9];
-                }else {
-                    pItem->ControlAction.Type = BT_CONTROL_ACTION_PARAMS;
-                    pItem->ControlAction.Length = sizeof(WMI_SET_BT_PARAMS_CMD);
-                    WMI_SET_BT_PARAMS_CMD   *pParamsCmd =
-                                    (WMI_SET_BT_PARAMS_CMD *)pItem->ControlAction.Buffer;
-                    if (argCount != 8) {
-                        status = A_EINVAL;
-                        break;
-                    }
-                    pParamsCmd->paramType = BT_PARAM_A2DP;
-                    pParamsCmd->info.a2dpParams.a2dpWlanUsageLimit = (A_UINT8)args[0];
-                    pParamsCmd->info.a2dpParams.a2dpBurstCntMin = (A_UINT8)args[1];
-                    pParamsCmd->info.a2dpParams.a2dpDataRespTimeout = (A_UINT8)args[2];
-                    pParamsCmd->info.a2dpParams.a2dpOptFlags = (A_UINT8)args[3];
-                    pParamsCmd->info.a2dpParams.isCoLocatedBtRoleMaster = (A_UINT8)args[4];
-                    pParamsCmd->info.a2dpParams.a2dpOptOffRssi = (A_UINT8)args[5];
-                    pParamsCmd->info.a2dpParams.a2dpOptOnRssi = (A_UINT8)args[6];
-                    pParamsCmd->info.a2dpParams.a2dpOptRtsCount = (A_UINT8)args[7];
-                }
-            break;
-
-        default:
-            break;
-
-    }
-
-    if (A_FAILED(status)) {
-        A_FREE(pItem);
-    } else {
-        *pControlItem = pItem;
-    }
-
-    return status;
-}
-
-/* assemble the action list based on the descriptor list */
-static A_STATUS AssembleActionList(BT_FILTER_CORE_INFO * pCore, BT_CONTROL_ACTION_DESC *pDesc, DL_LIST *pActionListHead)
-{
-    BT_CONTROL_ACTION_ITEM  *pControlItem;
-    A_CHAR                  *pActionString;
-    A_CHAR                  *pStringToScan;
-    int                     length;
-    A_STATUS                status = A_OK;
-
-    for ( ;((pDesc != NULL) && A_SUCCESS(status)); pDesc = pDesc->pNext) {
-        if (NULL == pDesc->pActionString) {
-            continue;
-        }
-            /* scan the action string and assemble all actions */
-        pStringToScan = pDesc->pActionString;
-
-        while (1) {
-
-            length = FindActionString(pStringToScan, &pActionString);
-
-            if (0 == length) {
-                break;
-            }
-                /* found the string, now build the action */
-            status = BuildActionFromString(pCore, pActionString, length , &pControlItem);
-
-            if (A_FAILED(status)) {
-                break;
-            }
-
-                /* insert into the list head in FIFO order */
-            DL_ListInsertTail(pActionListHead,&pControlItem->ListEntry);
-
-                /* scan the rest of the string */
-            pStringToScan = pActionString + length;
-        }
-    }
-
-    return status;
-}
-
-
-static void CleanListItems(DL_LIST  *pListHead)
-{
-    DL_LIST                 *pListItem;
-    BT_CONTROL_ACTION_ITEM  *pControlItem;
-
-    while (1) {
-        pListItem = DL_ListRemoveItemFromHead(pListHead);
-        if (NULL == pListItem) {
-            break;
-        }
-        pControlItem = A_CONTAINING_STRUCT(pListItem, BT_CONTROL_ACTION_ITEM, ListEntry);
-            /* free it */
-        A_FREE(pControlItem);
-    }
-}
-
-
-static void CleanupActionLists(BT_FILTER_CORE_INFO *pCore)
-{
-    int  indication,state;
-
-    for (state = 0; state < STATE_MAX; state++) {
-            /* free all action list items */
-        for (indication = 0; indication < ATH_BT_MAX_STATE_INDICATION; indication++) {
-            CleanListItems(&pCore->ActionListsState[indication][state]);
-        }
-    }
-}
-
-/* API implementation */
-void FCore_ResetActionDescriptors(BT_FILTER_CORE_INFO *pCore)
-{
-    int indication,state;
-
-    for (state = 0; state < STATE_MAX; state++) {
-        for (indication = 0; indication < ATH_BT_MAX_STATE_INDICATION; indication++) {
-            CleanupModifiedControlActionDescChain(&pCore->ActionDescriptors[indication].Action[state]);
-        }
-    }
-
-    if(pCore->FilterState.btFilterFlags & ABF_WIFI_CHIP_IS_VENUS) {
-        memcpy(pCore->ActionDescriptors, g_ActionDefaultsVenus, sizeof(pCore->ActionDescriptors));
-    }else {
-        memcpy(pCore->ActionDescriptors, g_ActionDefaults, sizeof(pCore->ActionDescriptors));
-    }
-}
-
-A_BOOL FCore_Init(BT_FILTER_CORE_INFO *pCore)
-{
-    int indication,state;
-
-    for (state = 0; state < STATE_MAX; state++) {
-            /* initialize all action list heads */
-        for (indication = 0; indication < ATH_BT_MAX_STATE_INDICATION; indication++) {
-            DL_LIST_INIT(&pCore->ActionListsState[indication][state]);
-        }
-    }
-        /* load up the default action descriptors */
-    FCore_ResetActionDescriptors(pCore);
-
-    pCore->FilterState.ACL_ConnectionHandle = INVALID_BT_CONN_HANDLE;
-    pCore->FilterState.eSCO_ConnectionHandle = INVALID_BT_CONN_HANDLE;
-    pCore->FilterState.SCO_ConnectionHandle = INVALID_BT_CONN_HANDLE;
-
-    return TRUE;
-}
-
-/* assembly action lists from the action table, this is called after the OS-porting layer
- * has had a chance to alter the action table */
-A_STATUS FCore_RefreshActionList(BT_FILTER_CORE_INFO *pCore)
-{
-    int         indication,state;
-    A_STATUS    status = A_OK;
-
-        /* clean up previous ones */
-    CleanupActionLists(pCore);
-
-    for (state = 0; (state < STATE_MAX) && A_SUCCESS(status); state++) {
-        for (indication = 0; (indication < ATH_BT_MAX_STATE_INDICATION) && A_SUCCESS(status); indication++) {
-            status = AssembleActionList(pCore, &pCore->ActionDescriptors[indication].Action[state],
-                                        &pCore->ActionListsState[indication][state]);
-        }
-    }
-
-    if (A_FAILED(status)) {
-        FCore_Cleanup(pCore);
-    }
-
-    return status;
-}
-
-void FCore_Cleanup(BT_FILTER_CORE_INFO *pCore)
-{
-    int indication,state;
-
-    for (state = 0; state < STATE_MAX; state++) {
-        for (indication = 0; indication < ATH_BT_MAX_STATE_INDICATION; indication++) {
-            CleanupModifiedControlActionDescChain(&pCore->ActionDescriptors[indication].Action[state]);
-        }
-    }
-
-    CleanupActionLists(pCore);
-}
-
-
-BT_CONTROL_ACTION_ITEM *FCore_GetControlAction(BT_FILTER_CORE_INFO       *pCore,
-                                               ATHBT_STATE_INDICATION    Indication,
-                                               ATHBT_STATE               State,
-                                               BT_CONTROL_ACTION_ITEM    *pStart)
-{
-    DL_LIST  *pListHead;
-    BT_CONTROL_ACTION_ITEM *pBtControlAction = NULL;
-
-    if (State >= STATE_MAX) {
-        return NULL;
-    }
-
-    pListHead = &pCore->ActionListsState[Indication][State];
-
-    if (NULL == pStart) {
-            /* caller wants the first item in the list */
-        if (pListHead->pNext == pListHead) {
-                /* list is empty */
-            return NULL;
-        }
-        pBtControlAction =  A_CONTAINING_STRUCT(pListHead->pNext, BT_CONTROL_ACTION_ITEM, ListEntry);
-    } else {
-            /* caller wants the next list item */
-        if (pStart->ListEntry.pNext == pListHead) {
-                /* reached the end */
-            return NULL;
-        }
-        pBtControlAction =  A_CONTAINING_STRUCT(pStart->ListEntry.pNext, BT_CONTROL_ACTION_ITEM, ListEntry);
-    }
-
-   return pBtControlAction;
-}
-
-static void CleanupModifiedControlActionDescChain(BT_CONTROL_ACTION_DESC  *pDesc)
-{
-    BT_CONTROL_ACTION_DESC  *pNextDesc;
-
-    while (pDesc) {
-        pNextDesc = pDesc->pNext;
-        if (pDesc->Flags & BT_CA_DESC_FLAGS_ALLOCATED) {
-            A_FREE(pDesc);
-        }
-        pDesc = pNextDesc;
-    }
-
-}
-
-A_STATUS FCore_ModifyControlActionString(BT_FILTER_CORE_INFO          *pCore,
-                                         ATHBT_STATE_INDICATION       Indication,
-                                         ATHBT_STATE                  State,
-                                         A_CHAR                       *pAction,
-                                         int                          StringLength,
-                                         ATHBT_MODIFY_CONTROL_ACTION  ModifyAction)
-{
-    BT_CONTROL_ACTION_DESC  *pNewDesc;
-    BT_CONTROL_ACTION_DESC  *pDescHead;
-    A_CHAR                  *pString;
-
-        /* get first entry at the head */
-    pDescHead = &pCore->ActionDescriptors[Indication].Action[State];
-
-        /* allocate and assemble an entry for this action */
-    pNewDesc = (BT_CONTROL_ACTION_DESC  *)A_MALLOC(sizeof(BT_CONTROL_ACTION_DESC) + StringLength + 1);
-
-    if (NULL == pNewDesc) {
-        return A_NO_MEMORY;
-    }
-
-    A_MEMZERO(pNewDesc,sizeof(BT_CONTROL_ACTION_DESC));
-
-        /* setup and copy string */
-    pString = (A_CHAR *)((A_UINT8 *)pNewDesc + sizeof(BT_CONTROL_ACTION_DESC));
-    A_MEMCPY(pString,pAction,StringLength);
-    pString[StringLength] = 0;
-    pNewDesc->pActionString = pString;
-        /* mark that it was allocated so we can clean it up later */
-    pNewDesc->Flags = BT_CA_DESC_FLAGS_ALLOCATED;
-
-    switch (ModifyAction) {
-        case ATHBT_MODIFY_CONTROL_ACTION_APPEND:
-                /* append to the end of the list */
-            while (pDescHead->pNext != NULL) {
-                pDescHead = pDescHead->pNext;
-            }
-            pDescHead->pNext = pNewDesc;
-            break;
-
-        case ATHBT_MODIFY_CONTROL_ACTION_REPLACE:
-                /* remove any existing replacements or append operations */
-            CleanupModifiedControlActionDescChain(pDescHead);
-                /* ignore the first entry's action string */
-            pDescHead->pActionString = NULL;
-                /* add new replacement */
-            pDescHead->pNext = pNewDesc;
-            break;
-
-        default:
-            A_FREE(pNewDesc);
-            break;
-    }
-
-
-    return A_OK;
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btfilter_core.c b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btfilter_core.c
deleted file mode 100644 (file)
index 3d42822..0000000
+++ /dev/null
@@ -1,620 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="btfilter_core.c" company="Atheros">
-//    Copyright (c) 2007 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// Bluetooth filter core action tables and action lookup
-//
-// Author(s): ="Atheros"
-//==============================================================================
-
-#include <stdlib.h>
-#include <string.h>
-#include "athdefs.h"
-#define  ATH_MODULE_NAME btfilt
-#include "a_debug.h"
-#include "a_types.h"
-#include "a_osapi.h"
-#include "wmi.h"
-#include "athbtfilter.h"
-#include "btfilter_core.h"
-
-#ifdef DEBUG
-
-ATH_DEBUG_INSTANTIATE_MODULE_VAR(btfilt,
-                                 "btfilt",
-                                 "BT Filter Core",
-                                 ATH_DEBUG_MASK_DEFAULTS,
-                                 0,
-                                 NULL);
-                                 
-#endif
-
-#define IS_STATE_FILTER_IGNORED(pCore,indication) ((pCore)->StateFilterIgnore & (1 << (indication)))
-
-static A_BOOL IsACLSignaling(BT_FILTER_CORE_INFO *pCore,
-                             A_UINT8             *pBuffer, 
-                             int                 Length);
-
-static A_BOOL IsA2DPConnection(BT_FILTER_CORE_INFO *pCore,
-                               A_UINT8             *pBuffer, 
-                               int                 Length);
-
-static void ParseACLPacket(BT_FILTER_CORE_INFO *pCore,
-                           A_UINT8             *pBuffer, 
-                           int                 Length);
-
-static void ProcessA2DPconnection(BT_FILTER_CORE_INFO *pCore,
-                                  L2CAP_CONTROL       *pL2Ctrl,
-                                  A_BOOL              IsConnect);
-
-static ATHBT_STATE_INDICATION A2DP_StateIndication(BT_FILTER_CORE_INFO *pCore,
-                                                   A_UINT8             *pBuffer, 
-                                                   int                 Length,
-                                                   ATHBT_STATE         *pNewState);
-
-static ATHBT_STATE_INDICATION ProcessA2DPCMD(BT_FILTER_CORE_INFO *pCore,
-                                             A_UINT8             CMDID,
-                                             ATHBT_STATE         *pNewState,
-                                             A_BOOL                     IsACPT);
-
-ATHBT_STATE_INDICATION FCore_FilterBTCommand(BT_FILTER_CORE_INFO *pCore, A_UINT8 *pBuffer, int Length, ATHBT_STATE *pNewState)
-{
-    ATHBT_STATE_INDICATION indication = ATH_BT_NOOP;
-    ATHBT_STATE            state = STATE_OFF;
-    A_UINT16               command;
-
-
-    if (!IS_LINK_CONTROL_CMD(pBuffer)) {
-            /* we only filter link control commands */
-        return indication;
-    }
-
-    command = HCI_GET_OP_CODE(pBuffer);
-
-    switch (command) {
-        case HCI_INQUIRY :
-            if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_INQUIRY)) {
-                break;
-            }
-            indication = ATH_BT_INQUIRY;
-            state = STATE_ON;
-            break;
-
-        case HCI_INQUIRY_CANCEL :
-            if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_INQUIRY)) {
-                break;
-            }
-            indication = ATH_BT_INQUIRY;
-            state = STATE_OFF;
-            break;
-
-        case HCI_CREATE_CONNECTION :
-            if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_CONNECT)) {
-                break;
-            }
-            indication = ATH_BT_CONNECT;
-            state = STATE_ON;
-            break;
-
-        case HCI_ACCEPT_CONN_REQ :
-            if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_CONNECT)) {
-                break;
-            }
-            indication = ATH_BT_CONNECT;
-            state = STATE_ON;
-            break;
-
-        case HCI_ADD_SCO :
-            /* we do not need to handle this command, we can pick up the connection complete event */
-        case HCI_DISCONNECT :
-            /* we don't need to handle this command as we can pick up the disconnect event */
-        case HCI_PER_INQUIRY :
-        case HCI_PER_INQUIRY_CANCEL :
-            /* we do not handle these currently */
-        default :
-            break;
-    }
-
-    if (indication != ATH_BT_NOOP) {
-            /* the HCI filter simply determines the "precise" state and calls the shared function */
-        return FCore_FilterIndicatePreciseState(pCore, indication, state, pNewState);
-    }
-
-    return ATH_BT_NOOP;
-}
-
-
-void FilterConnectDisconnectComplete(BT_FILTER_CORE_INFO    *pCore,
-                                     A_UINT8                LinkType,
-                                     A_UINT16               ConnectionHandle,
-                                     A_BOOL                 Connected,
-                                     ATHBT_STATE_INDICATION *pIndication,
-                                     ATHBT_STATE            *pState)
-{
-
-
-    do {
-        if (Connected) {
-
-            if (LinkType == BT_LINK_TYPE_SCO) {
-
-                    /* SCO connection */
-                if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_SCO)) {
-                    break;
-                }
-
-                pCore->FilterState.SCO_ConnectionHandle = ConnectionHandle;
-                *pIndication = ATH_BT_SCO;
-                *pState = STATE_ON;
-
-            } else if (LinkType == BT_LINK_TYPE_ACL) {
-
-                    /* ACL connection */
-                if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_ACL)) {
-                    break;
-                }
-
-                /**** TODO , currently we do not keep track of ACL connections
-                  at the moment we rely on upper layer stack to detect specific
-                  traffic types like A2DP. Since there can be multiple ACL connections
-                  it is not practical to provide a single action for all ACL connections.
-                  This is just a place holder in case a customer does require specific
-                  actions to take for an ACL connection *****/
-
-            } else if (LinkType == BT_LINK_TYPE_ESCO) {
-
-                    /* eSCO connection */
-                if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_ESCO)) {
-                    break;
-                }
-
-                pCore->FilterState.eSCO_ConnectionHandle = ConnectionHandle;
-                *pIndication = ATH_BT_ESCO;
-                *pState = STATE_ON;
-            }
-
-            break;
-        }
-
-        /* if we get here, we are handling the disconnect case */
-
-        if (ConnectionHandle == pCore->FilterState.ACL_ConnectionHandle) {
-
-            /*** TODO, we currently do not keep track of these, see note above */
-
-        } else if (ConnectionHandle == pCore->FilterState.SCO_ConnectionHandle) {
-
-            pCore->FilterState.SCO_ConnectionHandle = INVALID_BT_CONN_HANDLE;
-            *pIndication = ATH_BT_SCO;
-            *pState = STATE_OFF;
-
-        } else if (ConnectionHandle == pCore->FilterState.eSCO_ConnectionHandle) {
-
-            pCore->FilterState.eSCO_ConnectionHandle = INVALID_BT_CONN_HANDLE;
-            *pIndication = ATH_BT_ESCO;
-            *pState = STATE_OFF;
-        }
-
-    } while (FALSE);
-
-}
-
-
-ATHBT_STATE_INDICATION FCore_FilterBTEvent(BT_FILTER_CORE_INFO *pCore, A_UINT8 *pBuffer, int Length, ATHBT_STATE *pNewState)
-{
-    ATHBT_STATE_INDICATION indication = ATH_BT_NOOP;
-    ATHBT_STATE            state = STATE_OFF;
-
-    switch HCI_GET_EVENT_CODE(pBuffer) {
-        case HCI_EVT_INQUIRY_COMPLETE :
-            if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_INQUIRY)) {
-                break;
-            }
-            indication = ATH_BT_INQUIRY;
-            state = STATE_OFF;
-            break;
-
-        case HCI_EVT_CONNECT_COMPLETE :
-                         
-            if (BT_CONN_EVENT_STATUS_SUCCESS(pBuffer)) {
-                FilterConnectDisconnectComplete(pCore,
-                                                GET_BT_CONN_LINK_TYPE(pBuffer),
-                                                GET_BT_CONN_HANDLE(pBuffer),
-                                                TRUE, /* connected */
-                                                &indication,
-                                                &state);
-            }
-                                       
-            break;
-
-        case HCI_EVT_CONNECT_REQUEST :
-            if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_CONNECT)) {
-                break;
-            }
-
-            indication = ATH_BT_CONNECT;
-            state = STATE_ON;
-            break;
-
-        case HCI_EVT_SCO_CONNECT_COMPLETE:
-
-            if (BT_CONN_EVENT_STATUS_SUCCESS(pBuffer)) {
-                FilterConnectDisconnectComplete(pCore,
-                                                GET_BT_CONN_LINK_TYPE(pBuffer),
-                                                GET_BT_CONN_HANDLE(pBuffer),
-                                                TRUE, /* connected */
-                                                &indication,
-                                                &state);
-            }
-
-            break;
-
-        case HCI_EVT_DISCONNECT :
-
-            FilterConnectDisconnectComplete(pCore,
-                                            GET_BT_CONN_LINK_TYPE(pBuffer),
-                                            GET_BT_CONN_HANDLE(pBuffer),
-                                            FALSE, /* disconnected */
-                                            &indication,
-                                            &state);
-            break;
-
-        case HCI_EVT_REMOTE_NAME_REQ :
-
-            /* TODO */
-            break;
-
-        case HCI_EVT_ROLE_CHANGE :
-            /* TODO */
-            break;
-
-        default:
-            break;
-    }
-
-    if (indication != ATH_BT_NOOP) {
-            /* the HCI filter simply determines the "precise" state and calls the shared function */
-        return FCore_FilterIndicatePreciseState(pCore, indication, state, pNewState);
-    }
-
-    return ATH_BT_NOOP;
-}
-
-/* a precise state can be indicated by the porting layer or indicated by the HCI command/event filtering.
- * The caller needs to protect this call with a lock */
-ATHBT_STATE_INDICATION FCore_FilterIndicatePreciseState(BT_FILTER_CORE_INFO    *pCore,
-                                                        ATHBT_STATE_INDICATION  Indication,
-                                                        ATHBT_STATE             StateOn,
-                                                        ATHBT_STATE            *pNewState)
-{
-    A_UINT32 bitmap = (1 << Indication);
-    A_UINT32 oldBitMap;
-
-    oldBitMap = pCore->FilterState.StateBitMap;
-
-    if (StateOn == STATE_ON) {
-        pCore->FilterState.StateBitMap |= bitmap;
-    } else {
-        pCore->FilterState.StateBitMap &= ~bitmap;
-    }
-
-    if (oldBitMap ^ pCore->FilterState.StateBitMap) {
-        *pNewState = StateOn;
-        return Indication;
-    } else {
-            /* no state change */
-        return ATH_BT_NOOP;
-    }
-}
-
-A_UINT32 FCore_GetCurrentBTStateBitMap(BT_FILTER_CORE_INFO    *pCore)
-{
-    return pCore->FilterState.StateBitMap;
-}
-
-ATHBT_STATE_INDICATION FCore_FilterACLDataIn(BT_FILTER_CORE_INFO *pCore,
-                                             A_UINT8             *pBuffer, 
-                                             int                 Length, 
-                                             ATHBT_STATE         *pNewState)
-{
-    ATHBT_STATE_INDICATION  stateIndication = ATH_BT_NOOP;
-   
-    *pNewState  = STATE_OFF;
-    
-    do {
-        
-        if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_A2DP)) {
-            /* we only filter for A2DP stream state if the OS-ported layer
-             * cannot do it */
-            break;
-        }
-        
-        /***** the following code filters for A2DP stream state ONLY *****/
-        
-            /* filter ACL packets for application specific traffic */
-        if (IsACLSignaling(pCore,pBuffer,Length)) {
-               ParseACLPacket(pCore,pBuffer,Length);
-        } else if ( IsA2DPConnection(pCore,pBuffer,Length)) {
-               stateIndication = A2DP_StateIndication(pCore,pBuffer,Length,pNewState);
-        }   
-        
-    } while (FALSE);   
-  
-    return stateIndication;    
-}
-
-ATHBT_STATE_INDICATION FCore_FilterACLDataOut(BT_FILTER_CORE_INFO *pCore, 
-                                              A_UINT8             *pBuffer, 
-                                              int                 Length, 
-                                              ATHBT_STATE         *pNewState)
-{ 
-    ATHBT_STATE_INDICATION  stateIndication = ATH_BT_NOOP;
-      
-    *pNewState  = STATE_OFF;
-        
-    do {
-        
-        if (IS_STATE_FILTER_IGNORED(pCore, ATH_BT_A2DP)) {
-            /* we only filter for A2DP stream state if the OS-ported layer
-             * cannot do it */
-            break;
-        }
-        
-        /***** the following code filters for A2DP stream state ONLY *****/
-             
-        if (IsACLSignaling(pCore,pBuffer,Length)) {
-               ParseACLPacket(pCore,pBuffer,Length);
-        } else if (IsA2DPConnection(pCore,pBuffer,Length)) {
-               stateIndication = A2DP_StateIndication(pCore,pBuffer,Length,pNewState);
-        }   
-    
-    } while (FALSE);   
-    
-    return stateIndication;
-}
-
-static INLINE A_BOOL ParseCAPheader(L2CAP_HEADER *pL2hdr,
-                                    A_UINT8      *pBuffer,
-                                    int          Length)
-{
-    A_UCHAR    *pTemp = pBuffer + sizeof(ACL_HEADER);
-    
-    if (Length < (sizeof(ACL_HEADER)+sizeof(L2CAP_HEADER))) {
-        return FALSE;
-    }
-
-    pL2hdr->Length = GETUINT16(pTemp);
-    pTemp += sizeof(A_UINT16);
-    pL2hdr->CID = GETUINT16(pTemp);
-    pTemp += sizeof(A_UINT16);
-    return TRUE;
-}
-
-
-static INLINE A_BOOL ParseCAPCtrl(L2CAP_CONTROL *pL2Ctrl,
-                                  A_UINT8       *pBuffer,
-                                  int           Length)
-{
-    A_UCHAR     *pTemp = pBuffer + sizeof(ACL_HEADER);
-      
-    if (Length < (sizeof(ACL_HEADER)+sizeof(L2CAP_HEADER)+sizeof(L2CAP_CONTROL)-6)) {
-        return FALSE;
-    }
-    
-    pTemp +=sizeof(L2CAP_HEADER);
-
-    pL2Ctrl->CODE = *pTemp++;
-    pL2Ctrl->ID = *pTemp++;
-    pL2Ctrl->Length = GETUINT16(pTemp) ;
-    pTemp += sizeof(A_UINT16);
-    pL2Ctrl->PSM = pL2Ctrl->DESTINATION_CID=GETUINT16(pTemp);
-    pTemp += sizeof(A_UINT16);
-    pL2Ctrl->SOURCE_CID = GETUINT16(pTemp);
-    pTemp += sizeof(A_UINT16);
-    
-    if (Length >= (sizeof(ACL_HEADER)+sizeof(L2CAP_HEADER)+sizeof(L2CAP_CONTROL)-sizeof(A_UINT16))) { 
-        pL2Ctrl->RESULT = GETUINT16(pTemp);
-        pTemp += sizeof(A_UINT16);
-        pL2Ctrl->STATUS = GETUINT16(pTemp);
-        pTemp += sizeof(A_UINT16);
-    }
-    
-    return TRUE;
-} 
-
-static A_BOOL IsACLSignaling(BT_FILTER_CORE_INFO *pCore,
-                             A_UINT8             *pBuffer, 
-                             int                 Length)
-{
-    L2CAP_HEADER    L2hdr;
-    
-    A_MEMZERO(&L2hdr,sizeof(L2CAP_HEADER));
-    
-    if (!ParseCAPheader(&L2hdr,pBuffer,Length)) {
-         return FALSE;
-    }
-         
-    if (L2hdr.CID == SIGNALING) {
-        return TRUE;
-    }   
-    
-    return FALSE;   
-}
-
-static A_BOOL IsA2DPConnection(BT_FILTER_CORE_INFO *pCore,
-                               A_UINT8             *pBuffer, 
-                               int                 Length)
-{
-    L2CAP_HEADER    L2hdr;
-    
-    A_MEMZERO(&L2hdr,sizeof(L2CAP_HEADER));
-    
-    if (!ParseCAPheader(&L2hdr,pBuffer,Length)) {
-        /* not L2CAP header */        
-        return FALSE;
-    }
-     
-    if (pCore->FilterState.AVDTP_state==STATE_CONNECTED && 
-        ((L2hdr.CID==pCore->FilterState.AVDTP_DESTINATION_CID) ||
-         (L2hdr.CID==pCore->FilterState.AVDTP_SOURCE_CID))) {
-        //ACL normal packet
-        return TRUE;                   
-    }
-    
-    return FALSE;  
-}   
-
-static void ParseACLPacket(BT_FILTER_CORE_INFO *pCore,
-                           A_UINT8             *pBuffer, 
-                           int                 Length)
-{
-    L2CAP_CONTROL   L2ctrl;
-    
-    A_MEMZERO(&L2ctrl,sizeof(L2CAP_CONTROL));
-    
-    if (!ParseCAPCtrl(&L2ctrl,pBuffer,Length)) {
-        return; 
-    }      
-    
-    switch( L2ctrl.CODE) {
-        case CONNECT_REQ:
-        case CONNECT_RSP:
-            ProcessA2DPconnection(pCore,&L2ctrl,TRUE);
-            break;        
-        case DISCONNECT_REQ:
-        case DISCONNECT_RSP:
-            ProcessA2DPconnection(pCore,&L2ctrl,FALSE);
-            break;  
-    }   
-}
-
-static void ProcessA2DPconnection(BT_FILTER_CORE_INFO *pCore,
-                                  PL2CAP_CONTROL      pL2Ctrl,
-                                  A_BOOL              IsConnect)
-{
-    
-    if (IsConnect) {
-        if (pL2Ctrl->CODE==CONNECT_REQ) { 
-            if (pCore->FilterState.AVDTP_state==STATE_DISCONNECT) {
-                pCore->FilterState.AVDTP_state = pL2Ctrl->PSM == 
-                                    A2DP_TYPE ? STATE_CONNECTING:STATE_DISCONNECT;                
-            } else if (pCore->FilterState.RFCOMM_state==STATE_DISCONNECT) {
-                pCore->FilterState.RFCOMM_state= pL2Ctrl->PSM == 
-                                    RFCOMM_TYPE ? STATE_CONNECTING:STATE_DISCONNECT;
-            }
-        } else if (pL2Ctrl->CODE==CONNECT_RSP) {
-            switch (pL2Ctrl->RESULT) {
-                case STATE_SUCCESS:
-                    if (pCore->FilterState.AVDTP_state == STATE_CONNECTING) {
-                        pCore->FilterState.AVDTP_SOURCE_CID=NULL_ID;
-                        pCore->FilterState.AVDTP_DESTINATION_CID=NULL_ID;
-                        if ( pL2Ctrl->STATUS==STATE_SUCCESS) {
-                            pCore->FilterState.AVDTP_state= STATE_CONNECTED;
-                            pCore->FilterState.AVDTP_SOURCE_CID= pL2Ctrl->SOURCE_CID;  
-                            pCore->FilterState.AVDTP_DESTINATION_CID= pL2Ctrl->DESTINATION_CID; 
-                        }
-                    } else if (pCore->FilterState.RFCOMM_state == STATE_CONNECTING) {
-                        pCore->FilterState.RFCOMM_SOURCE_CID=NULL_ID;
-                        pCore->FilterState.RFCOMM_DESTINATION_CID=NULL_ID;
-                        if ( pL2Ctrl->STATUS==STATE_SUCCESS) {
-                            pCore->FilterState.RFCOMM_state= STATE_CONNECTED;
-                            pCore->FilterState.RFCOMM_SOURCE_CID= pL2Ctrl->SOURCE_CID; 
-                            pCore->FilterState.RFCOMM_DESTINATION_CID= pL2Ctrl->DESTINATION_CID;
-                        }
-                    } 
-                    break;
-                case STATE_PENDING:
-                    break;
-                default: 
-                    pCore->FilterState.RFCOMM_state=STATE_DISCONNECT;   
-                    pCore->FilterState.RFCOMM_SOURCE_CID=NULL_ID;
-                    pCore->FilterState.RFCOMM_DESTINATION_CID=NULL_ID;
-                    pCore->FilterState.AVDTP_state=STATE_DISCONNECT;    
-                    pCore->FilterState.AVDTP_SOURCE_CID = NULL_ID;
-                    pCore->FilterState.AVDTP_DESTINATION_CID=NULL_ID;
-                    break;
-            }
-       }
-    } else {
-        pCore->FilterState.AVDTP_state=STATE_DISCONNECT;    
-        pCore->FilterState.RFCOMM_state=STATE_DISCONNECT;   
-    }
-    
-}                        
-
-
-static ATHBT_STATE_INDICATION A2DP_StateIndication(BT_FILTER_CORE_INFO *pCore,
-                                                   A_UINT8             *pBuffer, 
-                                                   int                 Length,
-                                                   ATHBT_STATE         *pNewState)                                       
-
-{
-    AVDTP_HEADER            Avdtphdr;   
-    ATHBT_STATE_INDICATION  stateIndication = ATH_BT_NOOP;
-    A_UCHAR                 *pTemp = pBuffer+sizeof(ACL_HEADER)+sizeof(L2CAP_HEADER);
-    
-    Avdtphdr.MESSAGE_TYPE= (*pTemp++) & 0x03; // get Message Type
-    Avdtphdr.CMD_ID = (*pTemp++) & 0x3F;     //Get command code
-    
-    switch (Avdtphdr.MESSAGE_TYPE) {
-        case TYPE_ACPT:
-            stateIndication = ProcessA2DPCMD(pCore,Avdtphdr.CMD_ID,pNewState,TRUE);
-            break;
-        case TYPE_REJ: 
-            stateIndication = ProcessA2DPCMD(pCore,Avdtphdr.CMD_ID,pNewState,FALSE);
-            break;       
-        default:
-            break;    
-    }
-    
-    return stateIndication; 
-}                                       
-
-static ATHBT_STATE_INDICATION ProcessA2DPCMD(BT_FILTER_CORE_INFO *pCore,
-                                             A_UINT8             CMDID,
-                                             ATHBT_STATE         *pNewState,
-                                             A_BOOL              IsACPT)
-
-{
-    ATHBT_STATE_INDICATION stateIndication = ATH_BT_NOOP;
-    
-    switch(CMDID) {        
-        case AVDTP_START:
-            stateIndication = ATH_BT_A2DP;
-            *pNewState = IsACPT ? STATE_ON:STATE_OFF;
-            break;
-        case AVDTP_OPEN:
-                // don't assign any state in here.
-            break;         
-        case AVDTP_SUSPEND:
-            stateIndication = ATH_BT_A2DP;
-            *pNewState = STATE_OFF;       
-            break;
-        case AVDTP_CLOSE:     
-            stateIndication = ATH_BT_A2DP;
-            *pNewState = STATE_OFF;       
-            break;  
-        default:
-            break;
-    }    
-   
-    return stateIndication;   
-}                  
-
-                    
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btfilter_core.h b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/btfilter_core.h
deleted file mode 100644 (file)
index f0230f6..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="btfilter_core.h" company="Atheros">
-//    Copyright (c) 2007 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// Internal APIs and definitions for Bluetooth filter core
-//
-// Author(s): ="Atheros"
-//==============================================================================
-#ifndef BTFILTER_INTERNAL_H_
-#define BTFILTER_INTERNAL_H_
-
-#include "btdefs.h"
-#include "athdefs.h"
-#include "dl_list.h"
-#include "wmi.h"
-
-typedef enum _BT_CONTROL_ACTION_TYPE {
-    BT_CONTROL_ACTION_STATUS = 0,
-    BT_CONTROL_ACTION_PARAMS = 1
-} BT_CONTROL_ACTION_TYPE;
-
-typedef union _BT_CONTROL_ACTION_BUFFER {
-    WMI_SET_BT_STATUS_CMD AsStatusCmd;              /* parameters for a status command */
-    WMI_SET_BT_PARAMS_CMD AsParamCmd;               /* parameters for a set params command */
-    WMI_SET_BTCOEX_SCO_CONFIG_CMD scoConfigCmd;
-    WMI_SET_BTCOEX_A2DP_CONFIG_CMD a2dpConfigCmd;
-} BT_CONTROL_ACTION_BUFFER;
-
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#define A_ROUND_UP_PWR2(x, align)    (((int) (x) + ((align)-1)) & ~((align)-1))
-
-#define MAX_BT_CONTROL_ACTION_DATA_SIZE A_ROUND_UP_PWR2(sizeof(BT_CONTROL_ACTION_BUFFER),4) /* nicely aligned */
-
-    /* core state flags and variables */
-typedef struct _BT_FILTER_CORE_STATE {
-    A_UINT16    SCO_ConnectionHandle;
-    A_UINT16    ACL_ConnectionHandle;
-    A_UINT16    eSCO_ConnectionHandle;
-    A_UINT32    StateBitMap;
-    A_UINT8     AVDTP_state;
-    A_UINT8     RFCOMM_state;
-    A_UINT16    AVDTP_SOURCE_CID;
-    A_UINT16    AVDTP_DESTINATION_CID;
-    A_UINT16    RFCOMM_SOURCE_CID;
-    A_UINT16    RFCOMM_DESTINATION_CID;
-    A_UINT32    btFilterFlags;
-} BT_FILTER_CORE_STATE;
-
-#define BT_ACTION_STRING_MAX_LENGTH 64  /* maximum action string length */
-#define BT_ACTION_MAX_ARGS          18  /* maximum number of numberic arguments */
-
-#define BT_CA_DESC_FLAGS_ALLOCATED (1 << 0)
-
-    /* a control action descriptor */
-typedef struct _BT_CONTROL_ACTION_DESC {
-    A_CHAR                            *pActionString; /* action string (described below) */
-    A_UINT32                           Flags;         /* flags for this entry */
-    struct _BT_CONTROL_ACTION_DESC    *pNext;         /* link to next action */
-} BT_CONTROL_ACTION_DESC;
-
-    /* control action descriptor containing actions for each state */
-typedef struct _BT_CONTROL_ACTION_DESC_STATE {
-    BT_CONTROL_ACTION_DESC Action[STATE_MAX];
-} BT_CONTROL_ACTION_DESC_STATE;
-
-
-/* ACTION strings:
- *    The BT control actions are described in string format.  The string is parsed for parameters
- *    (based on tags and order) and the parameter list passed to a function that assembles the WMI
- *    commands (status or params) to issue.
- *
- *    The string format is selected to follow the command line ordering from the WMI config application.
- *
- *
- * BT STATUS:
- *      "-s <streamtype> <status>"
- *
- * BT PARAM SCO:
- *      "-pSCO <noSCOPkts> <pspollTimeout> <stompbt> <scoOptFlags> <dutyCycleMin> <dutyCycleMax> <latencyFraction>
- *              <noScoSlots> <noIdleSlots> <optOffRssi> <optOnRssi> <rtsCount>"
- *
- * BT PARAM A2DP:
- *      "-pA2DP <wlanUsageLimit> <burstCountMin> <dataRespTimeout> <master-slave> <a2dpOptFlags> <optoffRssi> <optonRssi> <rtsCount>"
- *
- * BT PARAM MISC - WLAN Tx Protection:
- *      "-pMISC_TxProtect <period> <dutycycle> <stompbt> <protect policy>"
- *
- * BT PARAM MISC - Coex Policy:
- *      "-pMISC_Coex <ctrlflags>"
- *
- * BT PARAM REGISTERS :
- *      "-pREGS <mode> <sco weights> <a2dp weights> <general weights> <mode2> <set values>"
- *
- * A string may contain multiple commands delimited by a continuation character ';' .  For example:
- *
- *    "-pA2DP 100 40 1 ; -s 2 1"
- *
- *    Would issue a BT PARAM-A2DP command followed by a BT STATUS command.
- *
- */
-
-typedef struct _BT_CONTROL_ACTION {
-    BT_CONTROL_ACTION_TYPE      Type;                                    /* the action type (i.e. status, params) */
-    A_UCHAR                     Buffer[MAX_BT_CONTROL_ACTION_DATA_SIZE]; /* buffer holding parameters */
-    int                         Length;                                  /* length of parameters */
-} BT_CONTROL_ACTION;
-
-typedef struct _BT_CONTROL_ACTION_ITEM {
-    DL_LIST                 ListEntry;
-    BT_CONTROL_ACTION       ControlAction;
-} BT_CONTROL_ACTION_ITEM;
-
-    /* BT Core state blob */
-typedef struct _BT_FILTER_CORE_INFO {
-    BT_FILTER_CORE_STATE         FilterState;
-    A_UINT32                     StateFilterIgnore;   /* bitmap of state to ignore*/
-    BT_CONTROL_ACTION_DESC_STATE ActionDescriptors[ATH_BT_MAX_STATE_INDICATION];
-    DL_LIST                      ActionListsState[ATH_BT_MAX_STATE_INDICATION][STATE_MAX];
-} BT_FILTER_CORE_INFO;
-
-/* filter core APIs called by the OS adaptation layer */
-
-A_BOOL FCore_Init(BT_FILTER_CORE_INFO *pCore);
-void FCore_Cleanup(BT_FILTER_CORE_INFO *pCore);
-void FCore_ResetActionDescriptors(BT_FILTER_CORE_INFO *pCore);
-
-/* filter BT commands and events and extract current BT radio state
- * ***** NOTE: the caller must protect this function with locks to protect internal
- *             state.  This is however stack dependent. Some stacks may serialize HCI command and
- *             event processing. Some may allow these two operations to overlap.
- */
-ATHBT_STATE_INDICATION FCore_FilterBTCommand(BT_FILTER_CORE_INFO *pCore, A_UINT8 *pBuffer, int Length, ATHBT_STATE *pNewState);
-ATHBT_STATE_INDICATION FCore_FilterBTEvent(BT_FILTER_CORE_INFO *pCore, A_UINT8 *pBuffer, int Length, ATHBT_STATE *pNewState);
-
-/* filter ACL IN and OUT data to obtain BT application states
- * ***** NOTE: the caller must protect this function with locks to protect internal
- *             state.  
- */
-ATHBT_STATE_INDICATION FCore_FilterACLDataOut(BT_FILTER_CORE_INFO *pCore,
-                                              A_UINT8             *pBuffer, 
-                                              int                 Length, 
-                                              ATHBT_STATE         *pNewState);
-                                              
-ATHBT_STATE_INDICATION FCore_FilterACLDataIn(BT_FILTER_CORE_INFO *pCore,
-                                             A_UINT8             *pBuffer, 
-                                             int                 Length, 
-                                             ATHBT_STATE         *pNewState);
-                                      
-/* core state reset, usually called when the WLAN side goes away */
-#define FCore_ResetState(p)  /* doesn't do anything now */
-
-/* get the action list tem for this state indication
- * The caller should pass pStart=NULL to obtain the first item.  Then using each item returned,
- * the caller can set pStart to that item and obtain the *next* item */
-BT_CONTROL_ACTION_ITEM *FCore_GetControlAction(BT_FILTER_CORE_INFO       *pCore,
-                                               ATHBT_STATE_INDICATION    Indication,
-                                               ATHBT_STATE              State,
-                                               BT_CONTROL_ACTION_ITEM    *pStart);
-
-A_STATUS FCore_RefreshActionList(BT_FILTER_CORE_INFO *pCore);
-
-/* called to indicate the precise state of the BT radio when determined by external means */
-ATHBT_STATE_INDICATION FCore_FilterIndicatePreciseState(BT_FILTER_CORE_INFO    *pCore,
-                                                        ATHBT_STATE_INDICATION Indication,
-                                                        ATHBT_STATE            State,
-                                                        ATHBT_STATE           *pNewState);
-
-A_UINT32 FCore_GetCurrentBTStateBitMap(BT_FILTER_CORE_INFO    *pCore);
-
-typedef enum _ATHBT_MODIFY_CONTROL_ACTION {
-    ATHBT_MODIFY_CONTROL_ACTION_NOOP,
-    ATHBT_MODIFY_CONTROL_ACTION_APPEND,
-    ATHBT_MODIFY_CONTROL_ACTION_REPLACE
-} ATHBT_MODIFY_CONTROL_ACTION;
-
-/* called to modify a control action string (Replace or Append) */
-A_STATUS FCore_ModifyControlActionString(BT_FILTER_CORE_INFO         *pCore,
-                                         ATHBT_STATE_INDICATION       Indication,
-                                         ATHBT_STATE                  State,
-                                         A_CHAR                       *pAction,
-                                         int                          StringLength,
-                                         ATHBT_MODIFY_CONTROL_ACTION  ModifyAction);
-
-
-#endif /*BTFILTER_INTERNAL_H_*/
-
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/hciutils.h b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/hciutils.h
deleted file mode 100644 (file)
index 7287764..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="hciutils.h" company="Atheros">
-//    Copyright (c) 2011 Atheros Corporation.  All rights reserved.
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-
-#ifndef __HCI_UTILS_H__
-#define __HCI_UTILS_H__
-
-
-//
-// Return codes
-//
-typedef enum 
-{
-    HCIUTILS_SUCCESS,               // Success
-    HCIUTILS_FAILURE,               // Generic Failure
-    HCIUTILS_ALREADY_REGISTERED,    // Filter already registered
-    HCIUTILS_OUT_OF_MEMORY          //out of memory
-}tHCIUTILS_STATUS;
-
-//
-// Notification Type - Or to get notification for both types
-//
-typedef enum 
-{
-    HCIUTILS_COMMAND=0x1,
-    HCIUTILS_EVENT =0x2
-}tHCIUTILS_NOTIFICATION_TYPE;
-
-//
-// OpCode to get notifications for all hci commands and events
-//
-#define HCIUTILS_NOTIFICATION_OPCODE_ALL        0xffff
-
-typedef struct 
-{    
-    tHCIUTILS_NOTIFICATION_TYPE     tType;
-    unsigned short                  nOpCode;
-    void *                          p_notification_data_buf;
-    int                             n_data_length;
-    void *                          p_appdata;
-}tHCIUTILS_NOTIFICATION;
-
-typedef void ( *tHCIUTILS_EVENT_CALLBACK) ( tHCIUTILS_NOTIFICATION * pEvent);
-
-tHCIUTILS_STATUS HCIUTILS_RegisterHCINotification
-    (
-        tHCIUTILS_NOTIFICATION_TYPE t_type, 
-        unsigned short              nOpCode,
-        tHCIUTILS_EVENT_CALLBACK    eventCallback ,
-        void *                      p_appdata
-    );
-
-void HCIUTILS_UnRegisterHCINotification
-    (
-        tHCIUTILS_NOTIFICATION_TYPE t_type, 
-        unsigned short              nOpCode
-    );
-
-typedef enum
-{
-    HCIUTILS_SET_AFH_CHANNELS = 0x01,
-    HCIUTILS_SET_AFH_CHANNEL_ASSESSMENT
-
-}tHCIUTILS_HCI_CMD;
-
-typedef struct 
-{
-    unsigned char       first;
-    unsigned char       last;
-}tHCIUTILS_HCICMD_SET_AFH_CHANNELS;
-
-typedef struct
-{
-    int                 enable_or_disable;
-}tHCIUTILS_HCICMD_SET_AFH_CHANNEL_ASSESSMENT;
-
-
-void HCIUTILS_SendCmd
-    (
-        tHCIUTILS_HCI_CMD   tCmd,
-        void *              p_hci_cmd_params
-    );
-
-
-#endif //__HCI_UTILS_H__
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/sample.conf b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/sample.conf
deleted file mode 100644 (file)
index 870c351..0000000
+++ /dev/null
@@ -1 +0,0 @@
-INQUIRY-OFF:REPLACE:-s 2 2
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/bthmonoheadset.py b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/bthmonoheadset.py
deleted file mode 100644 (file)
index 2d36215..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-
-import dbus
-import os
-import sys
-
-def printusage():
-       print 'bthmonoheadset.py <options>'
-       print '    create - create a mono headset'
-       print '    start  - connect and play '
-       print '    stop   - stop and disconnect'
-       return
-
-headsetAddress = os.getenv("BTMONO_HEADSET")
-
-print 'BT Mono Headset Is :  => %s' % headsetAddress
-
-bus = dbus.SystemBus()
-manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager')
-bus_id = manager.ActivateService('audio')
-audio = dbus.Interface(bus.get_object(bus_id, '/org/bluez/audio'), 'org.bluez.audio.Manager')
-    
-if len(sys.argv) == 1 :
-       printusage()
-elif len(sys.argv) > 1 and sys.argv[1] == 'create'  :
-       path = audio.CreateHeadset(headsetAddress)
-       audio.ChangeDefaultHeadset(path)
-       headset = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Headset')
-       headset.Connect()
-       print 'Mono headset setup complete'
-elif len(sys.argv) > 1 and sys.argv[1] == 'start'  :
-       path = audio.DefaultDevice()
-       headset = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Headset')
-       if not headset.IsConnected() :
-               headset.Connect()               
-       if len(sys.argv) > 2 and sys.argv[2] == 'pcm'  :
-               print "Turning on PCM ...."
-               try : 
-                       headset.Play()
-               except dbus.exceptions.DBusException:
-                       print 'Play Failed'
-elif len(sys.argv) > 1 and sys.argv[1] == 'stop'  :
-       path = audio.DefaultDevice()
-       headset = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Headset')
-       try : 
-               headset.Stop()
-       except dbus.exceptions.DBusException:
-               print 'Stop Failed'
-       headset.Disconnect()
-       print 'Mono headset disconnect complete'
-elif len(sys.argv) > 1 and sys.argv[1] == 'delete'  :
-       path = audio.DefaultDevice()
-       print 'Deleting: %s ' % path
-       audio.RemoveDevice(path)
-
-        
-  
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/bthstereoheadset.py b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/bthstereoheadset.py
deleted file mode 100644 (file)
index 87ff4ec..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-
-import dbus
-import os
-import sys
-
-def printusage():
-       print 'bthstereoheadset.py <options>'
-       print '    create - create a stereo headset'
-       print '    start  - connect sink'
-       print '    stop   - disconnect sink'
-       return
-       
-headsetAddress = os.getenv("BTSTEREO_HEADSET")
-
-print 'BT Stereo Headset Is :  => %s' % headsetAddress
-
-bus = dbus.SystemBus()
-manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager')
-bus_id = manager.ActivateService('audio')
-audio = dbus.Interface(bus.get_object(bus_id, '/org/bluez/audio'), 'org.bluez.audio.Manager')
-   
-if len(sys.argv) == 1 :
-       printusage()
-elif len(sys.argv) > 1 and sys.argv[1] == 'create'  :
-       path = audio.CreateDevice(headsetAddress)
-       audio.ChangeDefaultDevice(path) 
-       sink = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Sink')
-       sink.Connect()
-       print 'Stereo Headset Connect Done'
-elif len(sys.argv) > 1 and sys.argv[1] == 'start'  :
-       path = audio.DefaultDevice()
-       sink = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Sink') 
-       if not sink.IsConnected() :
-               sink.Connect()                          
-       print 'Audio connected'
-elif len(sys.argv) > 1 and sys.argv[1] == 'stop'  :
-       path = audio.DefaultDevice()
-       sink = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Sink') 
-       try : 
-               sink.Disconnect()
-       except dbus.exceptions.DBusException:
-               print 'Disconnect Failed'               
-       print 'Stereo headset disconnect complete'
-elif len(sys.argv) > 1 and sys.argv[1] == 'delete'  :
-       path = audio.DefaultDevice()
-       print 'Deleting: %s ' % path
-       audio.RemoveDevice(path)
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/btmonoloop.sh b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/btmonoloop.sh
deleted file mode 100644 (file)
index 35900e6..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-arecord -D bluetooth -f S16_LE | aplay -D bluetooth -f S16_LE
-
-
-
-
-
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/btplaywav.sh b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/btplaywav.sh
deleted file mode 100644 (file)
index e79e816..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-aplay -D bluetooth $1
-
-
-
-
-
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/fc9_setup_readme.txt b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/fc9_setup_readme.txt
deleted file mode 100644 (file)
index 24382f2..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-This document provides setup instructions for setting up and testing bluetooth on
-a Fedora Core 9 system.
-
-9/25/2008
-
-
-Setting up Fedora Core 9
-========================
-
-You can try to install FC9 via a DVD onto a hard-drive based system or
-create a liveUSB disk (if you use the same PC for testing other versions of
-linux).
-
-
-Install to HD from DVD install:
-
-   You can install FC9 from here:  http://fedoraproject.org/get-fedora
-
-
-Install FC9-liveCD to USB disk (create a liveUSB):
-
-   **** MAKE SURE YOUR PC CAN BOOT TO USB DISKS, older PCs may not support this in their BIOS ******
-
-   A 4GB USB drive will be sufficient although 8GB is recommended.
-   
-   **** Limitations:
-         Using LiveUSB has some limitations:
-             1. USB flash drives have limited writes (typically 100,000).  The swap partition is disabled on
-                a liveUSB.  If you expect to do local compilation and editing you should use a hardisk install
-                or use a USB-based harddisk (laptop drive size would be okay).
-             2. USB HD access is slower than USB disk.  But I have not noticed any terrible slowdowns.
-
-   *** If your USB disk has U3 support (Sandisk Cruzer), you must disable it.  The disk contains a utility to disable
-   U3 support.  As an added check, you should also re-format the drive (as FAT) after your disable U3.
-
-   Making FAT-based USB image on Windows Host PC :
-   ===============================================
-   
-   A windowsPC Utility is available to install a liveCD ISO image directly onto a USB disk and make the disk
-   bootable. See: https://fedorahosted.org/liveusb-creator
-
-   This method requires a liveCD ISO file for FC9.  FC9 is the current version that 
-   support LiveUSB's persistent data storage.  You can install applications, new tools, SDKs etc..
-
-   You can find the FC9 liveCD here:
-
-            http://fedoraproject.org/get-fedora
-
-   When using the utility, you can setup a persistent area.  I recommend at least 2GB (max).
-
-   *********** WARNING WARNING, FAT16 is unreliable and not recommended as a liveUSB boot
-   disk.  Newer version of the liveusb-creator now support installations and syslinux binaries for
-   EXT2 filesystems.  I highly recommend using a liveUSB image on an EXT2 formated USB drive.
-
-   Making Ext2-based USB image on Linux Host (for use on FC9 or later host) :
-   ============================================================================
-   
-   Get the liveCD ISO image from http://fedoraproject.org/get-fedora
-   
-   Install the liveusb-creator utilities (as super user) :
-   
-       > yum install liveusb-creator
-       > yum --enablerepo=rawhide update syslinux
-   
-   Partition USB disk:
-   
-       > fdisk /dev/<usb disk e.g. sdb>
-
-               <--------- fdisk interactive dump: ---->       
-               Command (m for help): d
-               Selected partition 1
-               
-               Command (m for help): n
-               Command action
-               e   extended
-               p   primary partition (1-4)
-               p
-               Partition number (1-4): 1
-               First cylinder (1-960, default 1):
-               Using default value 1
-               Last cylinder or +size or +sizeM or +sizeK (1-960, default 960):
-               Using default value 960
-               
-               Command (m for help): t
-               Selected partition 1
-               Hex code (type L to list codes): 83
-               
-               Command (m for help): a
-               Partition number (1-4): 1
-               
-               Command (m for help): w
-               The partition table has been altered!
-               
-               <----------------------------------------->
-       Format partition as ext2:
-        
-        > umount /dev/<usb disk e.g. sdb1>
-        > mkfs.ext2 /dev/<usb disk>
-        
-    Run liveusb-creator GUI application:
-    
-        > liveusb-creator
-   
-    Select ISO image, kernel type (FC9-i686) and persistent storage size.
-      
-        see : https://fedorahosted.org/liveusb-creator
-        
-           
-  
-Checking and installing packages:
-=================================
-
-To compile our SDK, certain development packages must be installed.
-
-Log in as superuser
-
-execute the following:
-
-   yum install yum-utils rpmdevtools
-   yum install kernel-devel  
-   yum install gtk2-devel
-   yum install dbus-glib-devel
-   yum install bluez-utils-gstreamer
-   yum install openssl-devel             
-   yum install libpcap-devel 
-   yum install bluez-libs-devel
-   yum install alsa-lib-devel
-   yum install dbus-devel
-   
-Some useful utilities:
-
-   yum install telnet-server
-   yum install iperf
-
-For compilation of newer BlueZ utilities and BlueZ stack:
-
-   yum install byacc
-   yum install flex
-   yum install bison
-
-
-Setting up and BUILDING OLCA 
-=============================
-
-1. Export ATH_BUILD_TYPE=LOCAL_FC9_i686
-   Export ATH_BUS_TYPE=SDIO
-   
-   The default kernel path is set to:
-
-       ATH_LINUXPATH=/lib/modules/2.6.25-14.fc9.i686/build
-
-2. Set your WORKAREA and build normally.  
-
-
-Testing AR6K
-============
-
-1. Unload sdhci (MMC-stack standard host driver)
-   
-   as root, execute  "rmmod sdhci"
-
-2. Set NETIF, WORKAREA, ATH_PLATFORM variables and execute the load script (same procedure as FC3).
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/linux_setup_readme.txt b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/testscripts/linux_setup_readme.txt
deleted file mode 100644 (file)
index 95c209f..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-This document provides setup instructions for setting up and testing bluetooth on
-a Fedora Core 9 system.
-
-Setting up Bluetooth Stack
-==========================
-
-1). The following configurations can be made to /etc/bluetooth/audio.conf
-
-   For HCI devices that use a separate PCM audio path, you must uncomment
-
-      #SCORouting=PCM
-
-   the default is to route audio through the HCI interface (used for USB adapters).
-
-   If you wish to disable role switching (local radio is always master uncomment:
-
-      #Master=true
-
-   To enable A2DP uncomment all lines:
-      #[A2DP]
-      #..
-      #..   
-
-** NOTE ****
-
-   Some linux documents indicate the use of sdpd and bluetoothd-service-audio.  These are now deprecated.  The hcid application
-   now functions as an SDP daemon (launched as "hcid -s").  The bluetoothd-service-audio is also deprecated as the hcid 
-   application will load shared libraries (libaudio.so or audio.so) from the /usr/lib/bluetooth/plugin directory.
-
-
-2). Setting up alsa audio devices:
-
-   Create/edit .asoundrc at your home directory ~
-
-   Add the following:
-
-   pcm.bluetooth {
-         type bluetooth
-   } 
-
-
-Testing Bluetooth
-==================
-
-*** FC9 ships with BlueZ 3.30 pre-installed. A USB-HCI transport is available in the kernel.  
-Installing a USB adapter supporting the BT-USB class will automatically be recognized by the BT stack.
-
-
-A). Preparing to add a bluetooth headset
-
-  1. Make sure HCI adapter is up and running
-
-     For USB, plug in USB-BT adapter.
-
-     For Serial HCI devices (example: csr serial on ttyS0 ): 
-
-          hciattach /dev/ttyS0 bcsp 115200
-       
-          hciconfig -a
-     
-  2. Log into FC9 desktop session.  Select System->Preference->Internet and Network->Bluetooth
-     Set radio button to "Other devices can connect".  
-
-     Leave desktop session active.  You will need this to enter a pin code because the default PIN code agent is
-     the GNOME desktop Bluetooth applet. 
-
-
-  3. Scan for your headset device:
-
-   > hcitool -i hci0 scan
-
-     make note of the BT address of your headset e.g.: 00:1C:A4:2D:8D:5A
-
-
-  *** DEBUGGING BLUEZ stack ***
-  
-    You can capture BT stack debug prints (including BT-related dbus prints).
-    
-    ** the following can be done as superuser
-  
-    1. Stop Bluetooth service             :    > service stop bluetooth
-    2. launch hcid with debugging enabled :    > /usr/sbin/hcid -x -s -n -d
-    
-
-B). Pairing Mono headset
-
-   export the following environment variable:
-
-   export BTMONO_HEADSET=00:1C:A4:2D:8D:5A
-
-   run the following python script in $WORKAREA\host\tools\athbtfilter\bluez\testscripts
-
-        > bthmonoheadset.py create
-   
-   The desktop applet will ask for a PIN code.  Once the pairing has completed you should be able to see "Bonded Devices"
-   in the Bluetooth applet.  You can make this device "TRUSTED" which will store the PIN code and will no longer 
-   require you to input the PIN code.
-
-   To do a quick test (only for BT adapters that route SC(see above).O over HCI):
-
-        > bthmonoheadset.py start
-        > arecord -D bluetooth -f S16_LE | aplay -D bluetooth -f S16_LE
-
-        This command records the headset microphone input and echos it back to the headset speakers.
-
-   If you have a BT adapter that routes SCO over a PCM interface you can simply turn on the SCO path
-   using the following command:
-   
-        > bthmonoheadset.py start pcm
-        
-        To stop:
-        
-        > bthmonoheadset.py stop 
-
-   **** NOTE: you must configure /etc/bluetooth/audio.conf and set "SCORouting=PCM" (see above)
-
-   You can disconnect the mono headset :
-   
-        > bthmonoheadset.py stop
-
-C). Pairing Stereo headset 
-
-   export the following environment variable:
-
-        > export BTSTEREO_HEADSET=00:1C:A4:2D:8D:5A
-
-   run the following python script in $WORKAREA\host\tools\athbtfilter\bluez\testscripts
-
-        > bthstereoheadset.py create
-   
-   The desktop applet will ask for a PIN code.  Once the pairing has completed you should be able to see "Bonded Devices"
-   in the Bluetooth applet.  You can make this device "TRUSTED" which will store the PIN code and will no longer 
-   require you to input the PIN code.
-  
-   To do a quick test:
-       > bthstereoheadset.py start
-       > aplay -D bluetooth <wav file>
-
-   You can disconnect the mono headset :
-   
-        > bthstereoheadset.py stop
-
-Testing Atheros BT Filter
-=========================
-
-   The filter resides in $WORKAREA\host\.output\$ATH_PLATFORM\image as 'abtfilt'.
-   
-   To operate as a silent daemon execute :      > ./abtfilt
-   To operate the daemon with sysloging:        > ./abtfilt -d
-   To operate the daemon with console logging:  > ./abtfilt -c -d
-   To operate as an ordinary application just add -n to the command line.
-   
-   The option "-a" enables the filter to issue the AFH classification HCI command when WLAN connects.
-   The channel mask is derived from the 2.4 Ghz operating channel (1-14).  Upon WLAN disconnect or when
-   WLAN is switches to 11a, the default AFH classification mask (all channels okay) is issued.
-   
-   The following table shows the AFH channel mapping for channels 1-14, channel 0 is a special case 
-   (WLAN disconnected or not operating in 2.4 Ghz band).  The channel map is read LSB to the far left
-   to MSB to the far right and covers the 10 octets defined in the BT specification for the AFH
-   map.
-   
-      LSB ------------------------------------------> MSB
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 0 -- no WLAN */
-    { {0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 1 */
-    { {0x0F,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 2 */
-    { {0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 3 */
-    { {0xFF,0x3F,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0x7F}}, /* 4 */
-    { {0xFF,0xFF,0x07,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0x7F}}, /* 5 */
-    { {0xFF,0xFF,0xFF,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x7F}}, /* 6 */
-    { {0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xF0,0xFF,0xFF,0x7F}}, /* 7 */
-    { {0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFE,0xFF,0x7F}}, /* 8 */
-    { {0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0xC0,0xFF,0x7F}}, /* 9 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0xF8,0x7F}}, /* 10 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x7F}}, /* 11 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x60}}, /* 12 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00}}, /* 13 */
-    { {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00}}, /* 14 */
-   
-   
-
-
-
-
-
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/wireless.h b/drivers/net/wireless/ar6003/host/tools/athbtfilter/bluez/wireless.h
deleted file mode 100644 (file)
index 76cca2a..0000000
+++ /dev/null
@@ -1,1121 +0,0 @@
-/*
- * This file define a set of standard wireless extensions
- *
- * Version :   21      14.3.06
- *
- * Authors :   Jean Tourrilhes - HPL - <jt@hpl.hp.com>
- * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved.
- */
-
-#ifndef _LINUX_WIRELESS_H_LCL
-#define _LINUX_WIRELESS_H_LCL
-
-/************************** DOCUMENTATION **************************/
-/*
- * Initial APIs (1996 -> onward) :
- * -----------------------------
- * Basically, the wireless extensions are for now a set of standard ioctl
- * call + /proc/net/wireless
- *
- * The entry /proc/net/wireless give statistics and information on the
- * driver.
- * This is better than having each driver having its entry because
- * its centralised and we may remove the driver module safely.
- *
- * Ioctl are used to configure the driver and issue commands.  This is
- * better than command line options of insmod because we may want to
- * change dynamically (while the driver is running) some parameters.
- *
- * The ioctl mechanimsm are copied from standard devices ioctl.
- * We have the list of command plus a structure descibing the
- * data exchanged...
- * Note that to add these ioctl, I was obliged to modify :
- *     # net/core/dev.c (two place + add include)
- *     # net/ipv4/af_inet.c (one place + add include)
- *
- * /proc/net/wireless is a copy of /proc/net/dev.
- * We have a structure for data passed from the driver to /proc/net/wireless
- * Too add this, I've modified :
- *     # net/core/dev.c (two other places)
- *     # include/linux/netdevice.h (one place)
- *     # include/linux/proc_fs.h (one place)
- *
- * New driver API (2002 -> onward) :
- * -------------------------------
- * This file is only concerned with the user space API and common definitions.
- * The new driver API is defined and documented in :
- *     # include/net/iw_handler.h
- *
- * Note as well that /proc/net/wireless implementation has now moved in :
- *     # net/core/wireless.c
- *
- * Wireless Events (2002 -> onward) :
- * --------------------------------
- * Events are defined at the end of this file, and implemented in :
- *     # net/core/wireless.c
- *
- * Other comments :
- * --------------
- * Do not add here things that are redundant with other mechanisms
- * (drivers init, ifconfig, /proc/net/dev, ...) and with are not
- * wireless specific.
- *
- * These wireless extensions are not magic : each driver has to provide
- * support for them...
- *
- * IMPORTANT NOTE : As everything in the kernel, this is very much a
- * work in progress. Contact me if you have ideas of improvements...
- */
-
-/***************************** INCLUDES *****************************/
-
-/* This header is used in user-space, therefore need to be sanitised
- * for that purpose. Those includes are usually not compatible with glibc.
- * To know which includes to use in user-space, check iwlib.h. */
-#ifdef __KERNEL__
-#include <linux/types.h>               /* for "caddr_t" et al          */
-#include <linux/socket.h>              /* for "struct sockaddr" et al  */
-#include <linux/if.h>                  /* for IFNAMSIZ and co... */
-#endif /* __KERNEL__ */
-
-/***************************** VERSION *****************************/
-/*
- * This constant is used to know the availability of the wireless
- * extensions and to know which version of wireless extensions it is
- * (there is some stuff that will be added in the future...)
- * I just plan to increment with each new version.
- */
-#undef WIRELESS_EXT
-#define WIRELESS_EXT   21
-
-/*
- * Changes :
- *
- * V2 to V3
- * --------
- *     Alan Cox start some incompatibles changes. I've integrated a bit more.
- *     - Encryption renamed to Encode to avoid US regulation problems
- *     - Frequency changed from float to struct to avoid problems on old 386
- *
- * V3 to V4
- * --------
- *     - Add sensitivity
- *
- * V4 to V5
- * --------
- *     - Missing encoding definitions in range
- *     - Access points stuff
- *
- * V5 to V6
- * --------
- *     - 802.11 support (ESSID ioctls)
- *
- * V6 to V7
- * --------
- *     - define IW_ESSID_MAX_SIZE and IW_MAX_AP
- *
- * V7 to V8
- * --------
- *     - Changed my e-mail address
- *     - More 802.11 support (nickname, rate, rts, frag)
- *     - List index in frequencies
- *
- * V8 to V9
- * --------
- *     - Support for 'mode of operation' (ad-hoc, managed...)
- *     - Support for unicast and multicast power saving
- *     - Change encoding to support larger tokens (>64 bits)
- *     - Updated iw_params (disable, flags) and use it for NWID
- *     - Extracted iw_point from iwreq for clarity
- *
- * V9 to V10
- * ---------
- *     - Add PM capability to range structure
- *     - Add PM modifier : MAX/MIN/RELATIVE
- *     - Add encoding option : IW_ENCODE_NOKEY
- *     - Add TxPower ioctls (work like TxRate)
- *
- * V10 to V11
- * ----------
- *     - Add WE version in range (help backward/forward compatibility)
- *     - Add retry ioctls (work like PM)
- *
- * V11 to V12
- * ----------
- *     - Add SIOCSIWSTATS to get /proc/net/wireless programatically
- *     - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space
- *     - Add new statistics (frag, retry, beacon)
- *     - Add average quality (for user space calibration)
- *
- * V12 to V13
- * ----------
- *     - Document creation of new driver API.
- *     - Extract union iwreq_data from struct iwreq (for new driver API).
- *     - Rename SIOCSIWNAME as SIOCSIWCOMMIT
- *
- * V13 to V14
- * ----------
- *     - Wireless Events support : define struct iw_event
- *     - Define additional specific event numbers
- *     - Add "addr" and "param" fields in union iwreq_data
- *     - AP scanning stuff (SIOCSIWSCAN and friends)
- *
- * V14 to V15
- * ----------
- *     - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg
- *     - Make struct iw_freq signed (both m & e), add explicit padding
- *     - Add IWEVCUSTOM for driver specific event/scanning token
- *     - Add IW_MAX_GET_SPY for driver returning a lot of addresses
- *     - Add IW_TXPOW_RANGE for range of Tx Powers
- *     - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points
- *     - Add IW_MODE_MONITOR for passive monitor
- *
- * V15 to V16
- * ----------
- *     - Increase the number of bitrates in iw_range to 32 (for 802.11g)
- *     - Increase the number of frequencies in iw_range to 32 (for 802.11b+a)
- *     - Reshuffle struct iw_range for increases, add filler
- *     - Increase IW_MAX_AP to 64 for driver returning a lot of addresses
- *     - Remove IW_MAX_GET_SPY because conflict with enhanced spy support
- *     - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy"
- *     - Add IW_ENCODE_TEMP and iw_range->encoding_login_index
- *
- * V16 to V17
- * ----------
- *     - Add flags to frequency -> auto/fixed
- *     - Document (struct iw_quality *)->updated, add new flags (INVALID)
- *     - Wireless Event capability in struct iw_range
- *     - Add support for relative TxPower (yick !)
- *
- * V17 to V18 (From Jouni Malinen <jkmaline@cc.hut.fi>)
- * ----------
- *     - Add support for WPA/WPA2
- *     - Add extended encoding configuration (SIOCSIWENCODEEXT and
- *       SIOCGIWENCODEEXT)
- *     - Add SIOCSIWGENIE/SIOCGIWGENIE
- *     - Add SIOCSIWMLME
- *     - Add SIOCSIWPMKSA
- *     - Add struct iw_range bit field for supported encoding capabilities
- *     - Add optional scan request parameters for SIOCSIWSCAN
- *     - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA
- *       related parameters (extensible up to 4096 parameter values)
- *     - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE,
- *       IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND
- *
- * V18 to V19
- * ----------
- *     - Remove (struct iw_point *)->pointer from events and streams
- *     - Remove header includes to help user space
- *     - Increase IW_ENCODING_TOKEN_MAX from 32 to 64
- *     - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros
- *     - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM
- *     - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros
- *
- * V20 to V21
- * ----------
- *     - Remove (struct net_device *)->get_wireless_stats()
- *     - Change length in ESSID and NICK to strlen() instead of strlen()+1
- *     - Add SIOCSIWMODUL/SIOCGIWMODUL for modulation setting
- *     - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
- *     - Add IW_POWER_SAVING power type
- *     - Power/Retry relative values no longer * 100000
- *     - Add bitrate flags for unicast/broadcast
- */
-
-/**************************** CONSTANTS ****************************/
-
-/* -------------------------- IOCTL LIST -------------------------- */
-
-/* Wireless Identification */
-#define SIOCSIWCOMMIT  0x8B00          /* Commit pending changes to driver */
-#define SIOCGIWNAME    0x8B01          /* get name == wireless protocol */
-/* SIOCGIWNAME is used to verify the presence of Wireless Extensions.
- * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"...
- * Don't put the name of your driver there, it's useless. */
-
-/* Basic operations */
-#define SIOCSIWNWID    0x8B02          /* set network id (pre-802.11) */
-#define SIOCGIWNWID    0x8B03          /* get network id (the cell) */
-#define SIOCSIWFREQ    0x8B04          /* set channel/frequency (Hz) */
-#define SIOCGIWFREQ    0x8B05          /* get channel/frequency (Hz) */
-#define SIOCSIWMODE    0x8B06          /* set operation mode */
-#define SIOCGIWMODE    0x8B07          /* get operation mode */
-#define SIOCSIWSENS    0x8B08          /* set sensitivity (dBm) */
-#define SIOCGIWSENS    0x8B09          /* get sensitivity (dBm) */
-
-/* Informative stuff */
-#define SIOCSIWRANGE   0x8B0A          /* Unused */
-#define SIOCGIWRANGE   0x8B0B          /* Get range of parameters */
-#define SIOCSIWPRIV    0x8B0C          /* Unused */
-#define SIOCGIWPRIV    0x8B0D          /* get private ioctl interface info */
-#define SIOCSIWSTATS   0x8B0E          /* Unused */
-#define SIOCGIWSTATS   0x8B0F          /* Get /proc/net/wireless stats */
-/* SIOCGIWSTATS is strictly used between user space and the kernel, and
- * is never passed to the driver (i.e. the driver will never see it). */
-
-/* Spy support (statistics per MAC address - used for Mobile IP support) */
-#define SIOCSIWSPY     0x8B10          /* set spy addresses */
-#define SIOCGIWSPY     0x8B11          /* get spy info (quality of link) */
-#define SIOCSIWTHRSPY  0x8B12          /* set spy threshold (spy event) */
-#define SIOCGIWTHRSPY  0x8B13          /* get spy threshold */
-
-/* Access Point manipulation */
-#define SIOCSIWAP      0x8B14          /* set access point MAC addresses */
-#define SIOCGIWAP      0x8B15          /* get access point MAC addresses */
-#define SIOCGIWAPLIST  0x8B17          /* Deprecated in favor of scanning */
-#define SIOCSIWSCAN    0x8B18          /* trigger scanning (list cells) */
-#define SIOCGIWSCAN    0x8B19          /* get scanning results */
-
-/* 802.11 specific support */
-#define SIOCSIWESSID   0x8B1A          /* set ESSID (network name) */
-#define SIOCGIWESSID   0x8B1B          /* get ESSID */
-#define SIOCSIWNICKN   0x8B1C          /* set node name/nickname */
-#define SIOCGIWNICKN   0x8B1D          /* get node name/nickname */
-/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
- * within the 'iwreq' structure, so we need to use the 'data' member to
- * point to a string in user space, like it is done for RANGE... */
-
-/* Other parameters useful in 802.11 and some other devices */
-#define SIOCSIWRATE    0x8B20          /* set default bit rate (bps) */
-#define SIOCGIWRATE    0x8B21          /* get default bit rate (bps) */
-#define SIOCSIWRTS     0x8B22          /* set RTS/CTS threshold (bytes) */
-#define SIOCGIWRTS     0x8B23          /* get RTS/CTS threshold (bytes) */
-#define SIOCSIWFRAG    0x8B24          /* set fragmentation thr (bytes) */
-#define SIOCGIWFRAG    0x8B25          /* get fragmentation thr (bytes) */
-#define SIOCSIWTXPOW   0x8B26          /* set transmit power (dBm) */
-#define SIOCGIWTXPOW   0x8B27          /* get transmit power (dBm) */
-#define SIOCSIWRETRY   0x8B28          /* set retry limits and lifetime */
-#define SIOCGIWRETRY   0x8B29          /* get retry limits and lifetime */
-
-/* Encoding stuff (scrambling, hardware security, WEP...) */
-#define SIOCSIWENCODE  0x8B2A          /* set encoding token & mode */
-#define SIOCGIWENCODE  0x8B2B          /* get encoding token & mode */
-/* Power saving stuff (power management, unicast and multicast) */
-#define SIOCSIWPOWER   0x8B2C          /* set Power Management settings */
-#define SIOCGIWPOWER   0x8B2D          /* get Power Management settings */
-/* Modulation bitmask */
-#define SIOCSIWMODUL   0x8B2E          /* set Modulations settings */
-#define SIOCGIWMODUL   0x8B2F          /* get Modulations settings */
-
-/* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM).
- * This ioctl uses struct iw_point and data buffer that includes IE id and len
- * fields. More than one IE may be included in the request. Setting the generic
- * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers
- * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers
- * are required to report the used IE as a wireless event, e.g., when
- * associating with an AP. */
-#define SIOCSIWGENIE   0x8B30          /* set generic IE */
-#define SIOCGIWGENIE   0x8B31          /* get generic IE */
-
-/* WPA : IEEE 802.11 MLME requests */
-#define SIOCSIWMLME    0x8B16          /* request MLME operation; uses
-                                        * struct iw_mlme */
-/* WPA : Authentication mode parameters */
-#define SIOCSIWAUTH    0x8B32          /* set authentication mode params */
-#define SIOCGIWAUTH    0x8B33          /* get authentication mode params */
-
-/* WPA : Extended version of encoding configuration */
-#define SIOCSIWENCODEEXT 0x8B34                /* set encoding token & mode */
-#define SIOCGIWENCODEEXT 0x8B35                /* get encoding token & mode */
-
-/* WPA2 : PMKSA cache management */
-#define SIOCSIWPMKSA   0x8B36          /* PMKSA cache operation */
-
-/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
-
-/* These 32 ioctl are wireless device private, for 16 commands.
- * Each driver is free to use them for whatever purpose it chooses,
- * however the driver *must* export the description of those ioctls
- * with SIOCGIWPRIV and *must* use arguments as defined below.
- * If you don't follow those rules, DaveM is going to hate you (reason :
- * it make mixed 32/64bit operation impossible).
- */
-#define SIOCIWFIRSTPRIV        0x8BE0
-#define SIOCIWLASTPRIV 0x8BFF
-/* Previously, we were using SIOCDEVPRIVATE, but we now have our
- * separate range because of collisions with other tools such as
- * 'mii-tool'.
- * We now have 32 commands, so a bit more space ;-).
- * Also, all 'odd' commands are only usable by root and don't return the
- * content of ifr/iwr to user (but you are not obliged to use the set/get
- * convention, just use every other two command). More details in iwpriv.c.
- * And I repeat : you are not forced to use them with iwpriv, but you
- * must be compliant with it.
- */
-
-/* ------------------------- IOCTL STUFF ------------------------- */
-
-/* The first and the last (range) */
-#define SIOCIWFIRST    0x8B00
-#define SIOCIWLAST     SIOCIWLASTPRIV          /* 0x8BFF */
-#define IW_IOCTL_IDX(cmd)      ((cmd) - SIOCIWFIRST)
-
-/* Even : get (world access), odd : set (root access) */
-#define IW_IS_SET(cmd) (!((cmd) & 0x1))
-#define IW_IS_GET(cmd) ((cmd) & 0x1)
-
-/* ----------------------- WIRELESS EVENTS ----------------------- */
-/* Those are *NOT* ioctls, do not issue request on them !!! */
-/* Most events use the same identifier as ioctl requests */
-
-#define IWEVTXDROP     0x8C00          /* Packet dropped to excessive retry */
-#define IWEVQUAL       0x8C01          /* Quality part of statistics (scan) */
-#define IWEVCUSTOM     0x8C02          /* Driver specific ascii string */
-#define IWEVREGISTERED 0x8C03          /* Discovered a new node (AP mode) */
-#define IWEVEXPIRED    0x8C04          /* Expired a node (AP mode) */
-#define IWEVGENIE      0x8C05          /* Generic IE (WPA, RSN, WMM, ..)
-                                        * (scan results); This includes id and
-                                        * length fields. One IWEVGENIE may
-                                        * contain more than one IE. Scan
-                                        * results may contain one or more
-                                        * IWEVGENIE events. */
-#define IWEVMICHAELMICFAILURE 0x8C06   /* Michael MIC failure
-                                        * (struct iw_michaelmicfailure)
-                                        */
-#define IWEVASSOCREQIE 0x8C07          /* IEs used in (Re)Association Request.
-                                        * The data includes id and length
-                                        * fields and may contain more than one
-                                        * IE. This event is required in
-                                        * Managed mode if the driver
-                                        * generates its own WPA/RSN IE. This
-                                        * should be sent just before
-                                        * IWEVREGISTERED event for the
-                                        * association. */
-#define IWEVASSOCRESPIE        0x8C08          /* IEs used in (Re)Association
-                                        * Response. The data includes id and
-                                        * length fields and may contain more
-                                        * than one IE. This may be sent
-                                        * between IWEVASSOCREQIE and
-                                        * IWEVREGISTERED events for the
-                                        * association. */
-#define IWEVPMKIDCAND  0x8C09          /* PMKID candidate for RSN
-                                        * pre-authentication
-                                        * (struct iw_pmkid_cand) */
-
-#define IWEVFIRST      0x8C00
-#define IW_EVENT_IDX(cmd)      ((cmd) - IWEVFIRST)
-
-/* ------------------------- PRIVATE INFO ------------------------- */
-/*
- * The following is used with SIOCGIWPRIV. It allow a driver to define
- * the interface (name, type of data) for its private ioctl.
- * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV
- */
-
-#define IW_PRIV_TYPE_MASK      0x7000  /* Type of arguments */
-#define IW_PRIV_TYPE_NONE      0x0000
-#define IW_PRIV_TYPE_BYTE      0x1000  /* Char as number */
-#define IW_PRIV_TYPE_CHAR      0x2000  /* Char as character */
-#define IW_PRIV_TYPE_INT       0x4000  /* 32 bits int */
-#define IW_PRIV_TYPE_FLOAT     0x5000  /* struct iw_freq */
-#define IW_PRIV_TYPE_ADDR      0x6000  /* struct sockaddr */
-
-#define IW_PRIV_SIZE_FIXED     0x0800  /* Variable or fixed number of args */
-
-#define IW_PRIV_SIZE_MASK      0x07FF  /* Max number of those args */
-
-/*
- * Note : if the number of args is fixed and the size < 16 octets,
- * instead of passing a pointer we will put args in the iwreq struct...
- */
-
-/* ----------------------- OTHER CONSTANTS ----------------------- */
-
-/* Maximum frequencies in the range struct */
-#define IW_MAX_FREQUENCIES     32
-/* Note : if you have something like 80 frequencies,
- * don't increase this constant and don't fill the frequency list.
- * The user will be able to set by channel anyway... */
-
-/* Maximum bit rates in the range struct */
-#define IW_MAX_BITRATES                32
-
-/* Maximum tx powers in the range struct */
-#define IW_MAX_TXPOWER         8
-/* Note : if you more than 8 TXPowers, just set the max and min or
- * a few of them in the struct iw_range. */
-
-/* Maximum of address that you may set with SPY */
-#define IW_MAX_SPY             8
-
-/* Maximum of address that you may get in the
-   list of access points in range */
-#define IW_MAX_AP              64
-
-/* Maximum size of the ESSID and NICKN strings */
-#define IW_ESSID_MAX_SIZE      32
-
-/* Modes of operation */
-#define IW_MODE_AUTO   0       /* Let the driver decides */
-#define IW_MODE_ADHOC  1       /* Single cell network */
-#define IW_MODE_INFRA  2       /* Multi cell network, roaming, ... */
-#define IW_MODE_MASTER 3       /* Synchronisation master or Access Point */
-#define IW_MODE_REPEAT 4       /* Wireless Repeater (forwarder) */
-#define IW_MODE_SECOND 5       /* Secondary master/repeater (backup) */
-#define IW_MODE_MONITOR        6       /* Passive monitor (listen only) */
-
-/* Statistics flags (bitmask in updated) */
-#define IW_QUAL_QUAL_UPDATED   0x01    /* Value was updated since last read */
-#define IW_QUAL_LEVEL_UPDATED  0x02
-#define IW_QUAL_NOISE_UPDATED  0x04
-#define IW_QUAL_ALL_UPDATED    0x07
-#define IW_QUAL_DBM            0x08    /* Level + Noise are dBm */
-#define IW_QUAL_QUAL_INVALID   0x10    /* Driver doesn't provide value */
-#define IW_QUAL_LEVEL_INVALID  0x20
-#define IW_QUAL_NOISE_INVALID  0x40
-#define IW_QUAL_RCPI           0x80    /* Level + Noise are 802.11k RCPI */
-#define IW_QUAL_ALL_INVALID    0x70
-
-/* Frequency flags */
-#define IW_FREQ_AUTO           0x00    /* Let the driver decides */
-#define IW_FREQ_FIXED          0x01    /* Force a specific value */
-
-/* Maximum number of size of encoding token available
- * they are listed in the range structure */
-#define IW_MAX_ENCODING_SIZES  8
-
-/* Maximum size of the encoding token in bytes */
-#define IW_ENCODING_TOKEN_MAX  64      /* 512 bits (for now) */
-
-/* Flags for encoding (along with the token) */
-#define IW_ENCODE_INDEX                0x00FF  /* Token index (if needed) */
-#define IW_ENCODE_FLAGS                0xFF00  /* Flags defined below */
-#define IW_ENCODE_MODE         0xF000  /* Modes defined below */
-#define IW_ENCODE_DISABLED     0x8000  /* Encoding disabled */
-#define IW_ENCODE_ENABLED      0x0000  /* Encoding enabled */
-#define IW_ENCODE_RESTRICTED   0x4000  /* Refuse non-encoded packets */
-#define IW_ENCODE_OPEN         0x2000  /* Accept non-encoded packets */
-#define IW_ENCODE_NOKEY                0x0800  /* Key is write only, so not present */
-#define IW_ENCODE_TEMP         0x0400  /* Temporary key */
-
-/* Power management flags available (along with the value, if any) */
-#define IW_POWER_ON            0x0000  /* No details... */
-#define IW_POWER_TYPE          0xF000  /* Type of parameter */
-#define IW_POWER_PERIOD                0x1000  /* Value is a period/duration of  */
-#define IW_POWER_TIMEOUT       0x2000  /* Value is a timeout (to go asleep) */
-#define IW_POWER_SAVING                0x4000  /* Value is relative (how aggressive)*/
-#define IW_POWER_MODE          0x0F00  /* Power Management mode */
-#define IW_POWER_UNICAST_R     0x0100  /* Receive only unicast messages */
-#define IW_POWER_MULTICAST_R   0x0200  /* Receive only multicast messages */
-#define IW_POWER_ALL_R         0x0300  /* Receive all messages though PM */
-#define IW_POWER_FORCE_S       0x0400  /* Force PM procedure for sending unicast */
-#define IW_POWER_REPEATER      0x0800  /* Repeat broadcast messages in PM period */
-#define IW_POWER_MODIFIER      0x000F  /* Modify a parameter */
-#define IW_POWER_MIN           0x0001  /* Value is a minimum  */
-#define IW_POWER_MAX           0x0002  /* Value is a maximum */
-#define IW_POWER_RELATIVE      0x0004  /* Value is not in seconds/ms/us */
-
-/* Transmit Power flags available */
-#define IW_TXPOW_TYPE          0x00FF  /* Type of value */
-#define IW_TXPOW_DBM           0x0000  /* Value is in dBm */
-#define IW_TXPOW_MWATT         0x0001  /* Value is in mW */
-#define IW_TXPOW_RELATIVE      0x0002  /* Value is in arbitrary units */
-#define IW_TXPOW_RANGE         0x1000  /* Range of value between min/max */
-
-/* Retry limits and lifetime flags available */
-#define IW_RETRY_ON            0x0000  /* No details... */
-#define IW_RETRY_TYPE          0xF000  /* Type of parameter */
-#define IW_RETRY_LIMIT         0x1000  /* Maximum number of retries*/
-#define IW_RETRY_LIFETIME      0x2000  /* Maximum duration of retries in us */
-#define IW_RETRY_MODIFIER      0x00FF  /* Modify a parameter */
-#define IW_RETRY_MIN           0x0001  /* Value is a minimum  */
-#define IW_RETRY_MAX           0x0002  /* Value is a maximum */
-#define IW_RETRY_RELATIVE      0x0004  /* Value is not in seconds/ms/us */
-#define IW_RETRY_SHORT         0x0010  /* Value is for short packets  */
-#define IW_RETRY_LONG          0x0020  /* Value is for long packets */
-
-/* Scanning request flags */
-#define IW_SCAN_DEFAULT                0x0000  /* Default scan of the driver */
-#define IW_SCAN_ALL_ESSID      0x0001  /* Scan all ESSIDs */
-#define IW_SCAN_THIS_ESSID     0x0002  /* Scan only this ESSID */
-#define IW_SCAN_ALL_FREQ       0x0004  /* Scan all Frequencies */
-#define IW_SCAN_THIS_FREQ      0x0008  /* Scan only this Frequency */
-#define IW_SCAN_ALL_MODE       0x0010  /* Scan all Modes */
-#define IW_SCAN_THIS_MODE      0x0020  /* Scan only this Mode */
-#define IW_SCAN_ALL_RATE       0x0040  /* Scan all Bit-Rates */
-#define IW_SCAN_THIS_RATE      0x0080  /* Scan only this Bit-Rate */
-/* struct iw_scan_req scan_type */
-#define IW_SCAN_TYPE_ACTIVE 0
-#define IW_SCAN_TYPE_PASSIVE 1
-/* Maximum size of returned data */
-#define IW_SCAN_MAX_DATA       4096    /* In bytes */
-
-/* Max number of char in custom event - use multiple of them if needed */
-#define IW_CUSTOM_MAX          256     /* In bytes */
-
-/* Generic information element */
-#define IW_GENERIC_IE_MAX      1024
-
-/* MLME requests (SIOCSIWMLME / struct iw_mlme) */
-#define IW_MLME_DEAUTH         0
-#define IW_MLME_DISASSOC       1
-
-/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
-#define IW_AUTH_INDEX          0x0FFF
-#define IW_AUTH_FLAGS          0xF000
-/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095)
- * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the
- * parameter that is being set/get to; value will be read/written to
- * struct iw_param value field) */
-#define IW_AUTH_WPA_VERSION            0
-#define IW_AUTH_CIPHER_PAIRWISE                1
-#define IW_AUTH_CIPHER_GROUP           2
-#define IW_AUTH_KEY_MGMT               3
-#define IW_AUTH_TKIP_COUNTERMEASURES   4
-#define IW_AUTH_DROP_UNENCRYPTED       5
-#define IW_AUTH_80211_AUTH_ALG         6
-#define IW_AUTH_WPA_ENABLED            7
-#define IW_AUTH_RX_UNENCRYPTED_EAPOL   8
-#define IW_AUTH_ROAMING_CONTROL                9
-#define IW_AUTH_PRIVACY_INVOKED                10
-
-/* IW_AUTH_WPA_VERSION values (bit field) */
-#define IW_AUTH_WPA_VERSION_DISABLED   0x00000001
-#define IW_AUTH_WPA_VERSION_WPA                0x00000002
-#define IW_AUTH_WPA_VERSION_WPA2       0x00000004
-
-/* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */
-#define IW_AUTH_CIPHER_NONE    0x00000001
-#define IW_AUTH_CIPHER_WEP40   0x00000002
-#define IW_AUTH_CIPHER_TKIP    0x00000004
-#define IW_AUTH_CIPHER_CCMP    0x00000008
-#define IW_AUTH_CIPHER_WEP104  0x00000010
-
-/* IW_AUTH_KEY_MGMT values (bit field) */
-#define IW_AUTH_KEY_MGMT_802_1X        1
-#define IW_AUTH_KEY_MGMT_PSK   2
-
-/* IW_AUTH_80211_AUTH_ALG values (bit field) */
-#define IW_AUTH_ALG_OPEN_SYSTEM        0x00000001
-#define IW_AUTH_ALG_SHARED_KEY 0x00000002
-#define IW_AUTH_ALG_LEAP       0x00000004
-
-/* IW_AUTH_ROAMING_CONTROL values */
-#define IW_AUTH_ROAMING_ENABLE 0       /* driver/firmware based roaming */
-#define IW_AUTH_ROAMING_DISABLE        1       /* user space program used for roaming
-                                        * control */
-
-/* SIOCSIWENCODEEXT definitions */
-#define IW_ENCODE_SEQ_MAX_SIZE 8
-/* struct iw_encode_ext ->alg */
-#define IW_ENCODE_ALG_NONE     0
-#define IW_ENCODE_ALG_WEP      1
-#define IW_ENCODE_ALG_TKIP     2
-#define IW_ENCODE_ALG_CCMP     3
-/* struct iw_encode_ext ->ext_flags */
-#define IW_ENCODE_EXT_TX_SEQ_VALID     0x00000001
-#define IW_ENCODE_EXT_RX_SEQ_VALID     0x00000002
-#define IW_ENCODE_EXT_GROUP_KEY                0x00000004
-#define IW_ENCODE_EXT_SET_TX_KEY       0x00000008
-
-/* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */
-#define IW_MICFAILURE_KEY_ID   0x00000003 /* Key ID 0..3 */
-#define IW_MICFAILURE_GROUP    0x00000004
-#define IW_MICFAILURE_PAIRWISE 0x00000008
-#define IW_MICFAILURE_STAKEY   0x00000010
-#define IW_MICFAILURE_COUNT    0x00000060 /* 1 or 2 (0 = count not supported)
-                                           */
-
-/* Bit field values for enc_capa in struct iw_range */
-#define IW_ENC_CAPA_WPA                0x00000001
-#define IW_ENC_CAPA_WPA2       0x00000002
-#define IW_ENC_CAPA_CIPHER_TKIP        0x00000004
-#define IW_ENC_CAPA_CIPHER_CCMP        0x00000008
-
-/* Event capability macros - in (struct iw_range *)->event_capa
- * Because we have more than 32 possible events, we use an array of
- * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
-#define IW_EVENT_CAPA_BASE(cmd)                ((cmd >= SIOCIWFIRSTPRIV) ? \
-                                        (cmd - SIOCIWFIRSTPRIV + 0x60) : \
-                                        (cmd - SIOCSIWCOMMIT))
-#define IW_EVENT_CAPA_INDEX(cmd)       (IW_EVENT_CAPA_BASE(cmd) >> 5)
-#define IW_EVENT_CAPA_MASK(cmd)                (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
-/* Event capability constants - event autogenerated by the kernel
- * This list is valid for most 802.11 devices, customise as needed... */
-#define IW_EVENT_CAPA_K_0      (IW_EVENT_CAPA_MASK(0x8B04) | \
-                                IW_EVENT_CAPA_MASK(0x8B06) | \
-                                IW_EVENT_CAPA_MASK(0x8B1A))
-#define IW_EVENT_CAPA_K_1      (IW_EVENT_CAPA_MASK(0x8B2A))
-/* "Easy" macro to set events in iw_range (less efficient) */
-#define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd))
-#define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; }
-
-/* Modulations bitmasks */
-#define IW_MODUL_ALL           0x00000000      /* Everything supported */
-#define IW_MODUL_FH            0x00000001      /* Frequency Hopping */
-#define IW_MODUL_DS            0x00000002      /* Original Direct Sequence */
-#define IW_MODUL_CCK           0x00000004      /* 802.11b : 5.5 + 11 Mb/s */
-#define IW_MODUL_11B           (IW_MODUL_DS | IW_MODUL_CCK)
-#define IW_MODUL_PBCC          0x00000008      /* TI : 5.5 + 11 + 22 Mb/s */
-#define IW_MODUL_OFDM_A                0x00000010      /* 802.11a : 54 Mb/s */
-#define IW_MODUL_11A           (IW_MODUL_OFDM_A)
-#define IW_MODUL_11AB          (IW_MODUL_11B | IW_MODUL_11A)
-#define IW_MODUL_OFDM_G                0x00000020      /* 802.11g : 54 Mb/s */
-#define IW_MODUL_11G           (IW_MODUL_11B | IW_MODUL_OFDM_G)
-#define IW_MODUL_11AG          (IW_MODUL_11G | IW_MODUL_11A)
-#define IW_MODUL_TURBO         0x00000040      /* ATH : bonding, 108 Mb/s */
-/* In here we should define MIMO stuff. Later... */
-#define IW_MODUL_CUSTOM                0x40000000      /* Driver specific */
-
-/* Bitrate flags available */
-#define IW_BITRATE_TYPE                0x00FF  /* Type of value */
-#define IW_BITRATE_UNICAST     0x0001  /* Maximum/Fixed unicast bitrate */
-#define IW_BITRATE_BROADCAST   0x0002  /* Fixed broadcast bitrate */
-
-/****************************** TYPES ******************************/
-
-/* --------------------------- SUBTYPES --------------------------- */
-/*
- *     Generic format for most parameters that fit in an int
- */
-struct iw_param
-{
-  __s32                value;          /* The value of the parameter itself */
-  __u8         fixed;          /* Hardware should not use auto select */
-  __u8         disabled;       /* Disable the feature */
-  __u16                flags;          /* Various specifc flags (if any) */
-};
-
-/*
- *     For all data larger than 16 octets, we need to use a
- *     pointer to memory allocated in user space.
- */
-struct iw_point
-{
-  void __user  *pointer;       /* Pointer to the data  (in user space) */
-  __u16                length;         /* number of fields or size in bytes */
-  __u16                flags;          /* Optional params */
-};
-
-/*
- *     A frequency
- *     For numbers lower than 10^9, we encode the number in 'm' and
- *     set 'e' to 0
- *     For number greater than 10^9, we divide it by the lowest power
- *     of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
- *     The power of 10 is in 'e', the result of the division is in 'm'.
- */
-struct iw_freq
-{
-       __s32           m;              /* Mantissa */
-       __s16           e;              /* Exponent */
-       __u8            i;              /* List index (when in range struct) */
-       __u8            flags;          /* Flags (fixed/auto) */
-};
-
-/*
- *     Quality of the link
- */
-struct iw_quality
-{
-       __u8            qual;           /* link quality (%retries, SNR,
-                                          %missed beacons or better...) */
-       __u8            level;          /* signal level (dBm) */
-       __u8            noise;          /* noise level (dBm) */
-       __u8            updated;        /* Flags to know if updated */
-};
-
-/*
- *     Packet discarded in the wireless adapter due to
- *     "wireless" specific problems...
- *     Note : the list of counter and statistics in net_device_stats
- *     is already pretty exhaustive, and you should use that first.
- *     This is only additional stats...
- */
-struct iw_discarded
-{
-       __u32           nwid;           /* Rx : Wrong nwid/essid */
-       __u32           code;           /* Rx : Unable to code/decode (WEP) */
-       __u32           fragment;       /* Rx : Can't perform MAC reassembly */
-       __u32           retries;        /* Tx : Max MAC retries num reached */
-       __u32           misc;           /* Others cases */
-};
-
-/*
- *     Packet/Time period missed in the wireless adapter due to
- *     "wireless" specific problems...
- */
-struct iw_missed
-{
-       __u32           beacon;         /* Missed beacons/superframe */
-};
-
-/*
- *     Quality range (for spy threshold)
- */
-struct iw_thrspy
-{
-       struct sockaddr         addr;           /* Source address (hw/mac) */
-       struct iw_quality       qual;           /* Quality of the link */
-       struct iw_quality       low;            /* Low threshold */
-       struct iw_quality       high;           /* High threshold */
-};
-
-/*
- *     Optional data for scan request
- *
- *     Note: these optional parameters are controlling parameters for the
- *     scanning behavior, these do not apply to getting scan results
- *     (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and
- *     provide a merged results with all BSSes even if the previous scan
- *     request limited scanning to a subset, e.g., by specifying an SSID.
- *     Especially, scan results are required to include an entry for the
- *     current BSS if the driver is in Managed mode and associated with an AP.
- */
-struct iw_scan_req
-{
-       __u8            scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */
-       __u8            essid_len;
-       __u8            num_channels; /* num entries in channel_list;
-                                      * 0 = scan all allowed channels */
-       __u8            flags; /* reserved as padding; use zero, this may
-                               * be used in the future for adding flags
-                               * to request different scan behavior */
-       struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or
-                               * individual address of a specific BSS */
-
-       /*
-        * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using
-        * the current ESSID. This allows scan requests for specific ESSID
-        * without having to change the current ESSID and potentially breaking
-        * the current association.
-        */
-       __u8            essid[IW_ESSID_MAX_SIZE];
-
-       /*
-        * Optional parameters for changing the default scanning behavior.
-        * These are based on the MLME-SCAN.request from IEEE Std 802.11.
-        * TU is 1.024 ms. If these are set to 0, driver is expected to use
-        * reasonable default values. min_channel_time defines the time that
-        * will be used to wait for the first reply on each channel. If no
-        * replies are received, next channel will be scanned after this. If
-        * replies are received, total time waited on the channel is defined by
-        * max_channel_time.
-        */
-       __u32           min_channel_time; /* in TU */
-       __u32           max_channel_time; /* in TU */
-
-       struct iw_freq  channel_list[IW_MAX_FREQUENCIES];
-};
-
-/* ------------------------- WPA SUPPORT ------------------------- */
-
-/*
- *     Extended data structure for get/set encoding (this is used with
- *     SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_*
- *     flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and
- *     only the data contents changes (key data -> this structure, including
- *     key data).
- *
- *     If the new key is the first group key, it will be set as the default
- *     TX key. Otherwise, default TX key index is only changed if
- *     IW_ENCODE_EXT_SET_TX_KEY flag is set.
- *
- *     Key will be changed with SIOCSIWENCODEEXT in all cases except for
- *     special "change TX key index" operation which is indicated by setting
- *     key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY.
- *
- *     tx_seq/rx_seq are only used when respective
- *     IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal
- *     TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start
- *     TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally
- *     used only by an Authenticator (AP or an IBSS station) to get the
- *     current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and
- *     RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for
- *     debugging/testing.
- */
-struct iw_encode_ext
-{
-       __u32           ext_flags; /* IW_ENCODE_EXT_* */
-       __u8            tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
-       __u8            rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
-       struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast
-                              * (group) keys or unicast address for
-                              * individual keys */
-       __u16           alg; /* IW_ENCODE_ALG_* */
-       __u16           key_len;
-       __u8            key[0];
-};
-
-/* SIOCSIWMLME data */
-struct iw_mlme
-{
-       __u16           cmd; /* IW_MLME_* */
-       __u16           reason_code;
-       struct sockaddr addr;
-};
-
-/* SIOCSIWPMKSA data */
-#define IW_PMKSA_ADD           1
-#define IW_PMKSA_REMOVE                2
-#define IW_PMKSA_FLUSH         3
-
-#define IW_PMKID_LEN   16
-
-struct iw_pmksa
-{
-       __u32           cmd; /* IW_PMKSA_* */
-       struct sockaddr bssid;
-       __u8            pmkid[IW_PMKID_LEN];
-};
-
-/* IWEVMICHAELMICFAILURE data */
-struct iw_michaelmicfailure
-{
-       __u32           flags;
-       struct sockaddr src_addr;
-       __u8            tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
-};
-
-/* IWEVPMKIDCAND data */
-#define IW_PMKID_CAND_PREAUTH  0x00000001 /* RNS pre-authentication enabled */
-struct iw_pmkid_cand
-{
-       __u32           flags; /* IW_PMKID_CAND_* */
-       __u32           index; /* the smaller the index, the higher the
-                               * priority */
-       struct sockaddr bssid;
-};
-
-/* ------------------------ WIRELESS STATS ------------------------ */
-/*
- * Wireless statistics (used for /proc/net/wireless)
- */
-struct iw_statistics
-{
-       __u16           status;         /* Status
-                                        * - device dependent for now */
-
-       struct iw_quality       qual;           /* Quality of the link
-                                                * (instant/mean/max) */
-       struct iw_discarded     discard;        /* Packet discarded counts */
-       struct iw_missed        miss;           /* Packet missed counts */
-};
-
-/* ------------------------ IOCTL REQUEST ------------------------ */
-/*
- * This structure defines the payload of an ioctl, and is used 
- * below.
- *
- * Note that this structure should fit on the memory footprint
- * of iwreq (which is the same as ifreq), which mean a max size of
- * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
- * You should check this when increasing the structures defined
- * above in this file...
- */
-union  iwreq_data
-{
-       /* Config - generic */
-       char            name[IFNAMSIZ];
-       /* Name : used to verify the presence of  wireless extensions.
-        * Name of the protocol/provider... */
-
-       struct iw_point essid;          /* Extended network name */
-       struct iw_param nwid;           /* network id (or domain - the cell) */
-       struct iw_freq  freq;           /* frequency or channel :
-                                        * 0-1000 = channel
-                                        * > 1000 = frequency in Hz */
-
-       struct iw_param sens;           /* signal level threshold */
-       struct iw_param bitrate;        /* default bit rate */
-       struct iw_param txpower;        /* default transmit power */
-       struct iw_param rts;            /* RTS threshold threshold */
-       struct iw_param frag;           /* Fragmentation threshold */
-       __u32           mode;           /* Operation mode */
-       struct iw_param retry;          /* Retry limits & lifetime */
-
-       struct iw_point encoding;       /* Encoding stuff : tokens */
-       struct iw_param power;          /* PM duration/timeout */
-       struct iw_quality qual;         /* Quality part of statistics */
-
-       struct sockaddr ap_addr;        /* Access point address */
-       struct sockaddr addr;           /* Destination address (hw/mac) */
-
-       struct iw_param param;          /* Other small parameters */
-       struct iw_point data;           /* Other large parameters */
-};
-
-/*
- * The structure to exchange data for ioctl.
- * This structure is the same as 'struct ifreq', but (re)defined for
- * convenience...
- * Do I need to remind you about structure size (32 octets) ?
- */
-struct iwreq 
-{
-       union
-       {
-               char    ifrn_name[IFNAMSIZ];    /* if name, e.g. "eth0" */
-       } ifr_ifrn;
-
-       /* Data part (defined just above) */
-       union   iwreq_data      u;
-};
-
-/* -------------------------- IOCTL DATA -------------------------- */
-/*
- *     For those ioctl which want to exchange mode data that what could
- *     fit in the above structure...
- */
-
-/*
- *     Range of parameters
- */
-
-struct iw_range
-{
-       /* Informative stuff (to choose between different interface) */
-       __u32           throughput;     /* To give an idea... */
-       /* In theory this value should be the maximum benchmarked
-        * TCP/IP throughput, because with most of these devices the
-        * bit rate is meaningless (overhead an co) to estimate how
-        * fast the connection will go and pick the fastest one.
-        * I suggest people to play with Netperf or any benchmark...
-        */
-
-       /* NWID (or domain id) */
-       __u32           min_nwid;       /* Minimal NWID we are able to set */
-       __u32           max_nwid;       /* Maximal NWID we are able to set */
-
-       /* Old Frequency (backward compat - moved lower ) */
-       __u16           old_num_channels;
-       __u8            old_num_frequency;
-
-       /* Wireless event capability bitmasks */
-       __u32           event_capa[6];
-
-       /* signal level threshold range */
-       __s32           sensitivity;
-
-       /* Quality of link & SNR stuff */
-       /* Quality range (link, level, noise)
-        * If the quality is absolute, it will be in the range [0 ; max_qual],
-        * if the quality is dBm, it will be in the range [max_qual ; 0].
-        * Don't forget that we use 8 bit arithmetics... */
-       struct iw_quality       max_qual;       /* Quality of the link */
-       /* This should contain the average/typical values of the quality
-        * indicator. This should be the threshold between a "good" and
-        * a "bad" link (example : monitor going from green to orange).
-        * Currently, user space apps like quality monitors don't have any
-        * way to calibrate the measurement. With this, they can split
-        * the range between 0 and max_qual in different quality level
-        * (using a geometric subdivision centered on the average).
-        * I expect that people doing the user space apps will feedback
-        * us on which value we need to put in each driver... */
-       struct iw_quality       avg_qual;       /* Quality of the link */
-
-       /* Rates */
-       __u8            num_bitrates;   /* Number of entries in the list */
-       __s32           bitrate[IW_MAX_BITRATES];       /* list, in bps */
-
-       /* RTS threshold */
-       __s32           min_rts;        /* Minimal RTS threshold */
-       __s32           max_rts;        /* Maximal RTS threshold */
-
-       /* Frag threshold */
-       __s32           min_frag;       /* Minimal frag threshold */
-       __s32           max_frag;       /* Maximal frag threshold */
-
-       /* Power Management duration & timeout */
-       __s32           min_pmp;        /* Minimal PM period */
-       __s32           max_pmp;        /* Maximal PM period */
-       __s32           min_pmt;        /* Minimal PM timeout */
-       __s32           max_pmt;        /* Maximal PM timeout */
-       __u16           pmp_flags;      /* How to decode max/min PM period */
-       __u16           pmt_flags;      /* How to decode max/min PM timeout */
-       __u16           pm_capa;        /* What PM options are supported */
-
-       /* Encoder stuff */
-       __u16   encoding_size[IW_MAX_ENCODING_SIZES];   /* Different token sizes */
-       __u8    num_encoding_sizes;     /* Number of entry in the list */
-       __u8    max_encoding_tokens;    /* Max number of tokens */
-       /* For drivers that need a "login/passwd" form */
-       __u8    encoding_login_index;   /* token index for login token */
-
-       /* Transmit power */
-       __u16           txpower_capa;   /* What options are supported */
-       __u8            num_txpower;    /* Number of entries in the list */
-       __s32           txpower[IW_MAX_TXPOWER];        /* list, in bps */
-
-       /* Wireless Extension version info */
-       __u8            we_version_compiled;    /* Must be WIRELESS_EXT */
-       __u8            we_version_source;      /* Last update of source */
-
-       /* Retry limits and lifetime */
-       __u16           retry_capa;     /* What retry options are supported */
-       __u16           retry_flags;    /* How to decode max/min retry limit */
-       __u16           r_time_flags;   /* How to decode max/min retry life */
-       __s32           min_retry;      /* Minimal number of retries */
-       __s32           max_retry;      /* Maximal number of retries */
-       __s32           min_r_time;     /* Minimal retry lifetime */
-       __s32           max_r_time;     /* Maximal retry lifetime */
-
-       /* Frequency */
-       __u16           num_channels;   /* Number of channels [0; num - 1] */
-       __u8            num_frequency;  /* Number of entry in the list */
-       struct iw_freq  freq[IW_MAX_FREQUENCIES];       /* list */
-       /* Note : this frequency list doesn't need to fit channel numbers,
-        * because each entry contain its channel index */
-
-       __u32           enc_capa;       /* IW_ENC_CAPA_* bit field */
-
-       /* More power management stuff */
-       __s32           min_pms;        /* Minimal PM saving */
-       __s32           max_pms;        /* Maximal PM saving */
-       __u16           pms_flags;      /* How to decode max/min PM saving */
-
-       /* All available modulations for driver (hw may support less) */
-       __s32           modul_capa;     /* IW_MODUL_* bit field */
-
-       /* More bitrate stuff */
-       __u32           bitrate_capa;   /* Types of bitrates supported */
-};
-
-/*
- * Private ioctl interface information
- */
-struct iw_priv_args
-{
-       __u32           cmd;            /* Number of the ioctl to issue */
-       __u16           set_args;       /* Type and number of args */
-       __u16           get_args;       /* Type and number of args */
-       char            name[IFNAMSIZ]; /* Name of the extension */
-};
-
-/* ----------------------- WIRELESS EVENTS ----------------------- */
-/*
- * Wireless events are carried through the rtnetlink socket to user
- * space. They are encapsulated in the IFLA_WIRELESS field of
- * a RTM_NEWLINK message.
- */
-
-/*
- * A Wireless Event. Contains basically the same data as the ioctl...
- */
-struct iw_event
-{
-       __u16           len;                    /* Real lenght of this stuff */
-       __u16           cmd;                    /* Wireless IOCTL */
-       union iwreq_data        u;              /* IOCTL fixed payload */
-};
-
-/* Size of the Event prefix (including padding and alignement junk) */
-#define IW_EV_LCP_LEN  (sizeof(struct iw_event) - sizeof(union iwreq_data))
-/* Size of the various events */
-#define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ)
-#define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32))
-#define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq))
-#define IW_EV_PARAM_LEN        (IW_EV_LCP_LEN + sizeof(struct iw_param))
-#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr))
-#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality))
-
-/* iw_point events are special. First, the payload (extra data) come at
- * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second,
- * we omit the pointer, so start at an offset. */
-#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
-                         (char *) NULL)
-#define IW_EV_POINT_LEN        (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
-                        IW_EV_POINT_OFF)
-
-#endif /* _LINUX_WIRELESS_H */
diff --git a/drivers/net/wireless/ar6003/host/tools/athbtfilter/filter.sh b/drivers/net/wireless/ar6003/host/tools/athbtfilter/filter.sh
deleted file mode 100644 (file)
index f238654..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-
-#!/bin/bash
-
-mkdir ../athbtfilter.bk
-cp -r ../athbtfilter ../athbtfilter.bk
-
-mkdir include
-mkdir host
-mkdir host/include
-mkdir host/os
-mkdir host/os/linux
-mkdir host/os/linux/include
-mkdir host/tools
-mkdir host/tools/athbtfilter
-
-mv bluez host/tools/athbtfilter
-
-cp Android.mk host
-cp Android.mk host/tools
-cp Android.mk host/tools/athbtfilter
-
-cp ../../include/*.h host/include
-cp ../../os/linux/include/*.h host/os/linux/include
-cp ../../../include/*.h include
diff --git a/drivers/net/wireless/ar6003/host/tools/drvdebugctrl/Android.mk b/drivers/net/wireless/ar6003/host/tools/drvdebugctrl/Android.mk
deleted file mode 100644 (file)
index e05064c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2010 Atheros Corporation.  All rights reserved.
-#
-# 
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES := \
-       $(LOCAL_PATH)/../../include \
-    $(LOCAL_PATH)/../../os/linux/include \
-    $(LOCAL_PATH)/../../../include \
-
-LOCAL_CFLAGS+= 
-LOCAL_SRC_FILES:= debugctrl.c
-LOCAL_MODULE := drvdebugctrl
-LOCAL_MODULE_TAGS := debug eng optional
-include $(BUILD_EXECUTABLE)
-
diff --git a/drivers/net/wireless/ar6003/host/tools/drvdebugctrl/Makefile b/drivers/net/wireless/ar6003/host/tools/drvdebugctrl/Makefile
deleted file mode 100644 (file)
index 75dffd2..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-CC := $(ATH_CROSS_COMPILE_TYPE)gcc
-
-all:
-       $(CC) -g -Wall -I../../include -I../../os/linux/include debugctrl.c -o drvdebugctrl
\ No newline at end of file
diff --git a/drivers/net/wireless/ar6003/host/tools/drvdebugctrl/debugctrl.c b/drivers/net/wireless/ar6003/host/tools/drvdebugctrl/debugctrl.c
deleted file mode 100644 (file)
index c0053ff..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-
-/*
- * Copyright (c) 2009 Atheros Communications Inc.
- * All rights reserved.
- *
- *
- * 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
- * 
- */
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <linux/types.h>
-#include <linux/if.h>
-#include <linux/wireless.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <getopt.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <err.h>
-
-#include <a_config.h>
-#include <a_osapi.h>
-#include <a_types.h>
-#include <athdrv_linux.h>
-
-const char *prog_name;
-struct ifreq ifr;
-int sock;
-
-char module_name[128];
-
-const char cmd_args[] =
-"arguments:\n\
-  --module=   , -m <module name>    name of module (htc,bmi,wmi,wlan) \n\
-  --set=      , -s <bit map>        set the current debug mask  \n\
-  --setbit=   , -b <bit number>     set a single bit (0..31)    \n\
-  --clrbit=   , -c <bit number>     clear a single bit (0..31)  \n\
-  --dumpinfo  , -d                  dump info for this module   \n\
-  --dumpall                         dump all registered module debug info \n\
-  --interface=, -i <netif name>     (e.g. eth1) \n\
-\n";
-
-void
-usage(void)
-{
-    fprintf(stderr, "usage:\n%s arguments...\n", prog_name);
-    fprintf(stderr, "%s\n", cmd_args);
-    exit(1);
-}
-
-void
-do_ioctl(void *ioctl_data)
-{
-    ifr.ifr_data = (char *)ioctl_data;
-
-    if (ioctl(sock, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-        err(1, "%s", ifr.ifr_name);
-        exit (1);
-    }
-}
-
-void DumpModuleDebugInfo(char *name)
-{
-    struct  debuginfocmd {
-        int    cmd;
-        struct drv_debug_module_s modinfo; 
-    } command;
-
-    memset(&command,0,sizeof(command));
-    
-    command.cmd = AR6000_XIOCTL_DUMP_MODULE_DEBUG_INFO;
-    strncpy(command.modinfo.modulename,name,sizeof(command.modinfo.modulename)); 
-    printf("Dumping module : %s info.... \n",name);
-    do_ioctl(&command);
-}
-
-void SetDebugBitMask(char *name,unsigned int mask)
-{
-    struct  debuginfocmd {
-        int    cmd;
-        struct drv_debug_module_s modinfo; 
-    } command;
-
-    memset(&command,0,sizeof(command));
-    
-    command.cmd = AR6000_XIOCTL_MODULE_DEBUG_SET_MASK;
-    command.modinfo.mask = mask;
-    strncpy(command.modinfo.modulename,name,sizeof(command.modinfo.modulename)); 
-    printf("Setting module : %s mask to: 0x%X \n", module_name, mask);
-    do_ioctl(&command);
-}
-
-unsigned int GetDebugBitMask(char *name)
-{
-    struct  debuginfocmd {
-        int    cmd;
-        struct drv_debug_module_s modinfo; 
-    } command;
-
-    memset(&command,0,sizeof(command));
-    
-    command.cmd = AR6000_XIOCTL_MODULE_DEBUG_GET_MASK;
-    strncpy(command.modinfo.modulename,name,sizeof(command.modinfo.modulename)); 
-    do_ioctl(&command);    
-    printf("Got module : %s mask : 0x%X \n", module_name, command.modinfo.mask);
-    return command.modinfo.mask;
-}
-
-void SetDebugBitNo(char *name,unsigned int bit)
-{
-    unsigned int mask = GetDebugBitMask(name);
-    
-    mask |= (1 << bit);
-    SetDebugBitMask(name, mask);
-}
-
-void ClearDebugBitNo(char *name,unsigned int bit)
-{
-    unsigned int mask = GetDebugBitMask(name);
-    
-    mask &= ~(1 << bit);
-    SetDebugBitMask(name, mask);
-}
-
-typedef enum {
-    MASK_ACTION_NONE = 0,
-    MASK_ACTION_SET_MASK,
-    MASK_ACTION_SET_BIT,
-    MASK_ACTION_CLR_BIT,
-    MASK_ACTION_DUMP_INFO,
-    MASK_ACTION_DUMP_ALL_INFO
-} MASK_ACTION;
-
-int
-main (int argc, char **argv)
-{
-    int c;
-    int gotname = 0;
-    MASK_ACTION action = MASK_ACTION_NONE;
-    unsigned int bitmask;
-    unsigned int bitpos;
-    
-    prog_name = argv[0];
-
-    if (argc == 1) {
-        usage();
-    }
-
-    sock = socket(AF_INET, SOCK_DGRAM, 0);
-    if (sock < 0) {
-        err(1, "socket");
-    }
-
-    memset(ifr.ifr_name, '\0', sizeof(ifr.ifr_name));
-    strcpy(ifr.ifr_name, "eth1"); /* default */
-  
-    while (1) {
-        int option_index = 0;
-        static struct option long_options[] = {
-            {"module", 1, NULL, 'm'},
-            {"set", 1, NULL, 's'},
-            {"setbit", 1, NULL, 'b'},
-            {"clrbit", 1, NULL, 'c'},
-            {"interface", 1, NULL, 'i'},
-            {"dumpall", 0, NULL, 'a'},
-            {"dumpinfo", 0, NULL, 'd'},
-            {0, 0, 0, 0}
-        };
-
-        c = getopt_long (argc, argv, "m:s:b:c:i:d",
-                         long_options, &option_index);
-        if (c == -1) {
-            break;
-        }
-
-        switch (c) {
-
-        case 'm':
-        {
-            strncpy(module_name, optarg, sizeof(module_name));
-            gotname = 1;
-            break;
-        }
-        case 's':
-        {
-            bitmask = strtoul(optarg, NULL, 0);
-            action = MASK_ACTION_SET_MASK;
-            break;
-        }
-
-        case 'b':
-        {
-            bitpos = strtoul(optarg, NULL, 0);
-            if (bitpos > 31) {
-                printf(" bit number is too high");
-                break;    
-            }
-            action = MASK_ACTION_SET_BIT;
-            break;
-        }
-
-        case 'c':
-        {
-            bitpos = strtoul(optarg, NULL, 0);
-            if (bitpos > 31) {
-                printf(" bit number is too high");
-                break;    
-            }
-            
-            action = MASK_ACTION_CLR_BIT;
-            break;
-        }
-
-        case 'a':
-        {
-            action = MASK_ACTION_DUMP_ALL_INFO;
-            break;
-        }
-        case 'd':
-            action = MASK_ACTION_DUMP_INFO;
-            break;
-        case 'i':
-        {
-            memset(ifr.ifr_name, '\0', sizeof(ifr.ifr_name));
-            strncpy(ifr.ifr_name, optarg, sizeof(ifr.ifr_name));
-            break;
-        }
-
-        default:
-        {
-            usage();
-            break;
-        }
-        }
-    }
-    
-    if (action == MASK_ACTION_NONE) {
-        usage();
-        exit(1);  
-    }
-    
-    if (action != MASK_ACTION_DUMP_ALL_INFO) {
-        if (!gotname) {
-            printf("** must specify module name\n");     
-            usage();
-            exit(1);
-        }
-    }
-    
-    switch (action) {
-        
-        case MASK_ACTION_DUMP_ALL_INFO :
-            DumpModuleDebugInfo("all");
-            break;    
-        case MASK_ACTION_DUMP_INFO:
-            DumpModuleDebugInfo(module_name);
-            break;
-        case MASK_ACTION_CLR_BIT :
-            ClearDebugBitNo(module_name,bitpos);
-            DumpModuleDebugInfo(module_name);
-            break;   
-        case MASK_ACTION_SET_BIT :
-            SetDebugBitNo(module_name,bitpos);
-            DumpModuleDebugInfo(module_name);
-            break;    
-        case MASK_ACTION_SET_MASK :
-            SetDebugBitMask(module_name,bitmask);
-            DumpModuleDebugInfo(module_name);
-            break;    
-        default:
-            break;   
-    }  
-    
-
-    exit(0);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/recEvent/Android.mk b/drivers/net/wireless/ar6003/host/tools/recEvent/Android.mk
deleted file mode 100644 (file)
index 0edeb4a..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2010 Atheros Corporation.  All rights reserved.
-# 
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES := \
-       $(LOCAL_PATH)/../../include \
-    $(LOCAL_PATH)/../../os/linux/include \
-    $(LOCAL_PATH)/../../../include \
-    $(LOCAL_PATH)/../../wlan/include \
-    $(KERNEL_HEADER)
-
-LOCAL_CFLAGS+=
-LOCAL_SRC_FILES:= recEvent.c dbgFormatter.c
-LOCAL_MODULE := recEvent
-LOCAL_MODULE_TAGS := debug eng optional
-LOCAL_SHARED_LIBRARIES := libcutils
-
-include $(BUILD_EXECUTABLE)
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/recEvent/Makefile b/drivers/net/wireless/ar6003/host/tools/recEvent/Makefile
deleted file mode 100644 (file)
index efee709..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2007 Atheros Corporation.  All rights reserved.
-# 
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-CC := $(ATH_CROSS_COMPILE_TYPE)gcc
-KERNEL_SRC :=$(ATH_LINUXPATH)
-
-all:
-       $(CC) -Wall -I./ -I$(KERNEL_SRC)/include -I../../include -I../../../include -I../../wlan/include -I../../os/linux/include recEvent.c dbgFormatter.c -o recEvent
diff --git a/drivers/net/wireless/ar6003/host/tools/recEvent/dbgFormatter.c b/drivers/net/wireless/ar6003/host/tools/recEvent/dbgFormatter.c
deleted file mode 100644 (file)
index b4dd31c..0000000
+++ /dev/null
@@ -1,1790 +0,0 @@
-//
-// Copyright (c) 2006 Atheros Communications Inc.
-// All rights reserved.
-// 
-//
-// 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-// 
-//
-
-/* This tool parses the recevent logs stored in the binary format 
-   by the wince athsrc */
-#define WAPI_ENABLE
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <a_config.h>
-#include <a_osapi.h>
-#include <a_types.h>
-#include <athdefs.h>
-#include <ieee80211.h>
-#include <wmi.h>
-#include <athdrv_linux.h>
-#include <dbglog_api.h>
-#include <dbglog_id.h>
-
-typedef int (*DbgCmdFormatter)(char *output, size_t len, const A_UINT8 *);
-typedef int (*DbgLogFormatter)(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer);
-
-struct dbglog_desc {
-    A_INT32 oid;
-    const char *desc;
-    DbgLogFormatter formatter;
-};
-
-struct module_desc {
-    int module;
-    const char *name;
-    struct dbglog_desc *descs;
-    size_t len;
-    int bsearch;
-};
-
-struct wmi_id_desc {
-    A_INT32 oid;
-    const char *desc;
-    DbgCmdFormatter formatter;
-    size_t cmdSize;
-};
-
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
-#define CASE_STR_CONST(_s, _n, _val) case _n: (_val) = #_s; break
-#define CASE_STR(_x, _val) case _x: (_val) = #_x; break
-#define CASE_DEF_STR(_val) default: (_val) = "Unknown"; break
-#define BIT_STR(_b, _l, _r, _s, _c, _v) if (((_v) & (_c)) == (_c)) (_r) += snprintf((_b)+(_r), (_l)-(_r), _s)
-
-#define DBG_DESC(_x) { _x, #_x, NULL }
-#define DBG_DESC_FMT(_x) { _x, #_x, _x ## _fmt }
-
-#define WM_ID_DESC(_x) { _x, #_x, NULL, 0 }
-#define WM_ID_DESC_FMT(_x, s) { _x, #_x, _x ## _fmt, s }
-
-#define MODULE_DESC(_x, _d) { DBGLOG_MODULEID_ ## _x, #_x, _d, ARRAY_SIZE(_d),0}
-
-extern A_CHAR dbglog_id_tag[DBGLOG_MODULEID_NUM_MAX][DBGLOG_DBGID_NUM_MAX][DBGLOG_DBGID_DEFINITION_LEN_MAX];
-static int check_ids;
-
-static const char *pmmode2text(A_INT32 mode)
-{
-    const char *pm;
-    switch (mode) {
-    case 1: pm = "sleep"; break;
-    case 2: pm = "awake"; break;
-    case 3: pm = "fake_sleep"; break;
-    default: pm = "unknown"; break;
-    }
-    return pm;
-}
-
-#if 0
-static const char *module2text(A_INT32 moduleid)
-{
-    const char *msg;
-    switch (moduleid) {
-    CASE_STR_CONST(INF, DBGLOG_MODULEID_INF, msg);
-    CASE_STR_CONST(WMI, DBGLOG_MODULEID_WMI, msg);
-    CASE_STR_CONST(MISC, DBGLOG_MODULEID_MISC, msg);
-    CASE_STR_CONST(PM, DBGLOG_MODULEID_PM, msg);
-    CASE_STR_CONST(MGMTBUF, DBGLOG_MODULEID_TXRX_MGMTBUF, msg);
-    CASE_STR_CONST(TXBUF, DBGLOG_MODULEID_TXRX_TXBUF, msg);
-    CASE_STR_CONST(RXBUF, DBGLOG_MODULEID_TXRX_RXBUF, msg);
-    CASE_STR_CONST(WOW, DBGLOG_MODULEID_WOW, msg);
-    CASE_STR_CONST(WHAL, DBGLOG_MODULEID_WHAL, msg);
-    CASE_STR_CONST(DC, DBGLOG_MODULEID_DC, msg);
-    CASE_STR_CONST(CO, DBGLOG_MODULEID_CO, msg);
-    CASE_STR_CONST(RO, DBGLOG_MODULEID_RO, msg);
-    CASE_STR_CONST(CM, DBGLOG_MODULEID_CM, msg);
-    CASE_STR_CONST(MGMT, DBGLOG_MODULEID_MGMT, msg);
-    CASE_STR_CONST(TMR, DBGLOG_MODULEID_TMR, msg);
-    CASE_STR_CONST(BTCOEX, DBGLOG_MODULEID_BTCOEX, msg);
-    CASE_DEF_STR(msg);
-    }
-    return msg;
-}
-#endif
-
-static const char *pmmodule2text(A_INT32 moduleid)
-{
-    const char *msg;
-    switch (moduleid) {
-    CASE_STR_CONST(CSERV, 1, msg);
-    CASE_STR_CONST(MLME   , 2, msg);
-    CASE_STR_CONST(TXRX   , 3, msg);
-    CASE_STR_CONST(PM     , 4, msg);
-    CASE_STR_CONST(BT_COEX, 5, msg);
-    CASE_STR_CONST(CO     , 6, msg);
-    CASE_STR_CONST(DC     , 7, msg);
-    CASE_STR_CONST(RO     , 8, msg);
-    CASE_STR_CONST(CM     , 9, msg);
-    CASE_STR_CONST(RRM    , 10, msg);
-    CASE_STR_CONST(AP     , 11, msg);
-    CASE_STR_CONST(KEYMGMT, 12, msg);
-    CASE_STR_CONST(CCX    , 13, msg);
-    CASE_STR_CONST(MISC   , 14, msg);
-    CASE_STR_CONST(DFS    , 15, msg);
-    CASE_STR_CONST(TIMER  , 16, msg);
-    CASE_DEF_STR(msg);
-    }
-    return msg;
-}
-
-static const char *status2text(A_STATUS status)
-{
-    const char *msg;
-    switch (status) {
-    CASE_STR(A_ERROR, msg);
-    CASE_STR(A_OK, msg);                   /* success */
-                                /* Following values start at 1 */
-    CASE_STR(A_DEVICE_NOT_FOUND, msg);         /* not able to find PCI device */
-    CASE_STR(A_NO_MEMORY, msg);                /* not able to allocate memory, msg); not available */
-    CASE_STR(A_MEMORY_NOT_AVAIL, msg);         /* memory region is not free for mapping */
-    CASE_STR(A_NO_FREE_DESC, msg);             /* no free descriptors available */
-    CASE_STR(A_BAD_ADDRESS, msg);              /* address does not match descriptor */
-    CASE_STR(A_WIN_DRIVER_ERROR, msg);         /* used in NT_HW version, msg); if problem at init */
-    CASE_STR(A_REGS_NOT_MAPPED, msg);          /* registers not correctly mapped */
-    CASE_STR(A_EPERM, msg);                    /* Not superuser */
-    CASE_STR(A_EACCES, msg);                   /* Access denied */
-    CASE_STR(A_ENOENT, msg);                   /* No such entry, msg); search failed, msg); etc. */
-    CASE_STR(A_EEXIST, msg);                   /* The object already exists (can't create) */
-    CASE_STR(A_EFAULT, msg);                   /* Bad address fault */
-    CASE_STR(A_EBUSY, msg);                    /* Object is busy */
-    CASE_STR(A_EINVAL, msg);                   /* Invalid parameter */
-    CASE_STR(A_EMSGSIZE, msg);                 /* Inappropriate message buffer length */
-    CASE_STR(A_ECANCELED, msg);                /* Operation canceled */
-    CASE_STR(A_ENOTSUP, msg);                  /* Operation not supported */
-    CASE_STR(A_ECOMM, msg);                    /* Communication error on send */
-    CASE_STR(A_EPROTO, msg);                   /* Protocol error */
-    CASE_STR(A_ENODEV, msg);                   /* No such device */
-    CASE_STR(A_EDEVNOTUP, msg);                /* device is not UP */
-    CASE_STR(A_NO_RESOURCE, msg);              /* No resources for requested operation */
-    CASE_STR(A_HARDWARE, msg);                 /* Hardware failure */
-    CASE_STR(A_PENDING, msg);                  /* Asynchronous routine; will send up results la
-ter (typically in callback) */
-    CASE_STR(A_EBADCHANNEL, msg);              /* The channel cannot be used */
-    CASE_STR(A_DECRYPT_ERROR, msg);            /* Decryption error */
-    CASE_STR(A_PHY_ERROR, msg);                /* RX PHY error */
-    CASE_STR(A_CONSUMED, msg);                    /* Object was consumed */
-    CASE_DEF_STR(msg);
-    }
-    return msg;
-}
-
-static const char *btStatus2text(A_INT32 status)
-{
-    const char *btState;
-    switch (status) {
-    CASE_STR_CONST(BT_UNDEF, 1, btState);
-    CASE_STR_CONST(BT_ON, 2, btState);
-    CASE_STR_CONST(BT_OFF, 3, btState); 
-    CASE_STR_CONST(BT_IGNORE, 4, btState);    
-    CASE_DEF_STR(btState);
-    }
-    return btState;
-}
-
-static int cipher2text(char *buf, size_t len, A_UINT8 cipher)
-{
-    int ret = 0;
-    BIT_STR(buf, len, ret, "none ", NONE_CRYPT, cipher);
-    BIT_STR(buf, len, ret, "wep ", WEP_CRYPT, cipher);
-    BIT_STR(buf, len, ret, "tkip ", TKIP_CRYPT, cipher);
-    BIT_STR(buf, len, ret, "aes ", AES_CRYPT, cipher);
-    buf[(ret>0) ? --ret : ret] = 0;
-    return ret;
-}
-
-static const char* enable2text(A_INT32 enable)
-{
-    return enable ? "ENABLE" : "DISABLE";
-}
-
-static const char* txrxstatus2text(A_INT32 status)
-{
-    const char *txstatus;
-    switch (status) {
-    CASE_STR_CONST(TXRX_ERROR, -1, txstatus);
-    CASE_STR_CONST(TXRX_OK                 ,  0, txstatus);
-    CASE_STR_CONST(TXRX_FAILED             ,  1, txstatus);
-    CASE_STR_CONST(TXRX_Q_IS_EMPTY         ,  2, txstatus);
-    CASE_STR_CONST(TXRX_Q_NOT_DRAINED      ,  3, txstatus);
-    CASE_STR_CONST(TXRX_Q_DRAINED_ALL      ,  4, txstatus);
-    CASE_STR_CONST(TXRX_Q_DRAIN_PENDING    ,  5, txstatus);
-    CASE_STR_CONST(TXRX_IS_MGMT_PKT        ,  6, txstatus);
-    CASE_STR_CONST(TXRX_IS_DATA_PKT        ,  7, txstatus);
-    CASE_STR_CONST(TXRX_SAVED_AS_FRAG      ,  8, txstatus);
-    CASE_STR_CONST(TXRX_Q_IS_PAUSED        ,  9, txstatus);
-    CASE_STR_CONST(TXRX_RX_SEND_TO_HOST    , 10, txstatus);
-    CASE_STR_CONST(TXRX_ERROR_PKT_DRAINED  , 11, txstatus);
-    CASE_STR_CONST(TXRX_EOL_EXPIRED        , 12, txstatus);
-    CASE_STR_CONST(TXRX_PS_FILTERED        , 13,  txstatus);
-    CASE_STR_CONST(TXRX_RX_SEND_TO_TX      , 14,  txstatus);
-    CASE_DEF_STR(txstatus);
-    }
-    return txstatus;
-}
-
-static int rxfilter2text(char *buf, size_t blen, A_INT32 rxfilter)
-{
-    int ret = 0;  
-    BIT_STR(buf, blen, ret, "UCAST "    , 0x00000001, rxfilter);
-    BIT_STR(buf, blen, ret, "MCAST "    , 0x00000002, rxfilter);
-    BIT_STR(buf, blen, ret, "BCAST "   , 0x00000004, rxfilter);
-    BIT_STR(buf, blen, ret, "CONTROL "  , 0x00000008, rxfilter);
-    BIT_STR(buf, blen, ret, "BEACON "  , 0x00000010, rxfilter);
-    BIT_STR(buf, blen, ret, "PROM "    , 0x00000020, rxfilter);
-    BIT_STR(buf, blen, ret, "PROBEREQ ", 0x00000080, rxfilter);
-    BIT_STR(buf, blen, ret, "MYBEACON ", 0x00000200, rxfilter);
-    BIT_STR(buf, blen, ret, "COMP_BAR ", 0x00000400, rxfilter);
-    BIT_STR(buf, blen, ret, "COMP_BA " , 0x00000800, rxfilter);
-    BIT_STR(buf, blen, ret, "UNCOMP_BA_BAR " , 0x00001000, rxfilter);
-    BIT_STR(buf, blen, ret, "PS_POLL " , 0x00004000, rxfilter);
-    BIT_STR(buf, blen, ret, "MCAST_BCAST_ALL " , 0x00008000, rxfilter);
-    BIT_STR(buf, blen, ret, "FROM_TO_DS "      , 0x00020000, rxfilter);
-    buf[(ret>0) ? --ret : ret] = 0;
-    return ret;
-}
-
-static int btState2text(char *buf, size_t blen, A_INT32 btState)
-{
-    int bret = 0;
-    BIT_STR(buf, blen, bret, "SCO ", (1<<1), btState);
-    BIT_STR(buf, blen, bret, "A2DP ", (1<<2), btState);
-    BIT_STR(buf, blen, bret, "SCAN ", (1<<3), btState);
-    BIT_STR(buf, blen, bret, "ESCO ", (1<<4), btState);
-    buf[(bret>0) ? --bret : bret] = 0;
-    return bret;
-}
-
-static int btcoexFlags2text(char *buf, size_t blen, A_INT32 btCoexFlags)
-{
-    int bret = 0;
-    BIT_STR(buf, blen, bret, "SCO_ON ", 0x0001, btCoexFlags);
-    BIT_STR(buf, blen, bret, "A2DP_ON ", 0x0002, btCoexFlags);
-    BIT_STR(buf, blen, bret, "ACL_ON ", 0x0004, btCoexFlags);
-    BIT_STR(buf, blen, bret, "INQUIRY_ON ", 0x0008, btCoexFlags);
-    BIT_STR(buf, blen, bret, "VOIP ", 0x0010, btCoexFlags);
-    BIT_STR(buf, blen, bret, "RXDATA_PENDING ", 0x0020, btCoexFlags);
-    BIT_STR(buf, blen, bret, "SLEEP_PENDING ", 0x0040, btCoexFlags);
-    BIT_STR(buf, blen, bret, "FAKESLEEP_ON ", 0x0080, btCoexFlags);
-    BIT_STR(buf, blen, bret, "ADD_BA_PENDING ", 0x0100, btCoexFlags);
-    BIT_STR(buf, blen, bret, "WAKEUP_TIM_INTR ", 0x0200, btCoexFlags);
-    BIT_STR(buf, blen, bret, "OPT_MODE ", 0x0400, btCoexFlags);
-    BIT_STR(buf, blen, bret, "FIRST_BMISS ", 0x0800, btCoexFlags);
-    BIT_STR(buf, blen, bret, "BEACON_PROTECION_ON ", 0x1000, btCoexFlags);
-    BIT_STR(buf, blen, bret, "WAIT_FOR_NULL_COMP ", 0x4000, btCoexFlags);
-    BIT_STR(buf, blen, bret, "PROTECT_POST_INQUIRY ", 0x8000, btCoexFlags);
-    BIT_STR(buf, blen, bret, "DUAL_ANT_ACTIVE ", 0x10000, btCoexFlags);
-    BIT_STR(buf, blen, bret, "DUAL_ANT_WAKEUP_TIM ", 0x20000, btCoexFlags);
-    BIT_STR(buf, blen, bret, "STOMP_FOR_DTIM_RECV ", 0x40000, btCoexFlags);
-    BIT_STR(buf, blen, bret, "ENABLE_COEX_ON_BCN_RECV ", 0x80000, btCoexFlags);
-    buf[(bret>0) ? --bret : bret] = 0;
-    return bret;
-}
-
-static int WMI_SET_MCAST_FILTER_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    WMI_SET_MCAST_FILTER_CMD *cmd = (WMI_SET_MCAST_FILTER_CMD*)cmdbuf;
-    return snprintf(output, len, "%02X:%02X:%02X:%02X:%02X:%02X",
-                    cmd->multicast_mac[0], cmd->multicast_mac[1], cmd->multicast_mac[2], 
-                    cmd->multicast_mac[3], cmd->multicast_mac[4], cmd->multicast_mac[5]);
-}
-
-static int WMI_DEL_MCAST_FILTER_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    return WMI_SET_MCAST_FILTER_CMDID_fmt(output, len, cmdbuf);
-}
-
-static int WMI_MCAST_FILTER_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    WMI_MCAST_FILTER_CMD *cmd = (WMI_MCAST_FILTER_CMD*)cmdbuf;
-    return snprintf(output, len, "%s", enable2text(cmd->enable));
-}
-
-static int WMI_START_SCAN_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    int i;
-    int ret = 0;
-    WMI_START_SCAN_CMD *cmd = (WMI_START_SCAN_CMD*)cmdbuf;
-    const char *scanType = (cmd->scanType == WMI_SHORT_SCAN) ? "short" : "long";
-    if (cmd->forceFgScan) {
-        ret += snprintf(output+ret, len-ret, "forceFg ");
-    }
-    ret += snprintf(output+ret, len-ret, "hmdwell %u ", cmd->homeDwellTime);
-    ret += snprintf(output+ret, len-ret, "fscanint %u ", cmd->forceScanInterval);
-    ret += snprintf(output+ret, len-ret, "%s ", scanType);
-    for (i=0; i<cmd->numChannels; ++i) {
-        ret += snprintf(output+ret, len-ret, "%d ", cmd->channelList[i]);
-    }
-    return ret;
-}
-
-static int WMI_CONNECT_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    WMI_CONNECT_CMD *cmd = (WMI_CONNECT_CMD*)cmdbuf;
-    char ssid[33];
-    char pairwise[128], group[128];
-    const char *dot11Auth, *authMode;
-    memcpy(ssid, cmd->ssid, 32);
-    ssid[cmd->ssidLength] = 0;
-    cipher2text(pairwise, sizeof(pairwise), cmd->pairwiseCryptoType);
-    cipher2text(group, sizeof(group), cmd->groupCryptoType);
-
-    switch (cmd->dot11AuthMode) {
-    CASE_STR(OPEN_AUTH, dot11Auth);
-    CASE_STR(SHARED_AUTH, dot11Auth);
-    CASE_STR(LEAP_AUTH, dot11Auth);
-    CASE_DEF_STR(dot11Auth);
-    }
-
-    switch (cmd->authMode) {
-    CASE_STR(WMI_NONE_AUTH, authMode);
-    CASE_STR(WMI_WPA_AUTH, authMode);
-    CASE_STR(WMI_WPA2_AUTH, authMode);
-    CASE_STR(WMI_WPA_PSK_AUTH, authMode);
-    CASE_STR(WMI_WPA2_PSK_AUTH, authMode);
-    CASE_STR(WMI_WPA_AUTH_CCKM, authMode);
-    CASE_STR(WMI_WPA2_AUTH_CCKM, authMode);
-    CASE_DEF_STR(authMode);
-    }
-    return snprintf(output, len, "'%s' ch %d %s %s uni:%s grp:%s %02X:%02X:%02X:%02X:%02X:%02X ctrl 0x%x",
-        ssid, cmd->channel, 
-        dot11Auth, authMode, pairwise, group,
-        cmd->bssid[0], cmd->bssid[1], cmd->bssid[2], 
-        cmd->bssid[3], cmd->bssid[4], cmd->bssid[5], 
-        cmd->ctrl_flags);
-}
-
-static int WMI_SET_BTCOEX_FE_ANT_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    WMI_SET_BTCOEX_FE_ANT_CMD *cmd = (WMI_SET_BTCOEX_FE_ANT_CMD*)cmdbuf;
-    const char *fe;
-    switch (cmd->btcoexFeAntType) {
-    CASE_STR(WMI_BTCOEX_NOT_ENABLED, fe);
-    CASE_STR(WMI_BTCOEX_FE_ANT_SINGLE, fe);
-    CASE_STR(WMI_BTCOEX_FE_ANT_DUAL, fe);
-    CASE_STR(WMI_BTCOEX_FE_ANT_DUAL_HIGH_ISO, fe);
-    CASE_DEF_STR(fe);
-    }
-    return snprintf(output, len, "%s", fe);
-}
-
-static int WMI_SET_BTCOEX_SCO_CONFIG_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    WMI_SET_BTCOEX_SCO_CONFIG_CMD *cmd = (WMI_SET_BTCOEX_SCO_CONFIG_CMD*)cmdbuf;
-    char scoFlags[512];
-    int blen = sizeof(scoFlags);
-    int bret = 0;
-    BIT_STR(scoFlags, blen, bret, "OPT ", (1<<0), cmd->scoConfig.scoFlags);
-    BIT_STR(scoFlags, blen, bret, "EDR ", (1<<1), cmd->scoConfig.scoFlags);   
-    BIT_STR(scoFlags, blen, bret, "MASTER ", (1<<2), cmd->scoConfig.scoFlags);
-    BIT_STR(scoFlags, blen, bret, "FRM ", (1<<3), cmd->scoConfig.scoFlags);
-    scoFlags[(bret>0) ? --bret : bret] = 0;
-
-    return snprintf(output, len, "%d/%d slots [%s] ps %u-%u-%u opt %u-%u-%u-%u-%u-%u scan %u/%u", 
-                    cmd->scoConfig.scoSlots, cmd->scoConfig.scoIdleSlots, scoFlags,
-
-                    cmd->scoPspollConfig.scoCyclesForceTrigger,
-                    cmd->scoPspollConfig.scoDataResponseTimeout,
-                    cmd->scoPspollConfig.scoPsPollLatencyFraction,
-
-                    cmd->scoOptModeConfig.scoStompCntIn100ms,
-                       cmd->scoOptModeConfig.scoContStompMax,
-                       cmd->scoOptModeConfig.scoMinlowRateMbps,
-                       cmd->scoOptModeConfig.scoLowRateCnt,
-                       cmd->scoOptModeConfig.scoHighPktRatio,
-                       cmd->scoOptModeConfig.scoMaxAggrSize,
-
-                    cmd->scoWlanScanConfig.scanInterval,
-                    cmd->scoWlanScanConfig.maxScanStompCnt);
-}
-
-static int WMI_SET_BTCOEX_A2DP_CONFIG_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    return 0;
-}
-
-static int WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    return 0;
-}
-
-static int WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD *cmd = (WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD*)cmdbuf;
-    return snprintf(output, len, "pspoll every %u inquiry duration %u",
-                    cmd->btInquiryDataFetchFrequency,
-                    cmd->protectBmissDurPostBtInquiry);
-}
-
-static int WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD *cmd = (WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD*)cmdbuf;
-    const char *profile;
-    const char *op = (cmd->btOperatingStatus==1) ? "START" : "STOP";
-    switch (cmd->btProfileType) {
-    CASE_STR_CONST(SCO, 1, profile);
-    CASE_STR_CONST(A2DP, 2, profile);
-    CASE_STR_CONST(Inquiry, 3, profile);
-    CASE_STR_CONST(ACL, 4, profile);
-    CASE_DEF_STR(profile);
-    }
-    return snprintf(output, len, "%s %s", profile, op);
-}
-
-static int WMI_SET_LISTEN_INT_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    WMI_LISTEN_INT_CMD *cmd = (WMI_LISTEN_INT_CMD*)cmdbuf;
-    return snprintf(output, len, "interval %d numBeacons %d", cmd->listenInterval, cmd->numBeacons);
-}
-
-static int WMI_SET_BSS_FILTER_CMDID_fmt(char *output, size_t len, const A_UINT8 *cmdbuf)
-{
-    WMI_BSS_FILTER_CMD *cmd = (WMI_BSS_FILTER_CMD*)cmdbuf;
-    const char *filter;
-    switch (cmd->bssFilter) {
-    CASE_STR(NONE_BSS_FILTER, filter);
-    CASE_STR(ALL_BSS_FILTER, filter);
-    CASE_STR(PROFILE_FILTER, filter);
-    CASE_STR(ALL_BUT_PROFILE_FILTER, filter);
-    CASE_STR(CURRENT_BSS_FILTER, filter);
-    CASE_STR(ALL_BUT_BSS_FILTER, filter);
-    CASE_STR(PROBED_SSID_FILTER, filter);
-    CASE_STR(LAST_BSS_FILTER, filter);
-    CASE_DEF_STR(filter);
-    }
-    return snprintf(output, len, "[%s]", filter);
-}
-
-static int CO_CHANGE_CHANNEL_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 freq = buffer[1];
-    A_INT32 duration = buffer[2];
-    return snprintf(output, len, "freq %d duration %d", freq, duration);
-}
-
-static int CO_CHANGE_STATE_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 stateLog = (numargs==1) ? buffer[1] : buffer[2];
-    int op = stateLog & 0xff;
-    const char *opstr = op ? "set" : "clr";
-    int opState = (stateLog >> 8) & 0xff;
-    int oldState = stateLog >> 16;
-    int newState = (op) ? (oldState | opState) : (oldState & ~(opState));
-    char state[256];
-    size_t blen = sizeof(state);
-    int ret = 0;
-    BIT_STR(state, blen, ret, "DRAIN_IN_PROGRESS ", 0x01, newState);
-    BIT_STR(state, blen, ret, "FAKE_SLEEP_ENABLE_IN_PROGRESS ", 0x02, newState);
-    BIT_STR(state, blen, ret, "FAKE_SLEEP_ENABLED ", 0x04, newState);
-    BIT_STR(state, blen, ret, "TXQ_PAUSED ", 0x08, newState);
-    BIT_STR(state, blen, ret, "CHANNEL_CHANGE_IN_PROGRESS ", 0x10, newState);
-    state[(ret>0) ? --ret : ret] = 0;
-
-    ret = 0;
-    if (numargs==2) {
-        ret = snprintf(output+ret, len-ret, "dev %d ", buffer[1]);
-    }
-    ret += snprintf(output+ret, len-ret, "0x%x %s 0x%x->0x%x [%s]",
-                    oldState, opstr, opState, newState, state);
-    return ret;
-}
-
-static int TXRX_MGMTBUF_WLAN_RESET_ON_ERROR_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    if (numargs==1) {
-        char buf[512];
-        A_INT32 rxfilter = buffer[1];
-        rxfilter2text(buf, sizeof(buf),rxfilter);
-        return snprintf(output, len, "rxfilter:[%s]", buf);
-    } else if (numargs==2) {
-        return snprintf(output, len, "rstCnt %d caller %p", 
-                        buffer[1], (void*)buffer[2]);
-    } else {
-        return 0;
-    }
-}
-static int TXRX_MGMTBUF_WAIT_FOR_TXQ_DRAIN_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *mid;
-    switch (buffer[2]) {
-    CASE_STR_CONST(CO, 0x001, mid);
-    CASE_STR_CONST(PM, 0x002, mid);
-    CASE_STR_CONST(BTCOEX, 0x004, mid);
-    CASE_DEF_STR(mid);
-    }
-    return snprintf(output, len, "wait drain %d ms %s ", buffer[1], mid);
-}
-
-static int TXRX_MGMTBUF_REAPED_BUF_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *txstatus = txrxstatus2text(buffer[2]);
-    return snprintf(output, len, "mgt %p %s", (void*)buffer[1], txstatus);
-}
-
-static int TXRX_MGMTBUF_DRAINQ_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 hwq = buffer[1];
-    A_INT32 depth = buffer[2];
-    return snprintf(output, len, "hwq 0x%x depth 0x%x", hwq, depth);
-}
-
-static int DC_RECEIVED_ANY_BEACON_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    if (numargs==1) {
-        A_INT32 addr3 = buffer[1];
-        return snprintf(output, len, "addr3 ??:??:%02X:%02X:%02X:%02X",
-                 (addr3 & 0xff), ((addr3>>8)&0xff), ((addr3>>16)&0xff), ((addr3>>24)&0xff));
-    } else if (numargs==2) {
-        A_UINT64 tsf;
-        A_UINT8 ie_tstamp[8];
-        ie_tstamp[4] = buffer[1] & 0xff;
-        ie_tstamp[5] = (buffer[1]>>8) & 0xff;
-        ie_tstamp[6] = (buffer[1]>>16) & 0xff;
-        ie_tstamp[7] = (buffer[1]>>24) & 0xff;
-        ie_tstamp[0] = buffer[2] & 0xff;
-        ie_tstamp[1] = (buffer[2]>>8) & 0xff;
-        ie_tstamp[2] = (buffer[2]>>16) & 0xff;
-        ie_tstamp[3] = (buffer[2]>>24) & 0xff;
-        A_MEMCPY((A_UINT8 *)&tsf, ie_tstamp, sizeof(ie_tstamp));
-        return snprintf(output, len, "ie_tsf %llu", tsf);
-    }
-    return 0;
-}
-
-static int DC_SET_POWER_MODE_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *pm = pmmode2text(buffer[1]);
-    return snprintf(output, len, "%s caller %p", pm, (void*)buffer[2]);
-}
-
-static int DC_SSID_PROBE_CB_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *txstatus = txrxstatus2text(buffer[1]);
-    return snprintf(output, len, "%s", txstatus);
-}
-
-static int DC_SEARCH_OPPORTUNITY_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *opt;
-    switch (buffer[1]) {
-    CASE_STR_CONST(SCAN_IN_PROGRESS, 1, opt);
-    CASE_STR_CONST(NOT_SCAN_IN_PROGRESS,  0, opt);
-    CASE_DEF_STR(opt);
-    }
-    return snprintf(output, len, "%s", opt);
-}
-
-static int DC_SEND_NEXT_SSID_PROBE_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *flags;
-    switch (buffer[2]) {
-    CASE_STR(DISABLE_SSID_FLAG, flags);
-    CASE_STR(SPECIFIC_SSID_FLAG, flags);
-    CASE_STR(ANY_SSID_FLAG, flags);
-    CASE_DEF_STR(flags);
-    }  
-    return snprintf(output, len, "idx %d %s", buffer[1], flags);
-}
-
-static int DC_SCAN_CHAN_FINISH_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_UINT16 freq = buffer[1] & 0xffff;
-    A_UINT16 status = (buffer[1] >> 16) & 0xffff;
-    A_INT32 rxfilter = buffer[2];   
-    char rxfilterMsg[1024];
-    rxfilter2text(rxfilterMsg, sizeof(rxfilterMsg), rxfilter);
-    return snprintf(output, len, "freq %d status %s(%d), %s", 
-                    freq, status2text(status), status, rxfilterMsg);
-}
-
-static int DC_SCAN_CHAN_START_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 rxfilter = buffer[2];   
-    char rxfilterMsg[1024];
-    A_UINT16 freq;
-    A_UINT16 attrib;
-    const char *probed;
-    rxfilter2text(rxfilterMsg, sizeof(rxfilterMsg), rxfilter);
-    freq = buffer[1] & 0xffff;
-    attrib = (buffer[1] >> 16) & 0xffff;
-    probed = ((attrib & (0x0100|0x10))==(0x0100|0x10)) && !(attrib &  0x0800) ? "allow" : "not allow";
-
-    return snprintf(output, len, "freq %d attrib %d probed %s %s", 
-                    freq, attrib, probed, rxfilterMsg);
-}
-
-static int DC_START_SEARCH_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    if (numargs==1) {
-        return snprintf(output, len, "devid %d", buffer[1]);
-    } else {
-        A_INT32 stype = buffer[1];
-        int ret = 0;  
-        char buf[1024];
-        size_t blen = sizeof(buf);
-        if (stype == 0) {
-            BIT_STR(buf, blen, ret, "RESET "                     , 0, stype);
-        }
-        BIT_STR(buf, blen, ret, "ALL "                      , (0x01|0x02|0x04|0x08), stype);
-        if (((0x01|0x02|0x04|0x08)& stype)!=(0x01|0x02|0x04|0x08)) {
-            BIT_STR(buf, blen, ret, "POPULAR "                   , (0x02 | 0x04 | 0x08), stype);
-            if (((0x02|0x04|0x08)& stype)!=(0x02|0x04|0x08)) {
-                BIT_STR(buf, blen, ret, "SSIDS "                     , (0x04 | 0x08), stype);
-                if (((0x04|0x08)& stype)!=(0x04|0x08)) {
-                    BIT_STR(buf, blen, ret, "PROF_MASK "                 , (0x08), stype);
-                }
-            }
-        }
-
-        BIT_STR(buf, blen, ret, "MULTI_CHANNEL "             , 0x000100, stype);
-        BIT_STR(buf, blen, ret, "DETERMINISTIC "             , 0x000200, stype);
-        BIT_STR(buf, blen, ret, "PROFILE_MATCH_TERMINATED "  , 0x000400, stype);
-        BIT_STR(buf, blen, ret, "HOME_CHANNEL_SKIP "         , 0x000800, stype);
-        BIT_STR(buf, blen, ret, "CHANNEL_LIST_CONTINUE "     , 0x001000, stype);
-        BIT_STR(buf, blen, ret, "CURRENT_SSID_SKIP "         , 0x002000, stype);
-        BIT_STR(buf, blen, ret, "ACTIVE_PROBE_DISABLE "      , 0x004000, stype);
-        BIT_STR(buf, blen, ret, "CHANNEL_HINT_ONLY "         , 0x008000, stype);
-        BIT_STR(buf, blen, ret, "ACTIVE_CHANNELS_ONLY "      , 0x010000, stype);
-        BIT_STR(buf, blen, ret, "UNUSED1 "                   , 0x020000, stype);
-        BIT_STR(buf, blen, ret, "PERIODIC "                  , 0x040000, stype);
-        BIT_STR(buf, blen, ret, "FIXED_DURATION "            , 0x080000, stype);
-        BIT_STR(buf, blen, ret, "AP_ASSISTED "               , 0x100000, stype);
-        buf[(ret>0) ? --ret : ret] = 0;
-        return snprintf(output, len, "%s cb 0x%x", buf, buffer[2]);
-    }
-}
-
-static int PM_CHAN_OP_REQ_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *start = (buffer[1]==1) ? "start" : "stop";
-    A_INT32 chanOpReq = buffer[2];
-    return snprintf(output, len, "%s chan OpReq %d", start, chanOpReq);
-}
-
-static int PM_SET_ALL_BEACON_POLICY_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *policyMsg;
-    A_UINT16 policy = buffer[1];
-    A_UINT32 cnt = buffer[2];
-    switch (policy) {
-    CASE_STR_CONST(disallow, 1, policyMsg);
-    CASE_STR_CONST(allow, 2, policyMsg);
-    CASE_DEF_STR(policyMsg);
-    }
-    return snprintf(output, len, "%s beacons filterCnt %d", policyMsg, cnt);
-}
-
-static int PM_SET_MY_BEACON_POLICY_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *policyMsg;
-    A_UINT16 policy = buffer[1] & 0xff;
-    A_UINT32 bMiss = (buffer[1] >> 8);
-    A_UINT32 myBeaconCnt = buffer[2];
-    switch (policy) {
-    CASE_STR_CONST(disallow, 1, policyMsg);
-    CASE_STR_CONST(allow, 2, policyMsg);
-    CASE_DEF_STR(policyMsg);
-    }
-    return snprintf(output, len, "bmiss %d %s during sleep filterCnt %d", bMiss, policyMsg, myBeaconCnt);
-}
-
-
-static int PM_SET_STATE_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT16 pmStateWakeupCount = (buffer[1] >> 16) & 0xffff;
-    A_INT16 pmState = buffer[1] & 0xffff;
-    A_INT16 pmAwakeCount = (buffer[2] >> 16) & 0xffff;
-    A_INT8 pmSleepCount = (buffer[2] >> 8) & 0xff;
-    A_INT8 pmOldState = buffer[2] & 0xff;
-    return snprintf(output, len, "StateWakeupCnt %d AwakeCnt %d, SleepCnt %d, %s to %s",
-                    pmStateWakeupCount, pmAwakeCount, pmSleepCount, 
-                    pmmode2text(pmOldState), pmmode2text(pmState));
-}
-
-static int PM_SET_POWERMODE_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_UINT16 wcnt = buffer[1] >> 16;
-    A_UINT16 fakeSleep = buffer[1] & 0xffff;
-    A_UINT16 oldPowerMode = buffer[2] >> 16;
-    A_UINT8 powerMode = (buffer[2] >> 8) & 0xff;
-    A_UINT8 moduleId = buffer[2] & 0xff;
-    return snprintf(output, len, "wakeCnt %d fakeSleep %d %s(%d)=>%s(%d) %s(%d)",
-         wcnt, fakeSleep, pmmode2text(oldPowerMode), oldPowerMode, pmmode2text(powerMode), powerMode, pmmodule2text(moduleId), moduleId);
-}
-
-static int PM_FAKE_SLEEP_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT16 enable = (buffer[1] >> 16) & 0xffff;
-    const char *state = enable2text(enable);
-    A_INT8 pmFakeSleepCount = (buffer[1] >> 8) & 0xff;
-    A_INT8 fakeSleepEnable = (buffer[1] & 0xff);
-    A_INT16 forceAwake = (buffer[2] >> 16) & 0xffff;
-    A_INT8 dontWaitForDrain = (buffer[2] >> 8) & 0xff;
-    A_INT8 module = buffer[2] & 0xff;
-    return snprintf(output, len, "%s cnt %d hasCnt %d forceAwake %d dontWaitDrain %d %s(%d)",
-            state, pmFakeSleepCount, fakeSleepEnable, forceAwake, dontWaitForDrain, pmmodule2text(module), module);
-}
-
-static int BTCOEX_DBG_pmwakeupcnt_flags(char *output, size_t len, A_INT32 pmWakeupCnt, A_INT32 btCoexFlags)
-{
-    int ret = 0;
-    ret += snprintf(output+ret, len-ret, "coexPmWakeupCnt %d", pmWakeupCnt);
-    if (btCoexFlags!=-1) {
-        char buf[512];
-        btcoexFlags2text(buf, sizeof(buf), btCoexFlags);
-        ret += snprintf(output+ret, len-ret, " coex [%s]", buf);
-    }
-    return ret;
-}
-
-static int BTCOEX_ACL_COEX_STATUS_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 btStatus = (buffer[1] >> 16) & 0xffff;
-    A_INT32 redoAggr = buffer[1] & 0xffff;
-    return snprintf(output, len, "%s redoAggr %d", btStatus2text(btStatus), redoAggr);
-}
-
-static int BTCOEX_DBG_PM_SLEEP_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 pmWakeupCnt = buffer[1];
-    A_INT32 btCoexFlags = buffer[2];
-    return BTCOEX_DBG_pmwakeupcnt_flags(output,len,pmWakeupCnt,btCoexFlags); 
-}
-
-static int BTCOEX_PSPOLL_QUEUED_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT16 isEolEnabled = (buffer[1] >> 16) & 0xffff;
-    A_INT8 bSendAtLowestRate = (buffer[1] >>8) & 0xff;
-    A_INT8 isPmSleep = (buffer[1]) & 0xff;
-    return snprintf(output, len, "Eol:%s LowestRate:%s PmSleep:%s", 
-                    enable2text(isEolEnabled), enable2text(bSendAtLowestRate),
-                    enable2text(isPmSleep));
-}
-
-static int BTCOEX_PSPOLL_COMPLETE_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    return snprintf(output, len, "%s", txrxstatus2text(buffer[1]));
-}
-
-static int BTCOEX_DBG_PM_AWAKE_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    return BTCOEX_DBG_PM_SLEEP_fmt(output,len,numargs,buffer);
-}
-
-static int BTCOEX_DBG_GO_TO_SLEEP_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    return BTCOEX_DBG_pmwakeupcnt_flags(output,len,buffer[1],-1);
-}
-
-static int BTCOEX_WAKEUP_ON_DATA_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    return BTCOEX_DBG_pmwakeupcnt_flags(output,len,buffer[2], buffer[1]);
-}
-
-static int BTCOEX_TIM_NOTIFICATION_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    int ret = 0;
-    A_INT32 btCoexFlags = buffer[1];
-    A_INT32 btStatus = (buffer[2]>>16) & 0xffff;
-    A_INT32 pmWakeupCnt = (buffer[2] & 0xffff);
-    ret = BTCOEX_DBG_pmwakeupcnt_flags(output,len, pmWakeupCnt, btCoexFlags);
-    ret += snprintf(output+ret, len-ret, " %s", btStatus2text(btStatus));
-    return ret;
-}
-
-static int BTCOEX_DBG_ALLOW_SCAN_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    char buf[512];
-    A_INT32 retStatus = buffer[2];
-    A_INT32 btState = buffer[1];
-    btState2text(buf, sizeof(buf), btState);
-    return snprintf(output, len, "state: [%s] allow:%d", buf, retStatus);
-}
-
-static int BTCOEX_DBG_SCAN_REQUEST_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    char buf[512];
-    A_INT32 scanReqEnabled = buffer[2];
-    A_INT32 btState = buffer[1];
-    btState2text(buf, sizeof(buf), btState);
-    return snprintf(output, len, "state: [%s] scanReqEnabled:%d", buf, scanReqEnabled);
-}
-
-static int BTCOEX_DBG_SET_WLAN_STATE_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 btCoexFlags = buffer[2];
-    char buf[512];
-    const char *wlanState;
-    switch (buffer[1]) {
-    CASE_STR_CONST(IDLE     , 1, wlanState);
-    CASE_STR_CONST(CONNECTED , 2, wlanState);
-    CASE_STR_CONST(SCAN_START  , 3, wlanState);
-    CASE_STR_CONST(CONNECT_START ,4, wlanState);
-    CASE_STR_CONST(SCAN_END    , 5, wlanState);
-    CASE_STR_CONST(APMODE_STA_CONNECTED , 6, wlanState);
-    CASE_STR_CONST(APMODE_IDLE , 7, wlanState);
-    CASE_STR_CONST(APMODE_SWITCH , 8, wlanState);
-    CASE_STR_CONST(APMODE_TEARDOWN , 9, wlanState);
-    CASE_DEF_STR(wlanState);
-    }
-    btcoexFlags2text(buf, sizeof(buf), btCoexFlags);
-    return snprintf(output, len, "wlan %s coex [%s]", wlanState, buf);
-}
-
-static int BTCOEX_DBG_BT_INQUIRY_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *btState = btStatus2text(buffer[1]);
-    A_INT32 btCoexFlags = buffer[2];
-    char buf[512];
-    btcoexFlags2text(buf, sizeof(buf), btCoexFlags);
-    return snprintf(output, len, "%s coex [%s]", btState, buf);
-}
-
-static int BTCOEX_SET_WEIGHTS_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *weights;
-    switch (buffer[1]) {
-    CASE_STR_CONST(ALL_BT_TRAFFIC,1,weights);
-    CASE_STR_CONST(ONLY_HIGH_PRI_BT_TRAFFIC,2,weights);
-    CASE_STR_CONST(STOMP_ALL_BT_TRAFFIC,3,weights);
-    CASE_STR_CONST(ONLY_A2DP_TRAFFIC,4,weights);
-    CASE_STR_CONST(ONLY_HIGH_PRIO_AND_A2DP,5,weights);
-    CASE_STR_CONST(A2DP_STOMPED,6,weights);
-    CASE_STR_CONST(ALL_BT_TRAFFIC_WTX,7,weights);
-    CASE_STR_CONST(ALL_BT_TRAFFIC_WTX_HIGHISO_TXRX,8,weights);
-    CASE_STR_CONST(HIGH_PRI_TRAFFIC_WTX,9,weights);
-    CASE_STR_CONST(HIGH_PRI_TRAFFIC_WTX_HIGHISO_TXRX,0xa,weights);
-    CASE_STR_CONST(MCI_TEST,0xb,weights);
-    CASE_DEF_STR(weights);
-    }
-
-    return snprintf(output, len, "%s val 0x%x", weights, buffer[2]);    
-}
-
-static int BTCOEX_PM_FAKE_SLEEP_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *enable = enable2text(buffer[1]);
-    A_STATUS status = buffer[2];
-    return snprintf(output, len, "%s -> %s", enable, status2text(status));
-}
-
-static const struct wmi_id_desc evt_desc[] = {
-    WM_ID_DESC(WMI_READY_EVENTID), 
-    WM_ID_DESC(WMI_CONNECT_EVENTID),
-    WM_ID_DESC(WMI_DISCONNECT_EVENTID),
-    WM_ID_DESC(WMI_BSSINFO_EVENTID),
-    WM_ID_DESC(WMI_CMDERROR_EVENTID),
-    WM_ID_DESC(WMI_REGDOMAIN_EVENTID),
-    WM_ID_DESC(WMI_PSTREAM_TIMEOUT_EVENTID),
-    WM_ID_DESC(WMI_NEIGHBOR_REPORT_EVENTID),
-    WM_ID_DESC(WMI_TKIP_MICERR_EVENTID),
-    WM_ID_DESC(WMI_SCAN_COMPLETE_EVENTID),           /* 0x100a */
-    WM_ID_DESC(WMI_REPORT_STATISTICS_EVENTID),
-    WM_ID_DESC(WMI_RSSI_THRESHOLD_EVENTID),
-    WM_ID_DESC(WMI_ERROR_REPORT_EVENTID),
-    WM_ID_DESC(WMI_OPT_RX_FRAME_EVENTID),
-    WM_ID_DESC(WMI_REPORT_ROAM_TBL_EVENTID),
-    WM_ID_DESC(WMI_EXTENSION_EVENTID),
-    WM_ID_DESC(WMI_CAC_EVENTID),
-    WM_ID_DESC(WMI_SNR_THRESHOLD_EVENTID),
-    WM_ID_DESC(WMI_LQ_THRESHOLD_EVENTID),
-    WM_ID_DESC(WMI_TX_RETRY_ERR_EVENTID),            /* 0x1014 */
-    WM_ID_DESC(WMI_REPORT_ROAM_DATA_EVENTID),
-    WM_ID_DESC(WMI_TEST_EVENTID),
-    WM_ID_DESC(WMI_APLIST_EVENTID),
-    WM_ID_DESC(WMI_GET_WOW_LIST_EVENTID),
-    WM_ID_DESC(WMI_GET_PMKID_LIST_EVENTID),
-    WM_ID_DESC(WMI_CHANNEL_CHANGE_EVENTID),
-    WM_ID_DESC(WMI_PEER_NODE_EVENTID),
-    WM_ID_DESC(WMI_PSPOLL_EVENTID),
-    WM_ID_DESC(WMI_DTIMEXPIRY_EVENTID),
-    WM_ID_DESC(WMI_WLAN_VERSION_EVENTID),
-    WM_ID_DESC(WMI_SET_PARAMS_REPLY_EVENTID),
-    WM_ID_DESC(WMI_ADDBA_REQ_EVENTID),              /*0x1020 */
-    WM_ID_DESC(WMI_ADDBA_RESP_EVENTID),
-    WM_ID_DESC(WMI_DELBA_REQ_EVENTID),
-    WM_ID_DESC(WMI_TX_COMPLETE_EVENTID),
-    WM_ID_DESC(WMI_HCI_EVENT_EVENTID),
-    WM_ID_DESC(WMI_ACL_DATA_EVENTID),
-    WM_ID_DESC(WMI_REPORT_SLEEP_STATE_EVENTID),
-
-    WM_ID_DESC(WMI_WAPI_REKEY_EVENTID),
-
-    WM_ID_DESC(WMI_REPORT_BTCOEX_STATS_EVENTID),
-    WM_ID_DESC(WMI_REPORT_BTCOEX_CONFIG_EVENTID),
-    WM_ID_DESC(WMI_GET_PMK_EVENTID),
-
-    /* DFS Events */
-    WM_ID_DESC(WMI_DFS_HOST_ATTACH_EVENTID),
-    WM_ID_DESC(WMI_DFS_HOST_INIT_EVENTID),
-    WM_ID_DESC(WMI_DFS_RESET_DELAYLINES_EVENTID),
-    WM_ID_DESC(WMI_DFS_RESET_RADARQ_EVENTID),
-    WM_ID_DESC(WMI_DFS_RESET_AR_EVENTID),
-    WM_ID_DESC(WMI_DFS_RESET_ARQ_EVENTID),          /*0x1030*/
-    WM_ID_DESC(WMI_DFS_SET_DUR_MULTIPLIER_EVENTID),
-    WM_ID_DESC(WMI_DFS_SET_BANGRADAR_EVENTID),
-    WM_ID_DESC(WMI_DFS_SET_DEBUGLEVEL_EVENTID),
-    WM_ID_DESC(WMI_DFS_PHYERR_EVENTID),
-    /* CCX Evants */
-    WM_ID_DESC(WMI_CCX_RM_STATUS_EVENTID),
-
-    /* P2P Events */
-    WM_ID_DESC(WMI_P2P_GO_NEG_RESULT_EVENTID),
-
-    WM_ID_DESC(WMI_WAC_SCAN_DONE_EVENTID),
-    WM_ID_DESC(WMI_WAC_REPORT_BSS_EVENTID),
-    WM_ID_DESC(WMI_WAC_START_WPS_EVENTID),
-    WM_ID_DESC(WMI_WAC_CTRL_REQ_REPLY_EVENTID),
-        
-    /*RFKILL Events*/
-    WM_ID_DESC(WMI_RFKILL_STATE_CHANGE_EVENTID),
-    WM_ID_DESC(WMI_RFKILL_GET_MODE_CMD_EVENTID),
-
-    /* More P2P Events */
-    WM_ID_DESC(WMI_P2P_GO_NEG_REQ_EVENTID),
-    WM_ID_DESC(WMI_P2P_INVITE_REQ_EVENTID),
-    WM_ID_DESC(WMI_P2P_INVITE_RCVD_RESULT_EVENTID),
-    WM_ID_DESC(WMI_P2P_INVITE_SENT_RESULT_EVENTID), /*1040*/
-    WM_ID_DESC(WMI_P2P_PROV_DISC_RESP_EVENTID),
-    WM_ID_DESC(WMI_P2P_PROV_DISC_REQ_EVENTID),
-    WM_ID_DESC(WMI_P2P_START_SDPD_EVENTID),
-    WM_ID_DESC(WMI_P2P_SDPD_RX_EVENTID),
-};
-
-static const struct wmi_id_desc cmds_desc[] = {
-    WM_ID_DESC_FMT(WMI_CONNECT_CMDID, sizeof(WMI_CONNECT_CMD)),
-    WM_ID_DESC(WMI_RECONNECT_CMDID),
-    WM_ID_DESC(WMI_DISCONNECT_CMDID),
-    WM_ID_DESC(WMI_SYNCHRONIZE_CMDID),
-    WM_ID_DESC(WMI_CREATE_PSTREAM_CMDID),
-    WM_ID_DESC(WMI_DELETE_PSTREAM_CMDID),
-    WM_ID_DESC_FMT(WMI_START_SCAN_CMDID, sizeof(WMI_START_SCAN_CMD)),
-    WM_ID_DESC(WMI_SET_SCAN_PARAMS_CMDID),
-    WM_ID_DESC_FMT(WMI_SET_BSS_FILTER_CMDID, sizeof(WMI_BSS_FILTER_CMD)),
-    WM_ID_DESC(WMI_SET_PROBED_SSID_CMDID),               /* 10 */
-    WM_ID_DESC_FMT(WMI_SET_LISTEN_INT_CMDID, sizeof(WMI_LISTEN_INT_CMD)),
-    WM_ID_DESC(WMI_SET_BMISS_TIME_CMDID),
-    WM_ID_DESC(WMI_SET_DISC_TIMEOUT_CMDID),
-    WM_ID_DESC(WMI_GET_CHANNEL_LIST_CMDID),
-    WM_ID_DESC(WMI_SET_BEACON_INT_CMDID),
-    WM_ID_DESC(WMI_GET_STATISTICS_CMDID),
-    WM_ID_DESC(WMI_SET_CHANNEL_PARAMS_CMDID),
-    WM_ID_DESC(WMI_SET_POWER_MODE_CMDID),
-    WM_ID_DESC(WMI_SET_IBSS_PM_CAPS_CMDID),
-    WM_ID_DESC(WMI_SET_POWER_PARAMS_CMDID),              /* 20 */
-    WM_ID_DESC(WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID),
-    WM_ID_DESC(WMI_ADD_CIPHER_KEY_CMDID),
-    WM_ID_DESC(WMI_DELETE_CIPHER_KEY_CMDID),
-    WM_ID_DESC(WMI_ADD_KRK_CMDID),
-    WM_ID_DESC(WMI_DELETE_KRK_CMDID),
-    WM_ID_DESC(WMI_SET_PMKID_CMDID),
-    WM_ID_DESC(WMI_SET_TX_PWR_CMDID),
-    WM_ID_DESC(WMI_GET_TX_PWR_CMDID),
-    WM_ID_DESC(WMI_SET_ASSOC_INFO_CMDID),
-    WM_ID_DESC(WMI_ADD_BAD_AP_CMDID),                    /* 30 */
-    WM_ID_DESC(WMI_DELETE_BAD_AP_CMDID),
-    WM_ID_DESC(WMI_SET_TKIP_COUNTERMEASURES_CMDID),
-    WM_ID_DESC(WMI_RSSI_THRESHOLD_PARAMS_CMDID),
-    WM_ID_DESC(WMI_TARGET_ERROR_REPORT_BITMASK_CMDID),
-    WM_ID_DESC(WMI_SET_ACCESS_PARAMS_CMDID),
-    WM_ID_DESC(WMI_SET_RETRY_LIMITS_CMDID),
-    WM_ID_DESC(WMI_RESERVED1),
-    WM_ID_DESC(WMI_RESERVED2),
-    WM_ID_DESC(WMI_SET_VOICE_PKT_SIZE_CMDID),
-    WM_ID_DESC(WMI_SET_MAX_SP_LEN_CMDID),                /* 40 */
-    WM_ID_DESC(WMI_SET_ROAM_CTRL_CMDID),
-    WM_ID_DESC(WMI_GET_ROAM_TBL_CMDID),
-    WM_ID_DESC(WMI_GET_ROAM_DATA_CMDID),
-    WM_ID_DESC(WMI_ENABLE_RM_CMDID),
-    WM_ID_DESC(WMI_SET_MAX_OFFHOME_DURATION_CMDID),
-    WM_ID_DESC(WMI_EXTENSION_CMDID),                        /* Non-wireless extensions */
-    WM_ID_DESC(WMI_SNR_THRESHOLD_PARAMS_CMDID),
-    WM_ID_DESC(WMI_LQ_THRESHOLD_PARAMS_CMDID),
-    WM_ID_DESC(WMI_SET_LPREAMBLE_CMDID),
-    WM_ID_DESC(WMI_SET_RTS_CMDID),                       /* 50 */
-    WM_ID_DESC(WMI_CLR_RSSI_SNR_CMDID),
-    WM_ID_DESC(WMI_SET_FIXRATES_CMDID),
-    WM_ID_DESC(WMI_GET_FIXRATES_CMDID),
-    WM_ID_DESC(WMI_SET_AUTH_MODE_CMDID),
-    WM_ID_DESC(WMI_SET_REASSOC_MODE_CMDID),
-    WM_ID_DESC(WMI_SET_WMM_CMDID),
-    WM_ID_DESC(WMI_SET_WMM_TXOP_CMDID),
-    WM_ID_DESC(WMI_TEST_CMDID),
-    /* COEX AR6002 only*/
-    WM_ID_DESC(WMI_SET_BT_STATUS_CMDID),                
-    WM_ID_DESC(WMI_SET_BT_PARAMS_CMDID),                /* 60 */
-
-    WM_ID_DESC(WMI_SET_KEEPALIVE_CMDID),
-    WM_ID_DESC(WMI_GET_KEEPALIVE_CMDID),
-    WM_ID_DESC(WMI_SET_APPIE_CMDID),
-    WM_ID_DESC(WMI_GET_APPIE_CMDID),
-    WM_ID_DESC(WMI_SET_WSC_STATUS_CMDID),
-
-    /* Wake on Wireless */
-    WM_ID_DESC(WMI_SET_HOST_SLEEP_MODE_CMDID),
-    WM_ID_DESC(WMI_SET_WOW_MODE_CMDID),
-    WM_ID_DESC(WMI_GET_WOW_LIST_CMDID),
-    WM_ID_DESC(WMI_ADD_WOW_PATTERN_CMDID),
-    WM_ID_DESC(WMI_DEL_WOW_PATTERN_CMDID),               /* 70 */
-
-    WM_ID_DESC(WMI_SET_FRAMERATES_CMDID),
-    WM_ID_DESC(WMI_SET_AP_PS_CMDID),
-    WM_ID_DESC(WMI_SET_QOS_SUPP_CMDID),
-};
-
-static const struct wmi_id_desc cmdxs_desc[] = {
-    WM_ID_DESC(WMI_SET_BITRATE_CMDID),
-    WM_ID_DESC(WMI_GET_BITRATE_CMDID),
-    WM_ID_DESC(WMI_SET_WHALPARAM_CMDID),
-
-
-    /*Should add the new command to the tail for compatible with
-     * etna.
-     */
-    WM_ID_DESC(WMI_SET_MAC_ADDRESS_CMDID),
-    WM_ID_DESC(WMI_SET_AKMP_PARAMS_CMDID),
-    WM_ID_DESC(WMI_SET_PMKID_LIST_CMDID),
-    WM_ID_DESC(WMI_GET_PMKID_LIST_CMDID),
-    WM_ID_DESC(WMI_ABORT_SCAN_CMDID),
-    WM_ID_DESC(WMI_SET_TARGET_EVENT_REPORT_CMDID),
-
-    /* Unused */
-    WM_ID_DESC(WMI_UNUSED1),
-    WM_ID_DESC(WMI_UNUSED2),
-
-    /*
-     * AP mode commands
-     */
-    WM_ID_DESC(WMI_AP_HIDDEN_SSID_CMDID),
-    WM_ID_DESC(WMI_AP_SET_NUM_STA_CMDID),
-    WM_ID_DESC(WMI_AP_ACL_POLICY_CMDID),
-    WM_ID_DESC(WMI_AP_ACL_MAC_LIST_CMDID),
-    WM_ID_DESC(WMI_AP_CONFIG_COMMIT_CMDID),
-    WM_ID_DESC(WMI_AP_SET_MLME_CMDID),
-    WM_ID_DESC(WMI_AP_SET_PVB_CMDID),
-    WM_ID_DESC(WMI_AP_CONN_INACT_CMDID),
-    WM_ID_DESC(WMI_AP_PROT_SCAN_TIME_CMDID),
-    WM_ID_DESC(WMI_AP_SET_COUNTRY_CMDID),
-    WM_ID_DESC(WMI_AP_SET_DTIM_CMDID),
-    WM_ID_DESC(WMI_AP_MODE_STAT_CMDID),
-
-    WM_ID_DESC(WMI_SET_IP_CMDID),
-    WM_ID_DESC(WMI_SET_PARAMS_CMDID),
-    WM_ID_DESC_FMT(WMI_SET_MCAST_FILTER_CMDID, sizeof(WMI_SET_MCAST_FILTER_CMD)),
-    WM_ID_DESC_FMT(WMI_DEL_MCAST_FILTER_CMDID, sizeof(WMI_SET_MCAST_FILTER_CMD)),
-
-    WM_ID_DESC(WMI_ALLOW_AGGR_CMDID),
-    WM_ID_DESC(WMI_ADDBA_REQ_CMDID),
-    WM_ID_DESC(WMI_DELBA_REQ_CMDID),
-    WM_ID_DESC(WMI_SET_HT_CAP_CMDID),
-    WM_ID_DESC(WMI_SET_HT_OP_CMDID),
-    WM_ID_DESC(WMI_SET_TX_SELECT_RATES_CMDID),
-    WM_ID_DESC(WMI_SET_TX_SGI_PARAM_CMDID),
-    WM_ID_DESC(WMI_SET_RATE_POLICY_CMDID),
-
-    WM_ID_DESC(WMI_HCI_CMD_CMDID),
-    WM_ID_DESC(WMI_RX_FRAME_FORMAT_CMDID),
-    WM_ID_DESC(WMI_SET_THIN_MODE_CMDID),
-    WM_ID_DESC(WMI_SET_BT_WLAN_CONN_PRECEDENCE_CMDID),
-
-    WM_ID_DESC(WMI_AP_SET_11BG_RATESET_CMDID),
-    WM_ID_DESC(WMI_SET_PMK_CMDID),
-    WM_ID_DESC_FMT(WMI_MCAST_FILTER_CMDID, sizeof(WMI_MCAST_FILTER_CMD)),
-       /* COEX CMDID AR6003*/
-       WM_ID_DESC_FMT(WMI_SET_BTCOEX_FE_ANT_CMDID, sizeof(WMI_SET_BTCOEX_FE_ANT_CMD)),
-       WM_ID_DESC(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID),
-       WM_ID_DESC_FMT(WMI_SET_BTCOEX_SCO_CONFIG_CMDID, sizeof(WMI_SET_BTCOEX_SCO_CONFIG_CMD)),
-       WM_ID_DESC_FMT(WMI_SET_BTCOEX_A2DP_CONFIG_CMDID, sizeof(WMI_SET_BTCOEX_A2DP_CONFIG_CMD)),
-       WM_ID_DESC_FMT(WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID, sizeof(WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD)),
-       WM_ID_DESC_FMT(WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID, sizeof(WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD)),
-       WM_ID_DESC(WMI_SET_BTCOEX_DEBUG_CMDID),
-       WM_ID_DESC_FMT(WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID, sizeof(WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD)),
-       WM_ID_DESC(WMI_GET_BTCOEX_STATS_CMDID),
-       WM_ID_DESC(WMI_GET_BTCOEX_CONFIG_CMDID),
-
-    WM_ID_DESC(WMI_SET_DFS_ENABLE_CMDID),   /* F034 */
-    WM_ID_DESC(WMI_SET_DFS_MINRSSITHRESH_CMDID),
-    WM_ID_DESC(WMI_SET_DFS_MAXPULSEDUR_CMDID),
-    WM_ID_DESC(WMI_DFS_RADAR_DETECTED_CMDID),
-
-    /* P2P CMDS */
-    WM_ID_DESC(WMI_P2P_SET_CONFIG_CMDID),    /* F038 */
-    WM_ID_DESC(WMI_WPS_SET_CONFIG_CMDID),
-    WM_ID_DESC(WMI_SET_REQ_DEV_ATTR_CMDID),
-    WM_ID_DESC(WMI_P2P_FIND_CMDID),
-    WM_ID_DESC(WMI_P2P_STOP_FIND_CMDID),
-    WM_ID_DESC(WMI_P2P_GO_NEG_START_CMDID),
-    WM_ID_DESC(WMI_P2P_LISTEN_CMDID),
-
-    WM_ID_DESC(WMI_CONFIG_TX_MAC_RULES_CMDID),
-    WM_ID_DESC(WMI_SET_PROMISCUOUS_MODE_CMDID),/* F040 */
-    WM_ID_DESC(WMI_RX_FRAME_FILTER_CMDID),
-    WM_ID_DESC(WMI_SET_CHANNEL_CMDID),
-
-    /* WAC commands */
-    WM_ID_DESC(WMI_ENABLE_WAC_CMDID),
-    WM_ID_DESC(WMI_WAC_SCAN_REPLY_CMDID),
-    WM_ID_DESC(WMI_WAC_CTRL_REQ_CMDID),
-    WM_ID_DESC(WMI_SET_DIV_PARAMS_CMDID),
-
-    WM_ID_DESC(WMI_GET_PMK_CMDID),
-    WM_ID_DESC(WMI_SET_PASSPHRASE_CMDID),
-    WM_ID_DESC(WMI_SEND_ASSOC_RES_CMDID),
-    WM_ID_DESC(WMI_SET_ASSOC_REQ_RELAY_CMDID),
-    WM_ID_DESC(WMI_GET_RFKILL_MODE_CMDID),
-    WM_ID_DESC(WMI_SET_RFKILL_MODE_CMDID),
-
-    /* ACS command, consists of sub-commands */
-    WM_ID_DESC(WMI_ACS_CTRL_CMDID),
-    
-    /* Ultra low power store / recall commands */
-    WM_ID_DESC(WMI_STORERECALL_CONFIGURE_CMDID),
-    WM_ID_DESC(WMI_STORERECALL_RECALL_CMDID),
-    WM_ID_DESC(WMI_STORERECALL_HOST_READY_CMDID),
-    WM_ID_DESC(WMI_FORCE_TARGET_ASSERT_CMDID),
-    WM_ID_DESC(WMI_SET_EXCESS_TX_RETRY_THRES_CMDID),
-
-    WM_ID_DESC(WMI_P2P_GO_NEG_REQ_RSP_CMDID),  /* F053 */
-    WM_ID_DESC(WMI_P2P_GRP_INIT_CMDID),
-    WM_ID_DESC(WMI_P2P_GRP_FORMATION_DONE_CMDID),
-    WM_ID_DESC(WMI_P2P_INVITE_CMDID),
-    WM_ID_DESC(WMI_P2P_INVITE_REQ_RSP_CMDID),
-    WM_ID_DESC(WMI_P2P_PROV_DISC_REQ_CMDID),
-    WM_ID_DESC(WMI_P2P_SET_CMDID),
-
-    WM_ID_DESC(WMI_AP_SET_APSD_CMDID),         /* F05A */
-    WM_ID_DESC(WMI_AP_APSD_BUFFERED_TRAFFIC_CMDID),
-
-    WM_ID_DESC(WMI_P2P_SDPD_TX_CMDID), /* F05C */
-    WM_ID_DESC(WMI_P2P_STOP_SDPD_CMDID),
-    WM_ID_DESC(WMI_P2P_CANCEL_CMDID),
-};
-
-static int dbg_wmi_cmd_params_pos, dbg_wmi_cmd_params_cmdid;
-static A_UINT8 *dbg_wmi_cmd_params_buf;
-
-static int WMI_EVENT_SEND_XTND_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    const char *txt;
-    A_INT32 evt = buffer[1];
-    switch (evt) {
-    CASE_STR(WMIX_DSETOPENREQ_EVENTID, txt);
-    CASE_STR(WMIX_DSETCLOSE_EVENTID, txt);
-    CASE_STR(WMIX_DSETDATAREQ_EVENTID, txt);
-    CASE_STR(WMIX_GPIO_INTR_EVENTID, txt);
-    CASE_STR(WMIX_GPIO_DATA_EVENTID, txt);
-    CASE_STR(WMIX_GPIO_ACK_EVENTID, txt);
-    CASE_STR(WMIX_HB_CHALLENGE_RESP_EVENTID, txt);
-    CASE_STR(WMIX_DBGLOG_EVENTID, txt);
-    CASE_STR(WMIX_PROF_COUNT_EVENTID, txt);
-    CASE_DEF_STR(txt);
-    }
-    return snprintf(output, len, "%s", txt);
-}
-
-static int WMI_EVENT_SEND_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 idx = buffer[1];
-    A_INT32 sidx;
-    if (idx>=(A_INT32)WMI_READY_EVENTID && 
-            idx<(A_INT32)(WMI_READY_EVENTID+ARRAY_SIZE(evt_desc))) {
-        sidx = idx - WMI_READY_EVENTID;
-        return snprintf(output, len, "%s", evt_desc[sidx].desc);
-    } else if (idx>=(A_INT32)WMI_SET_BITRATE_CMDID && 
-            idx<(A_INT32)(WMI_SET_BITRATE_CMDID+ARRAY_SIZE(cmdxs_desc))) {
-        sidx = idx - WMI_SET_BITRATE_CMDID;
-        return snprintf(output, len, "%s", cmdxs_desc[sidx].desc);
-    }
-    return 0;
-}
-
-
-static int WMI_CMD_RX_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 idx = buffer[1];
-    A_INT32 length = buffer[2];
-    A_INT32 sidx;
-    if (idx>=(A_INT32)WMI_CONNECT_CMDID && 
-            idx<(A_INT32)(WMI_CONNECT_CMDID+ARRAY_SIZE(cmds_desc))) {
-        sidx = idx-WMI_CONNECT_CMDID;
-        return snprintf(output, len, "%s, len %d", 
-                       cmds_desc[sidx].desc, length);
-    } else if (idx>=(A_INT32)WMI_SET_BITRATE_CMDID && 
-            idx<(A_INT32)(WMI_SET_BITRATE_CMDID+ARRAY_SIZE(cmdxs_desc))) {
-        sidx = idx - WMI_SET_BITRATE_CMDID;
-        return snprintf(output, len, "%s, len %d", 
-                       cmdxs_desc[sidx].desc, length);
-    }
-    return 0;
-}
-
-static int WMI_CMD_PARAMS_DUMP_START_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    A_INT32 paramslen = buffer[2];
-    paramslen += (sizeof(A_INT32) * 2); /* adding pad */
-    dbg_wmi_cmd_params_pos = 0;
-    dbg_wmi_cmd_params_cmdid = buffer[1];
-    dbg_wmi_cmd_params_buf = (paramslen>0) ? malloc(paramslen) : NULL;
-    return 0;
-}
-
-static int WMI_CMD_PARAMS_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    if (dbg_wmi_cmd_params_buf == NULL) {
-        /* partial debug log where there is no START. Skip it*/
-        return 0;
-    }   
-    memcpy(&dbg_wmi_cmd_params_buf[dbg_wmi_cmd_params_pos], &buffer[1], sizeof(A_INT32));
-    memcpy(&dbg_wmi_cmd_params_buf[dbg_wmi_cmd_params_pos+4], &buffer[2], sizeof(A_INT32));
-    dbg_wmi_cmd_params_pos += (sizeof(A_INT32) * 2);
-    return 0;
-}
-
-static int WMI_CMD_PARAMS_DUMP_END_fmt(char *output, size_t len, A_UINT32 numargs, A_INT32 *buffer)
-{
-    int ret = 0;
-    A_INT32 idx = dbg_wmi_cmd_params_cmdid;
-    DbgCmdFormatter cmdFormatter = NULL;
-    size_t cmdSize;
-    if (dbg_wmi_cmd_params_buf == NULL) {
-        /* partial debug log where there is no START. Skip it*/
-        return 0;
-    }   
-    if (idx>=(A_INT32)WMI_CONNECT_CMDID && 
-            idx<(A_INT32)(WMI_CONNECT_CMDID+ARRAY_SIZE(cmds_desc)) ) {
-        cmdFormatter = cmds_desc[idx-WMI_CONNECT_CMDID].formatter;
-        cmdSize = cmds_desc[idx-WMI_CONNECT_CMDID].cmdSize;
-    } else if (idx>=(A_INT32)WMI_SET_BITRATE_CMDID && 
-            idx<(A_INT32)(WMI_SET_BITRATE_CMDID+ARRAY_SIZE(cmdxs_desc))) {
-        cmdFormatter = cmdxs_desc[idx-WMI_SET_BITRATE_CMDID].formatter;
-        cmdSize = cmdxs_desc[idx-WMI_SET_BITRATE_CMDID].cmdSize;
-    }
-    if (cmdFormatter) {
-        ret += snprintf(output+ret, len-ret, " ");
-        if (dbg_wmi_cmd_params_pos>=cmdSize) {
-            ret += cmdFormatter(output+ret, len-ret, dbg_wmi_cmd_params_buf);
-        } else {
-            ret += snprintf(output+ret, len-ret, "malformed cmd. size too small %d < %d",
-                    dbg_wmi_cmd_params_pos, cmdSize);
-        }
-    }
-    dbg_wmi_cmd_params_pos = 0;
-    dbg_wmi_cmd_params_cmdid = 0;
-    free(dbg_wmi_cmd_params_buf);
-    dbg_wmi_cmd_params_buf = NULL;
-    return ret;
-}
-
-static struct dbglog_desc wmi_desc[] = {
-    DBG_DESC(0),
-    DBG_DESC(WMI_CMD_RX_XTND_PKT_TOO_SHORT),
-    DBG_DESC(WMI_EXTENDED_CMD_NOT_HANDLED),
-    DBG_DESC(WMI_CMD_RX_PKT_TOO_SHORT),
-    DBG_DESC(WMI_CALLING_WMI_EXTENSION_FN),
-    DBG_DESC(WMI_CMD_NOT_HANDLED),
-    DBG_DESC(WMI_IN_SYNC),
-    DBG_DESC(WMI_TARGET_WMI_SYNC_CMD),
-    DBG_DESC(WMI_SET_SNR_THRESHOLD_PARAMS),
-    DBG_DESC(WMI_SET_RSSI_THRESHOLD_PARAMS),
-    DBG_DESC(WMI_SET_LQ_TRESHOLD_PARAMS),
-    DBG_DESC(WMI_TARGET_CREATE_PSTREAM_CMD),
-    DBG_DESC(WMI_WI_DTM_INUSE),
-    DBG_DESC(WMI_TARGET_DELETE_PSTREAM_CMD),
-    DBG_DESC(WMI_TARGET_IMPLICIT_DELETE_PSTREAM_CMD),
-    DBG_DESC(WMI_TARGET_GET_BIT_RATE_CMD),
-    DBG_DESC(WMI_GET_RATE_MASK_CMD_FIX_RATE_MASK_IS),
-    DBG_DESC(WMI_TARGET_GET_AVAILABLE_CHANNELS_CMD),
-    DBG_DESC(WMI_TARGET_GET_TX_PWR_CMD),
-    DBG_DESC(WMI_FREE_EVBUF_WMIBUF),
-    DBG_DESC(WMI_FREE_EVBUF_DATABUF),
-    DBG_DESC(WMI_FREE_EVBUF_BADFLAG),
-    DBG_DESC(WMI_HTC_RX_ERROR_DATA_PACKET),
-    DBG_DESC(WMI_HTC_RX_SYNC_PAUSING_FOR_MBOX),
-    DBG_DESC(WMI_INCORRECT_WMI_DATA_HDR_DROPPING_PKT),
-    DBG_DESC(WMI_SENDING_READY_EVENT),
-    DBG_DESC(WMI_SETPOWER_MDOE_TO_MAXPERF),
-    DBG_DESC(WMI_SETPOWER_MDOE_TO_REC),
-    DBG_DESC(WMI_BSSINFO_EVENT_FROM),
-    DBG_DESC(WMI_TARGET_GET_STATS_CMD),
-    DBG_DESC(WMI_SENDING_SCAN_COMPLETE_EVENT),
-    DBG_DESC(WMI_SENDING_RSSI_INDB_THRESHOLD_EVENT),
-    DBG_DESC(WMI_SENDING_RSSI_INDBM_THRESHOLD_EVENT),
-    DBG_DESC(WMI_SENDING_LINK_QUALITY_THRESHOLD_EVENT),
-    DBG_DESC(WMI_SENDING_ERROR_REPORT_EVENT),
-    DBG_DESC(WMI_SENDING_CAC_EVENT),
-    DBG_DESC(WMI_TARGET_GET_ROAM_TABLE_CMD),
-    DBG_DESC(WMI_TARGET_GET_ROAM_DATA_CMD),
-    DBG_DESC(WMI_SENDING_GPIO_INTR_EVENT),
-    DBG_DESC(WMI_SENDING_GPIO_ACK_EVENT),
-    DBG_DESC(WMI_SENDING_GPIO_DATA_EVENT),
-    DBG_DESC_FMT(WMI_CMD_RX),
-    DBG_DESC(WMI_CMD_RX_XTND),
-    DBG_DESC_FMT(WMI_EVENT_SEND),
-    DBG_DESC_FMT(WMI_EVENT_SEND_XTND),
-    DBG_DESC_FMT(WMI_CMD_PARAMS_DUMP_START),
-    DBG_DESC_FMT(WMI_CMD_PARAMS_DUMP_END),
-    DBG_DESC_FMT(WMI_CMD_PARAMS),
-};
-
-static struct dbglog_desc co_desc[] = {
-    DBG_DESC(0),
-    DBG_DESC(CO_INIT),
-    DBG_DESC(CO_ACQUIRE_LOCK),
-    DBG_DESC(CO_START_OP1),
-    DBG_DESC(CO_START_OP2),
-    DBG_DESC(CO_DRAIN_TX_COMPLETE_CB),
-    DBG_DESC(CO_CHANGE_CHANNEL_CB),
-    DBG_DESC(CO_RETURN_TO_HOME_CHANNEL),
-    DBG_DESC(CO_FINISH_OP_TIMEOUT),
-    DBG_DESC(CO_OP_END),
-    DBG_DESC(CO_CANCEL_OP),
-    DBG_DESC_FMT(CO_CHANGE_CHANNEL),
-    DBG_DESC(CO_RELEASE_LOCK),
-    DBG_DESC_FMT(CO_CHANGE_STATE),
-};
-
-static struct dbglog_desc mgmtbuf_desc[] = {
-    DBG_DESC(0),
-    DBG_DESC(TXRX_MGMTBUF_ALLOCATE_BUF),
-    DBG_DESC(TXRX_MGMTBUF_ALLOCATE_SM_BUF),
-    DBG_DESC(TXRX_MGMTBUF_ALLOCATE_RMBUF),
-    DBG_DESC(TXRX_MGMTBUF_GET_BUF),
-    DBG_DESC(TXRX_MGMTBUF_GET_SM_BUF),
-    DBG_DESC(TXRX_MGMTBUF_QUEUE_BUF_TO_TXQ),
-    DBG_DESC_FMT(TXRX_MGMTBUF_REAPED_BUF),
-    DBG_DESC(TXRX_MGMTBUF_REAPED_SM_BUF),
-    DBG_DESC_FMT(TXRX_MGMTBUF_WAIT_FOR_TXQ_DRAIN),
-    DBG_DESC(TXRX_MGMTBUF_WAIT_FOR_TXQ_SFQ_DRAIN),
-    DBG_DESC(TXRX_MGMTBUF_ENQUEUE_INTO_DATA_SFQ),
-    DBG_DESC(TXRX_MGMTBUF_DEQUEUE_FROM_DATA_SFQ),
-    DBG_DESC(TXRX_MGMTBUF_PAUSE_DATA_TXQ),
-    DBG_DESC(TXRX_MGMTBUF_RESUME_DATA_TXQ),
-    DBG_DESC(TXRX_MGMTBUF_WAIT_FORTXQ_DRAIN_TIMEOUT),
-    DBG_DESC_FMT(TXRX_MGMTBUF_DRAINQ),
-    DBG_DESC(TXRX_MGMTBUF_INDICATE_Q_DRAINED),
-    DBG_DESC(TXRX_MGMTBUF_ENQUEUE_INTO_HW_SFQ),
-    DBG_DESC(TXRX_MGMTBUF_DEQUEUE_FROM_HW_SFQ),
-    DBG_DESC(TXRX_MGMTBUF_PAUSE_HW_TXQ),
-    DBG_DESC(TXRX_MGMTBUF_RESUME_HW_TXQ),
-    DBG_DESC(TXRX_MGMTBUF_TEAR_DOWN_BA),
-    DBG_DESC(TXRX_MGMTBUF_PROCESS_ADDBA_REQ),
-    DBG_DESC(TXRX_MGMTBUF_PROCESS_DELBA),
-    DBG_DESC(TXRX_MGMTBUF_PERFORM_BA),
-    DBG_DESC_FMT(TXRX_MGMTBUF_WLAN_RESET_ON_ERROR),
-};
-
-static struct dbglog_desc dc_desc[] = {
-    DBG_DESC(0),
-    DBG_DESC_FMT(DC_SCAN_CHAN_START),
-    DBG_DESC_FMT(DC_SCAN_CHAN_FINISH),
-    DBG_DESC(DC_BEACON_RECEIVE7),
-    DBG_DESC_FMT(DC_SSID_PROBE_CB),
-    DBG_DESC_FMT(DC_SEND_NEXT_SSID_PROBE),
-    DBG_DESC_FMT(DC_START_SEARCH),
-    DBG_DESC(DC_CANCEL_SEARCH_CB),
-    DBG_DESC(DC_STOP_SEARCH),
-    DBG_DESC(DC_END_SEARCH),
-    DBG_DESC(DC_MIN_CHDWELL_TIMEOUT),
-    DBG_DESC(DC_START_SEARCH_CANCELED),
-    DBG_DESC_FMT(DC_SET_POWER_MODE),
-    DBG_DESC(DC_INIT),
-    DBG_DESC_FMT(DC_SEARCH_OPPORTUNITY),
-    DBG_DESC_FMT(DC_RECEIVED_ANY_BEACON),
-    DBG_DESC(DC_RECEIVED_MY_BEACON),
-    DBG_DESC(DC_PROFILE_IS_ADHOC_BUT_BSS_IS_INFRA),
-    DBG_DESC(DC_PS_ENABLED_BUT_ATHEROS_IE_ABSENT),
-    DBG_DESC(DC_BSS_ADHOC_CHANNEL_NOT_ALLOWED),
-    DBG_DESC(DC_SET_BEACON_UPDATE),
-    DBG_DESC(DC_BEACON_UPDATE_COMPLETE),
-    DBG_DESC(DC_END_SEARCH_BEACON_UPDATE_COMP_CB),
-    DBG_DESC(DC_BSSINFO_EVENT_DROPPED),
-    DBG_DESC(DC_IEEEPS_ENABLED_BUT_ATIM_ABSENT),
-};
-
-static struct dbglog_desc btcoex_desc[] = {
-    DBG_DESC(0),
-    DBG_DESC(BTCOEX_STATUS_CMD),
-    DBG_DESC(BTCOEX_PARAMS_CMD),
-    DBG_DESC(BTCOEX_ANT_CONFIG),
-    DBG_DESC(BTCOEX_COLOCATED_BT_DEVICE),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_SCO_ON),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_SCO_OFF),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_A2DP_ON),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_A2DP_OFF),
-    DBG_DESC(BTCOEX_A2DP_PROTECT_ON),
-    DBG_DESC(BTCOEX_A2DP_PROTECT_OFF),
-    DBG_DESC(BTCOEX_SCO_PROTECT_ON),
-    DBG_DESC(BTCOEX_SCO_PROTECT_OFF),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_DETECTOR_START),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_DETECTOR_STOP),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_TOGGLE),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_TOGGLE_RSSI_LRCNT),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_RSSI_THRESH),
-    DBG_DESC(BTCOEX_CLOSE_RANGE_LOW_RATE_THRESH),
-    DBG_DESC(BTCOEX_PTA_PRI_INTR_HANDLER),
-    DBG_DESC_FMT(BTCOEX_PSPOLL_QUEUED),
-    DBG_DESC_FMT(BTCOEX_PSPOLL_COMPLETE),
-    DBG_DESC_FMT(BTCOEX_DBG_PM_AWAKE),
-    DBG_DESC_FMT(BTCOEX_DBG_PM_SLEEP),
-    DBG_DESC(BTCOEX_DBG_SCO_COEX_ON),
-    DBG_DESC(BTCOEX_SCO_DATARECEIVE),
-    DBG_DESC(BTCOEX_INTR_INIT),
-    DBG_DESC(BTCOEX_PTA_PRI_DIFF),
-    DBG_DESC_FMT(BTCOEX_TIM_NOTIFICATION),
-    DBG_DESC(BTCOEX_SCO_WAKEUP_ON_DATA),
-    DBG_DESC(BTCOEX_SCO_SLEEP),
-    DBG_DESC_FMT(BTCOEX_SET_WEIGHTS),
-    DBG_DESC(BTCOEX_SCO_DATARECEIVE_LATENCY_VAL),
-    DBG_DESC(BTCOEX_SCO_MEASURE_TIME_DIFF),
-    DBG_DESC(BTCOEX_SET_EOL_VAL),
-    DBG_DESC(BTCOEX_OPT_DETECT_HANDLER),
-    DBG_DESC(BTCOEX_SCO_TOGGLE_STATE),
-    DBG_DESC(BTCOEX_SCO_STOMP),
-    DBG_DESC(BTCOEX_NULL_COMP_CALLBACK),
-    DBG_DESC(BTCOEX_RX_INCOMING),
-    DBG_DESC(BTCOEX_RX_INCOMING_CTL),
-    DBG_DESC(BTCOEX_RX_INCOMING_MGMT),
-    DBG_DESC(BTCOEX_RX_INCOMING_DATA),
-    DBG_DESC(BTCOEX_RTS_RECEPTION),
-    DBG_DESC(BTCOEX_FRAME_PRI_LOW_RATE_THRES),
-    DBG_DESC_FMT(BTCOEX_PM_FAKE_SLEEP),
-    DBG_DESC_FMT(BTCOEX_ACL_COEX_STATUS),
-    DBG_DESC(BTCOEX_ACL_COEX_DETECTION),
-    DBG_DESC(BTCOEX_A2DP_COEX_STATUS),
-    DBG_DESC(BTCOEX_SCO_STATUS),
-    DBG_DESC_FMT(BTCOEX_WAKEUP_ON_DATA),
-    DBG_DESC(BTCOEX_DATARECEIVE),
-    DBG_DESC(0),
-    DBG_DESC(BTCOEX_GET_MAX_AGGR_SIZE),
-    DBG_DESC(BTCOEX_MAX_AGGR_AVAIL_TIME),
-    DBG_DESC(BTCOEX_DBG_WBTIMER_INTR),
-    DBG_DESC(0),
-    DBG_DESC(BTCOEX_DBG_SCO_SYNC),
-    DBG_DESC(0),
-    DBG_DESC(BTCOEX_UPLINK_QUEUED_RATE),
-    DBG_DESC(BTCOEX_DBG_UPLINK_ENABLE_EOL),
-    DBG_DESC(BTCOEX_UPLINK_FRAME_DURATION),
-    DBG_DESC(BTCOEX_UPLINK_SET_EOL),
-    DBG_DESC(BTCOEX_DBG_EOL_EXPIRED),
-    DBG_DESC(BTCOEX_DBG_DATA_COMPLETE),
-    DBG_DESC(BTCOEX_UPLINK_QUEUED_TIMESTAMP),
-    DBG_DESC(BTCOEX_DBG_DATA_COMPLETE_TIME),
-    DBG_DESC(BTCOEX_DBG_A2DP_ROLE_IS_SLAVE),
-    DBG_DESC(BTCOEX_DBG_A2DP_ROLE_IS_MASTER),
-    DBG_DESC(BTCOEX_DBG_UPLINK_SEQ_NUM),
-    DBG_DESC(BTCOEX_UPLINK_AGGR_SEQ),
-    DBG_DESC(BTCOEX_DBG_TX_COMP_SEQ_NO),
-    DBG_DESC(BTCOEX_DBG_MAX_AGGR_PAUSE_STATE),
-    DBG_DESC(BTCOEX_DBG_ACL_TRAFFIC),
-    DBG_DESC(BTCOEX_CURR_AGGR_PROP),
-    DBG_DESC(BTCOEX_DBG_SCO_GET_PER_TIME_DIFF),
-    DBG_DESC(BTCOEX_PSPOLL_PROCESS),
-    DBG_DESC(BTCOEX_RETURN_FROM_MAC),
-    DBG_DESC(BTCOEX_FREED_REQUEUED_CNT),
-    DBG_DESC(BTCOEX_DBG_TOGGLE_LOW_RATES),
-    DBG_DESC(BTCOEX_MAC_GOES_TO_SLEEP),
-    DBG_DESC(BTCOEX_DBG_A2DP_NO_SYNC),
-    DBG_DESC(BTCOEX_RETURN_FROM_MAC_HOLD_Q_INFO),
-    DBG_DESC(BTCOEX_RETURN_FROM_MAC_AC),
-    DBG_DESC(BTCOEX_DBG_DTIM_RECV),
-    DBG_DESC(0),
-    DBG_DESC(BTCOEX_IS_PRE_UPDATE),
-    DBG_DESC(BTCOEX_ENQUEUED_BIT_MAP),
-    DBG_DESC(BTCOEX_TX_COMPLETE_FIRST_DESC_STATS),
-    DBG_DESC(BTCOEX_UPLINK_DESC),
-    DBG_DESC(BTCOEX_SCO_GET_PER_FIRST_FRM_TIMESTAMP),
-    DBG_DESC(0), DBG_DESC(0), DBG_DESC(0),
-    DBG_DESC(BTCOEX_DBG_RECV_ACK),
-    DBG_DESC(BTCOEX_DBG_ADDBA_INDICATION),
-    DBG_DESC(BTCOEX_TX_COMPLETE_EOL_FAILED),
-    DBG_DESC(BTCOEX_DBG_A2DP_USAGE_COMPLETE),
-    DBG_DESC(BTCOEX_DBG_A2DP_STOMP_FOR_BCN_HANDLER),
-    DBG_DESC(BTCOEX_DBG_A2DP_SYNC_INTR),
-    DBG_DESC(BTCOEX_DBG_A2DP_STOMP_FOR_BCN_RECEPTION),
-    DBG_DESC(BTCOEX_FORM_AGGR_CURR_AGGR),
-    DBG_DESC(BTCOEX_DBG_TOGGLE_A2DP_BURST_CNT),
-    DBG_DESC(BTCOEX_DBG_BT_TRAFFIC),
-    DBG_DESC(BTCOEX_DBG_STOMP_BT_TRAFFIC),
-    DBG_DESC(BTCOEX_RECV_NULL),
-    DBG_DESC(BTCOEX_DBG_A2DP_MASTER_BT_END),
-    DBG_DESC(BTCOEX_DBG_A2DP_BT_START),
-    DBG_DESC(BTCOEX_DBG_A2DP_SLAVE_BT_END),
-    DBG_DESC(BTCOEX_DBG_A2DP_STOMP_BT),
-    DBG_DESC_FMT(BTCOEX_DBG_GO_TO_SLEEP),
-    DBG_DESC(BTCOEX_DBG_A2DP_PKT),
-    DBG_DESC(BTCOEX_DBG_A2DP_PSPOLL_DATA_RECV),
-    DBG_DESC(BTCOEX_DBG_A2DP_NULL),
-    DBG_DESC(BTCOEX_DBG_UPLINK_DATA),
-    DBG_DESC(BTCOEX_DBG_A2DP_STOMP_LOW_PRIO_NULL),
-    DBG_DESC(BTCOEX_DBG_ADD_BA_RESP_TIMEOUT),
-    DBG_DESC(BTCOEX_DBG_TXQ_STATE),
-    DBG_DESC_FMT(BTCOEX_DBG_ALLOW_SCAN),
-    DBG_DESC_FMT(BTCOEX_DBG_SCAN_REQUEST),
-    DBG_DESC(0), DBG_DESC(0), DBG_DESC(0), DBG_DESC(0), DBG_DESC(0), DBG_DESC(0), DBG_DESC(0),
-    DBG_DESC(BTCOEX_A2DP_SLEEP),
-    DBG_DESC(BTCOEX_DBG_DATA_ACTIV_TIMEOUT),
-    DBG_DESC(BTCOEX_DBG_SWITCH_TO_PSPOLL_ON_MODE),
-    DBG_DESC(BTCOEX_DBG_SWITCH_TO_PSPOLL_OFF_MODE),
-    DBG_DESC(BTCOEX_DATARECEIVE_AGGR),
-    DBG_DESC(BTCOEX_DBG_DATA_RECV_SLEEPING_PENDING),
-    DBG_DESC(BTCOEX_DBG_DATARESP_TIMEOUT),
-    DBG_DESC(BTCOEX_BDG_BMISS),
-    DBG_DESC(BTCOEX_DBG_DATA_RECV_WAKEUP_TIM),
-    DBG_DESC(BTCOEX_DBG_SECOND_BMISS),
-    DBG_DESC(0), 
-    DBG_DESC_FMT(BTCOEX_DBG_SET_WLAN_STATE),
-    DBG_DESC(BTCOEX_BDG_FIRST_BMISS),
-    DBG_DESC(BTCOEX_DBG_A2DP_CHAN_OP),
-    DBG_DESC(BTCOEX_DBG_A2DP_INTR),
-    DBG_DESC_FMT(BTCOEX_DBG_BT_INQUIRY),
-    DBG_DESC(BTCOEX_DBG_BT_INQUIRY_DATA_FETCH),
-    DBG_DESC(BTCOEX_DBG_POST_INQUIRY_FINISH),
-    DBG_DESC(BTCOEX_DBG_SCO_OPT_MODE_TIMER_HANDLER),
-    DBG_DESC(BTCOEX_DBG_NULL_FRAME_SLEEP),
-    DBG_DESC(BTCOEX_DBG_NULL_FRAME_AWAKE),
-    DBG_DESC(0), DBG_DESC(0), DBG_DESC(0), DBG_DESC(0), 
-    DBG_DESC(BTCOEX_DBG_SET_AGGR_SIZE),
-    DBG_DESC(BTCOEX_DBG_TEAR_BA_TIMEOUT),
-    DBG_DESC(BTCOEX_DBG_MGMT_FRAME_SEQ_NO),
-    DBG_DESC(BTCOEX_DBG_SCO_STOMP_HIGH_PRI),
-    DBG_DESC(BTCOEX_DBG_COLOCATED_BT_DEV),
-    DBG_DESC(BTCOEX_DBG_FE_ANT_TYPE),
-    DBG_DESC(BTCOEX_DBG_BT_INQUIRY_CMD),
-    DBG_DESC(BTCOEX_DBG_SCO_CONFIG),
-    DBG_DESC(BTCOEX_DBG_SCO_PSPOLL_CONFIG),
-    DBG_DESC(BTCOEX_DBG_SCO_OPTMODE_CONFIG),
-    DBG_DESC(BTCOEX_DBG_A2DP_CONFIG),
-    DBG_DESC(BTCOEX_DBG_A2DP_PSPOLL_CONFIG),
-    DBG_DESC(BTCOEX_DBG_A2DP_OPTMODE_CONFIG),
-    DBG_DESC(BTCOEX_DBG_ACLCOEX_CONFIG),
-    DBG_DESC(BTCOEX_DBG_ACLCOEX_PSPOLL_CONFIG),
-    DBG_DESC(BTCOEX_DBG_ACLCOEX_OPTMODE_CONFIG),
-    DBG_DESC(BTCOEX_DBG_DEBUG_CMD),
-    DBG_DESC(BTCOEX_DBG_SET_BT_OPERATING_STATUS),
-    DBG_DESC(BTCOEX_DBG_GET_CONFIG),
-    DBG_DESC(BTCOEX_DBG_GET_STATS),
-    DBG_DESC(BTCOEX_DBG_BT_OPERATING_STATUS),
-    DBG_DESC(BTCOEX_DBG_PERFORM_RECONNECT),
-    DBG_DESC(0), 
-    DBG_DESC(BTCOEX_DBG_ACL_WLAN_MED),
-    DBG_DESC(BTCOEX_DBG_ACL_BT_MED),
-    DBG_DESC(BTCOEX_DBG_WLAN_CONNECT),
-    DBG_DESC(BTCOEX_DBG_A2DP_DUAL_START),
-    DBG_DESC(BTCOEX_DBG_PMAWAKE_NOTIFY),
-    DBG_DESC(BTCOEX_DBG_BEACON_SCAN_ENABLE),
-    DBG_DESC(BTCOEX_DBG_BEACON_SCAN_DISABLE),
-    DBG_DESC(BTCOEX_DBG_RX_NOTIFY),
-    DBG_DESC(BTCOEX_SCO_GET_PER_SECOND_FRM_TIMESTAMP),
-    DBG_DESC(BTCOEX_DBG_TXQ_DETAILS),
-    DBG_DESC(BTCOEX_DBG_SCO_STOMP_LOW_PRI),
-    DBG_DESC(BTCOEX_DBG_A2DP_FORCE_SCAN),
-    DBG_DESC(BTCOEX_DBG_DTIM_STOMP_COMP),
-    DBG_DESC(BTCOEX_ACL_PRESENCE_TIMER),
-    DBG_DESC(BTCOEX_DBG_QUEUE_SELF_CTS),
-    DBG_DESC(BTCOEX_DBG_SELF_CTS_COMP),
-    DBG_DESC(BTCOEX_DBG_APMODE_WAIT_FOR_CTS_COMP_FAILED),
-    DBG_DESC(BTCOEX_DBG_APMODE_A2DP_MED_TO_BT),
-    DBG_DESC(BTCOEX_DBG_APMODE_SET_BTSTATE),
-    DBG_DESC(BTCOEX_DBG_APMODE_A2DP_STATUS),
-    DBG_DESC(BTCOEX_DBG_APMODE_SCO_CTS_HANDLER),
-    DBG_DESC(BTCOEX_DBG_APMODE_SCO_STATUS),
-    DBG_DESC(BTCOEX_DBG_APMODE_TXQ_DRAINED),
-    DBG_DESC(BTCOEX_DBG_APMODE_SCO_ARM_TIMER),
-    DBG_DESC(BTCOEX_DBG_APMODE_SWITCH_MED_TO_WLAN),
-    DBG_DESC(BTCOEX_APMODE_BCN_TX_HANDLER),
-    DBG_DESC(BTCOEX_APMODE_BCN_TX),
-    DBG_DESC(BTCOEX_APMODE_SCO_RTS_HANDLER),
-};
-
-static struct dbglog_desc pm_desc[] = {
-    DBG_DESC(0),
-    DBG_DESC(PM_INIT), 
-    DBG_DESC(PM_ENABLE),
-    DBG_DESC_FMT(PM_SET_STATE),
-    DBG_DESC_FMT(PM_SET_POWERMODE),
-    DBG_DESC(PM_CONN_NOTIFY),
-    DBG_DESC(PM_REF_COUNT_NEGATIVE),
-    DBG_DESC(PM_INFRA_STA_APSD_ENABLE),
-    DBG_DESC(PM_INFRA_STA_UPDATE_APSD_STATE),
-    DBG_DESC_FMT(PM_CHAN_OP_REQ),
-    DBG_DESC_FMT(PM_SET_MY_BEACON_POLICY),
-    DBG_DESC_FMT(PM_SET_ALL_BEACON_POLICY),
-    DBG_DESC(PM_INFRA_STA_SET_PM_PARAMS1),
-    DBG_DESC(PM_INFRA_STA_SET_PM_PARAMS2),
-    DBG_DESC(PM_ADHOC_SET_PM_CAPS_FAIL),
-    DBG_DESC(PM_ADHOC_UNKNOWN_IBSS_ATTRIB_ID),
-    DBG_DESC(PM_ADHOC_SET_PM_PARAMS),
-    DBG_DESC(0),
-    DBG_DESC(PM_ADHOC_STATE1),
-    DBG_DESC(PM_ADHOC_STATE2),
-    DBG_DESC(PM_ADHOC_CONN_MAP),
-    DBG_DESC_FMT(PM_FAKE_SLEEP),
-    DBG_DESC(PM_AP_STATE1),
-    DBG_DESC(PM_AP_SET_PM_PARAMS),
-    DBG_DESC(PM_P2P_STATE1),
-};
-
-static struct dbglog_desc dummy_desc[] = {
-    DBG_DESC(0),
-};
-
-static struct module_desc modules[] = {
-    MODULE_DESC(INF, dummy_desc),
-    MODULE_DESC(WMI, wmi_desc),
-    MODULE_DESC(MISC, dummy_desc),
-    MODULE_DESC(PM, pm_desc),
-    MODULE_DESC(TXRX_MGMTBUF, mgmtbuf_desc),
-    MODULE_DESC(TXRX_TXBUF, dummy_desc),
-    MODULE_DESC(TXRX_RXBUF, dummy_desc),
-    MODULE_DESC(WOW, dummy_desc),
-    MODULE_DESC(WHAL, dummy_desc),
-    MODULE_DESC(DC, dc_desc),
-    MODULE_DESC(CO, co_desc),
-    MODULE_DESC(RO, dummy_desc),
-    MODULE_DESC(CM, dummy_desc),
-    MODULE_DESC(MGMT, dummy_desc),
-    MODULE_DESC(TMR, dummy_desc),
-    MODULE_DESC(BTCOEX, btcoex_desc),
-};
-
-static int compOid(const void *a, const void *b)
-{
-    return *(A_INT32*)a  - *(A_INT32*)b;
-}
-
-static void do_check_ids()
-{
-    size_t m, d, td;
-    for (m=0; dbglog_id_tag[m][1][0]!='\0'; ++m) {
-        size_t mlen;
-        struct dbglog_desc *dlog;
-        if (m >= ARRAY_SIZE(modules)) {
-            printf("module does not matched\n");
-            break;
-        }
-        dlog = modules[m].descs;
-        mlen = modules[m].len;
-        d=td=1;
-        while (dlog && (d<mlen||dbglog_id_tag[m][td][0]!='\0')) {       
-            if (d>=mlen) {
-                if (dlog != dummy_desc) {
-                    printf("m %s dbgid %s(%d) is larger than max internal table %d host/firmware mismatch?\n", 
-                            modules[m].name, dbglog_id_tag[m][td], td, mlen);
-                }                
-                break;
-            }
-
-            if (dbglog_id_tag[m][td][0]=='\0' && dlog[d].oid!=0) {
-                for (;td < DBGLOG_DBGID_NUM_MAX && dbglog_id_tag[m][td][0]=='\0'; ++td);
-            }
-            if (strcmp(dbglog_id_tag[m][td], dlog[d].desc)!=0 && dlog[d].oid!=0) {
-                printf("debug id does not matched '%s' <> '%s'\n", dbglog_id_tag[m][td], dlog[d].desc);
-                break;
-            } else {
-                if (td!=d && !modules[m].bsearch) {                    
-                    printf("Module %s debugid %s(%d) mismatched. using binary search for debugid",
-                           modules[m].name, dbglog_id_tag[m][td], td); 
-                    modules[m].bsearch = 1;
-                }
-            }
-            ++d; ++td;
-        }
-        if (modules[m].bsearch && dlog) {
-            qsort(dlog, mlen, sizeof(dlog[0]), compOid);
-        }
-    }
-    check_ids = 1;
-}
-
-static DbgLogFormatter getFormatter(A_INT32 moduleid, A_INT32 debugid)
-{
-    if (!check_ids) {
-        do_check_ids();
-    }
-
-    if ( moduleid < ARRAY_SIZE(modules)) {
-        const struct module_desc *m = &modules[moduleid];
-        if (m->descs ) {
-            if (m->bsearch){
-                struct dbglog_desc *d;
-                d = (struct dbglog_desc*)bsearch(&debugid, m->descs, m->len, sizeof(m->descs[0]), compOid);
-                return d ? d->formatter : NULL;
-            } else if (debugid>0 && debugid<m->len) {
-                return m->descs[debugid].formatter;   
-            }
-        }
-    }
-    return NULL;
-}
-
-int dbg_formater(int lv, char *output, size_t len, A_UINT32 ts, A_INT32 *logbuf)
-{
-    int ret = 0;
-    A_UINT32 debugid = DBGLOG_GET_DBGID(logbuf[0]);
-    A_UINT32 moduleid = DBGLOG_GET_MODULEID(logbuf[0]);
-    A_UINT32 numargs = DBGLOG_GET_NUMARGS(logbuf[0]);
-    A_UINT32 timestamp = DBGLOG_GET_TIMESTAMP(logbuf[0]);
-    DbgLogFormatter dbgFormatter = NULL;
-
-    if (numargs>2) {
-        return ret;
-    }
-
-    if (lv > 0) {
-        dbgFormatter = getFormatter(moduleid, debugid);
-    }
-
-    if (ts>0) {
-        if (lv == 0) {
-            ret += snprintf(output+ret, len-ret, "%8d: ", ts);
-        } else {
-            ret += strftime(output+ret, len-ret, "%m-%d %H:%M:%S ", gmtime((time_t*)&ts));
-        }
-    }
-    ret += snprintf(output+ret, len-ret, "%s (%d)", dbglog_id_tag[moduleid][debugid],
-                    timestamp);
-    if (lv>1 || lv == 0 || !dbgFormatter) {
-        if (numargs>0) {
-            ret += snprintf(output+ret, len-ret, ": 0x%x", logbuf[1]);
-        }
-        if (numargs>1) {
-            ret += snprintf(output+ret, len-ret, ", 0x%x", logbuf[2]);
-        }
-        if (dbgFormatter && numargs>0 && lv > 0) {
-            ret += snprintf(output+ret, len-ret, ", ");
-        }
-    } else {
-        ret += snprintf(output+ret, len-ret, ": ");
-    }
-
-    if (dbgFormatter && lv > 0) {
-        int pos = ret;
-        int addlen;
-        addlen = dbgFormatter(output+ret, len-ret, numargs, logbuf);
-        if (addlen>0) {
-            ret += addlen;
-        } else if (lv<=1) {
-            /* skip this message */
-            (void)pos;
-            return 0;
-        }
-    }
-    ret += snprintf(output+ret, len-ret, "\n");
-    return ret;
-}
-
diff --git a/drivers/net/wireless/ar6003/host/tools/recEvent/recEvent.c b/drivers/net/wireless/ar6003/host/tools/recEvent/recEvent.c
deleted file mode 100644 (file)
index 161b745..0000000
+++ /dev/null
@@ -1,950 +0,0 @@
-/*
- * Copyright (c) 2006 Atheros Communications Inc.
- * All rights reserved.
- *
- *
- * 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <time.h>
-#include <getopt.h>
-#include <limits.h>
-#include <asm/types.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-#include <linux/types.h>
-#include <linux/if.h>
-#include <linux/version.h>
-extern char *if_indextoname (unsigned int __ifindex, char *__ifname);
-#include <ctype.h>
-#ifdef ANDROID
-#include "wireless_copy.h"
-#else
-#include <linux/wireless.h>
-#endif 
-#include <a_config.h>
-#include <a_osapi.h>
-#include <a_types.h>
-#include <athdefs.h>
-#include <ieee80211.h>
-#include <wmi.h>
-#include <athdrv_linux.h>
-#include <dbglog_api.h>
-
-#undef DEBUG
-#undef DBGLOG_DEBUG
-
-#define ID_LEN                         2
-#define DBGLOG_FILE                    "dbglog.h"
-#define DBGLOGID_FILE                  "dbglog_id.h"
-
-#define GET_CURRENT_TIME(s) do { \
-    time_t t; \
-    t = time(NULL); \
-    s = strtok(ctime(&t), "\n"); \
-} while (0);
-
-#ifdef ANDROID 
-#define DEBUG 1
-#include <cutils/log.h>
-#endif
-
-
-#define AR6K_DBG_BUFFER_SIZE 256 
-
-struct dbg_binary_header {
-    A_UINT8     sig;
-    A_UINT8     ver;
-    A_UINT16    len;
-    A_UINT32    reserved;
-};
-
-struct dbg_binary_record {
-    A_UINT32 ts;                /* Timestamp of the log */
-    A_UINT32 length;            /* Length of the log */
-    A_UINT8  log[AR6K_DBG_BUFFER_SIZE]; /* log message */
-};
-
-static int ATH_WE_VERSION = 0;
-
-#define SRCDIR_FLAG            0x01
-#define LOGFILE_FLAG           0x02
-#define DBGREC_LIMIT_FLAG      0x04
-#define RESTORE_FLAG           0x08
-#define BINARY_FLAG            0x10
-
-const char *progname;
-char restorefile[PATH_MAX];
-char dbglogfile[PATH_MAX];
-char dbglogidfile[PATH_MAX];
-char dbglogoutfile[PATH_MAX];
-FILE *fpout;
-int dbgRecLimit = 1000000; /* Million records is a good default */
-int optionflag;
-char dbglog_id_tag[DBGLOG_MODULEID_NUM_MAX][DBGLOG_DBGID_NUM_MAX][DBGLOG_DBGID_DEFINITION_LEN_MAX];
-const char options[] = 
-"Options:\n\
--f, --logfile=<Output log file> [Mandatory]\n\
--g, --debug (-gg to print out dbglog info together) [Optional]\n\
--b, --binary\n\
--d, --srcdir=<Directory containing the dbglog header files> [Mandatory if not binary]\n\
--l, --reclimit=<Maximum number of records before the log rolls over> [Optional]\n\
--r, --restore=<Script to recover from errors on the target> [Optional]\n\
-The options can also be given in the abbreviated form --option=x or -o x. The options can be given in any order";
-
-#ifdef DEBUG
-static int debugRecEventLevel = 0;
-#ifdef ANDROID 
-static const char TAGS[] = "recEvent";
-#define RECEVENT_DEBUG_PRINTF(args...)        \
-    if (debugRecEventLevel)  __android_log_print(ANDROID_LOG_DEBUG, TAGS, ##args);
-#define RECEVENT_DBGLOG_PRINTF(args...)      \
-    if (debugRecEventLevel>1) __android_log_print(ANDROID_LOG_DEBUG, TAGS, ##args);
-#else
-#define RECEVENT_DEBUG_PRINTF(args...)    if (debugRecEventLevel) printf(args);
-#define RECEVENT_DBGLOG_PRINTF(args...) if (debugRecEventLevel>1) printf(args);
-#endif
-#else
-#define RECEVENT_DEBUG_PRINTF(args...)
-#define RECEVENT_DBGLOG_PRINTF(args...)
-#endif
-
-static A_STATUS app_sleep_report_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_wmiready_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_connect_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_disconnect_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_bssInfo_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_pstream_timeout_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_reportError_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_rssi_threshold_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_scan_complete_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_challenge_resp_event_rx(A_UINT8 *datap, size_t len);
-static A_STATUS app_target_debug_event_rx(A_INT8 *datap, size_t len);
-
-static void
-event_rtm_newlink(struct nlmsghdr *h, int len);
-
-static void
-event_wireless(A_INT8 *data, int len);
-
-int
-string_search(FILE *fp, char *string)
-{
-    char str[DBGLOG_DBGID_DEFINITION_LEN_MAX];
-
-    rewind(fp);
-    memset(str, 0, DBGLOG_DBGID_DEFINITION_LEN_MAX);
-    while (!feof(fp)) {
-        fscanf(fp, "%s", str);
-        if (strstr(str, string)) return 1;
-    }
-
-    return 0;
-}
-
-void
-get_module_name(char *string, char *dest)
-{
-    char *str1, *str2;
-    char str[DBGLOG_DBGID_DEFINITION_LEN_MAX];
-
-    memset(str, 0, DBGLOG_DBGID_DEFINITION_LEN_MAX);
-    strcpy(str, string);
-    str1 = strtok(str, "_");
-    while ((str2 = strtok(NULL, "_"))) {
-        str1 = str2;
-    }
-
-    strcpy(dest, str1);
-}
-
-#ifdef DBGLOG_DEBUG
-void
-dbglog_print_id_tags(void)
-{
-    int i, j;
-
-    for (i = 0; i < DBGLOG_MODULEID_NUM_MAX; i++) {
-        for (j = 0; j < DBGLOG_DBGID_NUM_MAX; j++) {
-            printf("[%d][%d]: %s\n", i, j, dbglog_id_tag[i][j]);
-        }
-    }
-}
-#endif /* DBGLOG_DEBUG */
-
-int
-dbglog_generate_id_tags(void)
-{
-    int id1, id2;
-    FILE *fp1, *fp2;
-    char str1[DBGLOG_DBGID_DEFINITION_LEN_MAX];
-    char str2[DBGLOG_DBGID_DEFINITION_LEN_MAX];
-    char str3[DBGLOG_DBGID_DEFINITION_LEN_MAX];
-
-    if (!(fp1 = fopen(dbglogfile, "r"))) {
-        perror(dbglogfile);
-        return -1;
-    }
-
-    if (!(fp2 = fopen(dbglogidfile, "r"))) {
-        perror(dbglogidfile);
-        fclose(fp1);
-        return -1;
-    }
-
-    memset(dbglog_id_tag, 0, sizeof(dbglog_id_tag));
-    if (string_search(fp1, "DBGLOG_MODULEID_START")) {
-        fscanf(fp1, "%s %s %d", str1, str2, &id1);
-        do {
-            memset(str3, 0, DBGLOG_DBGID_DEFINITION_LEN_MAX);
-            get_module_name(str2, str3);
-            strcat(str3, "_DBGID_DEFINITION_START");
-            if (string_search(fp2, str3)) {
-                memset(str3, 0, DBGLOG_DBGID_DEFINITION_LEN_MAX);
-                get_module_name(str2, str3);
-                strcat(str3, "_DBGID_DEFINITION_END");
-                fscanf(fp2, "%s %s %d", str1, str2, &id2);
-                while (!(strstr(str2, str3))) {
-                    strcpy((char *)&dbglog_id_tag[id1][id2], str2);
-                    fscanf(fp2, "%s %s %d", str1, str2, &id2);
-                }
-            }
-            fscanf(fp1, "%s %s %d", str1, str2, &id1);
-        } while (!(strstr(str2, "DBGLOG_MODULEID_END")));
-    }
-
-    fclose(fp2);
-    fclose(fp1);
-
-    return 0;
-}
-
-static void
-usage(void)
-{
-    fprintf(stderr, "Usage:\n%s options\n", progname);
-    fprintf(stderr, "%s\n", options);
-    exit(-1);
-}
-
-int main(int argc, char** argv)
-{
-    int s, c, ret;
-    struct sockaddr_nl local;
-    struct sockaddr_nl from;
-    socklen_t fromlen;
-    struct nlmsghdr *h;
-    char buf[16384];
-    int left;
-
-    progname = argv[0];
-
-    while (1) {
-        int option_index = 0;
-        static struct option long_options[] = {
-            {"logfile", 1, NULL, 'f'},
-            {"debug", 0, NULL, 'g' },
-            {"binary", 0, NULL, 'b'},
-            {"srcdir", 1, NULL, 'd'},
-            {"reclimit", 1, NULL, 'l'},
-            {"restore", 1, NULL, 'r'},
-            {0, 0, 0, 0}
-        };
-
-        c = getopt_long (argc, argv, "f:gbd:l:r:", long_options, &option_index);
-        if (c == -1) break;
-
-        switch (c) {
-            case 'g':
-#ifdef DEBUG
-                ++debugRecEventLevel;
-#endif
-                break;
-            case 'f':
-                memset(dbglogoutfile, 0, PATH_MAX);
-                strncpy(dbglogoutfile, optarg, sizeof(dbglogoutfile)-1);
-                optionflag |= LOGFILE_FLAG;
-                break;
-
-            case 'b':
-                optionflag |= BINARY_FLAG;
-                break;
-
-            case 'd':
-                memset(dbglogfile, 0, PATH_MAX);
-                strncpy(dbglogfile, optarg, sizeof(dbglogfile) - 1);
-                strcat(dbglogfile, DBGLOG_FILE);
-                memset(dbglogidfile, 0, PATH_MAX);
-                strncpy(dbglogidfile, optarg, sizeof(dbglogidfile) - 1);
-                strcat(dbglogidfile, DBGLOGID_FILE);
-                optionflag |= SRCDIR_FLAG;
-                break;
-
-            case 'l':
-                dbgRecLimit = strtoul(optarg, NULL, 0);
-                break;
-
-            case 'r':
-                strncpy(restorefile, optarg, sizeof(restorefile)-1);
-                optionflag |= RESTORE_FLAG;
-                break;
-
-            default:
-                usage();
-        }
-    }
-
-    if (!((optionflag & (SRCDIR_FLAG | BINARY_FLAG)) && (optionflag & LOGFILE_FLAG))) {
-        usage();
-    }
-
-    /* Get the file name for dbglog output file */
-    if (!(fpout = fopen(dbglogoutfile, "w+"))) {
-        perror(dbglogoutfile);
-        return -1;
-    }
-
-    if (optionflag & BINARY_FLAG) {
-        struct dbg_binary_header header;
-
-        header.sig = 0xDB;
-        header.ver = 0x1;
-        header.len = AR6K_DBG_BUFFER_SIZE;
-        header.reserved = 0;
-    
-        fseek(fpout, 0, SEEK_SET);
-        fwrite(&header, sizeof(header), 1, fpout); 
-        /* first 8 bytes contains log header */
-        fseek(fpout, 8, SEEK_SET);
-    } else {
-        /* first 8 bytes are to indicate the last record */
-        fseek(fpout, 8, SEEK_SET);
-        fprintf(fpout, "\n");
-    }
-
-    s = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
-    if (s < 0) {
-        perror("socket(PF_NETLINK,SOCK_RAW,NETLINK_ROUTE)");
-        return -1;
-    }
-
-    memset(&local, 0, sizeof(local));
-    local.nl_family = AF_NETLINK;
-    local.nl_groups = RTMGRP_LINK;
-    if (bind(s, (struct sockaddr *) &local, sizeof(local)) < 0) {
-        perror("bind(netlink)");
-        close(s);
-        return -1;
-    }
-
-    /* Generate id tags if dbglog header files are present */
-    if (optionflag & SRCDIR_FLAG) {
-        if ((ret = dbglog_generate_id_tags()) < 0) {
-            return -1;
-        }
-
-#ifdef DBGLOG_DEBUG
-        dbglog_print_id_tags();
-#endif /* DBGLOG_DEBUG */
-    }
-
-    while (1) {
-        fromlen = sizeof(from);
-        left = recvfrom(s, buf, sizeof(buf), 0,
-                        (struct sockaddr *) &from, &fromlen);
-        if (left < 0) {
-            if (errno != EINTR && errno != EAGAIN)
-                perror("recvfrom(netlink)");
-            break;
-        }
-
-        h = (struct nlmsghdr *) buf;
-
-        while (left >= (int)sizeof(*h)) {
-            int len, plen;
-
-            len = h->nlmsg_len;
-            plen = len - sizeof(*h);
-            if (len > left || plen < 0) {
-                perror("Malformed netlink message: ");
-                break;
-            }
-
-            switch (h->nlmsg_type) {
-            case RTM_NEWLINK:
-                event_rtm_newlink(h, plen);
-                break;
-            case RTM_DELLINK:
-                RECEVENT_DEBUG_PRINTF("DELLINK\n");
-                break;
-            default:
-                RECEVENT_DEBUG_PRINTF("OTHERS\n");
-            }
-
-            len = NLMSG_ALIGN(len);
-            left -= len;
-            h = (struct nlmsghdr *) ((char *) h + len);
-        }
-    }
-
-    fclose(fpout);
-    close(s);
-    return 0;
-}
-
-static void
-event_rtm_newlink(struct nlmsghdr *h, int len)
-{
-    struct ifinfomsg *ifi;
-    int attrlen, nlmsg_len, rta_len;
-    struct rtattr * attr;
-
-    if (len < (int)sizeof(*ifi)) {
-        perror("too short\n");
-        return;
-    }
-
-    ifi = NLMSG_DATA(h);
-
-    nlmsg_len = NLMSG_ALIGN(sizeof(struct ifinfomsg));
-
-    attrlen = h->nlmsg_len - nlmsg_len;
-    if (attrlen < 0) {
-        perror("bad attren\n");
-        return;
-    }
-
-    attr = (struct rtattr *) (((char *) ifi) + nlmsg_len);
-
-    rta_len = RTA_ALIGN(sizeof(struct rtattr));
-    while (RTA_OK(attr, attrlen)) {
-        if (attr->rta_type == IFLA_WIRELESS) {
-            if (ATH_WE_VERSION==0) {
-                int s = socket(PF_INET, SOCK_DGRAM, 0);
-                struct iw_range range;
-                struct iwreq iwr;
-                if (s>=0) {                        
-                    memset(&iwr, 0, sizeof(iwr));
-                    if_indextoname(ifi->ifi_index, iwr.ifr_name);
-                    iwr.u.data.pointer = (caddr_t) &range;
-                    iwr.u.data.length = sizeof(range);
-                    if (ioctl(s, SIOCGIWRANGE, &iwr) >= 0) {
-                        ATH_WE_VERSION = range.we_version_compiled;
-                    }
-                    close(s);
-                }
-                if (ATH_WE_VERSION==0) {
-                    RECEVENT_DEBUG_PRINTF("Fail to check we_version\n");
-                    return ;
-                } else {
-                    RECEVENT_DEBUG_PRINTF("Get we version is %d", ATH_WE_VERSION);
-                }
-            }
-            event_wireless( ((A_INT8*)attr) + rta_len, attr->rta_len - rta_len);
-        } else if (attr->rta_type == IFLA_IFNAME) {
-
-        }
-        attr = RTA_NEXT(attr, attrlen);
-    }
-}
-
-#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
-
-static void
-event_wireless(A_INT8 *data, int len)
-{
-    struct iw_event iwe_buf, *iwe = &iwe_buf;
-    A_INT8 *pos, *end, *custom, *buf;
-    A_UINT16 eventid;
-    A_STATUS status;
-
-    pos = data;
-    end = data + len;
-
-    while (pos + IW_EV_LCP_LEN <= end) 
-    {
-        /* Event data may be unaligned, so make a local, aligned copy
-         * before processing. */
-        memcpy(&iwe_buf, pos, IW_EV_LCP_LEN);
-        if (iwe->len <= IW_EV_LCP_LEN)
-            break;
-
-        custom = pos + IW_EV_POINT_LEN;
-        if (ATH_WE_VERSION > 18 &&
-            (iwe->cmd == IWEVMICHAELMICFAILURE ||
-             iwe->cmd == IWEVCUSTOM ||
-             iwe->cmd == IWEVASSOCREQIE ||
-             iwe->cmd == IWEVASSOCRESPIE ||
-             iwe->cmd == IWEVPMKIDCAND ||
-             iwe->cmd == IWEVGENIE)) {
-            /* WE-19 removed the pointer from struct iw_point */
-            char *dpos = (char *) &iwe_buf.u.data.length;
-            int dlen = dpos - (char *) &iwe_buf;
-            memcpy(dpos, pos + IW_EV_LCP_LEN,
-                   sizeof(struct iw_event) - dlen);
-        } else {
-            memcpy(&iwe_buf, pos, sizeof(struct iw_event));
-            custom += IW_EV_POINT_OFF;
-        }
-            
-        switch (iwe->cmd) {
-        case SIOCGIWAP:                
-            RECEVENT_DEBUG_PRINTF("event = new AP: "
-               "%02x:%02x:%02x:%02x:%02x:%02x %s" ,
-                MAC2STR((__u8 *) iwe->u.ap_addr.sa_data),
-                (memcmp(iwe->u.ap_addr.sa_data,
-                   "\x00\x00\x00\x00\x00\x00", 6) == 0 ||
-                memcmp(iwe->u.ap_addr.sa_data,
-                   "\x44\x44\x44\x44\x44\x44", 6) == 0) ?
-                   "Disassociated\n" : " Associated\n");
-            break;
-        case IWEVMICHAELMICFAILURE:
-            RECEVENT_DEBUG_PRINTF("event = Michael failure len = %d\n", iwe->u.data.length);
-            break;
-        case IWEVCUSTOM:
-            if (custom + iwe->u.data.length > end || (iwe->u.data.length < ID_LEN)) {
-                RECEVENT_DEBUG_PRINTF("event = IWEVCUSTOM with wrong length %d remain %d\n", 
-                    iwe->u.data.length, (end-custom));
-                return;
-            }
-            buf = malloc(iwe->u.data.length + 1);
-            if (buf == NULL) return;
-            memcpy(buf, custom, iwe->u.data.length);
-            eventid = *((A_UINT16*)buf);
-
-            switch (eventid) {
-            case (WMI_READY_EVENTID):
-                status = app_wmiready_event_rx((A_UINT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            case (WMI_DISCONNECT_EVENTID):
-                status = app_disconnect_event_rx((A_UINT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            case (WMI_PSTREAM_TIMEOUT_EVENTID):
-                status = app_pstream_timeout_event_rx((A_UINT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            case (WMI_ERROR_REPORT_EVENTID):
-                status = app_reportError_event_rx((A_UINT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            case (WMI_RSSI_THRESHOLD_EVENTID):
-                status = app_rssi_threshold_event_rx((A_UINT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            case (WMI_SCAN_COMPLETE_EVENTID):
-                status = app_scan_complete_event_rx((A_UINT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            case (WMI_TX_RETRY_ERR_EVENTID):
-                RECEVENT_DEBUG_PRINTF("event = Wmi Tx Retry Err, len = %d\n", iwe->u.data.length);
-                break;
-            case WMI_REPORT_SLEEP_STATE_EVENTID:
-                status = app_sleep_report_event_rx((A_UINT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            case (WMIX_HB_CHALLENGE_RESP_EVENTID):
-                status = app_challenge_resp_event_rx((A_UINT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            case (WMIX_DBGLOG_EVENTID):
-                status = app_target_debug_event_rx((A_INT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            default:
-#ifdef DEBUG
-               if (isalnum(*buf) && isalnum(*(buf+1))) {
-                    buf[iwe->u.data.length] = '\0';
-                    RECEVENT_DEBUG_PRINTF("Host received custom event: %s\n", buf);
-                } else {
-                    RECEVENT_DEBUG_PRINTF("Host received other event with id 0x%x length %d\n",
-                                          eventid, iwe->u.data.length);
-                }
-#endif
-                break;
-            }
-            free(buf);
-            break;
-        case SIOCGIWSCAN:
-            RECEVENT_DEBUG_PRINTF("event = scanComplete \n");
-            break;
-        case SIOCSIWESSID:
-            RECEVENT_DEBUG_PRINTF("event = ESSID: ");
-            break;
-        case IWEVASSOCREQIE:
-            RECEVENT_DEBUG_PRINTF("event = associte ReqIE \n");
-            break;
-        case IWEVASSOCRESPIE:
-            RECEVENT_DEBUG_PRINTF("event = associte RespIE \n");
-            break;
-        case IWEVPMKIDCAND:
-            RECEVENT_DEBUG_PRINTF("event = PMKID candidate \n");
-            break;
-        case IWEVGENIE:
-            if (custom + iwe->u.data.length > end || (iwe->u.data.length < ID_LEN)) {
-                RECEVENT_DEBUG_PRINTF("event = IWEVGENIE with wrong length %d remain %d\n", 
-                                      iwe->u.data.length, (end-custom));
-                return;
-            }
-            buf = malloc(iwe->u.data.length + 1);
-            if (buf == NULL) return;
-            memcpy(buf, custom, iwe->u.data.length);
-            eventid = *((A_UINT16*)buf);
-
-            switch (eventid) {
-            case (WMI_BSSINFO_EVENTID):                    
-                status = app_bssInfo_event_rx((A_UINT8 *)buf + ID_LEN, iwe->u.data.length - ID_LEN);
-                break;
-            case (WMI_CONNECT_EVENTID):                    
-                status = app_connect_event_rx((A_UINT8 *)(buf + ID_LEN), iwe->u.data.length - ID_LEN);
-                break;
-            default:
-                RECEVENT_DEBUG_PRINTF("Host received other generic event with id 0x%x\n", eventid);
-                break;
-            }
-            free(buf);
-            break;
-        default:
-            RECEVENT_DEBUG_PRINTF("event = Others %x length = %d\n", iwe->cmd, iwe->u.data.length);
-            break;
-        }
-        pos += iwe->len;
-    }
-}
-
-static void app_data_hexdump(const char *title, const unsigned char *buf, size_t len)
-{
-#ifdef DEBUG
-    if (!debugRecEventLevel) {
-        return;
-    }
-    if (len==0) {
-        RECEVENT_DEBUG_PRINTF("%s - is EMPTY (len=%lu)\n", title, (unsigned long)len);
-        return;
-    }
-    RECEVENT_DEBUG_PRINTF("%s - HEX DUMP(len=%lu):\n", title, (unsigned long)len);
-    if (buf) {
-        char line[82];
-        size_t i = 0;
-        while (i<len) {
-            int j, next=0;
-            for (j=0; j<16 && i<len; ++j, ++i) {
-                next += sprintf(line+next, "%02X ", buf[i]);
-                if (j==7) {
-                    next += sprintf(line+next, "   ");
-                }
-            }
-            if (j>0) {
-                next += sprintf(line+next, "\n");
-            }
-            RECEVENT_DEBUG_PRINTF("%s", line);
-        }        
-    }
-#endif
-}
-
-static A_STATUS app_sleep_report_event_rx(A_UINT8 *datap, size_t len)
-{
-    const char *status;
-    WMI_REPORT_SLEEP_STATE_EVENT *ev;
-    if(len < sizeof(WMI_REPORT_SLEEP_STATE_EVENT)) {
-        return A_EINVAL;
-    }
-    ev = (WMI_REPORT_SLEEP_STATE_EVENT *)datap;
-    switch(ev->sleepState) {
-        case  WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP:
-            status = "SLEEP";
-            break;
-        case WMI_REPORT_SLEEP_STATUS_IS_AWAKE:
-            status = "AWAKE";
-            break;
-        default:
-            status = "unknown";
-            break;
-    }
-    RECEVENT_DEBUG_PRINTF("Application receive sleep report %s\n", status);
-    return A_OK;
-}
-
-static A_STATUS app_wmiready_event_rx(A_UINT8 *datap, size_t len)
-{
-    WMI_READY_EVENT *ev;
-
-    if (len < sizeof(WMI_READY_EVENT)) {
-        return A_EINVAL;
-    }
-    ev = (WMI_READY_EVENT *)datap;
-    RECEVENT_DEBUG_PRINTF("Application receive wmi ready event:\n");
-    RECEVENT_DEBUG_PRINTF("mac address =  %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ",
-              ev->macaddr[0], ev->macaddr[1], ev->macaddr[2], ev->macaddr[3],
-              ev->macaddr[4], ev->macaddr[5]);
-    RECEVENT_DEBUG_PRINTF("Physical capability = %d\n",ev->phyCapability);
-    return A_OK;
-}
-
-static A_STATUS app_connect_event_rx(A_UINT8 *datap, size_t len)
-{
-    WMI_CONNECT_EVENT *ev;
-
-    if (len < sizeof(WMI_CONNECT_EVENT)) {
-        return A_EINVAL;
-    }
-    ev = (WMI_CONNECT_EVENT *)datap;
-
-    RECEVENT_DEBUG_PRINTF("Application receive connected event (len=%d) on freq %d \n", len, ev->u.infra_ibss_bss.channel);
-    RECEVENT_DEBUG_PRINTF("with bssid %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x "
-            " listenInterval=%d, assocReqLen=%d assocRespLen =%d\n",
-             ev->u.infra_ibss_bss.bssid[0], ev->u.infra_ibss_bss.bssid[1],
-             ev->u.infra_ibss_bss.bssid[2], ev->u.infra_ibss_bss.bssid[3],
-             ev->u.infra_ibss_bss.bssid[4], ev->u.infra_ibss_bss.bssid[5],
-             ev->u.infra_ibss_bss.listenInterval, ev->assocReqLen, ev->assocRespLen);
-
-    return A_OK;
-}
-
-static A_STATUS app_disconnect_event_rx(A_UINT8 *datap, size_t len)
-{
-    WMI_DISCONNECT_EVENT *ev;
-
-    if (len < sizeof(WMI_DISCONNECT_EVENT)) {
-        return A_EINVAL;
-    }
-
-    ev = (WMI_DISCONNECT_EVENT *)datap;
-    RECEVENT_DEBUG_PRINTF("Application receive disconnected event: reason is %d protocol reason/status code is %d\n",
-            ev->disconnectReason, ev->protocolReasonStatus);
-    RECEVENT_DEBUG_PRINTF("Disconnect from %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x \n",
-              ev->bssid[0], ev->bssid[1], ev->bssid[2], ev->bssid[3],
-              ev->bssid[4], ev->bssid[5]);
-
-    app_data_hexdump("AssocResp Frame", datap, ev->assocRespLen);
-    return A_OK;
-}
-
-static A_STATUS app_bssInfo_event_rx(A_UINT8 *datap, size_t len)
-{
-    WMI_BSS_INFO_HDR *bih;
-
-    if (len <= sizeof(WMI_BSS_INFO_HDR)) {
-        return A_EINVAL;
-    }
-    bih = (WMI_BSS_INFO_HDR *)datap;
-    RECEVENT_DEBUG_PRINTF("Application receive BSS info event, len = %d\n", len);
-    RECEVENT_DEBUG_PRINTF("channel = %d, frame type = %d, snr = %d rssi = %d.\n",
-            bih->channel, bih->frameType, bih->snr, bih->rssi);
-    RECEVENT_DEBUG_PRINTF("BSSID is: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x \n",
-              bih->bssid[0], bih->bssid[1], bih->bssid[2], bih->bssid[3],
-              bih->bssid[4], bih->bssid[5]);
-    return A_OK;
-}
-
-static A_STATUS app_pstream_timeout_event_rx(A_UINT8 *datap, size_t len)
-{
-    WMI_PSTREAM_TIMEOUT_EVENT *ev;
-
-    if (len < sizeof(WMI_PSTREAM_TIMEOUT_EVENT)) {
-        return A_EINVAL;
-    }
-    ev = (WMI_PSTREAM_TIMEOUT_EVENT *)datap;
-    RECEVENT_DEBUG_PRINTF("Application receive pstream timeout event:\n");
-    RECEVENT_DEBUG_PRINTF("streamID= %d\n", ev->trafficClass);
-    return A_OK;
-}
-
-static A_STATUS app_reportError_event_rx(A_UINT8 *datap, size_t len)
-{
-    WMI_TARGET_ERROR_REPORT_EVENT *reply;
-
-    if (len < sizeof(WMI_TARGET_ERROR_REPORT_EVENT)) {
-        return A_EINVAL;
-    }
-    reply = (WMI_TARGET_ERROR_REPORT_EVENT *)datap;
-    RECEVENT_DEBUG_PRINTF("Application receive report error event\n");
-    RECEVENT_DEBUG_PRINTF("error value is %d\n",reply->errorVal);
-
-    /* Initiate recovery if its a fatal error */
-    if (reply->errorVal & WMI_TARGET_FATAL_ERR) {
-        /* Reset the ar6000 module in the driver */
-        if (optionflag & RESTORE_FLAG) {
-            printf("Executing script: %s\n", restorefile);
-            system(restorefile);
-        }
-    }
-
-    return A_OK;
-}
-
-static A_STATUS
-app_rssi_threshold_event_rx(A_UINT8 *datap, size_t len)
-{
-    USER_RSSI_THOLD *evt;
-
-    if (len < sizeof(USER_RSSI_THOLD)) {
-        return A_EINVAL;
-    }
-    evt = (USER_RSSI_THOLD*)datap;
-    RECEVENT_DEBUG_PRINTF("Application receive rssi threshold event\n");
-    RECEVENT_DEBUG_PRINTF("tag is %d, rssi is %d\n", evt->tag, evt->rssi);
-
-    return A_OK;
-}
-
-static A_STATUS
-app_scan_complete_event_rx(A_UINT8 *datap, size_t len)
-{
-    char buf[10];
-    const char *status;
-    WMI_SCAN_COMPLETE_EVENT *ev;
-    if (len < sizeof(WMI_SCAN_COMPLETE_EVENT)) {
-        return A_EINVAL;
-    }
-    ev = (WMI_SCAN_COMPLETE_EVENT *)datap;
-    switch (ev->status) {
-    case A_OK:
-        status = "OK";
-        break;
-    case A_EBUSY:
-        status = "BUSY";
-        break;
-    case A_ECANCELED:
-        status = "CANCEL";
-        break;
-    default:
-        sprintf(buf, "%d", ev->status);
-        status = buf;
-        break;
-    }
-    RECEVENT_DEBUG_PRINTF("Application receive scan complete event %s\n", status);
-    return A_OK;
-}
-
-static A_STATUS
-app_challenge_resp_event_rx(A_UINT8 *datap, size_t len)
-{
-    A_UINT32 cookie;
-
-    memcpy(&cookie, datap, len);
-    RECEVENT_DEBUG_PRINTF("Application receive challenge response event: 0x%x\n", cookie);
-
-    return A_OK;
-}
-
-static A_STATUS
-app_target_debug_event_rx(A_INT8 *datap, size_t len)
-{
-#define BUF_SIZE    120
-    A_UINT32 count;
-    A_UINT32 numargs;
-    A_INT32 *buffer;
-    A_UINT32 length;
-    A_CHAR buf[BUF_SIZE];
-    long curpos;
-    static int numOfRec = 0;
-#ifdef ANDROID
-    A_INT8 *tmp_buf = (A_INT8*)malloc(len);
-#endif 
-#ifdef DBGLOG_DEBUG
-    RECEVENT_DEBUG_PRINTF("Application received target debug event: %d\n", len);
-#endif /* DBGLOG_DEBUG */
-    count = 0;
-
-#ifdef ANDROID /*Android cannot take casting; crash at run-time*/   
-    if (!tmp_buf) {
-        return A_NO_MEMORY;
-    }
-    memcpy(tmp_buf, datap, len);
-    buffer=(A_INT32*)tmp_buf;
-#else
-    buffer = (A_INT32 *)datap;
-#endif
-    
-    if (optionflag & BINARY_FLAG) {
-        /*
-         * If saved in binary format, create a binary 
-         * record and write it without decoding
-         */
-    
-        struct dbg_binary_record rec;
-    
-        rec.ts = time(NULL);
-        rec.length = len;
-        memcpy(rec.log, buffer, len);
-        fwrite((void *)&rec, sizeof(rec),1, fpout); 
-        fflush(fpout);
-        numOfRec += len/12; /* assume the average record size is 12 bytes */
-    
-        /* If exceeded the record limit, go back to beginning */
-        if(dbgRecLimit && (numOfRec >= dbgRecLimit)) {
-            numOfRec = 0;
-            fseek(fpout, 8, SEEK_SET);
-        }
-    } else {
-        char outputBuf[2048]; 
-        length = (len >> 2);
-        while (count < length) {
-            numargs = DBGLOG_GET_NUMARGS(buffer[count]);
-            if (dbg_formater(0, outputBuf, sizeof(outputBuf), (A_UINT32)time(NULL), &buffer[count]) > 0) {
-                fprintf(fpout, "%s", outputBuf);
-            }
-#ifdef DEBUG
-            if (debugRecEventLevel>1) {
-                if (dbg_formater(1, outputBuf, sizeof(outputBuf), 0, &buffer[count]) > 0) {
-                    RECEVENT_DBGLOG_PRINTF("%s", outputBuf);
-                }
-            }
-#endif
-            count += (numargs + 1);
-
-            numOfRec++;
-            if(dbgRecLimit && (numOfRec % dbgRecLimit == 0)) {
-                /* Once record limit is hit, rewind to start
-                * after 8 bytes from start
-                */
-                numOfRec = 0;
-                curpos = ftell(fpout);
-                truncate(dbglogoutfile, curpos);
-                rewind(fpout);
-                fseek(fpout, 8, SEEK_SET);
-                fprintf(fpout, "\n");
-            }
-        }
-
-        /* Update the last rec at the top of file */
-        curpos = ftell(fpout);
-        if( fgets(buf, BUF_SIZE, fpout) ) {
-            buf[BUF_SIZE - 1] = 0;  /* In case string is longer from logs */
-            length = strlen(buf);
-            memset(buf, ' ', length-1);
-            buf[length] = 0;
-            fseek(fpout, curpos, SEEK_SET);
-            fprintf(fpout, "%s", buf);
-        }
-
-        rewind(fpout);
-        /* Update last record */
-        fprintf(fpout, "%08d\n", numOfRec);
-        fseek(fpout, curpos, SEEK_SET);
-        fflush(fpout);
-    }
-
-#undef BUF_SIZE
-#ifdef ANDROID
-    free(tmp_buf);
-#endif 
-    return A_OK;
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/recEvent/restore.sh b/drivers/net/wireless/ar6003/host/tools/recEvent/restore.sh
deleted file mode 100644 (file)
index 953ee6e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-if [ -z "$WORKAREA" ]
-then
-        echo "Please set your WORKAREA environment variable."
-        exit
-fi
-
-if [ -z "$ATH_PLATFORM" ]
-then
-        echo "Please set your ATH_PLATFORM environment variable."
-        exit 1
-fi
-
-if [ -z "$NETIF" ]
-then
-        NETIF=eth1
-fi
-
-export IMAGEPATH=${IMAGEPATH:-$WORKAREA/host/.output/$ATH_PLATFORM/image}
-
-/sbin/ifconfig $NETIF down
-rmmod ar6000
-sleep 2
-case $ATH_PLATFORM in
-        LOCAL_i686-SDIO|LOCAL_i686-CF|SANDGATEII_ARM-SDIO|SANDGATEII_ARM-CF)
-        /sbin/insmod $IMAGEPATH/ar6000.ko
-        ;;
-        *)
-        /sbin/insmod $IMAGEPATH/ar6000.o
-esac
diff --git a/drivers/net/wireless/ar6003/host/tools/recEvent/wireless_copy.h b/drivers/net/wireless/ar6003/host/tools/recEvent/wireless_copy.h
deleted file mode 100644 (file)
index ae2514a..0000000
+++ /dev/null
@@ -1,1142 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-
-#ifndef _LINUX_WIRELESS_H
-#define _LINUX_WIRELESS_H
-
-/************************** DOCUMENTATION **************************/
-/*
- * Initial APIs (1996 -> onward) :
- * -----------------------------
- * Basically, the wireless extensions are for now a set of standard ioctl
- * call + /proc/net/wireless
- *
- * The entry /proc/net/wireless give statistics and information on the
- * driver.
- * This is better than having each driver having its entry because
- * its centralised and we may remove the driver module safely.
- *
- * Ioctl are used to configure the driver and issue commands.  This is
- * better than command line options of insmod because we may want to
- * change dynamically (while the driver is running) some parameters.
- *
- * The ioctl mechanimsm are copied from standard devices ioctl.
- * We have the list of command plus a structure descibing the
- * data exchanged...
- * Note that to add these ioctl, I was obliged to modify :
- *     # net/core/dev.c (two place + add include)
- *     # net/ipv4/af_inet.c (one place + add include)
- *
- * /proc/net/wireless is a copy of /proc/net/dev.
- * We have a structure for data passed from the driver to /proc/net/wireless
- * Too add this, I've modified :
- *     # net/core/dev.c (two other places)
- *     # include/linux/netdevice.h (one place)
- *     # include/linux/proc_fs.h (one place)
- *
- * New driver API (2002 -> onward) :
- * -------------------------------
- * This file is only concerned with the user space API and common definitions.
- * The new driver API is defined and documented in :
- *     # include/net/iw_handler.h
- *
- * Note as well that /proc/net/wireless implementation has now moved in :
- *     # net/core/wireless.c
- *
- * Wireless Events (2002 -> onward) :
- * --------------------------------
- * Events are defined at the end of this file, and implemented in :
- *     # net/core/wireless.c
- *
- * Other comments :
- * --------------
- * Do not add here things that are redundant with other mechanisms
- * (drivers init, ifconfig, /proc/net/dev, ...) and with are not
- * wireless specific.
- *
- * These wireless extensions are not magic : each driver has to provide
- * support for them...
- *
- * IMPORTANT NOTE : As everything in the kernel, this is very much a
- * work in progress. Contact me if you have ideas of improvements...
- */
-
-/***************************** INCLUDES *****************************/
-
-/* This header is used in user-space, therefore need to be sanitised
- * for that purpose. Those includes are usually not compatible with glibc.
- * To know which includes to use in user-space, check iwlib.h. */
-#ifdef __KERNEL__
-#include <linux/types.h>               /* for "caddr_t" et al          */
-#include <linux/socket.h>              /* for "struct sockaddr" et al  */
-#include <linux/if.h>                  /* for IFNAMSIZ and co... */
-#endif /* __KERNEL__ */
-
-/***************************** VERSION *****************************/
-/*
- * This constant is used to know the availability of the wireless
- * extensions and to know which version of wireless extensions it is
- * (there is some stuff that will be added in the future...)
- * I just plan to increment with each new version.
- */
-#define WIRELESS_EXT   22
-
-/*
- * Changes :
- *
- * V2 to V3
- * --------
- *     Alan Cox start some incompatibles changes. I've integrated a bit more.
- *     - Encryption renamed to Encode to avoid US regulation problems
- *     - Frequency changed from float to struct to avoid problems on old 386
- *
- * V3 to V4
- * --------
- *     - Add sensitivity
- *
- * V4 to V5
- * --------
- *     - Missing encoding definitions in range
- *     - Access points stuff
- *
- * V5 to V6
- * --------
- *     - 802.11 support (ESSID ioctls)
- *
- * V6 to V7
- * --------
- *     - define IW_ESSID_MAX_SIZE and IW_MAX_AP
- *
- * V7 to V8
- * --------
- *     - Changed my e-mail address
- *     - More 802.11 support (nickname, rate, rts, frag)
- *     - List index in frequencies
- *
- * V8 to V9
- * --------
- *     - Support for 'mode of operation' (ad-hoc, managed...)
- *     - Support for unicast and multicast power saving
- *     - Change encoding to support larger tokens (>64 bits)
- *     - Updated iw_params (disable, flags) and use it for NWID
- *     - Extracted iw_point from iwreq for clarity
- *
- * V9 to V10
- * ---------
- *     - Add PM capability to range structure
- *     - Add PM modifier : MAX/MIN/RELATIVE
- *     - Add encoding option : IW_ENCODE_NOKEY
- *     - Add TxPower ioctls (work like TxRate)
- *
- * V10 to V11
- * ----------
- *     - Add WE version in range (help backward/forward compatibility)
- *     - Add retry ioctls (work like PM)
- *
- * V11 to V12
- * ----------
- *     - Add SIOCSIWSTATS to get /proc/net/wireless programatically
- *     - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space
- *     - Add new statistics (frag, retry, beacon)
- *     - Add average quality (for user space calibration)
- *
- * V12 to V13
- * ----------
- *     - Document creation of new driver API.
- *     - Extract union iwreq_data from struct iwreq (for new driver API).
- *     - Rename SIOCSIWNAME as SIOCSIWCOMMIT
- *
- * V13 to V14
- * ----------
- *     - Wireless Events support : define struct iw_event
- *     - Define additional specific event numbers
- *     - Add "addr" and "param" fields in union iwreq_data
- *     - AP scanning stuff (SIOCSIWSCAN and friends)
- *
- * V14 to V15
- * ----------
- *     - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg
- *     - Make struct iw_freq signed (both m & e), add explicit padding
- *     - Add IWEVCUSTOM for driver specific event/scanning token
- *     - Add IW_MAX_GET_SPY for driver returning a lot of addresses
- *     - Add IW_TXPOW_RANGE for range of Tx Powers
- *     - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points
- *     - Add IW_MODE_MONITOR for passive monitor
- *
- * V15 to V16
- * ----------
- *     - Increase the number of bitrates in iw_range to 32 (for 802.11g)
- *     - Increase the number of frequencies in iw_range to 32 (for 802.11b+a)
- *     - Reshuffle struct iw_range for increases, add filler
- *     - Increase IW_MAX_AP to 64 for driver returning a lot of addresses
- *     - Remove IW_MAX_GET_SPY because conflict with enhanced spy support
- *     - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy"
- *     - Add IW_ENCODE_TEMP and iw_range->encoding_login_index
- *
- * V16 to V17
- * ----------
- *     - Add flags to frequency -> auto/fixed
- *     - Document (struct iw_quality *)->updated, add new flags (INVALID)
- *     - Wireless Event capability in struct iw_range
- *     - Add support for relative TxPower (yick !)
- *
- * V17 to V18 (From Jouni Malinen <jkmaline@cc.hut.fi>)
- * ----------
- *     - Add support for WPA/WPA2
- *     - Add extended encoding configuration (SIOCSIWENCODEEXT and
- *       SIOCGIWENCODEEXT)
- *     - Add SIOCSIWGENIE/SIOCGIWGENIE
- *     - Add SIOCSIWMLME
- *     - Add SIOCSIWPMKSA
- *     - Add struct iw_range bit field for supported encoding capabilities
- *     - Add optional scan request parameters for SIOCSIWSCAN
- *     - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA
- *       related parameters (extensible up to 4096 parameter values)
- *     - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE,
- *       IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND
- *
- * V18 to V19
- * ----------
- *     - Remove (struct iw_point *)->pointer from events and streams
- *     - Remove header includes to help user space
- *     - Increase IW_ENCODING_TOKEN_MAX from 32 to 64
- *     - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros
- *     - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM
- *     - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros
- *
- * V19 to V20
- * ----------
- *     - RtNetlink requests support (SET/GET)
- *
- * V20 to V21
- * ----------
- *     - Remove (struct net_device *)->get_wireless_stats()
- *     - Change length in ESSID and NICK to strlen() instead of strlen()+1
- *     - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
- *     - Power/Retry relative values no longer * 100000
- *     - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
- *
- * V21 to V22
- * ----------
- *     - Prevent leaking of kernel space in stream on 64 bits.
- */
-
-/**************************** CONSTANTS ****************************/
-
-/* -------------------------- IOCTL LIST -------------------------- */
-
-/* Wireless Identification */
-#define SIOCSIWCOMMIT  0x8B00          /* Commit pending changes to driver */
-#define SIOCGIWNAME    0x8B01          /* get name == wireless protocol */
-/* SIOCGIWNAME is used to verify the presence of Wireless Extensions.
- * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"...
- * Don't put the name of your driver there, it's useless. */
-
-/* Basic operations */
-#define SIOCSIWNWID    0x8B02          /* set network id (pre-802.11) */
-#define SIOCGIWNWID    0x8B03          /* get network id (the cell) */
-#define SIOCSIWFREQ    0x8B04          /* set channel/frequency (Hz) */
-#define SIOCGIWFREQ    0x8B05          /* get channel/frequency (Hz) */
-#define SIOCSIWMODE    0x8B06          /* set operation mode */
-#define SIOCGIWMODE    0x8B07          /* get operation mode */
-#define SIOCSIWSENS    0x8B08          /* set sensitivity (dBm) */
-#define SIOCGIWSENS    0x8B09          /* get sensitivity (dBm) */
-
-/* Informative stuff */
-#define SIOCSIWRANGE   0x8B0A          /* Unused */
-#define SIOCGIWRANGE   0x8B0B          /* Get range of parameters */
-#define SIOCSIWPRIV    0x8B0C          /* Unused */
-#define SIOCGIWPRIV    0x8B0D          /* get private ioctl interface info */
-#define SIOCSIWSTATS   0x8B0E          /* Unused */
-#define SIOCGIWSTATS   0x8B0F          /* Get /proc/net/wireless stats */
-/* SIOCGIWSTATS is strictly used between user space and the kernel, and
- * is never passed to the driver (i.e. the driver will never see it). */
-
-/* Spy support (statistics per MAC address - used for Mobile IP support) */
-#define SIOCSIWSPY     0x8B10          /* set spy addresses */
-#define SIOCGIWSPY     0x8B11          /* get spy info (quality of link) */
-#define SIOCSIWTHRSPY  0x8B12          /* set spy threshold (spy event) */
-#define SIOCGIWTHRSPY  0x8B13          /* get spy threshold */
-
-/* Access Point manipulation */
-#define SIOCSIWAP      0x8B14          /* set access point MAC addresses */
-#define SIOCGIWAP      0x8B15          /* get access point MAC addresses */
-#define SIOCGIWAPLIST  0x8B17          /* Deprecated in favor of scanning */
-#define SIOCSIWSCAN    0x8B18          /* trigger scanning (list cells) */
-#define SIOCGIWSCAN    0x8B19          /* get scanning results */
-
-/* 802.11 specific support */
-#define SIOCSIWESSID   0x8B1A          /* set ESSID (network name) */
-#define SIOCGIWESSID   0x8B1B          /* get ESSID */
-#define SIOCSIWNICKN   0x8B1C          /* set node name/nickname */
-#define SIOCGIWNICKN   0x8B1D          /* get node name/nickname */
-/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
- * within the 'iwreq' structure, so we need to use the 'data' member to
- * point to a string in user space, like it is done for RANGE... */
-
-/* Other parameters useful in 802.11 and some other devices */
-#define SIOCSIWRATE    0x8B20          /* set default bit rate (bps) */
-#define SIOCGIWRATE    0x8B21          /* get default bit rate (bps) */
-#define SIOCSIWRTS     0x8B22          /* set RTS/CTS threshold (bytes) */
-#define SIOCGIWRTS     0x8B23          /* get RTS/CTS threshold (bytes) */
-#define SIOCSIWFRAG    0x8B24          /* set fragmentation thr (bytes) */
-#define SIOCGIWFRAG    0x8B25          /* get fragmentation thr (bytes) */
-#define SIOCSIWTXPOW   0x8B26          /* set transmit power (dBm) */
-#define SIOCGIWTXPOW   0x8B27          /* get transmit power (dBm) */
-#define SIOCSIWRETRY   0x8B28          /* set retry limits and lifetime */
-#define SIOCGIWRETRY   0x8B29          /* get retry limits and lifetime */
-
-/* Encoding stuff (scrambling, hardware security, WEP...) */
-#define SIOCSIWENCODE  0x8B2A          /* set encoding token & mode */
-#define SIOCGIWENCODE  0x8B2B          /* get encoding token & mode */
-/* Power saving stuff (power management, unicast and multicast) */
-#define SIOCSIWPOWER   0x8B2C          /* set Power Management settings */
-#define SIOCGIWPOWER   0x8B2D          /* get Power Management settings */
-/* Modulation bitmask */
-#define SIOCSIWMODUL   0x8B2E          /* set Modulations settings */
-#define SIOCGIWMODUL   0x8B2F          /* get Modulations settings */
-
-/* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM).
- * This ioctl uses struct iw_point and data buffer that includes IE id and len
- * fields. More than one IE may be included in the request. Setting the generic
- * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers
- * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers
- * are required to report the used IE as a wireless event, e.g., when
- * associating with an AP. */
-#define SIOCSIWGENIE   0x8B30          /* set generic IE */
-#define SIOCGIWGENIE   0x8B31          /* get generic IE */
-
-/* WPA : IEEE 802.11 MLME requests */
-#define SIOCSIWMLME    0x8B16          /* request MLME operation; uses
-                                        * struct iw_mlme */
-/* WPA : Authentication mode parameters */
-#define SIOCSIWAUTH    0x8B32          /* set authentication mode params */
-#define SIOCGIWAUTH    0x8B33          /* get authentication mode params */
-
-/* WPA : Extended version of encoding configuration */
-#define SIOCSIWENCODEEXT 0x8B34                /* set encoding token & mode */
-#define SIOCGIWENCODEEXT 0x8B35                /* get encoding token & mode */
-
-/* WPA2 : PMKSA cache management */
-#define SIOCSIWPMKSA   0x8B36          /* PMKSA cache operation */
-
-/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
-
-/* These 32 ioctl are wireless device private, for 16 commands.
- * Each driver is free to use them for whatever purpose it chooses,
- * however the driver *must* export the description of those ioctls
- * with SIOCGIWPRIV and *must* use arguments as defined below.
- * If you don't follow those rules, DaveM is going to hate you (reason :
- * it make mixed 32/64bit operation impossible).
- */
-#define SIOCIWFIRSTPRIV        0x8BE0
-#define SIOCIWLASTPRIV 0x8BFF
-/* Previously, we were using SIOCDEVPRIVATE, but we now have our
- * separate range because of collisions with other tools such as
- * 'mii-tool'.
- * We now have 32 commands, so a bit more space ;-).
- * Also, all 'even' commands are only usable by root and don't return the
- * content of ifr/iwr to user (but you are not obliged to use the set/get
- * convention, just use every other two command). More details in iwpriv.c.
- * And I repeat : you are not forced to use them with iwpriv, but you
- * must be compliant with it.
- */
-
-/* ------------------------- IOCTL STUFF ------------------------- */
-
-/* The first and the last (range) */
-#define SIOCIWFIRST    0x8B00
-#define SIOCIWLAST     SIOCIWLASTPRIV          /* 0x8BFF */
-#define IW_IOCTL_IDX(cmd)      ((cmd) - SIOCIWFIRST)
-
-/* Odd : get (world access), even : set (root access) */
-#define IW_IS_SET(cmd) (!((cmd) & 0x1))
-#define IW_IS_GET(cmd) ((cmd) & 0x1)
-
-/* ----------------------- WIRELESS EVENTS ----------------------- */
-/* Those are *NOT* ioctls, do not issue request on them !!! */
-/* Most events use the same identifier as ioctl requests */
-
-#define IWEVTXDROP     0x8C00          /* Packet dropped to excessive retry */
-#define IWEVQUAL       0x8C01          /* Quality part of statistics (scan) */
-#define IWEVCUSTOM     0x8C02          /* Driver specific ascii string */
-#define IWEVREGISTERED 0x8C03          /* Discovered a new node (AP mode) */
-#define IWEVEXPIRED    0x8C04          /* Expired a node (AP mode) */
-#define IWEVGENIE      0x8C05          /* Generic IE (WPA, RSN, WMM, ..)
-                                        * (scan results); This includes id and
-                                        * length fields. One IWEVGENIE may
-                                        * contain more than one IE. Scan
-                                        * results may contain one or more
-                                        * IWEVGENIE events. */
-#define IWEVMICHAELMICFAILURE 0x8C06   /* Michael MIC failure
-                                        * (struct iw_michaelmicfailure)
-                                        */
-#define IWEVASSOCREQIE 0x8C07          /* IEs used in (Re)Association Request.
-                                        * The data includes id and length
-                                        * fields and may contain more than one
-                                        * IE. This event is required in
-                                        * Managed mode if the driver
-                                        * generates its own WPA/RSN IE. This
-                                        * should be sent just before
-                                        * IWEVREGISTERED event for the
-                                        * association. */
-#define IWEVASSOCRESPIE        0x8C08          /* IEs used in (Re)Association
-                                        * Response. The data includes id and
-                                        * length fields and may contain more
-                                        * than one IE. This may be sent
-                                        * between IWEVASSOCREQIE and
-                                        * IWEVREGISTERED events for the
-                                        * association. */
-#define IWEVPMKIDCAND  0x8C09          /* PMKID candidate for RSN
-                                        * pre-authentication
-                                        * (struct iw_pmkid_cand) */
-
-#define IWEVFIRST      0x8C00
-#define IW_EVENT_IDX(cmd)      ((cmd) - IWEVFIRST)
-
-/* ------------------------- PRIVATE INFO ------------------------- */
-/*
- * The following is used with SIOCGIWPRIV. It allow a driver to define
- * the interface (name, type of data) for its private ioctl.
- * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV
- */
-
-#define IW_PRIV_TYPE_MASK      0x7000  /* Type of arguments */
-#define IW_PRIV_TYPE_NONE      0x0000
-#define IW_PRIV_TYPE_BYTE      0x1000  /* Char as number */
-#define IW_PRIV_TYPE_CHAR      0x2000  /* Char as character */
-#define IW_PRIV_TYPE_INT       0x4000  /* 32 bits int */
-#define IW_PRIV_TYPE_FLOAT     0x5000  /* struct iw_freq */
-#define IW_PRIV_TYPE_ADDR      0x6000  /* struct sockaddr */
-
-#define IW_PRIV_SIZE_FIXED     0x0800  /* Variable or fixed number of args */
-
-#define IW_PRIV_SIZE_MASK      0x07FF  /* Max number of those args */
-
-/*
- * Note : if the number of args is fixed and the size < 16 octets,
- * instead of passing a pointer we will put args in the iwreq struct...
- */
-
-/* ----------------------- OTHER CONSTANTS ----------------------- */
-
-/* Maximum frequencies in the range struct */
-#define IW_MAX_FREQUENCIES     32
-/* Note : if you have something like 80 frequencies,
- * don't increase this constant and don't fill the frequency list.
- * The user will be able to set by channel anyway... */
-
-/* Maximum bit rates in the range struct */
-#define IW_MAX_BITRATES                32
-
-/* Maximum tx powers in the range struct */
-#define IW_MAX_TXPOWER         8
-/* Note : if you more than 8 TXPowers, just set the max and min or
- * a few of them in the struct iw_range. */
-
-/* Maximum of address that you may set with SPY */
-#define IW_MAX_SPY             8
-
-/* Maximum of address that you may get in the
-   list of access points in range */
-#define IW_MAX_AP              64
-
-/* Maximum size of the ESSID and NICKN strings */
-#define IW_ESSID_MAX_SIZE      32
-
-/* Modes of operation */
-#define IW_MODE_AUTO   0       /* Let the driver decides */
-#define IW_MODE_ADHOC  1       /* Single cell network */
-#define IW_MODE_INFRA  2       /* Multi cell network, roaming, ... */
-#define IW_MODE_MASTER 3       /* Synchronisation master or Access Point */
-#define IW_MODE_REPEAT 4       /* Wireless Repeater (forwarder) */
-#define IW_MODE_SECOND 5       /* Secondary master/repeater (backup) */
-#define IW_MODE_MONITOR        6       /* Passive monitor (listen only) */
-
-/* Statistics flags (bitmask in updated) */
-#define IW_QUAL_QUAL_UPDATED   0x01    /* Value was updated since last read */
-#define IW_QUAL_LEVEL_UPDATED  0x02
-#define IW_QUAL_NOISE_UPDATED  0x04
-#define IW_QUAL_ALL_UPDATED    0x07
-#define IW_QUAL_DBM            0x08    /* Level + Noise are dBm */
-#define IW_QUAL_QUAL_INVALID   0x10    /* Driver doesn't provide value */
-#define IW_QUAL_LEVEL_INVALID  0x20
-#define IW_QUAL_NOISE_INVALID  0x40
-#define IW_QUAL_RCPI           0x80    /* Level + Noise are 802.11k RCPI */
-#define IW_QUAL_ALL_INVALID    0x70
-
-/* Frequency flags */
-#define IW_FREQ_AUTO           0x00    /* Let the driver decides */
-#define IW_FREQ_FIXED          0x01    /* Force a specific value */
-
-/* Maximum number of size of encoding token available
- * they are listed in the range structure */
-#define IW_MAX_ENCODING_SIZES  8
-
-/* Maximum size of the encoding token in bytes */
-#define IW_ENCODING_TOKEN_MAX  64      /* 512 bits (for now) */
-
-/* Flags for encoding (along with the token) */
-#define IW_ENCODE_INDEX                0x00FF  /* Token index (if needed) */
-#define IW_ENCODE_FLAGS                0xFF00  /* Flags defined below */
-#define IW_ENCODE_MODE         0xF000  /* Modes defined below */
-#define IW_ENCODE_DISABLED     0x8000  /* Encoding disabled */
-#define IW_ENCODE_ENABLED      0x0000  /* Encoding enabled */
-#define IW_ENCODE_RESTRICTED   0x4000  /* Refuse non-encoded packets */
-#define IW_ENCODE_OPEN         0x2000  /* Accept non-encoded packets */
-#define IW_ENCODE_NOKEY                0x0800  /* Key is write only, so not present */
-#define IW_ENCODE_TEMP         0x0400  /* Temporary key */
-
-/* Power management flags available (along with the value, if any) */
-#define IW_POWER_ON            0x0000  /* No details... */
-#define IW_POWER_TYPE          0xF000  /* Type of parameter */
-#define IW_POWER_PERIOD                0x1000  /* Value is a period/duration of  */
-#define IW_POWER_TIMEOUT       0x2000  /* Value is a timeout (to go asleep) */
-#define IW_POWER_SAVING                0x4000  /* Value is relative (how aggressive)*/
-#define IW_POWER_MODE          0x0F00  /* Power Management mode */
-#define IW_POWER_UNICAST_R     0x0100  /* Receive only unicast messages */
-#define IW_POWER_MULTICAST_R   0x0200  /* Receive only multicast messages */
-#define IW_POWER_ALL_R         0x0300  /* Receive all messages though PM */
-#define IW_POWER_FORCE_S       0x0400  /* Force PM procedure for sending unicast */
-#define IW_POWER_REPEATER      0x0800  /* Repeat broadcast messages in PM period */
-#define IW_POWER_MODIFIER      0x000F  /* Modify a parameter */
-#define IW_POWER_MIN           0x0001  /* Value is a minimum  */
-#define IW_POWER_MAX           0x0002  /* Value is a maximum */
-#define IW_POWER_RELATIVE      0x0004  /* Value is not in seconds/ms/us */
-
-/* Transmit Power flags available */
-#define IW_TXPOW_TYPE          0x00FF  /* Type of value */
-#define IW_TXPOW_DBM           0x0000  /* Value is in dBm */
-#define IW_TXPOW_MWATT         0x0001  /* Value is in mW */
-#define IW_TXPOW_RELATIVE      0x0002  /* Value is in arbitrary units */
-#define IW_TXPOW_RANGE         0x1000  /* Range of value between min/max */
-
-/* Retry limits and lifetime flags available */
-#define IW_RETRY_ON            0x0000  /* No details... */
-#define IW_RETRY_TYPE          0xF000  /* Type of parameter */
-#define IW_RETRY_LIMIT         0x1000  /* Maximum number of retries*/
-#define IW_RETRY_LIFETIME      0x2000  /* Maximum duration of retries in us */
-#define IW_RETRY_MODIFIER      0x00FF  /* Modify a parameter */
-#define IW_RETRY_MIN           0x0001  /* Value is a minimum  */
-#define IW_RETRY_MAX           0x0002  /* Value is a maximum */
-#define IW_RETRY_RELATIVE      0x0004  /* Value is not in seconds/ms/us */
-#define IW_RETRY_SHORT         0x0010  /* Value is for short packets  */
-#define IW_RETRY_LONG          0x0020  /* Value is for long packets */
-
-/* Scanning request flags */
-#define IW_SCAN_DEFAULT                0x0000  /* Default scan of the driver */
-#define IW_SCAN_ALL_ESSID      0x0001  /* Scan all ESSIDs */
-#define IW_SCAN_THIS_ESSID     0x0002  /* Scan only this ESSID */
-#define IW_SCAN_ALL_FREQ       0x0004  /* Scan all Frequencies */
-#define IW_SCAN_THIS_FREQ      0x0008  /* Scan only this Frequency */
-#define IW_SCAN_ALL_MODE       0x0010  /* Scan all Modes */
-#define IW_SCAN_THIS_MODE      0x0020  /* Scan only this Mode */
-#define IW_SCAN_ALL_RATE       0x0040  /* Scan all Bit-Rates */
-#define IW_SCAN_THIS_RATE      0x0080  /* Scan only this Bit-Rate */
-/* struct iw_scan_req scan_type */
-#define IW_SCAN_TYPE_ACTIVE 0
-#define IW_SCAN_TYPE_PASSIVE 1
-/* Maximum size of returned data */
-#define IW_SCAN_MAX_DATA       4096    /* In bytes */
-
-/* Max number of char in custom event - use multiple of them if needed */
-#define IW_CUSTOM_MAX          256     /* In bytes */
-
-/* Generic information element */
-#define IW_GENERIC_IE_MAX      1024
-
-/* MLME requests (SIOCSIWMLME / struct iw_mlme) */
-#define IW_MLME_DEAUTH         0
-#define IW_MLME_DISASSOC       1
-#define IW_MLME_AUTH           2
-#define IW_MLME_ASSOC          3
-
-/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
-#define IW_AUTH_INDEX          0x0FFF
-#define IW_AUTH_FLAGS          0xF000
-/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095)
- * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the
- * parameter that is being set/get to; value will be read/written to
- * struct iw_param value field) */
-#define IW_AUTH_WPA_VERSION            0
-#define IW_AUTH_CIPHER_PAIRWISE                1
-#define IW_AUTH_CIPHER_GROUP           2
-#define IW_AUTH_KEY_MGMT               3
-#define IW_AUTH_TKIP_COUNTERMEASURES   4
-#define IW_AUTH_DROP_UNENCRYPTED       5
-#define IW_AUTH_80211_AUTH_ALG         6
-#define IW_AUTH_WPA_ENABLED            7
-#define IW_AUTH_RX_UNENCRYPTED_EAPOL   8
-#define IW_AUTH_ROAMING_CONTROL                9
-#define IW_AUTH_PRIVACY_INVOKED                10
-
-/* IW_AUTH_WPA_VERSION values (bit field) */
-#define IW_AUTH_WPA_VERSION_DISABLED   0x00000001
-#define IW_AUTH_WPA_VERSION_WPA                0x00000002
-#define IW_AUTH_WPA_VERSION_WPA2       0x00000004
-
-/* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */
-#define IW_AUTH_CIPHER_NONE    0x00000001
-#define IW_AUTH_CIPHER_WEP40   0x00000002
-#define IW_AUTH_CIPHER_TKIP    0x00000004
-#define IW_AUTH_CIPHER_CCMP    0x00000008
-#define IW_AUTH_CIPHER_WEP104  0x00000010
-
-/* IW_AUTH_KEY_MGMT values (bit field) */
-#define IW_AUTH_KEY_MGMT_802_1X        1
-#define IW_AUTH_KEY_MGMT_PSK   2
-
-/* IW_AUTH_80211_AUTH_ALG values (bit field) */
-#define IW_AUTH_ALG_OPEN_SYSTEM        0x00000001
-#define IW_AUTH_ALG_SHARED_KEY 0x00000002
-#define IW_AUTH_ALG_LEAP       0x00000004
-
-/* IW_AUTH_ROAMING_CONTROL values */
-#define IW_AUTH_ROAMING_ENABLE 0       /* driver/firmware based roaming */
-#define IW_AUTH_ROAMING_DISABLE        1       /* user space program used for roaming
-                                        * control */
-
-/* SIOCSIWENCODEEXT definitions */
-#define IW_ENCODE_SEQ_MAX_SIZE 8
-/* struct iw_encode_ext ->alg */
-#define IW_ENCODE_ALG_NONE     0
-#define IW_ENCODE_ALG_WEP      1
-#define IW_ENCODE_ALG_TKIP     2
-#define IW_ENCODE_ALG_CCMP     3
-/* struct iw_encode_ext ->ext_flags */
-#define IW_ENCODE_EXT_TX_SEQ_VALID     0x00000001
-#define IW_ENCODE_EXT_RX_SEQ_VALID     0x00000002
-#define IW_ENCODE_EXT_GROUP_KEY                0x00000004
-#define IW_ENCODE_EXT_SET_TX_KEY       0x00000008
-
-/* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */
-#define IW_MICFAILURE_KEY_ID   0x00000003 /* Key ID 0..3 */
-#define IW_MICFAILURE_GROUP    0x00000004
-#define IW_MICFAILURE_PAIRWISE 0x00000008
-#define IW_MICFAILURE_STAKEY   0x00000010
-#define IW_MICFAILURE_COUNT    0x00000060 /* 1 or 2 (0 = count not supported)
-                                           */
-
-/* Bit field values for enc_capa in struct iw_range */
-#define IW_ENC_CAPA_WPA                0x00000001
-#define IW_ENC_CAPA_WPA2       0x00000002
-#define IW_ENC_CAPA_CIPHER_TKIP        0x00000004
-#define IW_ENC_CAPA_CIPHER_CCMP        0x00000008
-
-/* Event capability macros - in (struct iw_range *)->event_capa
- * Because we have more than 32 possible events, we use an array of
- * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
-#define IW_EVENT_CAPA_BASE(cmd)                ((cmd >= SIOCIWFIRSTPRIV) ? \
-                                        (cmd - SIOCIWFIRSTPRIV + 0x60) : \
-                                        (cmd - SIOCSIWCOMMIT))
-#define IW_EVENT_CAPA_INDEX(cmd)       (IW_EVENT_CAPA_BASE(cmd) >> 5)
-#define IW_EVENT_CAPA_MASK(cmd)                (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
-/* Event capability constants - event autogenerated by the kernel
- * This list is valid for most 802.11 devices, customise as needed... */
-#define IW_EVENT_CAPA_K_0      (IW_EVENT_CAPA_MASK(0x8B04) | \
-                                IW_EVENT_CAPA_MASK(0x8B06) | \
-                                IW_EVENT_CAPA_MASK(0x8B1A))
-#define IW_EVENT_CAPA_K_1      (IW_EVENT_CAPA_MASK(0x8B2A))
-/* "Easy" macro to set events in iw_range (less efficient) */
-#define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd))
-#define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; }
-
-/* Modulations bitmasks */
-#define IW_MODUL_ALL           0x00000000      /* Everything supported */
-#define IW_MODUL_FH            0x00000001      /* Frequency Hopping */
-#define IW_MODUL_DS            0x00000002      /* Original Direct Sequence */
-#define IW_MODUL_CCK           0x00000004      /* 802.11b : 5.5 + 11 Mb/s */
-#define IW_MODUL_11B           (IW_MODUL_DS | IW_MODUL_CCK)
-#define IW_MODUL_PBCC          0x00000008      /* TI : 5.5 + 11 + 22 Mb/s */
-#define IW_MODUL_OFDM_A                0x00000010      /* 802.11a : 54 Mb/s */
-#define IW_MODUL_11A           (IW_MODUL_OFDM_A)
-#define IW_MODUL_11AB          (IW_MODUL_11B | IW_MODUL_11A)
-#define IW_MODUL_OFDM_G                0x00000020      /* 802.11g : 54 Mb/s */
-#define IW_MODUL_11G           (IW_MODUL_11B | IW_MODUL_OFDM_G)
-#define IW_MODUL_11AG          (IW_MODUL_11G | IW_MODUL_11A)
-#define IW_MODUL_TURBO         0x00000040      /* ATH : bonding, 108 Mb/s */
-/* In here we should define MIMO stuff. Later... */
-#define IW_MODUL_CUSTOM                0x40000000      /* Driver specific */
-
-/* Bitrate flags available */
-#define IW_BITRATE_TYPE                0x00FF  /* Type of value */
-#define IW_BITRATE_UNICAST     0x0001  /* Maximum/Fixed unicast bitrate */
-#define IW_BITRATE_BROADCAST   0x0002  /* Fixed broadcast bitrate */
-
-/****************************** TYPES ******************************/
-
-/* --------------------------- SUBTYPES --------------------------- */
-/*
- *     Generic format for most parameters that fit in an int
- */
-struct iw_param
-{
-  __s32                value;          /* The value of the parameter itself */
-  __u8         fixed;          /* Hardware should not use auto select */
-  __u8         disabled;       /* Disable the feature */
-  __u16                flags;          /* Various specifc flags (if any) */
-};
-
-/*
- *     For all data larger than 16 octets, we need to use a
- *     pointer to memory allocated in user space.
- */
-struct iw_point
-{
-  void __user  *pointer;       /* Pointer to the data  (in user space) */
-  __u16                length;         /* number of fields or size in bytes */
-  __u16                flags;          /* Optional params */
-};
-
-/*
- *     A frequency
- *     For numbers lower than 10^9, we encode the number in 'm' and
- *     set 'e' to 0
- *     For number greater than 10^9, we divide it by the lowest power
- *     of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
- *     The power of 10 is in 'e', the result of the division is in 'm'.
- */
-struct iw_freq
-{
-       __s32           m;              /* Mantissa */
-       __s16           e;              /* Exponent */
-       __u8            i;              /* List index (when in range struct) */
-       __u8            flags;          /* Flags (fixed/auto) */
-};
-
-/*
- *     Quality of the link
- */
-struct iw_quality
-{
-       __u8            qual;           /* link quality (%retries, SNR,
-                                          %missed beacons or better...) */
-       __u8            level;          /* signal level (dBm) */
-       __u8            noise;          /* noise level (dBm) */
-       __u8            updated;        /* Flags to know if updated */
-};
-
-/*
- *     Packet discarded in the wireless adapter due to
- *     "wireless" specific problems...
- *     Note : the list of counter and statistics in net_device_stats
- *     is already pretty exhaustive, and you should use that first.
- *     This is only additional stats...
- */
-struct iw_discarded
-{
-       __u32           nwid;           /* Rx : Wrong nwid/essid */
-       __u32           code;           /* Rx : Unable to code/decode (WEP) */
-       __u32           fragment;       /* Rx : Can't perform MAC reassembly */
-       __u32           retries;        /* Tx : Max MAC retries num reached */
-       __u32           misc;           /* Others cases */
-};
-
-/*
- *     Packet/Time period missed in the wireless adapter due to
- *     "wireless" specific problems...
- */
-struct iw_missed
-{
-       __u32           beacon;         /* Missed beacons/superframe */
-};
-
-/*
- *     Quality range (for spy threshold)
- */
-struct iw_thrspy
-{
-       struct sockaddr         addr;           /* Source address (hw/mac) */
-       struct iw_quality       qual;           /* Quality of the link */
-       struct iw_quality       low;            /* Low threshold */
-       struct iw_quality       high;           /* High threshold */
-};
-
-/*
- *     Optional data for scan request
- *
- *     Note: these optional parameters are controlling parameters for the
- *     scanning behavior, these do not apply to getting scan results
- *     (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and
- *     provide a merged results with all BSSes even if the previous scan
- *     request limited scanning to a subset, e.g., by specifying an SSID.
- *     Especially, scan results are required to include an entry for the
- *     current BSS if the driver is in Managed mode and associated with an AP.
- */
-struct iw_scan_req
-{
-       __u8            scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */
-       __u8            essid_len;
-       __u8            num_channels; /* num entries in channel_list;
-                                      * 0 = scan all allowed channels */
-       __u8            flags; /* reserved as padding; use zero, this may
-                               * be used in the future for adding flags
-                               * to request different scan behavior */
-       struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or
-                               * individual address of a specific BSS */
-
-       /*
-        * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using
-        * the current ESSID. This allows scan requests for specific ESSID
-        * without having to change the current ESSID and potentially breaking
-        * the current association.
-        */
-       __u8            essid[IW_ESSID_MAX_SIZE];
-
-       /*
-        * Optional parameters for changing the default scanning behavior.
-        * These are based on the MLME-SCAN.request from IEEE Std 802.11.
-        * TU is 1.024 ms. If these are set to 0, driver is expected to use
-        * reasonable default values. min_channel_time defines the time that
-        * will be used to wait for the first reply on each channel. If no
-        * replies are received, next channel will be scanned after this. If
-        * replies are received, total time waited on the channel is defined by
-        * max_channel_time.
-        */
-       __u32           min_channel_time; /* in TU */
-       __u32           max_channel_time; /* in TU */
-
-       struct iw_freq  channel_list[IW_MAX_FREQUENCIES];
-};
-
-/* ------------------------- WPA SUPPORT ------------------------- */
-
-/*
- *     Extended data structure for get/set encoding (this is used with
- *     SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_*
- *     flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and
- *     only the data contents changes (key data -> this structure, including
- *     key data).
- *
- *     If the new key is the first group key, it will be set as the default
- *     TX key. Otherwise, default TX key index is only changed if
- *     IW_ENCODE_EXT_SET_TX_KEY flag is set.
- *
- *     Key will be changed with SIOCSIWENCODEEXT in all cases except for
- *     special "change TX key index" operation which is indicated by setting
- *     key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY.
- *
- *     tx_seq/rx_seq are only used when respective
- *     IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal
- *     TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start
- *     TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally
- *     used only by an Authenticator (AP or an IBSS station) to get the
- *     current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and
- *     RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for
- *     debugging/testing.
- */
-struct iw_encode_ext
-{
-       __u32           ext_flags; /* IW_ENCODE_EXT_* */
-       __u8            tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
-       __u8            rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
-       struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast
-                              * (group) keys or unicast address for
-                              * individual keys */
-       __u16           alg; /* IW_ENCODE_ALG_* */
-       __u16           key_len;
-       __u8            key[0];
-};
-
-/* SIOCSIWMLME data */
-struct iw_mlme
-{
-       __u16           cmd; /* IW_MLME_* */
-       __u16           reason_code;
-       struct sockaddr addr;
-};
-
-/* SIOCSIWPMKSA data */
-#define IW_PMKSA_ADD           1
-#define IW_PMKSA_REMOVE                2
-#define IW_PMKSA_FLUSH         3
-
-#define IW_PMKID_LEN   16
-
-struct iw_pmksa
-{
-       __u32           cmd; /* IW_PMKSA_* */
-       struct sockaddr bssid;
-       __u8            pmkid[IW_PMKID_LEN];
-};
-
-/* IWEVMICHAELMICFAILURE data */
-struct iw_michaelmicfailure
-{
-       __u32           flags;
-       struct sockaddr src_addr;
-       __u8            tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
-};
-
-/* IWEVPMKIDCAND data */
-#define IW_PMKID_CAND_PREAUTH  0x00000001 /* RNS pre-authentication enabled */
-struct iw_pmkid_cand
-{
-       __u32           flags; /* IW_PMKID_CAND_* */
-       __u32           index; /* the smaller the index, the higher the
-                               * priority */
-       struct sockaddr bssid;
-};
-
-/* ------------------------ WIRELESS STATS ------------------------ */
-/*
- * Wireless statistics (used for /proc/net/wireless)
- */
-struct iw_statistics
-{
-       __u16           status;         /* Status
-                                        * - device dependent for now */
-
-       struct iw_quality       qual;           /* Quality of the link
-                                                * (instant/mean/max) */
-       struct iw_discarded     discard;        /* Packet discarded counts */
-       struct iw_missed        miss;           /* Packet missed counts */
-};
-
-/* ------------------------ IOCTL REQUEST ------------------------ */
-/*
- * This structure defines the payload of an ioctl, and is used 
- * below.
- *
- * Note that this structure should fit on the memory footprint
- * of iwreq (which is the same as ifreq), which mean a max size of
- * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
- * You should check this when increasing the structures defined
- * above in this file...
- */
-union  iwreq_data
-{
-       /* Config - generic */
-       char            name[IFNAMSIZ];
-       /* Name : used to verify the presence of  wireless extensions.
-        * Name of the protocol/provider... */
-
-       struct iw_point essid;          /* Extended network name */
-       struct iw_param nwid;           /* network id (or domain - the cell) */
-       struct iw_freq  freq;           /* frequency or channel :
-                                        * 0-1000 = channel
-                                        * > 1000 = frequency in Hz */
-
-       struct iw_param sens;           /* signal level threshold */
-       struct iw_param bitrate;        /* default bit rate */
-       struct iw_param txpower;        /* default transmit power */
-       struct iw_param rts;            /* RTS threshold threshold */
-       struct iw_param frag;           /* Fragmentation threshold */
-       __u32           mode;           /* Operation mode */
-       struct iw_param retry;          /* Retry limits & lifetime */
-
-       struct iw_point encoding;       /* Encoding stuff : tokens */
-       struct iw_param power;          /* PM duration/timeout */
-       struct iw_quality qual;         /* Quality part of statistics */
-
-       struct sockaddr ap_addr;        /* Access point address */
-       struct sockaddr addr;           /* Destination address (hw/mac) */
-
-       struct iw_param param;          /* Other small parameters */
-       struct iw_point data;           /* Other large parameters */
-};
-
-/*
- * The structure to exchange data for ioctl.
- * This structure is the same as 'struct ifreq', but (re)defined for
- * convenience...
- * Do I need to remind you about structure size (32 octets) ?
- */
-struct iwreq 
-{
-       union
-       {
-               char    ifrn_name[IFNAMSIZ];    /* if name, e.g. "eth0" */
-       } ifr_ifrn;
-
-       /* Data part (defined just above) */
-       union   iwreq_data      u;
-};
-
-/* -------------------------- IOCTL DATA -------------------------- */
-/*
- *     For those ioctl which want to exchange mode data that what could
- *     fit in the above structure...
- */
-
-/*
- *     Range of parameters
- */
-
-struct iw_range
-{
-       /* Informative stuff (to choose between different interface) */
-       __u32           throughput;     /* To give an idea... */
-       /* In theory this value should be the maximum benchmarked
-        * TCP/IP throughput, because with most of these devices the
-        * bit rate is meaningless (overhead an co) to estimate how
-        * fast the connection will go and pick the fastest one.
-        * I suggest people to play with Netperf or any benchmark...
-        */
-
-       /* NWID (or domain id) */
-       __u32           min_nwid;       /* Minimal NWID we are able to set */
-       __u32           max_nwid;       /* Maximal NWID we are able to set */
-
-       /* Old Frequency (backward compat - moved lower ) */
-       __u16           old_num_channels;
-       __u8            old_num_frequency;
-
-       /* Wireless event capability bitmasks */
-       __u32           event_capa[6];
-
-       /* signal level threshold range */
-       __s32           sensitivity;
-
-       /* Quality of link & SNR stuff */
-       /* Quality range (link, level, noise)
-        * If the quality is absolute, it will be in the range [0 ; max_qual],
-        * if the quality is dBm, it will be in the range [max_qual ; 0].
-        * Don't forget that we use 8 bit arithmetics... */
-       struct iw_quality       max_qual;       /* Quality of the link */
-       /* This should contain the average/typical values of the quality
-        * indicator. This should be the threshold between a "good" and
-        * a "bad" link (example : monitor going from green to orange).
-        * Currently, user space apps like quality monitors don't have any
-        * way to calibrate the measurement. With this, they can split
-        * the range between 0 and max_qual in different quality level
-        * (using a geometric subdivision centered on the average).
-        * I expect that people doing the user space apps will feedback
-        * us on which value we need to put in each driver... */
-       struct iw_quality       avg_qual;       /* Quality of the link */
-
-       /* Rates */
-       __u8            num_bitrates;   /* Number of entries in the list */
-       __s32           bitrate[IW_MAX_BITRATES];       /* list, in bps */
-
-       /* RTS threshold */
-       __s32           min_rts;        /* Minimal RTS threshold */
-       __s32           max_rts;        /* Maximal RTS threshold */
-
-       /* Frag threshold */
-       __s32           min_frag;       /* Minimal frag threshold */
-       __s32           max_frag;       /* Maximal frag threshold */
-
-       /* Power Management duration & timeout */
-       __s32           min_pmp;        /* Minimal PM period */
-       __s32           max_pmp;        /* Maximal PM period */
-       __s32           min_pmt;        /* Minimal PM timeout */
-       __s32           max_pmt;        /* Maximal PM timeout */
-       __u16           pmp_flags;      /* How to decode max/min PM period */
-       __u16           pmt_flags;      /* How to decode max/min PM timeout */
-       __u16           pm_capa;        /* What PM options are supported */
-
-       /* Encoder stuff */
-       __u16   encoding_size[IW_MAX_ENCODING_SIZES];   /* Different token sizes */
-       __u8    num_encoding_sizes;     /* Number of entry in the list */
-       __u8    max_encoding_tokens;    /* Max number of tokens */
-       /* For drivers that need a "login/passwd" form */
-       __u8    encoding_login_index;   /* token index for login token */
-
-       /* Transmit power */
-       __u16           txpower_capa;   /* What options are supported */
-       __u8            num_txpower;    /* Number of entries in the list */
-       __s32           txpower[IW_MAX_TXPOWER];        /* list, in bps */
-
-       /* Wireless Extension version info */
-       __u8            we_version_compiled;    /* Must be WIRELESS_EXT */
-       __u8            we_version_source;      /* Last update of source */
-
-       /* Retry limits and lifetime */
-       __u16           retry_capa;     /* What retry options are supported */
-       __u16           retry_flags;    /* How to decode max/min retry limit */
-       __u16           r_time_flags;   /* How to decode max/min retry life */
-       __s32           min_retry;      /* Minimal number of retries */
-       __s32           max_retry;      /* Maximal number of retries */
-       __s32           min_r_time;     /* Minimal retry lifetime */
-       __s32           max_r_time;     /* Maximal retry lifetime */
-
-       /* Frequency */
-       __u16           num_channels;   /* Number of channels [0; num - 1] */
-       __u8            num_frequency;  /* Number of entry in the list */
-       struct iw_freq  freq[IW_MAX_FREQUENCIES];       /* list */
-       /* Note : this frequency list doesn't need to fit channel numbers,
-        * because each entry contain its channel index */
-
-       __u32           enc_capa;       /* IW_ENC_CAPA_* bit field */
-
-       /* More power management stuff */
-       __s32           min_pms;        /* Minimal PM saving */
-       __s32           max_pms;        /* Maximal PM saving */
-       __u16           pms_flags;      /* How to decode max/min PM saving */
-
-       /* All available modulations for driver (hw may support less) */
-       __s32           modul_capa;     /* IW_MODUL_* bit field */
-
-       /* More bitrate stuff */
-       __u32           bitrate_capa;   /* Types of bitrates supported */
-};
-
-/*
- * Private ioctl interface information
- */
-struct iw_priv_args
-{
-       __u32           cmd;            /* Number of the ioctl to issue */
-       __u16           set_args;       /* Type and number of args */
-       __u16           get_args;       /* Type and number of args */
-       char            name[IFNAMSIZ]; /* Name of the extension */
-};
-
-/* ----------------------- WIRELESS EVENTS ----------------------- */
-/*
- * Wireless events are carried through the rtnetlink socket to user
- * space. They are encapsulated in the IFLA_WIRELESS field of
- * a RTM_NEWLINK message.
- */
-
-/*
- * A Wireless Event. Contains basically the same data as the ioctl...
- */
-struct iw_event
-{
-       __u16           len;                    /* Real lenght of this stuff */
-       __u16           cmd;                    /* Wireless IOCTL */
-       union iwreq_data        u;              /* IOCTL fixed payload */
-};
-
-/* Size of the Event prefix (including padding and alignement junk) */
-#define IW_EV_LCP_LEN  (sizeof(struct iw_event) - sizeof(union iwreq_data))
-/* Size of the various events */
-#define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ)
-#define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32))
-#define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq))
-#define IW_EV_PARAM_LEN        (IW_EV_LCP_LEN + sizeof(struct iw_param))
-#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr))
-#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality))
-
-/* iw_point events are special. First, the payload (extra data) come at
- * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second,
- * we omit the pointer, so start at an offset. */
-#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
-                         (char *) NULL)
-#define IW_EV_POINT_LEN        (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
-                        IW_EV_POINT_OFF)
-
-/* Size of the Event prefix when packed in stream */
-#define IW_EV_LCP_PK_LEN       (4)
-/* Size of the various events when packed in stream */
-#define IW_EV_CHAR_PK_LEN      (IW_EV_LCP_PK_LEN + IFNAMSIZ)
-#define IW_EV_UINT_PK_LEN      (IW_EV_LCP_PK_LEN + sizeof(__u32))
-#define IW_EV_FREQ_PK_LEN      (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq))
-#define IW_EV_PARAM_PK_LEN     (IW_EV_LCP_PK_LEN + sizeof(struct iw_param))
-#define IW_EV_ADDR_PK_LEN      (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr))
-#define IW_EV_QUAL_PK_LEN      (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality))
-#define IW_EV_POINT_PK_LEN     (IW_EV_LCP_LEN + 4)
-
-#endif /* _LINUX_WIRELESS_H */
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/Android.mk b/drivers/net/wireless/ar6003/host/tools/sigma-dut/Android.mk
deleted file mode 100644 (file)
index 28fd92e..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2010 Atheros Corporation.  All rights reserved.
-# 
-# The software source and binaries included in this development package are
-# licensed, not sold. You, or your company, received the package under one
-# or more license agreements. The rights granted to you are specifically
-# listed in these license agreement(s). All other rights remain with Atheros
-# Communications, Inc., its subsidiaries, or the respective owner including
-# those listed on the included copyright notices.  Distribution of any
-# portion of this package must be in strict compliance with the license
-# agreement(s) terms.
-# </copyright>
-# 
-# <summary>
-#      Wifi driver for AR6002
-# </summary>
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-#MY_SIGMA_DUT := sigma-dut
-MY_SIGMA_DUT :=
-
-INCLUDES = $(LOCAL_PATH)
-INCLUDES += $(LOCAL_PATH)/../src
-INCLUDES += $(LOCAL_PATH)/../src/utils
-
-OBJS_c = wfa_tlv.c    
-OBJS_c += wfa_tg.c
-OBJS_c += wfa_cs.c
-OBJS_c += wfa_cmdtbl.c
-OBJS_c += wfa_wmmps.c
-OBJS_c += wfa_thr.c
-OBJS_c += sigma_dut.c
-OBJS_c += wpa_ctrl.c
-OBJS_c += wpa_helpers.c
-
-OBJS_c += cmds_reg.c
-OBJS_c += basic.c
-OBJS_c += sta.c
-OBJS_c += traffic.c
-OBJS_c += p2p.c
-OBJS_c += ap.c
-OBJS_c += powerswitch.c
-OBJS_c += atheros.c
-
-L_CFLAGS += -DCONFIG_CTRL_IFACE
-L_CFLAGS += -DCONFIG_CTRL_IFACE_UNIX
-
-ifndef NO_TRAFFIC_AGENT
-L_CFLAGS += -DCONFIG_TRAFFIC_AGENT
-OBJS_c += traffic_agent.c
-LIBS += -lpthread
-endif
-
-ifndef NO_WLANTEST
-L_CFLAGS += -DCONFIG_WLANTEST
-OBJS_c += wlantest.c
-endif
-
-#L_CFLAGS += -I../src/utils/
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := athsigma_dut
-LOCAL_MODULE_TAGS := debug eng optional
-LOCAL_SHARED_LIBRARIES := libc libcutils
-LOCAL_CFLAGS := $(L_CFLAGS)
-LOCAL_SRC_FILES := $(addprefix $(MY_SIGMA_DUT),$(OBJS_c))
-LOCAL_C_INCLUDES := $(addprefix $(MY_SIGMA_DUT),$(INCLUDES))
-include $(BUILD_EXECUTABLE)
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/Makefile b/drivers/net/wireless/ar6003/host/tools/sigma-dut/Makefile
deleted file mode 100644 (file)
index 1010812..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-all: sigma_dut
-
-ifndef CC
-CC=gcc
-endif
-
-ifndef LDO
-LDO=$(CC)
-endif
-
-ifndef CFLAGS
-CFLAGS = -MMD -O2 -Wall -g
-endif
-
-OBJS=sigma_dut.o
-OBJS += wpa_ctrl.o
-OBJS += wpa_helpers.o
-
-OBJS += cmds_reg.o
-OBJS += basic.o
-OBJS += sta.o
-OBJS += traffic.o
-OBJS += p2p.o
-OBJS += ap.o
-OBJS += powerswitch.o
-OBJS += atheros.o
-
-ifndef NO_TRAFFIC_AGENT
-CFLAGS += -DCONFIG_TRAFFIC_AGENT
-OBJS += traffic_agent.o
-LIBS += -lpthread
-endif
-
-ifndef NO_WLANTEST
-CFLAGS += -DCONFIG_WLANTEST
-OBJS += wlantest.o
-endif
-
-sigma_dut: $(OBJS)
-       $(LDO) $(LDFLAGS) -o sigma_dut $(OBJS) $(LIBS)
-
-clean:
-       rm -f core *~ *.o *.d sigma_dut
-
--include $(OBJS:%.o=%.d)
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/ap.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/ap.c
deleted file mode 100644 (file)
index 5c82765..0000000
+++ /dev/null
@@ -1,907 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include "wpa_helpers.h"
-
-
-enum driver_type {
-       DRIVER_ATHEROS,
-       DRIVER_MAC80211
-};
-
-
-static enum driver_type get_driver_type(void)
-{
-       struct stat s;
-       if (stat("/sys/module/mac80211", &s) == 0)
-               return DRIVER_MAC80211;
-       return DRIVER_ATHEROS;
-}
-
-
-static int cmd_ap_ca_version(struct sigma_dut *dut, struct sigma_conn *conn,
-                            struct sigma_cmd *cmd)
-{
-       /* const char *name = get_param(cmd, "NAME"); */
-       send_resp(dut, conn, SIGMA_COMPLETE, "version,1.0");
-       return 0;
-}
-
-
-static int cmd_ap_set_wireless(struct sigma_dut *dut, struct sigma_conn *conn,
-                              struct sigma_cmd *cmd)
-{
-       /* const char *name = get_param(cmd, "NAME"); */
-       /* const char *ifname = get_param(cmd, "INTERFACE"); */
-       const char *val;
-
-       val = get_param(cmd, "SSID");
-       if (val) {
-               if (strlen(val) > sizeof(dut->ap_ssid) - 1)
-                       return -1;
-               snprintf(dut->ap_ssid, sizeof(dut->ap_ssid), "%s", val);
-       }
-
-       val = get_param(cmd, "CHANNEL");
-       if (val)
-               dut->ap_channel = atoi(val);
-
-       val = get_param(cmd, "MODE");
-       if (val) {
-               if (strcasecmp(val, "11a") == 0)
-                       dut->ap_mode = AP_11a;
-               else if (strcasecmp(val, "11g") == 0)
-                       dut->ap_mode = AP_11g;
-               else if (strcasecmp(val, "11b") == 0)
-                       dut->ap_mode = AP_11b;
-               else if (strcasecmp(val, "11na") == 0)
-                       dut->ap_mode = AP_11na;
-               else if (strcasecmp(val, "11ng") == 0)
-                       dut->ap_mode = AP_11ng;
-               else {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Unsupported MODE");
-                       return 0;
-               }
-       }
-
-       /* TODO: WME */
-
-       /* TODO: WMMPS */
-
-       val = get_param(cmd, "RTS");
-       if (val)
-               dut->ap_rts = atoi(val);
-
-       val = get_param(cmd, "FRGMNT");
-       if (val)
-               dut->ap_frgmnt = atoi(val);
-
-       /* TODO: PWRSAVE */
-
-       val = get_param(cmd, "BCNINT");
-       if (val)
-               dut->ap_bcnint = atoi(val);
-
-       /* TODO: RADIO */
-
-       val = get_param(cmd, "P2PMgmtBit");
-       if (val)
-               dut->ap_p2p_mgmt = atoi(val);
-
-       /* TODO: ChannelUsage */
-
-       /* TODO: 40_INTOLERANT */
-       /* TODO: ADDBA_REJECT */
-       /* TODO: AMPDU */
-       /* TODO: AMPDU_EXP */
-       /* TODO: AMSDU */
-       /* TODO: GREENFIELD */
-       /* TODO: OFFSET */
-       /* TODO: MCS_32 */
-       /* TODO: MCS_FIXEDRATE */
-       /* TODO: SPATIAL_RX_STREAM */
-       /* TODO: SPATIAL_TX_STREAM */
-       /* TODO: MPDU_MIN_START_SPACING */
-       /* TODO: RIFS_TEST */
-       /* TODO: SGI20 */
-       /* TODO: STBC_TX */
-       /* TODO: WIDTH */
-       /* TODO: WIDTH_SCAN */
-
-       val = get_param(cmd, "TDLSProhibit");
-       dut->ap_tdls_prohibit = val && strcasecmp(val, "Enabled") == 0;
-       val = get_param(cmd, "TDLSChswitchProhibit");
-       dut->ap_tdls_prohibit_chswitch =
-               val && strcasecmp(val, "Enabled") == 0;
-
-       return 1;
-}
-
-
-static int cmd_ap_set_security(struct sigma_dut *dut, struct sigma_conn *conn,
-                              struct sigma_cmd *cmd)
-{
-       /* const char *name = get_param(cmd, "NAME"); */
-       const char *val;
-
-       val = get_param(cmd, "KEYMGNT");
-       if (val) {
-               if (strcasecmp(val, "WPA2-PSK") == 0) {
-                       dut->ap_key_mgmt = AP_WPA2_PSK;
-                       dut->ap_cipher = AP_CCMP;
-               } else if (strcasecmp(val, "WPA2-EAP") == 0 ||
-                          strcasecmp(val, "WPA2-Ent") == 0) {
-                       dut->ap_key_mgmt = AP_WPA2_EAP;
-                       dut->ap_cipher = AP_CCMP;
-               } else if (strcasecmp(val, "WPA-PSK") == 0) {
-                       dut->ap_key_mgmt = AP_WPA_PSK;
-                       dut->ap_cipher = AP_TKIP;
-               } else if (strcasecmp(val, "WPA-EAP") == 0 ||
-                          strcasecmp(val, "WPA-Ent") == 0) {
-                       dut->ap_key_mgmt = AP_WPA_EAP;
-                       dut->ap_cipher = AP_TKIP;
-               } else if (strcasecmp(val, "WPA2-Mixed") == 0) {
-                       dut->ap_key_mgmt = AP_WPA2_EAP_MIXED;
-                       dut->ap_cipher = AP_CCMP_TKIP;
-               } else if (strcasecmp(val, "WPA2-PSK-Mixed") == 0) {
-                       dut->ap_key_mgmt = AP_WPA2_PSK_MIXED;
-                       dut->ap_cipher = AP_CCMP_TKIP;
-               } else if (strcasecmp(val, "NONE") == 0) {
-                       dut->ap_key_mgmt = AP_OPEN;
-                       dut->ap_cipher = AP_PLAIN;
-               } else {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Unsupported KEYMGNT");
-                       return 0;
-               }
-       }
-
-       val = get_param(cmd, "ENCRYPT");
-       if (val) {
-               if (strcasecmp(val, "WEP") == 0) {
-                       dut->ap_cipher = AP_WEP;
-               } else if (strcasecmp(val, "TKIP") == 0) {
-                       dut->ap_cipher = AP_TKIP;
-               } else if (strcasecmp(val, "AES") == 0) {
-                       dut->ap_cipher = AP_CCMP;
-               } else {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Unsupported ENCRYPT");
-                       return 0;
-               }
-       }
-
-       val = get_param(cmd, "WEPKEY");
-       if (val) {
-               size_t len;
-               if (dut->ap_cipher != AP_WEP) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Unexpected WEPKEY without WEP "
-                                 "configuration");
-                       return 0;
-               }
-               len = strlen(val);
-               if (len != 10 && len != 26) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Unexpected WEPKEY length");
-                       return 0;
-               }
-               snprintf(dut->ap_wepkey, sizeof(dut->ap_wepkey), "%s", val);
-       }
-
-       val = get_param(cmd, "PSK");
-       if (val) {
-               if (strlen(val) > sizeof(dut->ap_passphrase) - 1)
-                       return -1;
-               snprintf(dut->ap_passphrase, sizeof(dut->ap_passphrase),
-                        "%s", val);
-       }
-
-       val = get_param(cmd, "PMF");
-       if (val) {
-               if (strcasecmp(val, "Disabled") == 0) {
-                       dut->ap_pmf = AP_PMF_DISABLED;
-               } else if (strcasecmp(val, "Optional") == 0) {
-                       dut->ap_pmf = AP_PMF_OPTIONAL;
-               } else if (strcasecmp(val, "Required") == 0) {
-                       dut->ap_pmf = AP_PMF_REQUIRED;
-               } else {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Unsupported PMF");
-                       return 0;
-               }
-       }
-
-       return 1;
-}
-
-
-static int cmd_ap_set_radius(struct sigma_dut *dut, struct sigma_conn *conn,
-                            struct sigma_cmd *cmd)
-{
-       /* const char *name = get_param(cmd, "NAME"); */
-       const char *val;
-
-       val = get_param(cmd, "IPADDR");
-       if (val) {
-               if (strlen(val) > sizeof(dut->ap_radius_ipaddr) - 1)
-                       return -1;
-               snprintf(dut->ap_radius_ipaddr, sizeof(dut->ap_radius_ipaddr),
-                        "%s", val);
-       }
-
-       val = get_param(cmd, "PORT");
-       if (val)
-               dut->ap_radius_port = atoi(val);
-
-       val = get_param(cmd, "PASSWORD");
-       if (val) {
-               if (strlen(val) > sizeof(dut->ap_radius_password) - 1)
-                       return -1;
-               snprintf(dut->ap_radius_password,
-                        sizeof(dut->ap_radius_password), "%s", val);
-       }
-
-       return 1;
-}
-
-
-static int cmd_ap_config_commit(struct sigma_dut *dut, struct sigma_conn *conn,
-                               struct sigma_cmd *cmd)
-{
-       /* const char *name = get_param(cmd, "NAME"); */
-       FILE *f;
-       const char *ifname;
-       char buf[100];
-       enum driver_type drv;
-
-       drv = get_driver_type();
-
-       if (dut->mode == SIGMA_MODE_STATION) {
-               stop_sta_mode(dut);
-               sleep(1);
-       }
-
-       if (dut->mode == SIGMA_MODE_SNIFFER && dut->sniffer_ifname) {
-               snprintf(buf, sizeof(buf), "ifconfig %s down",
-                        dut->sniffer_ifname);
-               if (system(buf) != 0) {
-                       sigma_dut_print( DUT_MSG_INFO,
-                                       "Failed to run '%s'", buf);
-               }
-               snprintf(buf, sizeof(buf), "iw dev %s set type station",
-                        dut->sniffer_ifname);
-               if (system(buf) != 0) {
-                       sigma_dut_print( DUT_MSG_INFO,
-                                       "Failed to run '%s'", buf);
-               }
-       }
-
-       dut->mode = SIGMA_MODE_AP;
-
-       f = fopen("/tmp/sigma_dut-ap.conf", "w");
-       if (f == NULL)
-               return -2;
-
-       switch (dut->ap_mode) {
-       case AP_11g:
-       case AP_11b:
-       case AP_11ng:
-               ifname = drv == DRIVER_MAC80211 ? "wlan0" : "ath0";
-               fprintf(f, "hw_mode=g\n");
-               break;
-       case AP_11a:
-       case AP_11na:
-               if (drv == DRIVER_MAC80211) {
-                       if (if_nametoindex("wlan1") >= 0)
-                               ifname = "wlan1";
-                       else
-                               ifname = "wlan0";
-               } else {
-                       if (if_nametoindex("ath1") >= 0)
-                               ifname = "ath1";
-                       else
-                               ifname = "ath0";
-               }
-               fprintf(f, "hw_mode=a\n");
-               break;
-       default:
-               fclose(f);
-               return -1;
-       }
-
-       if (drv == DRIVER_MAC80211)
-               fprintf(f, "driver=nl80211\n");
-
-       if (drv == DRIVER_MAC80211 &&
-           (dut->ap_mode == AP_11ng || dut->ap_mode == AP_11na))
-               fprintf(f, "ieee80211n=1\n");
-
-       if (drv == DRIVER_ATHEROS && if_nametoindex(ifname) <= 0) {
-               sigma_dut_print( DUT_MSG_INFO, "Starting AP");
-               if (system("apup") != 0) {
-                       sigma_dut_print( DUT_MSG_INFO, "apup failed");
-               }
-       }
-
-       fprintf(f, "interface=%s\n", ifname);
-       if (drv == DRIVER_ATHEROS)
-               fprintf(f, "bridge=%s\n", dut->bridge ? dut->bridge : "br0");
-       else if (dut->bridge)
-               fprintf(f, "bridge=%s\n", dut->bridge);
-       fprintf(f, "channel=%d\n", dut->ap_channel);
-
-       fprintf(f, "ctrl_interface=/var/run/hostapd\n");
-
-       fprintf(f, "ssid=%s\n", dut->ap_ssid);
-       if (dut->ap_bcnint)
-               fprintf(f, "beacon_int=%d\n", dut->ap_bcnint);
-
-       switch (dut->ap_key_mgmt) {
-       case AP_OPEN:
-               if (dut->ap_cipher == AP_WEP)
-                       fprintf(f, "wep_key0=%s\n", dut->ap_wepkey);
-               break;
-       case AP_WPA2_PSK:
-       case AP_WPA2_PSK_MIXED:
-       case AP_WPA_PSK:
-               if (dut->ap_key_mgmt == AP_WPA2_PSK)
-                       fprintf(f, "wpa=2\n");
-               else if (dut->ap_key_mgmt == AP_WPA2_PSK_MIXED)
-                       fprintf(f, "wpa=3\n");
-               else
-                       fprintf(f, "wpa=1\n");
-               fprintf(f, "wpa_key_mgmt=WPA-PSK\n");
-               switch (dut->ap_pmf) {
-               case AP_PMF_DISABLED:
-                       fprintf(f, "wpa_key_mgmt=WPA-PSK\n");
-                       break;
-               case AP_PMF_OPTIONAL:
-                       fprintf(f, "wpa_key_mgmt=WPA-PSK WPA-PSK-SHA256\n");
-                       break;
-               case AP_PMF_REQUIRED:
-                       fprintf(f, "wpa_key_mgmt=WPA-PSK-SHA256\n");
-                       break;
-               }
-               if (dut->ap_cipher == AP_CCMP_TKIP)
-                       fprintf(f, "wpa_pairwise=CCMP TKIP\n");
-               else if (dut->ap_cipher == AP_TKIP)
-                       fprintf(f, "wpa_pairwise=TKIP\n");
-               else
-                       fprintf(f, "wpa_pairwise=CCMP\n");
-               fprintf(f, "wpa_passphrase=%s\n", dut->ap_passphrase);
-               break;
-       case AP_WPA2_EAP:
-       case AP_WPA2_EAP_MIXED:
-       case AP_WPA_EAP:
-               if (dut->ap_key_mgmt == AP_WPA2_EAP)
-                       fprintf(f, "wpa=2\n");
-               else if (dut->ap_key_mgmt == AP_WPA2_EAP_MIXED)
-                       fprintf(f, "wpa=3\n");
-               else
-                       fprintf(f, "wpa=1\n");
-               switch (dut->ap_pmf) {
-               case AP_PMF_DISABLED:
-                       fprintf(f, "wpa_key_mgmt=WPA-EAP\n");
-                       break;
-               case AP_PMF_OPTIONAL:
-                       fprintf(f, "wpa_key_mgmt=WPA-EAP WPA-EAP-SHA256\n");
-                       break;
-               case AP_PMF_REQUIRED:
-                       fprintf(f, "wpa_key_mgmt=WPA-EAP-SHA256\n");
-                       break;
-               }
-               if (dut->ap_cipher == AP_CCMP_TKIP)
-                       fprintf(f, "wpa_pairwise=CCMP TKIP\n");
-               else if (dut->ap_cipher == AP_TKIP)
-                       fprintf(f, "wpa_pairwise=TKIP\n");
-               else
-                       fprintf(f, "wpa_pairwise=CCMP\n");
-               fprintf(f, "auth_server_addr=%s\n", dut->ap_radius_ipaddr);
-               if (dut->ap_radius_port)
-                       fprintf(f, "auth_server_port=%d\n",
-                               dut->ap_radius_port);
-               fprintf(f, "auth_server_shared_secret=%s\n",
-                       dut->ap_radius_password);
-               break;
-       }
-
-       switch (dut->ap_pmf) {
-       case AP_PMF_DISABLED:
-               break;
-       case AP_PMF_OPTIONAL:
-               fprintf(f, "ieee80211w=1\n");
-               break;
-       case AP_PMF_REQUIRED:
-               fprintf(f, "ieee80211w=2\n");
-               break;
-       }
-
-       if (dut->ap_p2p_mgmt)
-               fprintf(f, "manage_p2p=1\n");
-
-       if (dut->ap_tdls_prohibit)
-               fprintf(f, "tdls_prohibit=1\n");
-       if (dut->ap_tdls_prohibit_chswitch)
-               fprintf(f, "tdls_prohibit_chan_switch=1\n");
-
-       fclose(f);
-
-       if (system("killall hostapd") == 0) {
-               int i;
-
-               /* Wait some time to allow hostapd to complete cleanup before
-                * starting a new process */
-               for (i = 0; i < 10; i++) {
-                       usleep(500000);
-                       if (system("pidof hostapd") != 0)
-                               break;
-               }
-       }
-
-       if (drv == DRIVER_ATHEROS) {
-               snprintf(buf, sizeof(buf), "iwconfig %s channel %d",
-                        ifname, dut->ap_channel);
-               if (system(buf) != 0) {
-                       sigma_dut_print( DUT_MSG_ERROR, "iwconfig failed");
-               }
-
-               if (dut->ap_bcnint) {
-                       snprintf(buf, sizeof(buf), "iwpriv %s bintval %d",
-                                ifname, dut->ap_bcnint);
-                       if (system(buf) != 0) {
-                               sigma_dut_print( DUT_MSG_ERROR,
-                                               "iwpriv bintval failed");
-                       }
-               }
-       }
-
-       if (system("hostapd -B /tmp/sigma_dut-ap.conf") != 0) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "errorCode,Failed to start hostapd");
-               return 0;
-       }
-
-       return 1;
-}
-
-
-static int cmd_ap_get_info(struct sigma_dut *dut, struct sigma_conn *conn,
-                          struct sigma_cmd *cmd)
-{
-       /* const char *name = get_param(cmd, "NAME"); */
-       struct stat s;
-       char resp[200];
-       FILE *f;
-       enum driver_type drv = get_driver_type();
-
-       if (drv == DRIVER_ATHEROS) {
-               /* Atheros AP */
-               struct utsname uts;
-               char *version, athver[100];
-
-               if (stat("/proc/athversion", &s) != 0) {
-                       if (system("/etc/rc.d/rc.wlan up") != 0) {
-                       }
-               }
-
-               athver[0] = '\0';
-               f = fopen("/proc/athversion", "r");
-               if (f) {
-                       if (fgets(athver, sizeof(athver), f)) {
-                               char *pos = strchr(athver, '\n');
-                               if (pos)
-                                       *pos = '\0';
-                       }
-                       fclose(f);
-               }
-
-               if (uname(&uts) == 0)
-                       version = uts.release;
-               else
-                       version = "Unknown";
-
-               if (if_nametoindex("ath1") >= 0)
-                       snprintf(resp, sizeof(resp), "interface,ath0_24G "
-                                "ath1_5G,agent,1.0,version,%s/drv:%s",
-                                version, athver);
-               else
-                       snprintf(resp, sizeof(resp), "interface,ath0_24G,"
-                                "agent,1.0,version,%s/drv:%s",
-                                version, athver);
-
-               send_resp(dut, conn, SIGMA_COMPLETE, resp);
-               return 0;
-       }
-
-       if (drv == DRIVER_MAC80211) {
-               struct utsname uts;
-               char *version;
-
-               if (uname(&uts) == 0)
-                       version = uts.release;
-               else
-                       version = "Unknown";
-
-               if (if_nametoindex("wlan1") >= 0)
-                       snprintf(resp, sizeof(resp), "interface,wlan0_24G "
-                                "wlan1_5G,agent,1.0,version,%s", version);
-               else
-                       snprintf(resp, sizeof(resp), "interface,wlan0_24G,"
-                                "agent,1.0,version,%s", version);
-
-               send_resp(dut, conn, SIGMA_COMPLETE, resp);
-               return 0;
-       }
-
-       /* Unknown AP */
-       return 1;
-}
-
-
-static int cmd_ap_deauth_sta(struct sigma_dut *dut, struct sigma_conn *conn,
-                          struct sigma_cmd *cmd)
-{
-       /* const char *name = get_param(cmd, "NAME"); */
-       /* const char *ifname = get_param(cmd, "INTERFACE"); */
-       const char *val;
-       char buf[100];
-
-       val = get_param(cmd, "MinorCode");
-       if (val) {
-               /* TODO: add support for P2P minor code */
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,MinorCode not "
-                         "yet supported");
-               return 0;
-       }
-
-       val = get_param(cmd, "STA_MAC_ADDRESS");
-       if (val == NULL)
-               return -1;
-       snprintf(buf, sizeof(buf), "hostapd_cli deauth %s", val);
-       if (system(buf) != 0)
-               return -2;
-
-       return 1;
-}
-
-
-#ifdef __linux__
-int inject_frame(int s, const void *data, size_t len, int encrypt);
-int open_monitor(const char *ifname);
-int hwaddr_aton(const char *txt, unsigned char *addr);
-#endif /* __linux__ */
-
-enum send_frame_type {
-               DISASSOC, DEAUTH, SAQUERY
-};
-enum send_frame_protection {
-       CORRECT_KEY, INCORRECT_KEY, UNPROTECTED
-};
-
-
-static int ap_inject_frame(struct sigma_dut *dut, struct sigma_conn *conn,
-                          enum send_frame_type frame,
-                          enum send_frame_protection protected,
-                          const char *sta_addr)
-{
-#ifdef __linux__
-       unsigned char buf[1000], *pos;
-       int s, res;
-       unsigned char addr_sta[6], addr_own[6];
-       char *ifname;
-       char cbuf[100];
-       struct ifreq ifr;
-
-       if ((dut->ap_mode == AP_11a || dut->ap_mode == AP_11na) &&
-           if_nametoindex("wlan1") >= 0)
-               ifname = "wlan1";
-       else
-               ifname = "wlan0";
-
-       if (hwaddr_aton(sta_addr, addr_sta) < 0)
-               return -1;
-
-       s = socket(AF_INET, SOCK_DGRAM, 0);
-       if (s < 0)
-               return -1;
-       memset(&ifr, 0, sizeof(ifr));
-       strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-       if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
-               perror("ioctl");
-               close(s);
-               return -1;
-       }
-       close(s);
-       memcpy(addr_own, ifr.ifr_hwaddr.sa_data, 6);
-
-       if (if_nametoindex("sigmadut") == 0) {
-               snprintf(cbuf, sizeof(cbuf),
-                        "iw dev %s interface add sigmadut type monitor",
-                        ifname);
-               if (system(cbuf) != 0 ||
-                   if_nametoindex("sigmadut") == 0) {
-                       sigma_dut_print( DUT_MSG_ERROR, "Failed to add "
-                                       "monitor interface with '%s'", cbuf);
-                       return -2;
-               }
-       }
-
-       if (system("ifconfig sigmadut up") != 0) {
-               sigma_dut_print( DUT_MSG_ERROR, "Failed to set "
-                               "monitor interface up");
-               return -2;
-       }
-
-       pos = buf;
-
-       /* Frame Control */
-       switch (frame) {
-       case DISASSOC:
-               *pos++ = 0xa0;
-               break;
-       case DEAUTH:
-               *pos++ = 0xc0;
-               break;
-       case SAQUERY:
-               *pos++ = 0xd0;
-               break;
-       }
-
-       if (protected == INCORRECT_KEY)
-               *pos++ = 0x40; /* Set Protected field to 1 */
-       else
-               *pos++ = 0x00;
-
-       /* Duration */
-       *pos++ = 0x00;
-       *pos++ = 0x00;
-
-       /* addr1 = DA (station) */
-       memcpy(pos, addr_sta, 6);
-       pos += 6;
-       /* addr2 = SA (own address) */
-       memcpy(pos, addr_own, 6);
-       pos += 6;
-       /* addr3 = BSSID (own address) */
-       memcpy(pos, addr_own, 6);
-       pos += 6;
-
-       /* Seq# (to be filled by driver/mac80211) */
-       *pos++ = 0x00;
-       *pos++ = 0x00;
-
-       if (protected == INCORRECT_KEY) {
-               /* CCMP parameters */
-               memcpy(pos, "\x61\x01\x00\x20\x00\x10\x00\x00", 8);
-               pos += 8;
-       }
-
-       if (protected == INCORRECT_KEY) {
-               switch (frame) {
-               case DEAUTH:
-                       /* Reason code (encrypted) */
-                       memcpy(pos, "\xa7\x39", 2);
-                       pos += 2;
-                       break;
-               case DISASSOC:
-                       /* Reason code (encrypted) */
-                       memcpy(pos, "\xa7\x39", 2);
-                       pos += 2;
-                       break;
-               case SAQUERY:
-                       /* Category|Action|TransID (encrypted) */
-                       memcpy(pos, "\x6f\xbd\xe9\x4d", 4);
-                       pos += 4;
-                       break;
-               default:
-                       return -1;
-               }
-
-               /* CCMP MIC */
-               memcpy(pos, "\xc8\xd8\x3b\x06\x5d\xb7\x25\x68", 8);
-               pos += 8;
-       } else {
-               switch (frame) {
-               case DEAUTH:
-                       /* reason code = 8 */
-                       *pos++ = 0x08;
-                       *pos++ = 0x00;
-                       break;
-               case DISASSOC:
-                       /* reason code = 8 */
-                       *pos++ = 0x08;
-                       *pos++ = 0x00;
-                       break;
-               case SAQUERY:
-                       /* Category - SA Query */
-                       *pos++ = 0x08;
-                       /* SA query Action - Request */
-                       *pos++ = 0x00;
-                       /* Transaction ID */
-                       *pos++ = 0x12;
-                       *pos++ = 0x34;
-                       break;
-               }
-       }
-
-       s = open_monitor("sigmadut");
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Failed to open "
-                         "monitor socket");
-               return 0;
-       }
-
-       res = inject_frame(s, buf, pos - buf, protected == CORRECT_KEY);
-       if (res < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Failed to "
-                         "inject frame");
-               return 0;
-       }
-       if (res < pos - buf) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Only partial "
-                         "frame sent");
-               return 0;
-       }
-
-       close(s);
-
-       return 1;
-#else /* __linux__ */
-       send_resp(dut, conn, SIGMA_ERROR, "errorCode,ap_send_frame not "
-                 "yet supported");
-       return 0;
-#endif /* __linux__ */
-}
-
-
-static int cmd_ap_send_frame(struct sigma_dut *dut, struct sigma_conn *conn,
-                            struct sigma_cmd *cmd)
-{
-       /* const char *name = get_param(cmd, "NAME"); */
-       /* const char *ifname = get_param(cmd, "INTERFACE"); */
-       const char *val;
-       enum send_frame_type frame;
-       enum send_frame_protection protected;
-       char buf[100];
-
-       val = get_param(cmd, "PMFFrameType");
-       if (val == NULL)
-               return -1;
-       if (strcasecmp(val, "disassoc") == 0)
-               frame = DISASSOC;
-       else if (strcasecmp(val, "deauth") == 0)
-               frame = DEAUTH;
-       else if (strcasecmp(val, "saquery") == 0)
-               frame = SAQUERY;
-       else {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Unsupported "
-                         "PMFFrameType");
-               return 0;
-       }
-
-       val = get_param(cmd, "PMFProtected");
-       if (val == NULL)
-               val = get_param(cmd, "Protected");
-       if (val == NULL)
-               return -1;
-       if (strcasecmp(val, "Correct-key") == 0 ||
-           strcasecmp(val, "CorrectKey") == 0)
-               protected = CORRECT_KEY;
-       else if (strcasecmp(val, "IncorrectKey") == 0)
-               protected = INCORRECT_KEY;
-       else if (strcasecmp(val, "Unprotected") == 0)
-               protected = UNPROTECTED;
-       else {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Unsupported "
-                         "PMFProtected");
-               return 0;
-       }
-
-       val = get_param(cmd, "stationID");
-       if (val == NULL)
-               return -1;
-
-       if (protected == INCORRECT_KEY ||
-           (protected == UNPROTECTED && frame == SAQUERY))
-               return ap_inject_frame(dut, conn, frame, protected, val);
-
-       switch (frame) {
-       case DISASSOC:
-               snprintf(buf, sizeof(buf), "hostapd_cli disassoc %s test=%d",
-                        val, protected == CORRECT_KEY);
-               break;
-       case DEAUTH:
-               snprintf(buf, sizeof(buf), "hostapd_cli deauth %s test=%d",
-                        val, protected == CORRECT_KEY);
-               break;
-       case SAQUERY:
-               snprintf(buf, sizeof(buf), "hostapd_cli sa_query %s", val);
-               break;
-       }
-
-       if (system(buf) != 0)
-               return -2;
-
-       return 1;
-}
-
-
-static int cmd_ap_get_mac_address(struct sigma_dut *dut,
-                                 struct sigma_conn *conn,
-                                 struct sigma_cmd *cmd)
-{
-#ifdef __linux__
-       /* const char *name = get_param(cmd, "NAME"); */
-       /* const char *ifname = get_param(cmd, "INTERFACE"); */
-       char resp[50];
-       unsigned char addr[6];
-       char *ifname;
-       struct ifreq ifr;
-       int s;
-
-       if ((dut->ap_mode == AP_11a || dut->ap_mode == AP_11na) &&
-           if_nametoindex("wlan1") >= 0)
-               ifname = "wlan1";
-       else
-               ifname = "wlan0";
-
-       s = socket(AF_INET, SOCK_DGRAM, 0);
-       if (s < 0)
-               return -1;
-       memset(&ifr, 0, sizeof(ifr));
-       strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-       if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
-               perror("ioctl");
-               close(s);
-               return -1;
-       }
-       close(s);
-       memcpy(addr, ifr.ifr_hwaddr.sa_data, 6);
-
-       snprintf(resp, sizeof(resp), "mac,%02x:%02x:%02x:%02x:%02x:%02x",
-                addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-       return 0;
-#else /* __linux__ */
-       send_resp(dut, conn, SIGMA_ERROR, "errorCode,ap_get_mac_address not "
-                 "yet supported");
-       return 0;
-#endif /* __linux__ */
-}
-
-
-static int cmd_accesspoint(struct sigma_dut *dut, struct sigma_conn *conn,
-                          struct sigma_cmd *cmd)
-{
-       /* const char *name = get_param(cmd, "NAME"); */
-       return 1;
-}
-
-
-void ap_register_cmds(void)
-{
-       sigma_dut_reg_cmd("ap_ca_version", NULL, cmd_ap_ca_version);
-       sigma_dut_reg_cmd("ap_set_wireless", NULL, cmd_ap_set_wireless);
-       sigma_dut_reg_cmd("ap_set_11n_wireless", NULL, cmd_ap_set_wireless);
-       sigma_dut_reg_cmd("ap_set_11n", NULL, cmd_ap_set_wireless);
-       sigma_dut_reg_cmd("ap_set_security", NULL, cmd_ap_set_security);
-       /* TODO: ap_set_apqos */
-       /* TODO: ap_set_staqos */
-       sigma_dut_reg_cmd("ap_set_radius", NULL, cmd_ap_set_radius);
-       /* TODO: ap_reboot */
-       sigma_dut_reg_cmd("ap_config_commit", NULL, cmd_ap_config_commit);
-       /* TODO: ap_reset_default */
-       sigma_dut_reg_cmd("ap_get_info", NULL, cmd_ap_get_info);
-       sigma_dut_reg_cmd("ap_deauth_sta", NULL, cmd_ap_deauth_sta);
-       sigma_dut_reg_cmd("ap_send_frame", NULL, cmd_ap_send_frame);
-       sigma_dut_reg_cmd("ap_get_mac_address", NULL, cmd_ap_get_mac_address);
-       sigma_dut_reg_cmd("AccessPoint", NULL, cmd_accesspoint);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/atheros.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/atheros.c
deleted file mode 100644 (file)
index 0213571..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-#include "wpa_helpers.h"
-
-
-static int cmd_sta_atheros(struct sigma_dut *dut, struct sigma_conn *conn,
-                          struct sigma_cmd *cmd)
-{
-       char buf[2048], *pos;
-       int i;
-       const char *intf, *c;
-       char resp[200];
-
-       intf = get_param(cmd, "interface");
-       c = get_param(cmd, "cmd");
-       if (c == NULL)
-               return -1;
-
-       buf[0] = '\0';
-       if (strncmp(c, "ctrl=", 5) == 0) {
-               size_t rlen;
-               c += 5;
-               if (wpa_command_resp(intf, c, buf, sizeof(buf)) < 0)
-                       return -2;
-               rlen = strlen(buf);
-               if (rlen > 0 && buf[rlen - 1] == '\n')
-                       buf[rlen - 1] = '\0';
-       } else if (strncmp(c, "timeout=", 8) == 0) {
-               unsigned int timeout;
-               timeout = atoi(c + 8);
-               if (timeout == 0)
-                       return -1;
-               dut->default_timeout = timeout;
-               sigma_dut_print( DUT_MSG_INFO, "Set DUT default timeout "
-                               "to %u seconds", dut->default_timeout);
-               snprintf(buf, sizeof(buf), "OK");
-       } else
-               return -2;
-
-       i = snprintf(resp, sizeof(resp), "resp,");
-       pos = buf;
-       while (*pos && i + 1 < sizeof(resp)) {
-               char c = *pos++;
-               if (c == '\n' || c == '\r' || c == ',')
-                       c = '^';
-               resp[i++] = c;
-       }
-       resp[i] = '\0';
-
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-       return 0;
-}
-
-
-static int req_intf(struct sigma_cmd *cmd)
-{
-       return get_param(cmd, "interface") == NULL ? -1 : 0;
-}
-
-
-void atheros_register_cmds(void)
-{
-       sigma_dut_reg_cmd("sta_atheros", req_intf, cmd_sta_atheros);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/basic.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/basic.c
deleted file mode 100644 (file)
index 33884bc..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-#ifdef __linux__
-#include <sys/stat.h>
-#endif /* __linux__ */
-#include "wpa_helpers.h"
-
-
-#if 1 // by bbelief
-#include "wfa_p2p.h"
-#endif
-
-
-static int cmd_ca_get_version(struct sigma_dut *dut, struct sigma_conn *conn,
-                             struct sigma_cmd *cmd)
-{
-       const char *info;
-
-       info = get_param(cmd, "TestInfo");
-       if (info) {
-               char buf[200];
-               snprintf(buf, sizeof(buf), "NOTE CAPI:TestInfo:%s", info);
-               wpa_command(get_main_ifname(), buf);
-       }
-
-       send_resp(dut, conn, SIGMA_COMPLETE, "version,1.0");
-       return 0;
-}
-
-
-int cmd_device_get_info(struct sigma_dut *dut, dutCommand_t *command,
-                                             dutCmdResponse_t *resp)
-{
-       const char *model = "N/A";
-       char local_resp[200];
-
-#ifdef __APPLE__
-       model = "P2P (Mac)";
-#endif /* __APPLE__ */
-#ifdef __linux__
-       {
-               char path[128];
-               struct stat s;
-               snprintf(path, sizeof(path), "/sys/class/net/%s/phy80211",
-                        get_main_ifname());
-               if (stat(path, &s) == 0)
-                       model = "P2P (Linux/mac80211)";
-               else
-                       model = "P2P (Linux)";
-       }
-#endif /* __linux__ */
-
-       /* TODO: get version from wpa_supplicant (+ driver via wpa_s) */
-       snprintf(local_resp, sizeof(local_resp), "vendor,Atheros Communications,"
-                "model,%s,version,TODO", model);
-
-
-       strcpy(resp->cmdru.info/*[0]*/, local_resp);
-       //send_resp(dut, conn, SIGMA_COMPLETE, resp);
-       return 0;
-}
-
-
-static int check_device_list_interfaces(struct sigma_cmd *cmd)
-{
-       if (get_param(cmd, "interfaceType") == NULL)
-               return -1;
-       return 0;
-}
-
-
-static int cmd_device_list_interfaces(struct sigma_dut *dut,
-                                     struct sigma_conn *conn,
-                                     struct sigma_cmd *cmd)
-{
-       const char *type;
-       char resp[200];
-
-       type = get_param(cmd, "interfaceType");
-       sigma_dut_print( DUT_MSG_DEBUG, "device_list_interfaces - "
-                       "interfaceType=%s", type);
-       if (strcmp(type, "802.11") != 0)
-               return -2;
-
-       snprintf(resp, sizeof(resp), "interfaceType,802.11,"
-                "interfaceID,%s", get_main_ifname());
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-
-       return 0;
-}
-
-
-void basic_register_cmds(void)
-{
-#if 0
-       sigma_dut_reg_cmd("ca_get_version", NULL, cmd_ca_get_version);
-       sigma_dut_reg_cmd("device_get_info", NULL, cmd_device_get_info);
-       sigma_dut_reg_cmd("device_list_interfaces",
-                         check_device_list_interfaces,
-                         cmd_device_list_interfaces);
-#endif    
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/cmds_reg.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/cmds_reg.c
deleted file mode 100644 (file)
index 5fd33df..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-
-void sigma_dut_register_cmds(void)
-{
-       void basic_register_cmds(void);
-       basic_register_cmds();
-
-       void sta_register_cmds(void);
-       sta_register_cmds();
-
-       void traffic_register_cmds(void);
-       traffic_register_cmds();
-
-#ifdef CONFIG_TRAFFIC_AGENT
-       void traffic_agent_register_cmds(void);
-       traffic_agent_register_cmds();
-#endif /* CONFIG_TRAFFIC_AGENT */
-
-       void p2p_register_cmds(void);
-       p2p_register_cmds();
-
-       void ap_register_cmds(void);
-       ap_register_cmds();
-
-       void powerswitch_register_cmds(void);
-       powerswitch_register_cmds();
-
-       void atheros_register_cmds(void);
-       atheros_register_cmds();
-
-#ifdef CONFIG_WLANTEST
-       void wlantest_register_cmds(void);
-       wlantest_register_cmds();
-#endif /* CONFIG_WLANTEST */
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/os_unix.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/os_unix.c
deleted file mode 100644 (file)
index 4e11758..0000000
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * OS specific functions for UNIX/POSIX systems
- * Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
- */
-
-#include "includes.h"
-
-#ifdef ANDROID
-#include <linux/capability.h>
-#include <linux/prctl.h>
-#include <private/android_filesystem_config.h>
-#endif /* ANDROID */
-
-#include "os.h"
-
-#ifdef WPA_TRACE
-
-#include "common.h"
-#include "list.h"
-#include "wpa_debug.h"
-#include "trace.h"
-
-static struct dl_list alloc_list;
-
-#define ALLOC_MAGIC 0xa84ef1b2
-#define FREED_MAGIC 0x67fd487a
-
-struct os_alloc_trace {
-       unsigned int magic;
-       struct dl_list list;
-       size_t len;
-       WPA_TRACE_INFO
-};
-
-#endif /* WPA_TRACE */
-
-
-void os_sleep(os_time_t sec, os_time_t usec)
-{
-       if (sec)
-               sleep(sec);
-       if (usec)
-               usleep(usec);
-}
-
-
-int os_get_time(struct os_time *t)
-{
-       int res;
-       struct timeval tv;
-       res = gettimeofday(&tv, NULL);
-       t->sec = tv.tv_sec;
-       t->usec = tv.tv_usec;
-       return res;
-}
-
-
-int os_mktime(int year, int month, int day, int hour, int min, int sec,
-             os_time_t *t)
-{
-       struct tm tm, *tm1;
-       time_t t_local, t1, t2;
-       os_time_t tz_offset;
-
-       if (year < 1970 || month < 1 || month > 12 || day < 1 || day > 31 ||
-           hour < 0 || hour > 23 || min < 0 || min > 59 || sec < 0 ||
-           sec > 60)
-               return -1;
-
-       memset(&tm, 0, sizeof(tm));
-       tm.tm_year = year - 1900;
-       tm.tm_mon = month - 1;
-       tm.tm_mday = day;
-       tm.tm_hour = hour;
-       tm.tm_min = min;
-       tm.tm_sec = sec;
-
-       t_local = mktime(&tm);
-
-       /* figure out offset to UTC */
-       tm1 = localtime(&t_local);
-       if (tm1) {
-               t1 = mktime(tm1);
-               tm1 = gmtime(&t_local);
-               if (tm1) {
-                       t2 = mktime(tm1);
-                       tz_offset = t2 - t1;
-               } else
-                       tz_offset = 0;
-       } else
-               tz_offset = 0;
-
-       *t = (os_time_t) t_local - tz_offset;
-       return 0;
-}
-
-
-#ifdef __APPLE__
-#include <fcntl.h>
-static int os_daemon(int nochdir, int noclose)
-{
-       int devnull;
-
-       if (chdir("/") < 0)
-               return -1;
-
-       devnull = open("/dev/null", O_RDWR);
-       if (devnull < 0)
-               return -1;
-
-       if (dup2(devnull, STDIN_FILENO) < 0) {
-               close(devnull);
-               return -1;
-       }
-
-       if (dup2(devnull, STDOUT_FILENO) < 0) {
-               close(devnull);
-               return -1;
-       }
-
-       if (dup2(devnull, STDERR_FILENO) < 0) {
-               close(devnull);
-               return -1;
-       }
-
-       return 0;
-}
-#else /* __APPLE__ */
-#define os_daemon daemon
-#endif /* __APPLE__ */
-
-
-int os_daemonize(const char *pid_file)
-{
-#if defined(__uClinux__) || defined(__sun__)
-       return -1;
-#else /* defined(__uClinux__) || defined(__sun__) */
-       if (os_daemon(0, 0)) {
-               perror("daemon");
-               return -1;
-       }
-
-       if (pid_file) {
-               FILE *f = fopen(pid_file, "w");
-               if (f) {
-                       fprintf(f, "%u\n", getpid());
-                       fclose(f);
-               }
-       }
-
-       return -0;
-#endif /* defined(__uClinux__) || defined(__sun__) */
-}
-
-
-void os_daemonize_terminate(const char *pid_file)
-{
-       if (pid_file)
-               unlink(pid_file);
-}
-
-
-int os_get_random(unsigned char *buf, size_t len)
-{
-       FILE *f;
-       size_t rc;
-
-       f = fopen("/dev/urandom", "rb");
-       if (f == NULL) {
-               printf("Could not open /dev/urandom.\n");
-               return -1;
-       }
-
-       rc = fread(buf, 1, len, f);
-       fclose(f);
-
-       return rc != len ? -1 : 0;
-}
-
-
-unsigned long os_random(void)
-{
-       return random();
-}
-
-
-char * os_rel2abs_path(const char *rel_path)
-{
-       char *buf = NULL, *cwd, *ret;
-       size_t len = 128, cwd_len, rel_len, ret_len;
-       int last_errno;
-
-       if (rel_path[0] == '/')
-               return os_strdup(rel_path);
-
-       for (;;) {
-               buf = os_malloc(len);
-               if (buf == NULL)
-                       return NULL;
-               cwd = getcwd(buf, len);
-               if (cwd == NULL) {
-                       last_errno = errno;
-                       os_free(buf);
-                       if (last_errno != ERANGE)
-                               return NULL;
-                       len *= 2;
-                       if (len > 2000)
-                               return NULL;
-               } else {
-                       buf[len - 1] = '\0';
-                       break;
-               }
-       }
-
-       cwd_len = os_strlen(cwd);
-       rel_len = os_strlen(rel_path);
-       ret_len = cwd_len + 1 + rel_len + 1;
-       ret = os_malloc(ret_len);
-       if (ret) {
-               os_memcpy(ret, cwd, cwd_len);
-               ret[cwd_len] = '/';
-               os_memcpy(ret + cwd_len + 1, rel_path, rel_len);
-               ret[ret_len - 1] = '\0';
-       }
-       os_free(buf);
-       return ret;
-}
-
-
-int os_program_init(void)
-{
-#ifdef ANDROID
-       /*
-        * We ignore errors here since errors are normal if we
-        * are already running as non-root.
-        */
-       gid_t groups[] = { AID_INET, AID_WIFI, AID_KEYSTORE };
-       struct __user_cap_header_struct header;
-       struct __user_cap_data_struct cap;
-
-       setgroups(sizeof(groups)/sizeof(groups[0]), groups);
-
-       prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
-
-       setgid(AID_WIFI);
-       setuid(AID_WIFI);
-
-       header.version = _LINUX_CAPABILITY_VERSION;
-       header.pid = 0;
-       cap.effective = cap.permitted =
-               (1 << CAP_NET_ADMIN) | (1 << CAP_NET_RAW);
-       cap.inheritable = 0;
-       capset(&header, &cap);
-#endif /* ANDROID */
-
-#ifdef WPA_TRACE
-       dl_list_init(&alloc_list);
-#endif /* WPA_TRACE */
-       return 0;
-}
-
-
-void os_program_deinit(void)
-{
-#ifdef WPA_TRACE
-       struct os_alloc_trace *a;
-       unsigned long total = 0;
-       dl_list_for_each(a, &alloc_list, struct os_alloc_trace, list) {
-               total += a->len;
-               if (a->magic != ALLOC_MAGIC) {
-                       wpa_printf(MSG_INFO, "MEMLEAK[%p]: invalid magic 0x%x "
-                                  "len %lu",
-                                  a, a->magic, (unsigned long) a->len);
-                       continue;
-               }
-               wpa_printf(MSG_INFO, "MEMLEAK[%p]: len %lu",
-                          a, (unsigned long) a->len);
-               wpa_trace_dump("memleak", a);
-       }
-       if (total)
-               wpa_printf(MSG_INFO, "MEMLEAK: total %lu bytes",
-                          (unsigned long) total);
-#endif /* WPA_TRACE */
-}
-
-
-int os_setenv(const char *name, const char *value, int overwrite)
-{
-       return setenv(name, value, overwrite);
-}
-
-
-int os_unsetenv(const char *name)
-{
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || \
-    defined(__OpenBSD__)
-       unsetenv(name);
-       return 0;
-#else
-       return unsetenv(name);
-#endif
-}
-
-
-char * os_readfile(const char *name, size_t *len)
-{
-       FILE *f;
-       char *buf;
-       long pos;
-
-       f = fopen(name, "rb");
-       if (f == NULL)
-               return NULL;
-
-       if (fseek(f, 0, SEEK_END) < 0 || (pos = ftell(f)) < 0) {
-               fclose(f);
-               return NULL;
-       }
-       *len = pos;
-       if (fseek(f, 0, SEEK_SET) < 0) {
-               fclose(f);
-               return NULL;
-       }
-
-       buf = os_malloc(*len);
-       if (buf == NULL) {
-               fclose(f);
-               return NULL;
-       }
-
-       if (fread(buf, 1, *len, f) != *len) {
-               fclose(f);
-               os_free(buf);
-               return NULL;
-       }
-
-       fclose(f);
-
-       return buf;
-}
-
-
-#ifndef WPA_TRACE
-void * os_zalloc(size_t size)
-{
-       return calloc(1, size);
-}
-#endif /* WPA_TRACE */
-
-
-size_t os_strlcpy(char *dest, const char *src, size_t siz)
-{
-       const char *s = src;
-       size_t left = siz;
-
-       if (left) {
-               /* Copy string up to the maximum size of the dest buffer */
-               while (--left != 0) {
-                       if ((*dest++ = *s++) == '\0')
-                               break;
-               }
-       }
-
-       if (left == 0) {
-               /* Not enough room for the string; force NUL-termination */
-               if (siz != 0)
-                       *dest = '\0';
-               while (*s++)
-                       ; /* determine total src string length */
-       }
-
-       return s - src - 1;
-}
-
-
-#ifdef WPA_TRACE
-
-void * os_malloc(size_t size)
-{
-       struct os_alloc_trace *a;
-       a = malloc(sizeof(*a) + size);
-       if (a == NULL)
-               return NULL;
-       a->magic = ALLOC_MAGIC;
-       dl_list_add(&alloc_list, &a->list);
-       a->len = size;
-       wpa_trace_record(a);
-       return a + 1;
-}
-
-
-void * os_realloc(void *ptr, size_t size)
-{
-       struct os_alloc_trace *a;
-       size_t copy_len;
-       void *n;
-
-       if (ptr == NULL)
-               return os_malloc(size);
-
-       a = (struct os_alloc_trace *) ptr - 1;
-       if (a->magic != ALLOC_MAGIC) {
-               wpa_printf(MSG_INFO, "REALLOC[%p]: invalid magic 0x%x%s",
-                          a, a->magic,
-                          a->magic == FREED_MAGIC ? " (already freed)" : "");
-               wpa_trace_show("Invalid os_realloc() call");
-               abort();
-       }
-       n = os_malloc(size);
-       if (n == NULL)
-               return NULL;
-       copy_len = a->len;
-       if (copy_len > size)
-               copy_len = size;
-       os_memcpy(n, a + 1, copy_len);
-       os_free(ptr);
-       return n;
-}
-
-
-void os_free(void *ptr)
-{
-       struct os_alloc_trace *a;
-
-       if (ptr == NULL)
-               return;
-       a = (struct os_alloc_trace *) ptr - 1;
-       if (a->magic != ALLOC_MAGIC) {
-               wpa_printf(MSG_INFO, "FREE[%p]: invalid magic 0x%x%s",
-                          a, a->magic,
-                          a->magic == FREED_MAGIC ? " (already freed)" : "");
-               wpa_trace_show("Invalid os_free() call");
-               abort();
-       }
-       dl_list_del(&a->list);
-       a->magic = FREED_MAGIC;
-
-       wpa_trace_check_ref(ptr);
-       free(a);
-}
-
-
-void * os_zalloc(size_t size)
-{
-       void *ptr = os_malloc(size);
-       if (ptr)
-               os_memset(ptr, 0, size);
-       return ptr;
-}
-
-
-char * os_strdup(const char *s)
-{
-       size_t len;
-       char *d;
-       len = os_strlen(s);
-       d = os_malloc(len + 1);
-       if (d == NULL)
-               return NULL;
-       os_memcpy(d, s, len);
-       d[len] = '\0';
-       return d;
-}
-
-#endif /* WPA_TRACE */
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/p2p.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/p2p.c
deleted file mode 100644 (file)
index d03ffb4..0000000
+++ /dev/null
@@ -1,1831 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-#include <sys/stat.h>
-#include "wpa_ctrl.h"
-#include "wpa_helpers.h"
-
-#if 1 // by bbelief
-#include "wfa_p2p.h"
-#endif
-
-#ifdef __APPLE__
-#define SCRIPT_PATH "/usr/local/sbin/"
-#else /* __APPLE__ */
-#define SCRIPT_PATH "/home/atheros/Atheros-P2P/scripts/"
-#endif /* __APPLE__ */
-
-
-int cmd_sta_p2p_reset_test(void)
-{
-       char *intf = "wlan0";
-       struct wfa_cs_p2p_group *grp, *prev;
-       char buf[256];
-
-#if 0
-       dut->wps_method = WFA_CS_WPS_NOT_READY;
-
-       grp = dut->groups;
-       while (grp) {
-               prev = grp;
-               grp = grp->next;
-
-               snprintf(buf, sizeof(buf), "P2P_GROUP_REMOVE %s",
-                        prev->ifname);
-               wpa_command(intf, buf);
-               p2p_group_remove(dut, prev->grpid);
-       }
-#endif
-
-       wpa_command(intf, "P2P_GROUP_REMOVE *");
-       wpa_command(intf, "P2P_STOP_FIND");
-       wpa_command(intf, "P2P_FLUSH");
-       wpa_command(intf, "P2P_SERVICE_FLUSH");
-       wpa_command(intf, "P2P_SET ssid_postfix ");
-       wpa_command(intf, "P2P_EXT_LISTEN");
-       wpa_command(intf, "P2P_SET client_apsd disable");
-       wpa_command(intf, "P2P_SET go_apsd disable");
-       wpa_command(get_station_ifname(), "P2P_SET ps 98");
-       wpa_command(get_station_ifname(), "P2P_SET ps 96");
-       wpa_command(get_station_ifname(), "P2P_SET ps 0");
-       wpa_command(intf, "SET ampdu 1");
-#if 0    
-       run_system(dut, "iptables -F INPUT");
-       if (dut->arp_ipaddr[0]) {
-               snprintf(buf, sizeof(buf), "ip nei del %s dev %s",
-                        dut->arp_ipaddr, dut->arp_ifname);
-               run_system(dut, buf);
-               dut->arp_ipaddr[0] = '\0';
-       }
-       snprintf(buf, sizeof(buf), "ip nei flush dev %s",
-                get_station_ifname());
-       run_system(dut, buf);
-       dut->p2p_mode = P2P_IDLE;
-       dut->client_uapsd = 0;
-
-       remove_wpa_networks(intf);
-
-       disconnect_station(dut);
-#endif
-
-       return 1;
-}
-
-
-
-
-int cmd_sta_set_p2p_test(void)
-{
-       const char *intf = "wlan0";
-       char buf[256];
-
-        
-sigma_dut_print(DUT_MSG_INFO, "%s : %s", __func__, get_main_ifname());
-        
-
-        wpa_command(intf, "P2P_SET disabled 0");
-        if (wpa_command(intf, "P2P_FIND") < 0)
-                return -2;
-
-        snprintf(buf, sizeof(buf), "P2P_SET discoverability %d",
-                        1);
-               if (wpa_command(intf, buf) < 0)
-                       return -2;        
-                
-
-       return 1;
-}
-
-
-
-int cmd_sta_get_p2p_dev_address_test(void)
-{
-       //char *intf = command->intf;
-       char *intf = "wlan1";
-       char buf[100];
-
-       //start_sta_mode(dut);
-       //if (get_wpa_status(intf, "p2p_device_address", buf, sizeof(buf)) < 0) {
-       if (get_wpa_status(intf, "address", buf, sizeof(buf)) < 0)
-               return -1;
-
-        sigma_dut_print(DUT_MSG_INFO, "%s : %s", __func__, buf);
-
-        //strcpy(resp->cmdru.devid/*[0]*/, buf);
-       return 0;
-}
-
-
-
-
-int get_ip_config(struct sigma_dut *dut, const char *ifname, char *buf,
-                 size_t buf_len);
-
-
-static int run_system(struct sigma_dut *dut, const char *cmd)
-{
-       sigma_dut_print( DUT_MSG_DEBUG, "Running '%s'", cmd);
-       return system(cmd);
-}
-
-
-static int p2p_group_add(struct sigma_dut *dut, const char *ifname,
-                        int go, const char *grpid, const char *ssid)
-{
-       struct wfa_cs_p2p_group *grp;
-
-       grp = malloc(sizeof(*grp));
-       if (grp == NULL)
-               return -1;
-       memset(grp, 0, sizeof(*grp));
-       strncpy(grp->ifname, ifname, IFNAMSIZ);
-       grp->go = go;
-       strncpy(grp->grpid, grpid, P2P_GRP_ID_LEN);
-       strncpy(grp->ssid, ssid, sizeof(grp->ssid));
-
-       grp->next = dut->groups;
-       dut->groups = grp;
-
-       return 0;
-}
-
-
-static int p2p_group_remove(struct sigma_dut *dut, const char *grpid)
-{
-       struct wfa_cs_p2p_group *grp, *prev;
-
-       prev = NULL;
-       grp = dut->groups;
-       while (grp) {
-               if (strcmp(grpid, grp->grpid) == 0) {
-                       if (prev)
-                               prev->next = grp->next;
-                       else
-                               dut->groups = grp->next;
-                       free(grp);
-                       return 0;
-               }
-               prev = grp;
-               grp = grp->next;
-       }
-       return -1;
-}
-
-
-static struct wfa_cs_p2p_group * p2p_group_get(struct sigma_dut *dut,
-                                              const char *grpid)
-{
-       struct wfa_cs_p2p_group *grp;
-       char buf[1000], buf2[1000], *ifname, *pos;
-       char go_dev_addr[50];
-       char ssid[33];
-
-       for (grp = dut->groups; grp; grp = grp->next) {
-               if (strcmp(grpid, grp->grpid) == 0)
-                       return grp;
-       }
-
-       /*
-        * No group found based on group id. As a workaround for GO Negotiation
-        * responder case where we do not store group id, try to find an active
-        * group that matches with the requested group id.
-        */
-
-       pos = strchr(grpid, ' ');
-       if (pos == NULL)
-               return NULL;
-       if (pos - grpid > sizeof(go_dev_addr))
-               return NULL;
-       memcpy(go_dev_addr, grpid, pos - grpid);
-       go_dev_addr[pos - grpid] = '\0';
-       strncpy(ssid, pos + 1, sizeof(ssid));
-       ssid[sizeof(ssid) - 1] = '\0';
-       printf("Trying to find suitable interface for group: go_dev_addr='%s' "
-              "grpid='%s'\n", go_dev_addr, grpid);
-
-       if (wpa_command_resp(get_main_ifname(), "INTERFACES", buf, sizeof(buf))
-           < 0)
-               return NULL;
-       ifname = buf;
-       while (ifname && *ifname) {
-               int add = 0;
-               int go = 0;
-               pos = strchr(ifname, '\n');
-               if (pos)
-                       *pos++ = '\0';
-               printf("Considering interface '%s' for group\n", ifname);
-
-               if (wpa_command_resp(ifname, "STATUS", buf2, sizeof(buf2)) ==
-                   0) {
-                       if (strstr(buf2, ssid)) {
-                               printf("Selected interface '%s' based on "
-                                      "STATUS\n", ifname);
-                               add = 1;
-                       }
-                       if (strstr(buf2, "P2P GO"))
-                               go = 1;
-               }
-
-               if (wpa_command_resp(ifname, "LIST_NETWORKS", buf2,
-                                    sizeof(buf2)) == 0) {
-                       char *line, *end;
-                       line = buf2;
-                       while (line && *line) {
-                               end = strchr(line, ' ');
-                               if (end)
-                                       *end++ = '\0';
-                               if (strstr(line, ssid) &&
-                                   strstr(line, "[CURRENT]")) {
-                                       printf("Selected interface '%s' "
-                                              "based on LIST_NETWORKS\n",
-                                              ifname);
-                                       add = 1;
-                                       break;
-                               }
-                               line = end;
-                       }
-               }
-
-               if (add) {
-                       p2p_group_add(dut, ifname, go, grpid, ssid);
-                       return dut->groups;
-               }
-
-               ifname = pos;
-       }
-
-       return NULL;
-}
-
-
-static const char * get_group_ifname(struct sigma_dut *dut, const char *ifname)
-{
-       char buf[1000], *iface, *pos;
-       char state[100];
-
-       if (dut->groups) {
-               sigma_dut_print( DUT_MSG_DEBUG, "%s: Use group interface "
-                               "%s instead of main interface %s",
-                               __func__, dut->groups->ifname, ifname);
-               return dut->groups->ifname;
-       }
-
-       /* Try to find a suitable group interface */
-       if (wpa_command_resp(get_main_ifname(), "INTERFACES",
-                            buf, sizeof(buf)) < 0)
-               return ifname;
-
-       iface = buf;
-       while (iface && *iface) {
-               pos = strchr(iface, '\n');
-               if (pos)
-                       *pos++ = '\0';
-               sigma_dut_print( DUT_MSG_DEBUG, "Considering interface "
-                               "'%s' for IP address", iface);
-               if (get_wpa_status(iface, "wpa_state", state, sizeof(state)) ==
-                   0 && strcmp(state, "COMPLETED") == 0)
-                       return iface;
-               iface = pos;
-       }
-
-       return ifname;
-}
-
-
-static int p2p_peer_known(const char *ifname, const char *peer, int full)
-{
-       char buf[1000];
-
-       snprintf(buf, sizeof(buf), "P2P_PEER %s", peer);
-       if (wpa_command_resp(ifname, buf, buf, sizeof(buf)) < 0)
-               return 0;
-       if (strncasecmp(buf, peer, strlen(peer)) != 0)
-               return 0;
-       if (!full)
-               return 1;
-       return strstr(buf, "[PROBE_REQ_ONLY]") == NULL ? 1 : 0;
-}
-
-
-static int p2p_discover_peer(struct sigma_dut *dut, const char *ifname,
-                            const char *peer, int full)
-{
-       int count;
-
-       if (p2p_peer_known(ifname, peer, full))
-               return 0;
-       printf("Peer not yet discovered - start discovery\n");
-       if (wpa_command(ifname, "P2P_FIND") < 0) {
-               printf("Failed to start discovery\n");
-               return -1;
-       }
-
-       count = 0;
-       while (count < dut->default_timeout) {
-               count++;
-               sleep(1);
-               if (p2p_peer_known(ifname, peer, full)) {
-                       printf("Peer discovered - return to previous state\n");
-                       switch (dut->p2p_mode) {
-                       case P2P_IDLE:
-                               wpa_command(ifname, "P2P_STOP_FIND");
-                               break;
-                       case P2P_DISCOVER:
-                               /* Already running discovery */
-                               break;
-                       case P2P_LISTEN:
-                               wpa_command(ifname, "P2P_LISTEN");
-                               break;
-                       case P2P_DISABLE:
-                               printf("Invalid state - P2P was disabled?!\n");
-                               break;
-                       }
-                       return 0;
-               }
-       }
-
-       printf("Peer discovery timed out - peer not discovered\n");
-       wpa_command(ifname, "P2P_STOP_FIND");
-
-       return -1;
-}
-
-
-static void add_dummy_services(const char *intf)
-{
-       wpa_command(intf, "P2P_SERVICE_ADD bonjour 0b5f6166706f766572746370c00c000c01 074578616d706c65c027");
-       wpa_command(intf, "P2P_SERVICE_ADD bonjour 076578616d706c650b5f6166706f766572746370c00c001001 00");
-       wpa_command(intf, "P2P_SERVICE_ADD bonjour 045f697070c00c000c01 094d795072696e746572c027");
-       wpa_command(intf, "P2P_SERVICE_ADD bonjour 096d797072696e746572045f697070c00c001001 09747874766572733d311a70646c3d6170706c69636174696f6e2f706f7374736372797074");
-
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:6859dede-8574-59ab-9332-123456789012::upnp:rootdevice");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:5566d33e-9774-09ab-4822-333456785632::upnp:rootdevice");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:1122de4e-8574-59ab-9322-333456789044::urn:schemas-upnp-org:service:ContentDirectory:2");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:5566d33e-9774-09ab-4822-333456785632::urn:schemas-upnp-org:service:ContentDirectory:2");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:6859dede-8574-59ab-9332-123456789012::urn:schemas-upnp-org:device:InternetGatewayDevice:1");
-
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:1859dede-8574-59ab-9332-123456789012::upnp:rootdevice");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:1566d33e-9774-09ab-4822-333456785632::upnp:rootdevice");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:2122de4e-8574-59ab-9322-333456789044::urn:schemas-upnp-org:service:ContentDirectory:2");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:1566d33e-9774-09ab-4822-333456785632::urn:schemas-upnp-org:service:ContentDirectory:2");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:1859dede-8574-59ab-9332-123456789012::urn:schemas-upnp-org:device:InternetGatewayDevice:1");
-
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:2859dede-8574-59ab-9332-123456789012::upnp:rootdevice");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:2566d33e-9774-09ab-4822-333456785632::upnp:rootdevice");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:3122de4e-8574-59ab-9322-333456789044::urn:schemas-upnp-org:service:ContentDirectory:2");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:2566d33e-9774-09ab-4822-333456785632::urn:schemas-upnp-org:service:ContentDirectory:2");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:2859dede-8574-59ab-9332-123456789012::urn:schemas-upnp-org:device:InternetGatewayDevice:1");
-
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:3859dede-8574-59ab-9332-123456789012::upnp:rootdevice");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:3566d33e-9774-09ab-4822-333456785632::upnp:rootdevice");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:4122de4e-8574-59ab-9322-333456789044::urn:schemas-upnp-org:service:ContentDirectory:2");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:3566d33e-9774-09ab-4822-333456785632::urn:schemas-upnp-org:service:ContentDirectory:2");
-       wpa_command(intf, "P2P_SERVICE_ADD upnp 10 uuid:3859dede-8574-59ab-9332-123456789012::urn:schemas-upnp-org:device:InternetGatewayDevice:1");
-}
-
-
-void disconnect_station(struct sigma_dut *dut)
-{
-#ifdef __APPLE__
-       run_system(dut, "apple80211 en1 --disassoc");
-#else /* __APPLE__ */
-       wpa_command(get_station_ifname(), "DISCONNECT");
-       remove_wpa_networks(get_station_ifname());
-       dut->infra_ssid[0] = '\0';
-#ifdef __linux__
-       {
-               char path[128];
-               char buf[200];
-               struct stat s;
-               snprintf(path, sizeof(path), "/var/run/dhclient-%s.pid",
-                        get_station_ifname());
-               if (stat(path, &s) == 0) {
-                       snprintf(buf, sizeof(buf),
-                                "kill `cat %s`", path);
-                       sigma_dut_print( DUT_MSG_DEBUG,
-                                       "Kill previous DHCP client: %s", buf);
-                       run_system(dut, buf);
-               }
-               snprintf(buf, sizeof(buf),
-                        "ifconfig %s 0.0.0.0", get_station_ifname());
-               sigma_dut_print( DUT_MSG_DEBUG,
-                               "Clear infrastructure station IP address: %s",
-                               buf);
-               run_system(dut, buf);
-   }
-#endif /* __linux__ */
-#endif /* __APPLE__ */
-}
-
-
-int cmd_sta_get_p2p_dev_address(struct sigma_dut *dut, dutCommand_t *command, dutCmdResponse_t *resp)
-{
-       //char *intf = command->intf;
-       char *intf = "wlan1";
-       char buf[100];
-
-       start_sta_mode(dut);
-       //if (get_wpa_status(intf, "p2p_device_address", buf, sizeof(buf)) < 0) {
-       if (get_wpa_status(intf, "address", buf, sizeof(buf)) < 0)
-               return -1;
-
-        strcpy(resp->cmdru.devid/*[0]*/, buf);
-       return 0;
-}
-
-
-int cmd_sta_set_p2p(struct sigma_dut *dut, caStaSetP2p_t *command, dutCmdResponse_t *resp)
-{
-       const char *intf = command->intf;
-       char buf[256];
-       const char *val;
-       const char *noa_dur, *noa_int, *noa_count;
-       const char *ext_listen_int, *ext_listen_period;
-        dut->Concurrency = 0; 
-
-       if (command->listen_chn_flag) {
-               dut->listen_chn =  command->listen_chn;
-               snprintf(buf, sizeof(buf), "P2P_SET listen_channel %d",
-                        dut->listen_chn);
-               if (wpa_command(intf, buf) < 0)
-                       return -2;
-       }
-
-       val = command->p2p_mode;
-       if (command->p2p_mode_flag) {
-               if (strcasecmp(val, "Listen") == 0) {
-                       wpa_command(intf, "P2P_SET disabled 0");
-                       if (wpa_command(intf, "P2P_LISTEN") < 0)
-                               return -2;
-                       dut->p2p_mode = P2P_LISTEN;
-               } else if (strcasecmp(val, "Discover") == 0) {
-                       wpa_command(intf, "P2P_SET disabled 0");
-                       if (wpa_command(intf, "P2P_FIND") < 0)
-                               return -2;
-                       dut->p2p_mode = P2P_DISCOVER;
-               } else if (strcasecmp(val, "Idle") == 0) {
-                       wpa_command(intf, "P2P_SET disabled 0");
-                       if (wpa_command(intf, "P2P_STOP_FIND") < 0)
-                               return -2;
-                       dut->p2p_mode = P2P_IDLE;
-               } else if (strcasecmp(val, "Disable") == 0) {
-                       if (wpa_command(intf, "P2P_SET disabled 1") < 0)
-                               return -2;
-                       dut->p2p_mode = P2P_DISABLE;
-               } else
-                       return -1;
-       }
-
-       //val = get_param(cmd, "PERSISTENT");
-       if (command->presistent_flag) {
-               dut->persistent = command->presistent;
-       }
-
-       //val =         get_param(cmd, "INTRA_BSS");
-       if (command->intra_bss_flag) {
-               dut->intra_bss = command->intra_bss;
-
-        snprintf(buf, sizeof(buf), "P2P_SET intra_bss %d",
-                        dut->intra_bss);
-               if (wpa_command(intf, buf) < 0)
-                       return -2;
-       }
-
-       //noa_dur = get_param(cmd, "NoA_duration");
-       //noa_int = get_param(cmd, "NoA_Interval");
-       //noa_count = get_param(cmd, "NoA_Count");
-       if (command->noa_duration_flag)
-               dut->noa_duration = command->noa_duration;
-
-       if (command->noa_interval_flag)
-               dut->noa_interval = command->noa_interval;
-
-       if (command->noa_count_flag)
-               dut->noa_count = command->noa_count;
-
-       if (dut->noa_duration || dut->noa_interval || dut->noa_count) {
-               int start;
-               const char *ifname;
-               if (dut->noa_count == 0 && dut->noa_duration == 0)
-                       start = 0;
-               else if (dut->noa_duration > 102) /* likely non-periodic NoA */
-                       start = 50;
-               else
-                       start = 102 - dut->noa_duration;
-               snprintf(buf, sizeof(buf), "P2P_SET noa %d,%d,%d",
-                        dut->noa_count, start,
-                        dut->noa_duration);
-               ifname = get_group_ifname(dut, intf);
-               sigma_dut_print( DUT_MSG_INFO,
-                               "Set GO NoA for interface %s", ifname);
-               if (wpa_command(ifname, buf) < 0)
-                       return -2;
-       }
-
-       //val = get_param(cmd, "Concurrency");
-       if (command->concurrency_flag) {
-            dut->Concurrency = command->concurrency; 
-               /* TODO */
-       }
-
-       //val = get_param(cmd, "P2PInvitation");
-       if (command->p2p_invitation_flag) {
-               /* TODO */
-       }
-
-       //val = get_param(cmd, "BCN_INT");
-       if (command->bcn_int_flag) {
-               /* TODO */
-       }
-
-       //ext_listen_int = get_param(cmd, "Ext_Listen_Time_Interval");
-       //ext_listen_period = get_param(cmd, "Ext_Listen_Time_Period");
-
-       if (command->ext_listen_time_int_flag || command->ext_listen_time_period_flag) {
-               if (!command->ext_listen_time_int || !command->ext_listen_time_period) {
-                       sigma_dut_print( DUT_MSG_INFO, "Only one "
-                                       "ext_listen_time parameter included; "
-                                       "both are needed");
-                       return -1;
-               }
-               snprintf(buf, sizeof(buf), "P2P_EXT_LISTEN %d %d",
-                        command->ext_listen_time_period,
-                        command->ext_listen_time_int);
-               if (wpa_command(intf, buf) < 0)
-                       return -2;
-       }
-
-       //val = get_param(cmd, "Discoverability");
-       if (command->discoverability_flag) {
-               snprintf(buf, sizeof(buf), "P2P_SET discoverability %d",
-                        command->discoverability);
-               if (wpa_command(intf, buf) < 0)
-                       return -2;
-       }
-
-       //val = get_param(cmd, "Service_Discovery");
-       if (command->service_discovry_flag) {
-               int sd = command->service_discovery;
-               if (sd) {
-                       wpa_command(intf, "P2P_SERVICE_FLUSH");
-
-                       if (sd == 2)
-                               wpa_command(intf, "P2P_SET force_long_sd 1");
-
-                       /*
-                        * Set up some dummy service to create a large SD
-                        * response that requires fragmentation.
-                        */
-                       add_dummy_services(intf);
-               } else {
-                       wpa_command(intf, "P2P_SERVICE_FLUSH");
-               }
-       }
-
-       //val = get_param(cmd, "CrossConnection");
-       if (command->crossconnection_flag) {
-               if (command->crossconnection) {
-                       if (wpa_command(intf, "P2P_SET cross_connect 1") < 0)
-                               return -2;
-               } else {
-                       if (wpa_command(intf, "P2P_SET cross_connect 0") < 0)
-                               return -2;
-               }
-       }
-
-       //val = get_param(cmd, "P2PManaged");
-       if (command->p2pmanaged_flag) {
-               if (command->p2pmanaged) {
-                       //send_resp(dut, conn, SIGMA_INVALID, "ErrorCode,"
-                       //        "P2P Managed functionality not supported");
-                       return -1;
-               }
-       }
-
-       //val = get_param(cmd, "GO_APSD");
-       if (command->go_apsd_flag) {
-               if (command->go_apsd) {
-                       if (wpa_command(intf, "P2P_SET go_apsd 1") < 0)
-                               return -2;
-               } else {
-                       if (wpa_command(intf, "P2P_SET go_apsd 0") < 0)
-                               return -2;
-               }
-       }
-
-       return 1;
-}
-
-
-int cmd_sta_start_autonomous_go(struct sigma_dut *dut, caStaStartAutoGo_t *command, dutCmdResponse_t *cmdresp)
-{
-       const char *intf = command->intf;
-       unsigned short chan = command->oper_chn;
-       const char *ssid_param = command->ssid;
-       int freq, res;
-       char buf[256], grpid[100], resp[200];
-       struct wpa_ctrl *ctrl;
-       char *ifname, *gtype, *pos, *ssid, bssid[20];
-       char *go_dev_addr;
-
-       //chan = atoi(oper_chn);
-       if (chan >= 1 && chan <= 13)
-               freq = 2407 + chan * 5;
-       else if (chan == 14)
-               freq = 2484;
-       else
-               freq = 5000 + chan * 5;
-
-       if (command->ssid_flag)
-               snprintf(buf, sizeof(buf), "P2P_SET ssid_postfix %s",
-                        ssid_param);
-       else
-               snprintf(buf, sizeof(buf), "P2P_SET ssid_postfix ");
-       if (wpa_command(intf, buf) < 0)
-               return -2;
-
-       /* Stop Listen/Discovery state to avoid issues with GO operations */
-       if (wpa_command(intf, "P2P_STOP_FIND") < 0)
-               return -2;
-
-       ctrl = open_wpa_mon(intf);
-       if (ctrl == NULL) {
-               sigma_dut_print( DUT_MSG_ERROR, "Failed to open "
-                               "wpa_supplicant monitor connection");
-               return -2;
-       }
-
-       snprintf(buf, sizeof(buf), "P2P_GROUP_ADD %sfreq=%d",
-                dut->persistent ? "persistent " : "", freq);
-       if (wpa_command(intf, buf) < 0) {
-               wpa_ctrl_detach(ctrl);
-               wpa_ctrl_close(ctrl);
-               return -2;
-       }
-
-       res = get_wpa_cli_event(dut, ctrl, "P2P-GROUP-STARTED",
-                               buf, sizeof(buf));
-
-       wpa_ctrl_detach(ctrl);
-       wpa_ctrl_close(ctrl);
-
-       if (res < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,GO starting "
-                         "did not complete");
-               return 0;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Group started event '%s'", buf);
-       ifname = strchr(buf, ' ');
-       if (ifname == NULL)
-               return -2;
-       ifname++;
-       pos = strchr(ifname, ' ');
-       if (pos == NULL)
-               return -2;
-       *pos++ = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "Group interface %s", ifname);
-
-       gtype = pos;
-       pos = strchr(gtype, ' ');
-       if (pos == NULL)
-               return -2;
-       *pos++ = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "Group type %s", gtype);
-
-       ssid = strstr(pos, "ssid=\"");
-       if (ssid == NULL)
-               return -2;
-       ssid += 6;
-       pos = strchr(ssid, '"');
-       if (pos == NULL)
-               return -2;
-       *pos++ = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "Group SSID %s", ssid);
-
-       go_dev_addr = strstr(pos, "go_dev_addr=");
-       if (go_dev_addr == NULL) {
-               sigma_dut_print( DUT_MSG_ERROR, "No GO P2P Device Address "
-                               "found");
-               return -2;
-       }
-       go_dev_addr += 12;
-       if (strlen(go_dev_addr) < 17) {
-               sigma_dut_print( DUT_MSG_ERROR, "Too short GO P2P Device "
-                               "Address '%s'", go_dev_addr);
-               return -2;
-       }
-       go_dev_addr[17] = '\0';
-       *pos = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "GO P2P Device Address %s",
-                       go_dev_addr);
-
-       if (get_wpa_status(ifname, "bssid", bssid, sizeof(bssid)) < 0)
-               return -2;
-       sigma_dut_print( DUT_MSG_DEBUG, "Group BSSID %s", bssid);
-
-       snprintf(grpid, sizeof(grpid), "%s %s", go_dev_addr, ssid);
-       p2p_group_add(dut, ifname, strcmp(gtype, "GO") == 0, grpid, ssid);
-
-       snprintf(resp, sizeof(resp), "GroupID,%s", grpid);
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-
-#if 1        
-        // Fetch the group ID and store into   infoResp->cmdru.grpid 
-       strcpy(&cmdresp->cmdru.grpid[0], grpid);
-#endif
-
-       return 0;
-}
-
-
-int cmd_sta_p2p_connect(struct sigma_dut *dut, caStaP2pConnect_t *command, dutCmdResponse_t *cmdresp)
-{
-       const char *intf = command->intf;
-       const char *devid = command->devId;
-       /* const char *grpid_param = get_param(cmd, "GroupID"); */
-       int res;
-       char buf[256];
-       struct wpa_ctrl *ctrl;
-       char *ifname, *gtype, *pos, *ssid, bssid[20];
-       char grpid[100];
-
-       /* TODO: handle the new grpid argument */
-
-       if (strcmp(devid, "") == 0)
-               return -1;
-
-       if (dut->wps_method == WFA_CS_WPS_NOT_READY) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,WPS parameters "
-                         "not yet set");
-               return -1;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Trying to discover GO %s", devid);
-       if (p2p_discover_peer(dut, intf, devid, 1) < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Could not "
-                         "discover the requested peer");
-               return -1;
-       }
-
-       ctrl = open_wpa_mon(intf);
-       if (ctrl == NULL) {
-               sigma_dut_print( DUT_MSG_ERROR, "Failed to open "
-                               "wpa_supplicant monitor connection");
-               return -2;
-       }
-
-       snprintf(buf, sizeof(buf), "P2P_CONNECT %s %s join",
-                devid,
-                dut->wps_method == WFA_CS_WPS_PBC ?
-                "pbc" : dut->wps_pin);
-       if (wpa_command(intf, buf) < 0) {        
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Failed to join "
-                         "the group");
-               if (ctrl) {
-                       wpa_ctrl_detach(ctrl);
-                       wpa_ctrl_close(ctrl);
-               }
-               return -1;
-       }
-
-       res = get_wpa_cli_event(dut, ctrl, "P2P-GROUP-STARTED",
-                               buf, sizeof(buf));
-
-       wpa_ctrl_detach(ctrl);
-       wpa_ctrl_close(ctrl);
-
-       if (res < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Group joining "
-                         "did not complete");
-               return -1;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Group started event '%s'", buf);
-       ifname = strchr(buf, ' ');
-       if (ifname == NULL)
-               return -2;
-       ifname++;
-       pos = strchr(ifname, ' ');
-       if (pos == NULL)
-               return -2;
-       *pos++ = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "Group interface %s", ifname);
-
-       gtype = pos;
-       pos = strchr(gtype, ' ');
-       if (pos == NULL)
-               return -2;
-       *pos++ = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "Group type %s", gtype);
-
-       ssid = strstr(pos, "ssid=\"");
-       if (ssid == NULL)
-               return -2;
-       ssid += 6;
-       pos = strchr(ssid, '"');
-       if (pos == NULL)
-               return -2;
-       *pos = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "Group SSID %s", ssid);
-
-       if (get_wpa_status(ifname, "bssid", bssid, sizeof(bssid)) < 0)
-               return -2;
-       sigma_dut_print( DUT_MSG_DEBUG, "Group BSSID %s", bssid);
-
-       snprintf(grpid, sizeof(grpid), "%s %s", bssid, ssid);
-       p2p_group_add(dut, ifname, strcmp(gtype, "GO") == 0, grpid, ssid);
-
-       return 1;
-
-}
-
-
-int cmd_sta_p2p_start_group_formation(struct sigma_dut *dut,
-                                            caStaP2pStartGrpForm_t *command,
-                                            dutCmdResponse_t *cmdresp)
-{
-       const char *intf = command->intf;;
-       const char *devid = command->devId;
-       unsigned short intent_val = command->intent_val;
-       unsigned short init_go_neg = command->init_go_neg;
-       unsigned short oper_chn = command->oper_chn;
-       const char *ssid_param = command->ssid;
-       int freq = 0, chan, res, init;
-       char buf[256], grpid[50], resp[256];
-       struct wpa_ctrl *ctrl;
-       char *ifname, *gtype, *pos, *ssid, bssid[20];
-       char *go_dev_addr;
-
-sigma_dut_print( DUT_MSG_DEBUG, "%s -1, intent_val : %d\n", __func__, intent_val);
-
-#if 1
-       if(intent_val == 0) // o means oob ??
-            intent_val = 1;
-#endif
-
-       if (strcmp(devid, "")  == 0 || !intent_val)
-               return -1;
-
-sigma_dut_print( DUT_MSG_DEBUG, "%s -2\n", __func__);
-    
-
-       if (init_go_neg)
-               init = init_go_neg;
-       else
-               init = 0;
-
-sigma_dut_print( DUT_MSG_DEBUG, "%s -3 : init : %d\n", __func__, init);
-
-       if (command->oper_chn_flag && oper_chn) {
-               chan = oper_chn;
-               if (chan >= 1 && chan <= 13)
-                       freq = 2407 + chan * 5;
-               else if (chan == 14)
-                       freq = 2484;
-               else
-                       freq = 5000 + chan * 5;
-       }
-
-sigma_dut_print( DUT_MSG_DEBUG, "%s -4\n", __func__);    
-
-       if (dut->wps_method == WFA_CS_WPS_NOT_READY) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,WPS parameters "
-                         "not yet set");
-               return -1;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Trying to discover peer %s for "
-                       "group formation", devid);
-       if (p2p_discover_peer(dut, intf, devid, init) < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Could not "
-                         "discover the requested peer");
-               return -1;
-       }
-
-    sigma_dut_print( DUT_MSG_DEBUG, "%s -6\n", __func__);
-    
-
-       if (ssid_param)
-               snprintf(buf, sizeof(buf), "P2P_SET ssid_postfix %s",
-                        ssid_param);
-       else
-               snprintf(buf, sizeof(buf), "P2P_SET ssid_postfix ");
-       if (wpa_command(intf, buf) < 0)
-               return -2;
-
-       if (init) {
-               ctrl = open_wpa_mon(intf);
-               if (ctrl == NULL) {
-                       sigma_dut_print( DUT_MSG_ERROR, "Failed to open "
-                                       "wpa_supplicant monitor connection");
-                       return -2;
-               }
-       } else
-               ctrl = NULL;
-
-       snprintf(buf, sizeof(buf), "P2P_CONNECT %s %s%s%s%s go_intent=%d",
-                devid,
-                dut->wps_method == WFA_CS_WPS_PBC ?
-                "pbc" : dut->wps_pin,
-                dut->wps_method == WFA_CS_WPS_PBC ? "" :
-                (dut->wps_method == WFA_CS_WPS_PIN_DISPLAY ? " display" :
-                 (dut->wps_method == WFA_CS_WPS_PIN_LABEL ? " label" :
-                  " keypad" )),
-                dut->persistent ? " persistent" : "",
-                init ? "" : " auth",
-                intent_val);
-       if (freq > 0) {
-               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
-                        " freq=%d", freq);
-       }
-       if (wpa_command(intf, buf) < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Failed to start "
-                         "group formation");
-               if (ctrl) {
-                       wpa_ctrl_detach(ctrl);
-                       wpa_ctrl_close(ctrl);
-               }
-               return -1;
-       }
-
-       if (!init)
-               return 1;
-
-       res = get_wpa_cli_event2(dut, ctrl, "P2P-GROUP-STARTED",
-                                "P2P-GO-NEG-FAILURE",
-                                buf, sizeof(buf));
-
-       wpa_ctrl_detach(ctrl);
-       wpa_ctrl_close(ctrl);
-
-    if (res == -2) {
-               send_resp(dut, conn, SIGMA_INVALID, "ErrorCode,Group formation "
-                         "did not complete");
-               return -1;
-       }
-
-       if (res < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Group formation "
-                         "did not complete");
-               return -1;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Group started event '%s'", buf);
-
-       if (strstr(buf, "P2P-GO-NEG-FAILURE")) {
-               int status = -1;
-               pos = strstr(buf, " status=");
-               if (pos)
-                       status = atoi(pos + 8);
-               sigma_dut_print( DUT_MSG_INFO, "GO Negotiation failed "
-                               "(status=%d)", status);
-               if (status == 9) {
-                       sigma_dut_print( DUT_MSG_INFO, "Both devices "
-                                       "tried to use GO Intent 15");
-                       send_resp(dut, conn, SIGMA_COMPLETE, "result,FAIL");
-                       return -1;
-               }
-               snprintf(buf, sizeof(buf), "ErrorCode,GO Negotiation failed "
-                        "(status=%d)", status);
-               send_resp(dut, conn, SIGMA_ERROR, buf);
-               return -1;
-       }
-
-       ifname = strchr(buf, ' ');
-       if (ifname == NULL)
-               return -2;
-       ifname++;
-       pos = strchr(ifname, ' ');
-       if (pos == NULL)
-               return -2;
-       *pos++ = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "Group interface %s", ifname);
-
-       gtype = pos;
-       pos = strchr(gtype, ' ');
-       if (pos == NULL)
-               return -2;
-       *pos++ = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "Group type %s", gtype);
-
-       ssid = strstr(pos, "ssid=\"");
-       if (ssid == NULL)
-               return -2;
-       ssid += 6;
-       pos = strchr(ssid, '"');
-       if (pos == NULL)
-               return -2;
-       *pos++ = '\0';
-       sigma_dut_print( DUT_MSG_DEBUG, "Group SSID %s", ssid);
-
-       go_dev_addr = strstr(pos, "go_dev_addr=");
-       if (go_dev_addr == NULL) {
-               sigma_dut_print( DUT_MSG_ERROR, "No GO P2P Device Address "
-                               "found\n");
-               return -2;
-       }
-       go_dev_addr += 12;
-       if (strlen(go_dev_addr) < 17) {
-               sigma_dut_print( DUT_MSG_ERROR, "Too short GO P2P Device "
-                               "Address '%s'", go_dev_addr);
-               return -2;
-       }
-       go_dev_addr[17] = '\0';
-       *pos = '\0';
-       sigma_dut_print( DUT_MSG_ERROR, "GO P2P Device Address %s",
-                       go_dev_addr);
-
-       if (get_wpa_status(ifname, "bssid", bssid, sizeof(bssid)) < 0)
-               return -2;
-       sigma_dut_print( DUT_MSG_DEBUG, "Group BSSID %s", bssid);
-
-       snprintf(grpid, sizeof(grpid), "%s %s", go_dev_addr, ssid);
-       p2p_group_add(dut, ifname, strcmp(gtype, "GO") == 0, grpid, ssid);
-       snprintf(resp, sizeof(resp), "Result,%s,GroupID,%s",
-                strcmp(gtype, "GO") == 0 ? "GO" : "CLIENT", grpid);
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-
-#if 1
-       // Fetch the device mode and put in     infoResp->cmdru.p2presult 
-       //strcpy(infoResp->cmdru.p2presult, "GO");
-
-       // Fetch the device grp id and put in   infoResp->cmdru.grpid 
-       //strcpy(infoResp->cmdru.grpid, "AA:BB:CC:DD:EE:FF_DIRECT-SSID");
-       
-       strcpy(cmdresp->cmdru.grpFormInfo.result, gtype);
-       strcpy(cmdresp->cmdru.grpFormInfo.grpId, grpid);
-#endif
-
-            
-       return 0;
-}
-
-
-int cmd_sta_p2p_dissolve(struct sigma_dut *dut, caStaP2pDissolve_t *command,
-                               dutCmdResponse_t *cmdresp)
-{
-       const char *intf = command->intf;
-       const char *grpid = command->grpId;
-       struct wfa_cs_p2p_group *grp;
-       char buf[128];
-
-       if (strcmp(grpid, "") == 0)
-               return -1;
-
-       grp = p2p_group_get(dut, grpid);
-       if (grp == NULL) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Requested group "
-                         "not found");
-               return -1;
-       }
-
-       snprintf(buf, sizeof(buf), "P2P_GROUP_REMOVE %s", grp->ifname);
-       if (wpa_command(intf, buf) < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Failed to remove "
-                         "the specified group");
-               return -1;
-       }
-       sigma_dut_print( DUT_MSG_DEBUG, "Removed group %s", grpid);
-       p2p_group_remove(dut, grpid);
-       return 1;
-}
-
-
-int cmd_sta_send_p2p_invitation_req(struct sigma_dut *dut,
-                                          caStaSendP2pInvReq_t *command,
-                                          dutCmdResponse_t *cmdresp)
-{
-       const char *intf = command->intf;;
-       const char *devid = command->devId;
-       const char *grpid = command->grpId;
-       int                 reinvoke = command->reinvoke;
-       char c[256];
-       char buf[4096];
-       struct wpa_ctrl *ctrl;
-       int res;
-
-       if (strcmp(devid, "") == 0 || strcmp(grpid, "") == 0)
-               return -1;
-
-       if (reinvoke) {
-               int id = -1;
-               char *ssid, *pos;
-
-               ssid = strchr(grpid, ' ');
-               if (ssid == NULL) {
-                       sigma_dut_print( DUT_MSG_INFO, "Invalid grpid");
-                       return -1;
-               }
-               ssid++;
-               sigma_dut_print( DUT_MSG_DEBUG, "Search for persistent "
-                               "group credentials based on SSID: '%s'", ssid);
-               if (wpa_command_resp(intf, "LIST_NETWORKS",
-                                    buf, sizeof(buf)) < 0)
-                       return -2;
-               pos = strstr(buf, ssid);
-               if (pos == NULL || pos == buf || pos[-1] != '\t' ||
-                   pos[strlen(ssid)] != '\t') {
-                       send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,"
-                                 "Persistent group credentials not found");
-                       return -1;
-               }
-               while (pos > buf && pos[-1] != '\n')
-                       pos--;
-               id = atoi(pos);
-               snprintf(c, sizeof(c), "P2P_INVITE persistent=%d peer=%s",
-                        id, devid);
-       } else {
-               struct wfa_cs_p2p_group *grp;
-               grp = p2p_group_get(dut, grpid);
-               if (grp == NULL) {
-                       send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,"
-                                 "No active P2P group found for invitation");
-                       return -1;
-               }
-               snprintf(c, sizeof(c), "P2P_INVITE group=%s peer=%s",
-                        grp->ifname, devid);
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Trying to discover peer %s for "
-                       "invitation", devid);
-       if (p2p_discover_peer(dut, intf, devid, 0) < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Could not "
-                         "discover the requested peer");
-               return -1;
-       }
-
-       ctrl = open_wpa_mon(intf);
-       if (ctrl == NULL) {
-               sigma_dut_print( DUT_MSG_ERROR, "Failed to open "
-                               "wpa_supplicant monitor connection");
-               return -2;
-       }
-
-       if (wpa_command(intf, c) < 0) {
-               sigma_dut_print( DUT_MSG_INFO, "Failed to send invitation "
-                               "request");
-               return -2;
-       }
-
-       res = get_wpa_cli_event(dut, ctrl, "P2P-INVITATION-RESULT",
-                               buf, sizeof(buf));
-
-       wpa_ctrl_detach(ctrl);
-       wpa_ctrl_close(ctrl);
-
-       if (res < 0)
-               return -2;
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Invitation event: '%s'", buf);
-       return 1;
-}
-
-
-int cmd_sta_accept_p2p_invitation_req(struct sigma_dut *dut,
-                                            caStaAcceptP2pInvReq_t *command,
-                                            dutCmdResponse_t *cmdresp)
-{
-       const char *intf = command->intf;;
-       const char *devid = command->devId;
-       const char *grpid = command->grpId;
-       int                 reinvoke = command->reinvoke;
-
-    
-       char buf[100];
-
-       if (devid == NULL || grpid == NULL)
-               return -1;
-
-       if (reinvoke) {
-               /*
-                * Assume persistent reconnect is enabled and there is no need
-                * to do anything here.
-                */
-               return 1;
-       }
-
-       /*
-        * In a client-joining-a-running-group case, we need to separately
-        * authorize the invitation.
-        */
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Trying to discover GO %s", devid);
-       if (p2p_discover_peer(dut, intf, devid, 1) < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Could not "
-                         "discover the requested peer");
-               return -1;
-       }
-
-       snprintf(buf, sizeof(buf), "P2P_CONNECT %s %s join auth",
-                devid,
-                dut->wps_method == WFA_CS_WPS_PBC ?
-                "pbc" : dut->wps_pin);
-       if (wpa_command(intf, buf) < 0)
-               return -2;
-
-       return 1;
-}
-
-
-int cmd_sta_send_p2p_provision_dis_req(struct sigma_dut *dut,
-                                             caStaSendP2pProvDisReq_t *command,
-                                             dutCmdResponse_t *cmdresp)
-{
-       const char *intf = command->intf;
-       const char *conf_method = command->confMethod;
-       const char *devid = command->devId;
-       char buf[256];
-       char *method;
-
-       if (conf_method == NULL || devid == NULL)
-               return -1;
-
-       if (strcasecmp(conf_method, "Display") == 0)
-               method = "display";
-       else if (strcasecmp(conf_method, "Keyboard") == 0 ||
-                strcasecmp(conf_method, "keypad") == 0)
-               method = "keypad";
-       else if (strcasecmp(conf_method, "Label") == 0)
-               method = "label";
-       else if (strcasecmp(conf_method, "pbc") == 0 ||
-                strcasecmp(conf_method, "pushbutton") == 0)
-               method = "pbc";
-       else
-               return -1;
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Trying to discover peer %s for "
-                       "provision discovery", devid);
-       if (p2p_discover_peer(dut, intf, devid, 0) < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Could not "
-                         "discover the requested peer");
-               return -1;
-       }
-
-       snprintf(buf, sizeof(buf), "P2P_PROV_DISC %s %s", devid, method);
-       if (wpa_command(intf, buf) < 0) {
-               sigma_dut_print( DUT_MSG_INFO, "Failed to send provision "
-                               "discovery request");
-               return -2;
-       }
-
-       return 1;
-}
-
-
-int cmd_sta_set_wps_pbc(struct sigma_dut *dut, caStaSetWpsPbc_t *command,
-                              dutCmdResponse_t *cmdresp)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       const char *grpid = command->grpId;
-
-       if (grpid) {
-               struct wfa_cs_p2p_group *grp;
-               grp = p2p_group_get(dut, grpid);
-               if (grp && grp->go) {
-                       sigma_dut_print( DUT_MSG_DEBUG, "Authorize a "
-                                       "client to join with WPS");
-                       wpa_command(grp->ifname, "WPS_PBC");
-                       return 1;
-               }
-       }
-
-       dut->wps_method = WFA_CS_WPS_PBC;
-       return 1;
-}
-
-
-int cmd_sta_wps_read_pin(struct sigma_dut *dut, caStaWpsReadPin_t *command,
-                               dutCmdResponse_t *cmdresp)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       const char *grpid = command->grpId;
-       char *pin = "12345670"; /* TODO: use random PIN */
-       char resp[100];
-
-       if (command->grpid_flag && grpid) {
-               char buf[100];
-               struct wfa_cs_p2p_group *grp;
-               grp = p2p_group_get(dut, grpid);
-               if (grp && grp->go) {
-                       sigma_dut_print( DUT_MSG_DEBUG, "Authorize a "
-                                       "client to join with WPS");
-                       snprintf(buf, sizeof(buf), "WPS_PIN any %s", pin);
-                       wpa_command(grp->ifname, buf);
-                       //return 1;
-               }
-       }
-
-       strncpy(dut->wps_pin, pin, sizeof(dut->wps_pin));
-       dut->wps_method = WFA_CS_WPS_PIN_DISPLAY;
-       snprintf(resp, sizeof(resp), "PIN,%s", pin);
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-
-#if 1
-       // Fetch the device PIN and put in      infoResp->cmdru.wpsPin 
-       //strcpy(infoResp->cmdru.wpsPin, "12345678");
-       strcpy(&(cmdresp->cmdru.wpsPin[0]), pin);   
-#endif
-
-       return 0;
-}
-
-
-int cmd_sta_wps_read_label(struct sigma_dut *dut,
-                                 caStaWpsReadLabel_t *command,
-                                 dutCmdResponse_t *cmdresp)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       const char *grpid = command->grpId;;
-       char *pin = "12345670";
-       char resp[100];
-
-       if (command->grpid_flag && grpid) {
-               char buf[100];
-               struct wfa_cs_p2p_group *grp;
-               grp = p2p_group_get(dut, grpid);
-               if (grp && grp->go) {
-                       sigma_dut_print( DUT_MSG_DEBUG, "Authorize a "
-                                       "client to join with WPS");
-                       snprintf(buf, sizeof(buf), "WPS_PIN any %s", pin);
-                       wpa_command(grp->ifname, buf);
-                       return 1;
-               }
-       }
-
-       strncpy(dut->wps_pin, pin, sizeof(dut->wps_pin));
-       dut->wps_method = WFA_CS_WPS_PIN_LABEL;
-       snprintf(resp, sizeof(resp), "LABEL,%s", pin);
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-
-#if 1
-       // Fetch the device Label and put in    infoResp->cmdru.wpsPin 
-       //strcpy(infoResp->cmdru.wpsPin, "12345678");
-       strcpy(&cmdresp->cmdru.wpsPin[0], pin);
-#endif    
-
-       return 0;
-}
-
-
-int cmd_sta_wps_enter_pin(struct sigma_dut *dut,
-                                caStaWpsEnterPin_t *command,
-                                dutCmdResponse_t *cmdresp)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       const char *grpid = command->grpId;
-       const char *pin = command->wpsPin;
-        char *ifname;  
-
-       if (pin == NULL)
-               return -1;
-        ifname = get_main_ifname();        
-                                                                      
-        if(dut->Concurrency) {                                                                   
-            wpa_command(ifname, "P2P_STOP_FIND");                                                
-            wpa_command(ifname, "P2P_FIND");                                                     
-        } 
-
-       if (grpid) {
-               char buf[100];
-               struct wfa_cs_p2p_group *grp;
-               grp = p2p_group_get(dut, grpid);
-               if (grp && grp->go) {
-                       sigma_dut_print( DUT_MSG_DEBUG, "Authorize a "
-                                       "client to join with WPS");
-                       snprintf(buf, sizeof(buf), "WPS_PIN any %s", pin);
-                       wpa_command(grp->ifname, buf);
-                       return 1;
-               }
-       }
-
-       strncpy(dut->wps_pin, pin, sizeof(dut->wps_pin));
-       dut->wps_pin[sizeof(dut->wps_pin) - 1] = '\0';
-       dut->wps_method = WFA_CS_WPS_PIN_KEYPAD;
-
-       return 1;
-}
-
-
-int cmd_sta_get_psk(struct sigma_dut *dut, caStaGetPsk_t *command,
-                          dutCmdResponse_t *cmdresp)
-{
-       /* const char *intf = get_param(cmd, "interface"); */
-       const char *grpid = command->grpId;
-       struct wfa_cs_p2p_group *grp;
-       char passphrase[64], resp[200];
-
-       if (grpid == NULL)
-               return -1;
-
-       grp = p2p_group_get(dut, grpid);
-       if (grp == NULL) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "errorCode,Requested group not found");
-               return -1;
-       }
-       if (!grp->go) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "errorCode,Local role is not GO in the specified "
-                         "group");
-               return -1;
-       }
-
-       if (wpa_command_resp(grp->ifname, "P2P_GET_PASSPHRASE",
-                            passphrase, sizeof(passphrase)) < 0)
-               return -2;
-
-       snprintf(resp, sizeof(resp), "passPhrase,%s,ssid,%s",
-                passphrase, grp->ssid);
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-
-#if 1
-       // Fetch the device PP and SSID  and put in     infoResp->cmdru.pskInfo 
-       //strcpy(infoResp->cmdru.wpsPin, "12345678");
-       strcpy(&cmdresp->cmdru.pskInfo.passPhrase[0], passphrase);
-       strcpy(&cmdresp->cmdru.pskInfo.ssid[0], grp->ssid);     
-#endif    
-
-       return 0;
-}
-
-
-int cmd_sta_p2p_reset(struct sigma_dut *dut, dutCommand_t *command,
-                     dutCmdResponse_t *resp)
-{
-       char *intf = command->intf;
-       struct wfa_cs_p2p_group *grp, *prev;
-       char buf[256];
-
-       dut->wps_method = WFA_CS_WPS_NOT_READY;
-
-       grp = dut->groups;
-       while (grp) {
-               prev = grp;
-               grp = grp->next;
-
-               snprintf(buf, sizeof(buf), "P2P_GROUP_REMOVE %s",
-                        prev->ifname);
-               wpa_command(intf, buf);
-               p2p_group_remove(dut, prev->grpid);
-       }
-
-       wpa_command(intf, "P2P_GROUP_REMOVE *");
-       wpa_command(intf, "P2P_STOP_FIND");
-       wpa_command(intf, "P2P_FLUSH");
-       wpa_command(intf, "P2P_SERVICE_FLUSH");
-       wpa_command(intf, "P2P_SET ssid_postfix ");
-       wpa_command(intf, "P2P_EXT_LISTEN");
-       wpa_command(intf, "P2P_SET client_apsd disable");
-       wpa_command(intf, "P2P_SET go_apsd disable");
-       wpa_command(get_station_ifname(), "P2P_SET ps 98");
-       wpa_command(get_station_ifname(), "P2P_SET ps 96");
-       wpa_command(get_station_ifname(), "P2P_SET ps 0");
-       wpa_command(intf, "SET ampdu 1");
-       run_system(dut, "iptables -F INPUT");
-       if (dut->arp_ipaddr[0]) {
-               snprintf(buf, sizeof(buf), "ip nei del %s dev %s",
-                        dut->arp_ipaddr, dut->arp_ifname);
-               run_system(dut, buf);
-               dut->arp_ipaddr[0] = '\0';
-       }
-       snprintf(buf, sizeof(buf), "ip nei flush dev %s",
-                get_station_ifname());
-       run_system(dut, buf);
-       dut->p2p_mode = P2P_IDLE;
-       dut->client_uapsd = 0;
-
-       remove_wpa_networks(intf);
-
-       disconnect_station(dut);
-
-       return 1;
-}
-
-
-
-int cmd_sta_get_p2p_ip_config(struct sigma_dut *dut,
-                                    caStaGetP2pIpConfig_t *command,
-                                    dutCmdResponse_t *cmdRes)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       const char *grpid = command->grpId;
-       struct wfa_cs_p2p_group *grp = NULL;
-       int count;
-       char macaddr[20];
-       char resp[200], info[150];
-    caStaGetIpConfigResp_t *ifinfo = &(cmdRes->cmdru.getIfconfig);
-
-       if (grpid == NULL)
-               return -1;
-
-       /*
-        * If we did not initiate the operation that created the group, we may
-        * not have the group information available in the DUT code yet and it
-        * may take some time to get this from wpa_supplicant in case we are
-        * the P2P client. As such, we better try this multiple times to allow
-        * some time to complete the operation.
-        */
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Waiting to find the requested group : %s", grpid);
-       count = dut->default_timeout;
-       while (count > 0) {
-               grp = p2p_group_get(dut, grpid);
-               if (grp == NULL) {
-                       sigma_dut_print( DUT_MSG_DEBUG, "Requested group "
-                                       "not yet found (count=%d)", count);
-                       sleep(1);
-               } else
-                       break;
-               count--;
-       }
-       if (grp == NULL) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "errorCode,Requested group not found");
-               return 0;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Waiting for IP address on group "
-                       "interface %s", grp->ifname);
-       if (wait_ip_addr(dut, grp->ifname) < 0) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "errorCode,No IP address received");
-               return 0;
-       }
-
-       if (get_ip_config(dut, grp->ifname, info, sizeof(info)) < 0) {
-               sigma_dut_print( DUT_MSG_INFO, "Failed to get IP address "
-                               "for group interface %s",
-                               grp->ifname);
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "errorCode,Failed to get IP address");
-               return 0;
-       }
-
-       if (get_wpa_status(grp->ifname, "address",
-                          macaddr, sizeof(macaddr)) < 0) {
-               sigma_dut_print( DUT_MSG_ERROR, "Failed to get interface "
-                               "address for group interface %s",
-                               grp->ifname);
-               return -2;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "IP address for group interface "
-                       "%s found", grp->ifname);
-
-       snprintf(resp, sizeof(resp), "%s,P2PInterfaceAddress,%s",
-                info, macaddr);
-
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-
-#if 1
-       // Fetch the device IP config  and put in       infoResp->cmdru 
-       //strcpy(infoResp->cmdru.wpsPin, "12345678");
-
-        // 'info' format : dhcp,%d,ip,%s,mask,%s,primary-dns,%s
-        // 'info' parsing is needed for dhcp, ipaddr ...
-       ifinfo->isDhcp =0;
-       strcpy(&(ifinfo->ipaddr[0]), "192.165.100.111");
-       strcpy(&(ifinfo->mask[0]), "255.255.255.0");
-       strcpy(&(ifinfo->dns[0][0]), "192.165.100.1");
-       strcpy(&(ifinfo->mac[0]), macaddr);
-#endif     
-    
-       return 0;
-}
-
-
-int cmd_sta_send_p2p_presence_req(struct sigma_dut *dut,
-                                        caStaSendP2pPresenceReq_t *command,
-                                        dutCmdResponse_t *cmdRes)
-{
-       const char *intf = command->intf;
-       long long int dur = command->duration;
-       long long int interv = command->interval;
-       /* const char *grpid = get_param(cmd, "GroupID"); */
-       const char *ifname;
-       char buf[100];
-
-       if (dur == 0 || interv == 0)
-               return -1;
-
-       /* TODO: need to add groupid into parameters in CAPI spec; for now,
-        * pick the first active group */
-       ifname = get_group_ifname(dut, intf);
-       snprintf(buf, sizeof(buf), "P2P_PRESENCE_REQ %lld %lld", dur, interv);
-       if (wpa_command(ifname, buf) < 0)
-               return -2;
-
-       return 1;
-}
-
-
-int cmd_sta_set_sleep(struct sigma_dut *dut, caStaSetSleep_t *command,
-                            dutCmdResponse_t *cmdRes)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       struct wfa_cs_p2p_group *grp;
-       char *ifname;
-       const char *grpid = command->grpId;
-
-       if (strcmp(grpid, "") == 0)
-               ifname = get_station_ifname();
-       else {
-               grp = p2p_group_get(dut, grpid);
-               if (grp == NULL) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "errorCode,Requested group not found");
-                       return -1;
-               }
-               ifname = grp->ifname;
-       }
-
-       if (dut->client_uapsd) {
-               if (wpa_command(ifname, "P2P_SET ps 99") < 0)
-                       return -2;
-       } else {
-               if (wpa_command(ifname, "P2P_SET ps 1") < 0)
-                       return -2;
-       }
-
-       return 1;
-}
-
-
-int cmd_sta_set_opportunistic_ps(struct sigma_dut *dut,
-                                       caStaSetOpprPs_t *command,
-                                       dutCmdResponse_t *cmdRes)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       struct wfa_cs_p2p_group *grp;
-       char buf[100];
-       const char *grpid = command->grpId;
-       int ctwindow = command->ctwindow;
-
-       if (strcmp(grpid, "") == 0 || ctwindow == 0)
-               return -1;
-
-       grp = p2p_group_get(dut, grpid);
-       if (grp == NULL) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "errorCode,Requested group not found");
-               return -1;
-       }
-
-       if (wpa_command(grp->ifname, "P2P_SET oppps 1") < 0)
-               return -2;
-       snprintf(buf, sizeof(buf), "P2P_SET ctwindow %d", ctwindow);
-       if (wpa_command(grp->ifname, buf) < 0)
-               return -2;
-
-       return 1;
-}
-
-
-int cmd_sta_send_service_discovery_req(struct sigma_dut *dut,
-                                             caStaSendServiceDiscoveryReq_t *command,
-                                             dutCmdResponse_t *cmdRes)
-{
-       const char *intf = command->intf;
-       const char *devid = command->devId;
-       char buf[128];
-
-       if (strcmp(devid, "")  == 0)
-               return -1;
-
-       snprintf(buf, sizeof(buf), "P2P_SERV_DISC_REQ %s 02000001",
-                devid);
-       if (wpa_command(intf, buf) < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, NULL);
-               return -1;
-       }
-
-       return 1;
-}
-
-
-int cmd_sta_add_arp_table_entry(struct sigma_dut *dut,
-                                      caStaAddARPTableEntry_t *command,
-                                      dutCmdResponse_t *cmdRes)
-{
-       char buf[256];
-       char *ifname;
-       const char *grpid, *ipaddr, *macaddr;
-
-       grpid = NULL; //get_param(cmd, "GroupID");
-       ipaddr = command->ipaddress;
-       macaddr = command->macaddress;
-       if (strcmp(ipaddr, "") == 0 || strcmp(macaddr, "") == 0)
-               return -1;
-
-       if (grpid == NULL)
-               ifname = get_station_ifname();
-       else {
-               struct wfa_cs_p2p_group *grp;
-               grp = p2p_group_get(dut, grpid);
-               if (grp == NULL) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "errorCode,Requested group not found");
-                       return -1;
-               }
-               ifname = grp->ifname;
-       }
-
-       snprintf(dut->arp_ipaddr, sizeof(dut->arp_ipaddr), "%s",
-                ipaddr);
-       snprintf(dut->arp_ifname, sizeof(dut->arp_ifname), "%s",
-                ifname);
-
-       snprintf(buf, sizeof(buf), "ip nei add %s lladdr %s dev %s",
-                ipaddr, macaddr, ifname);
-       run_system(dut, buf);
-
-       return 1;
-}
-
-
-int cmd_sta_block_icmp_response(struct sigma_dut *dut,
-                                      caStaBlockICMPResponse_t *command,
-                                      dutCmdResponse_t *cmdRes)
-{
-       char buf[256];
-       struct wfa_cs_p2p_group *grp;
-       char *ifname;
-       const char *grpid, *ipaddr;
-
-       grpid = command->grpId;
-       ipaddr = command->ipaddress;
-       if (strcmp(ipaddr, "") == 0)
-               return -1;
-
-       if (strcmp(grpid, "") == 0)
-               ifname = get_station_ifname();
-       else {
-               grp = p2p_group_get(dut, grpid);
-               if (grp == NULL) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "errorCode,Requested group not found");
-                       return -1;
-               }
-               ifname = grp->ifname;
-       }
-
-       snprintf(buf, sizeof(buf),
-                "iptables -I INPUT -s %s -p icmp -i %s -j DROP",
-                ipaddr, ifname);
-       run_system(dut, buf);
-
-       return 1;
-}
-
-
-static int req_intf(struct sigma_cmd *cmd)
-{
-       return get_param(cmd, "interface") == NULL ? -1 : 0;
-}
-
-
-void p2p_register_cmds(void)
-{
-#ifdef _SIGMA_CA_REMOVED
-       sigma_dut_reg_cmd("sta_get_p2p_dev_address", req_intf,
-                         cmd_sta_get_p2p_dev_address);
-       sigma_dut_reg_cmd("sta_set_p2p", req_intf, cmd_sta_set_p2p);
-       sigma_dut_reg_cmd("sta_start_autonomous_go", req_intf,
-                         cmd_sta_start_autonomous_go);
-       sigma_dut_reg_cmd("sta_p2p_connect", req_intf, cmd_sta_p2p_connect);
-       sigma_dut_reg_cmd("sta_p2p_start_group_formation", req_intf,
-                         cmd_sta_p2p_start_group_formation);
-       sigma_dut_reg_cmd("sta_p2p_dissolve", req_intf, cmd_sta_p2p_dissolve);
-       sigma_dut_reg_cmd("sta_send_p2p_invitation_req", req_intf,
-                         cmd_sta_send_p2p_invitation_req);
-       sigma_dut_reg_cmd("sta_accept_p2p_invitation_req", req_intf,
-                         cmd_sta_accept_p2p_invitation_req);
-       sigma_dut_reg_cmd("sta_send_p2p_provision_dis_req", req_intf,
-                         cmd_sta_send_p2p_provision_dis_req);
-       sigma_dut_reg_cmd("sta_set_wps_pbc", req_intf, cmd_sta_set_wps_pbc);
-       sigma_dut_reg_cmd("sta_wps_read_pin", req_intf, cmd_sta_wps_read_pin);
-       sigma_dut_reg_cmd("sta_wps_read_label", req_intf,
-                         cmd_sta_wps_read_label);
-       sigma_dut_reg_cmd("sta_wps_enter_pin", req_intf,
-                         cmd_sta_wps_enter_pin);
-       sigma_dut_reg_cmd("sta_get_psk", req_intf, cmd_sta_get_psk);
-       sigma_dut_reg_cmd("sta_p2p_reset", req_intf, cmd_sta_p2p_reset);
-       sigma_dut_reg_cmd("sta_get_p2p_ip_config", req_intf,
-                         cmd_sta_get_p2p_ip_config);
-       sigma_dut_reg_cmd("sta_send_p2p_presence_req", req_intf,
-                         cmd_sta_send_p2p_presence_req);
-       sigma_dut_reg_cmd("sta_set_sleep", req_intf, cmd_sta_set_sleep);
-       sigma_dut_reg_cmd("sta_set_opportunistic_ps", req_intf,
-                         cmd_sta_set_opportunistic_ps);
-       sigma_dut_reg_cmd("sta_send_service_discovery_req", req_intf,
-                         cmd_sta_send_service_discovery_req);
-       sigma_dut_reg_cmd("sta_add_arp_table_entry", req_intf,
-                         cmd_sta_add_arp_table_entry);
-       sigma_dut_reg_cmd("sta_block_icmp_response", req_intf,
-                         cmd_sta_block_icmp_response);
-#endif    
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/powerswitch.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/powerswitch.c
deleted file mode 100644 (file)
index 8b2c650..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-
-
-static int cmd_power_switch_ctrl(struct sigma_dut *dut,
-                                struct sigma_conn *conn,
-                                struct sigma_cmd *cmd)
-{
-       return 1;
-}
-
-
-static int cmd_power_switch_reset(struct sigma_dut *dut,
-                                 struct sigma_conn *conn,
-                                 struct sigma_cmd *cmd)
-{
-       if (system("killall hostapd") == 0) {
-               int i;
-
-               /* Wait some time to allow hostapd to complete cleanup before
-                * starting a new process */
-               for (i = 0; i < 10; i++) {
-                       usleep(500000);
-                       if (system("pidof hostapd") != 0)
-                               break;
-               }
-       }
-       return 1;
-}
-
-
-static int cmd_powerswitch(struct sigma_dut *dut, struct sigma_conn *conn,
-                          struct sigma_cmd *cmd)
-{
-       return 1;
-}
-
-
-void powerswitch_register_cmds(void)
-{
-       sigma_dut_reg_cmd("power_switch_ctrl", NULL, cmd_power_switch_ctrl);
-       sigma_dut_reg_cmd("power_switch_reset", NULL, cmd_power_switch_reset);
-       sigma_dut_reg_cmd("PowerSwitch", NULL, cmd_powerswitch);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/sigma_dut.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/sigma_dut.c
deleted file mode 100644 (file)
index 00538a8..0000000
+++ /dev/null
@@ -1,649 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-#include "wpa_helpers.h"
-
-#if 1   // by bbelief
-#include "wfa_portall.h"
-#include "wfa_debug.h"
-#include "wfa_main.h"
-#include "wfa_types.h"
-//#include "wfa_dut.h"
-#include "wfa_sock.h"
-#include "wfa_tlv.h"
-#include "wfa_tg.h"
-#include "wfa_miscs.h"
-#include "wfa_agt.h"
-#include "wfa_rsp.h"
-#include "wfa_wmmps.h"
-#endif
-
-#ifdef ANDROID
-#include <cutils/log.h>
-#endif 
-
-
-#define SIGMA_DUT_PORT 9000
-#define MAX_CONNECTIONS 4
-
-
-static struct sigma_dut g_sigma_dut;
-
-unsigned short wfa_defined_debug = WFA_DEBUG_ERR | WFA_DEBUG_WARNING | WFA_DEBUG_INFO;
-int                     g_debug_level = 0;
-
-
-#ifdef ANDROID 
-static const char TAGS[] = "sigma_dut";
-
-
-static inline int sigma_lv2android(int level)
-{
-       switch (level) {
-       case DUT_MSG_ERROR:
-               return ANDROID_LOG_ERROR;
-       case DUT_MSG_INFO:
-               return ANDROID_LOG_INFO;
-       case DUT_MSG_DEBUG:
-               return ANDROID_LOG_DEBUG;
-       default:
-               return ANDROID_LOG_VERBOSE;
-       }
-}
-#endif /* ANDROID */
-
-
-void sigma_dut_hexdump(int level, const char *title, const unsigned char *buf, size_t len, int show)
-{
-       size_t i;
-       //if (level < wpa_debug_level)
-       //      return;
-       //wpa_debug_print_timestamp();
-
-        sigma_dut_print(DUT_MSG_DEBUG, "%s - hexdump(len=%lu): %s", title, (unsigned long)len, 
-               (show) ? (buf ? "......" : " [NULL]") : " [REMOVED]");
-
-       if (buf) {
-               char line[82];
-               i = 0;
-               while (i<len) {
-                       int j, next=0;
-                       for (j=0; j<27 && i<len; ++j, ++i) {
-                               next += sprintf(line+next, "%02X ", buf[i]);                            
-                       }
-                     sigma_dut_print(DUT_MSG_DEBUG, "%s %s", TAGS, line);        
-               }
-              sigma_dut_print(DUT_MSG_DEBUG, "%s %s", TAGS, "--------------------------------------------------------------------------------");        
-       }       
-}
-
-
-void sigma_dut_print(int level, const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       if (level >= g_debug_level) {
-#ifdef ANDROID
-                __android_log_vprint(sigma_lv2android(level), TAGS, fmt, ap);
-#else
-                vprintf(fmt, ap);
-                printf("\n");
-#endif /* ANDROID */
-       }
-       va_end(ap);
-}
-
-
-void send_resp_debug(enum sigma_status status, char *buf)
-{
-       sigma_dut_print( DUT_MSG_INFO, "resp: status=%d buf=%s",
-                       status, buf);
-
-}
-              
-
-struct sigma_dut *sigma_dut_ptr(void)
-{
-    return &g_sigma_dut;
-}
-
-
-
-int sigma_dut_reg_cmd(const char *cmd,
-                     int (*validate)(struct sigma_cmd *cmd),
-                     int (*process)(struct sigma_dut *dut,
-                                    struct sigma_conn *conn,
-                                    struct sigma_cmd *cmd))
-{
-       struct sigma_cmd_handler *h;
-       size_t clen, len;
-
-       clen = strlen(cmd);
-       len = sizeof(*h) + clen + 1;
-       h = malloc(len);
-       if (h == NULL)
-               return -1;
-       memset(h, 0, len);
-       h->cmd = (char *) (h + 1); /* include in same allocation */
-       memcpy(h->cmd, cmd, clen);
-       h->validate = validate;
-       h->process= process;
-
-       h->next = g_sigma_dut.cmds;
-       g_sigma_dut.cmds = h;
-
-       return 0;
-}
-
-
-static int open_socket(struct sigma_dut *dut, int port)
-{
-       struct sockaddr_in addr;
-       int val;
-
-       dut->s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
-       if (dut->s < 0) {
-               sigma_dut_print( DUT_MSG_ERROR, "socket: %s",
-                               strerror(errno));
-               return -1;
-       }
-
-       val = 1;
-       if (setsockopt(dut->s, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) <
-           0)
-               sigma_dut_print( DUT_MSG_INFO, "setsockopt SO_REUSEADDR: "
-                               "%s", strerror(errno));
-
-       memset(&addr, 0, sizeof(addr));
-       addr.sin_family = AF_INET;
-       addr.sin_port = htons(port);
-
-       if (bind(dut->s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
-               sigma_dut_print( DUT_MSG_ERROR, "bind: %s",
-                               strerror(errno));
-               goto fail;
-       }
-
-       if (listen(dut->s, 5) < 0) {
-               sigma_dut_print( DUT_MSG_ERROR, "listen: %s",
-                               strerror(errno));
-               goto fail;
-       }
-
-sigma_dut_print( DUT_MSG_INFO, "%s succeed", __func__);    
-
-       return 0;
-
-fail:
-       close(dut->s);
-       dut->s = -1;
-       return -1;
-}
-
-
-static void close_socket(struct sigma_dut *dut)
-{
-       close(dut->s);
-       dut->s = -1;
-}
-
-#if 0
-void send_resp(struct sigma_dut *dut, struct sigma_conn *conn,
-              enum sigma_status status, char *buf)
-{
-       struct msghdr msg;
-       struct iovec iov[4];
-       size_t elems;
-
-       sigma_dut_print( DUT_MSG_INFO, "resp: status=%d buf=%s",
-                       status, buf);
-
-       iov[0].iov_base = "status,";
-       iov[0].iov_len = 7;
-       switch (status) {
-       case SIGMA_RUNNING:
-               iov[1].iov_base = "RUNNING,";
-               iov[1].iov_len = 8;
-               break;
-       case SIGMA_INVALID:
-               iov[1].iov_base = "INVALID,";
-               iov[1].iov_len = 8;
-               break;
-       case SIGMA_ERROR:
-               iov[1].iov_base = "ERROR,";
-               iov[1].iov_len = 6;
-               break;
-       case SIGMA_COMPLETE:
-               iov[1].iov_base = "COMPLETE,";
-               iov[1].iov_len = 9;
-               break;
-       }
-       if (buf) {
-               iov[2].iov_base = buf;
-               iov[2].iov_len = strlen(buf);
-               iov[3].iov_base = "\r\n";
-               iov[3].iov_len = 2;
-               elems = 4;
-       } else {
-               iov[1].iov_len--;
-               iov[2].iov_base = "\r\n";
-               iov[2].iov_len = 2;
-               elems = 3;
-       }
-
-       memset(&msg, 0, sizeof(msg));
-       msg.msg_iov = iov;
-       msg.msg_iovlen = elems;
-       if (sendmsg(conn->s, &msg, 0) < 0)
-               sigma_dut_print( DUT_MSG_INFO, "sendmsg: %s",
-                               strerror(errno));
-}
-#endif
-
-const char * get_param(struct sigma_cmd *cmd, const char *name)
-{
-       int i;
-       for (i = 0; i < cmd->count; i++) {
-               if (strcasecmp(name, cmd->params[i]) == 0)
-                       return cmd->values[i];
-       }
-       return NULL;
-}
-
-
-static void process_cmd(struct sigma_dut *dut, struct sigma_conn *conn,
-                       char *buf)
-{
-       struct sigma_cmd_handler *h;
-       struct sigma_cmd c;
-       char *cmd, *pos, *pos2;
-       int len;
-       char txt[200];
-       int res;
-
-       while (*buf == '\r' || *buf == '\n' || *buf == '\t' || *buf == ' ')
-               buf++;
-       len = strlen(buf);
-       while (len > 0 && buf[len - 1] == ' ') {
-               buf[len - 1] = '\0';
-               len--;
-       }
-
-       sigma_dut_print( DUT_MSG_INFO, "cmd: %s", buf);
-       snprintf(txt, sizeof(txt), "NOTE CAPI:%s", buf);
-       txt[sizeof(txt) - 1] = '\0';
-       wpa_command(get_main_ifname(), txt);
-
-       memset(&c, 0, sizeof(c));
-       cmd = buf;
-       pos = strchr(cmd, ',');
-       if (pos) {
-               *pos++ = '\0';
-               if (strcasecmp(cmd, "AccessPoint") == 0 ||
-                   strcasecmp(cmd, "PowerSwitch") == 0) {
-                       pos2 = strchr(pos, ',');
-                       if (pos2 == NULL)
-                               goto invalid_params;
-                       c.params[c.count] = pos;
-                       c.values[c.count] = pos2;
-                       c.count++;
-                       pos = strchr(pos2, ',');
-                       if (pos)
-                               *pos++ = '\0';
-               }
-               while (pos) {
-                       pos2 = strchr(pos, ',');
-                       if (pos2 == NULL)
-                               goto invalid_params;
-                       *pos2++ = '\0';
-                       if (c.count == MAX_PARAMS) {
-                               sigma_dut_print( DUT_MSG_INFO, "Too many "
-                                               "parameters");
-                               goto invalid_params;
-                       }
-                       c.params[c.count] = pos;
-                       c.values[c.count] = pos2;
-                       c.count++;
-                       pos = strchr(pos2, ',');
-                       if (pos)
-                               *pos++ = '\0';
-               }
-       }
-       h = dut->cmds;
-       while (h) {
-               if (strcasecmp(cmd, h->cmd) == 0)
-                       break;
-               h = h->next;
-       }
-
-       if (h == NULL) {
-               sigma_dut_print( DUT_MSG_INFO, "Unknown command: '%s'",
-                               cmd);
-               send_resp(dut, conn, SIGMA_INVALID,
-                         "errorCode,Unknown command");
-               return;
-       }
-
-       if (h->validate && h->validate(&c) < 0) {
-       invalid_params:
-               sigma_dut_print( DUT_MSG_INFO, "Invalid parameters");
-               send_resp(dut, conn, SIGMA_INVALID, "errorCode,Invalid "
-                         "parameters");
-               return;
-       }
-
-       send_resp(dut, conn, SIGMA_RUNNING, NULL);
-       sigma_dut_print( DUT_MSG_INFO, "Run command: %s", cmd);
-       res = h->process(dut, conn, &c);
-       if (res == -2)
-               send_resp(dut, conn, SIGMA_ERROR, NULL);
-       else if (res == -1)
-               send_resp(dut, conn, SIGMA_INVALID, NULL);
-       else if (res == 1)
-               send_resp(dut, conn, SIGMA_COMPLETE, NULL);
-}
-
-
-
-static void process_conn(struct sigma_dut *dut, struct sigma_conn *conn)
-{
-       ssize_t res;
-       int i;
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Read from %s:%d",
-                       inet_ntoa(conn->addr.sin_addr),
-                       ntohs(conn->addr.sin_port));
-
-       res = recv(conn->s, conn->buf + conn->pos, MAX_CMD_LEN + 5 - conn->pos,
-                  0);
-       if (res < 0) {
-               sigma_dut_print( DUT_MSG_INFO, "recv: %s",
-                               strerror(errno));
-       }
-       if (res <= 0) {
-               sigma_dut_print( DUT_MSG_DEBUG, "Close connection from "
-                               "%s:%d",
-                               inet_ntoa(conn->addr.sin_addr),
-                               ntohs(conn->addr.sin_port));
-               close(conn->s);
-               conn->s = -1;
-               return;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Received %d bytes",
-                       (int) res);
-
-       for (;;) {
-               for (i = conn->pos; i < conn->pos + res; i++) {
-                       if (conn->buf[i] == '\r' || conn->buf[i] == '\n')
-                               break;
-               }
-
-               if (i == conn->pos + res) {
-                       /* Full command not yet received */
-                       conn->pos += res;
-                       if (conn->pos >= MAX_CMD_LEN + 5) {
-                               sigma_dut_print( DUT_MSG_INFO, "Too long "
-                                               "command dropped");
-                               conn->pos = 0;
-                       }
-                       break;
-               }
-
-               /* Full command received */
-               conn->buf[i++] = '\0';
-               process_cmd(dut, conn, conn->buf);
-
-               if (i < conn->pos + res &&
-                   (conn->buf[i] == '\r' || conn->buf[i] == '\n'))
-                       i++;
-               memmove(conn->buf, &conn->buf[i], conn->pos + res - i);
-               res = conn->pos + res - i;
-               conn->pos = 0;
-       }
-}
-
-
-// by bbelief
-extern     xcCommandFuncPtr gWfaCmdFuncTbl[]; /* command process functions */
-static void process_conn2(struct sigma_dut *dut, struct sigma_conn *conn)
-{
-        int       nbytes = 0, cmdLen = 0, respLen;
-        unsigned char       xcCmdBuf[WFA_BUFF_1K], parmsVal[MAX_PARMS_BUFF], respBuf[WFA_RESP_BUF_SZ];
-        unsigned short      xcCmdTag;
-        char gCmdStr[WFA_CMD_STR_SZ];
-        dutCmdResponse_t gGenericResp;
-       ssize_t res;
-       int i;
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Read from %s:%d",
-                       inet_ntoa(conn->addr.sin_addr),
-                       ntohs(conn->addr.sin_port));
-
-       res = recv(conn->s, conn->buf + conn->pos, MAX_CMD_LEN + 5 - conn->pos,
-                  0);
-       if (res < 0) {
-               sigma_dut_print( DUT_MSG_INFO, "recv: %s",
-                               strerror(errno));
-       }
-       if (res <= 0) {
-               sigma_dut_print( DUT_MSG_DEBUG, "Close connection from "
-                               "%s:%d",
-                               inet_ntoa(conn->addr.sin_addr),
-                               ntohs(conn->addr.sin_port));
-               close(conn->s);
-               conn->s = -1;
-               return;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Received %d bytes",
-                       (int) res);
-
-
-        ///////////////////////  
-        nbytes = (int)res;
-        memset(xcCmdBuf, 0, WFA_BUFF_1K);
-        memcpy(xcCmdBuf, conn->buf + conn->pos, nbytes); 
-//sigma_dut_hexdump(DUT_MSG_DEBUG, "sigma", xcCmdBuf , nbytes, 1);        
-
-       /* command received */
-       wfaDecodeTLV(xcCmdBuf, nbytes, &xcCmdTag, &cmdLen, parmsVal);    
-       memset(respBuf, 0, WFA_RESP_BUF_SZ); 
-       respLen = 0;
-//sigma_dut_print(DUT_MSG_DEBUG, "%s - 1 :  cmdtag : %d, cmdlen : %d\n", __func__, xcCmdTag, cmdLen);
-       
-
-       /* reset two commond storages used by control functions */
-       memset(gCmdStr, 0, WFA_CMD_STR_SZ);
-       memset(&gGenericResp, 0, sizeof(dutCmdResponse_t));
-
-       /* command process function defined in wfa_ca.c and wfa_tg.c */
-       if((xcCmdTag != 0 && xcCmdTag > WFA_STA_NEW_COMMANDS_START && xcCmdTag < WFA_STA_NEW_COMMANDS_END) && 
-                  gWfaCmdFuncTbl[xcCmdTag - WFA_STA_NEW_COMMANDS_START + (WFA_STA_COMMANDS_END - 1)] != NULL)
-       {
-sigma_dut_print(DUT_MSG_DEBUG, "%s - 2 : idx : %d\n", __func__, xcCmdTag - WFA_STA_NEW_COMMANDS_START + (WFA_STA_COMMANDS_END - 1));       
-       /* since the new commands are expanded to new block */
-   gWfaCmdFuncTbl[xcCmdTag - WFA_STA_NEW_COMMANDS_START + (WFA_STA_COMMANDS_END - 1)](cmdLen, parmsVal, &respLen, (BYTE *)respBuf);
-       }
-      
-       else if((xcCmdTag != 0 && xcCmdTag < WFA_STA_COMMANDS_END) && gWfaCmdFuncTbl[xcCmdTag] != NULL)
-       {
-sigma_dut_print(DUT_MSG_DEBUG, "%s - 3 : idx : %d\n", __func__, xcCmdTag);              
-       /* commands in the old block */
-           gWfaCmdFuncTbl[xcCmdTag](cmdLen, parmsVal, &respLen, (BYTE *)respBuf);
-       }
-       else
-       {       // no command defined
-sigma_dut_print(DUT_MSG_DEBUG, "%s - 4 : idx : %d\n", __func__, 0);                     
-   gWfaCmdFuncTbl[0](cmdLen, parmsVal, &respLen, (BYTE *)respBuf);
-       }
-
-       // gWfaCmdFuncTbl[xcCmdTag](cmdLen, parmsVal, &respLen, (BYTE *)respBuf);
-       if(send(conn->s, (BYTE *)respBuf, respLen, 0) != respLen)
-       {
-           sigma_dut_print( DUT_MSG_INFO, "wfa-wfaCtrlSend Error\n");
-       }
-    
-}
-
-
-static void run_loop(struct sigma_dut *dut)
-{
-       struct sigma_conn conn[MAX_CONNECTIONS];
-       int i, res, maxfd, can_accept;
-       fd_set rfds;
-
-       for (i = 0; i < MAX_CONNECTIONS; i++)
-               conn[i].s = -1;
-
-       for (;;) {
-               FD_ZERO(&rfds);
-               maxfd = -1;
-               can_accept = 0;
-               for (i = 0; i < MAX_CONNECTIONS; i++) {
-                       if (conn[i].s >= 0) {
-                               FD_SET(conn[i].s, &rfds);
-                               if (conn[i].s > maxfd)
-                                       maxfd = conn[i].s;
-                       } else
-                               can_accept = 1;
-               }
-
-               if (can_accept) {
-                       FD_SET(dut->s, &rfds);
-                       if (dut->s > maxfd)
-                               maxfd = dut->s;
-               }
-
-
-               sigma_dut_print( DUT_MSG_DEBUG, "Waiting for next "
-                               "command (can_accept=%d)", can_accept);
-               res = select(maxfd + 1, &rfds, NULL, NULL, NULL);   
-               if (res < 0) {
-                       perror("select");
-                       sleep(1);
-                       continue;
-               }
-
-               if (!res) {
-                       sigma_dut_print( DUT_MSG_DEBUG, "Nothing ready");
-                       sleep(1);
-                       continue;
-               }
-
-               if (FD_ISSET(dut->s, &rfds)) {
-                       for (i = 0; i < MAX_CONNECTIONS; i++) {
-                               if (conn[i].s < 0)
-                                       break;
-                       }
-                       conn[i].addrlen = sizeof(conn[i].addr);
-                       conn[i].s = accept(dut->s,
-                                          (struct sockaddr *) &conn[i].addr,
-                                          &conn[i].addrlen);
-                       if (conn[i].s < 0) {
-                               sigma_dut_print( DUT_MSG_INFO,
-                                               "accept: %s",
-                                               strerror(errno));
-                               continue;
-                       }
-
-                       sigma_dut_print( DUT_MSG_DEBUG,
-                                       "Connection %d from %s:%d", i,
-                                       inet_ntoa(conn[i].addr.sin_addr),
-                                       ntohs(conn[i].addr.sin_port));
-                       conn[i].pos = 0;
-               }
-
-               for (i = 0; i < MAX_CONNECTIONS; i++) {
-//sigma_dut_print( DUT_MSG_DEBUG, "%s : idx : %d, s : %d\n", __func__, i, conn[i].s);            
-                       if (conn[i].s < 0)
-                               continue;
-                       if (FD_ISSET(conn[i].s, &rfds))
-#if 0 // by bbelief                
-                               process_conn(dut, &conn[i]);
-#else
-                            process_conn2(dut, &conn[i]);
-#endif
-//sigma_dut_print( DUT_MSG_DEBUG, "##-7\n");            
-               }
-//sigma_dut_print( DUT_MSG_DEBUG, "##-8\n");        
-       }
-}
-
-
-int main(int argc, char *argv[])
-{
-       int c;
-       int daemonize = 0;
-       int port = SIGMA_DUT_PORT;
-
-       memset(&g_sigma_dut, 0, sizeof(g_sigma_dut));
-       //sigma_dut.debug_level = DUT_MSG_DEBUG; //DUT_MSG_INFO;
-       g_sigma_dut.default_timeout = 120;
-
-
-       for (;;) {
-               c = getopt(argc, argv, "b:Bdhp:qs:");
-               if (c < 0)
-                       break;
-               switch (c) {
-               case 'b':
-                       g_sigma_dut.bridge = optarg;
-                       break;
-               case 'B':
-                       daemonize++;
-                       break;
-               case 'd':
-                       if (g_debug_level > 0)
-                               g_debug_level--;
-                       break;
-               case 'p':
-                       port = atoi(optarg);
-//sigma_dut_print(DUT_MSG_INFO, "'%s - 2 : port : %d'", __func__, port);                        
-                       break;
-               case 'q':
-                       g_debug_level++;
-                       break;
-               case 's':
-                       g_sigma_dut.sniffer_ifname = optarg;
-                       break;
-               case 'h':
-               default:
-                       printf("usage: sigma_dut [-Bdq] [-p<port>] "
-                              "[-s<sniffer>]\n");
-                       exit(0);
-                       break;
-               }
-       }
-
-       sigma_dut_register_cmds();
-
-       if (open_socket(&g_sigma_dut, port) < 0)
-               return -1;
-
-// test
-//wpa_command("wlan0", "SCAN");
-
-       if (daemonize) {
-               if (daemon(0, 0) < 0) {
-                       perror("daemon");
-                       exit(-1);
-               }
-       }
-
-#if 0
-cmd_sta_p2p_reset_test();
-cmd_sta_set_p2p_test();
-cmd_sta_get_p2p_dev_address_test();
-return 0;
-#endif
-
-       run_loop(&g_sigma_dut);
-
-       close_socket(&g_sigma_dut);
-       return 0;
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/sigma_dut.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/sigma_dut.h
deleted file mode 100644 (file)
index 5b9153b..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#ifndef SIGMA_DUT_H
-#define SIGMA_DUT_H
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/types.h> 
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#ifdef CONFIG_TRAFFIC_AGENT
-#include <pthread.h>
-#endif /* CONFIG_TRAFFIC_AGENT */
-
-#if 0 // by bbelief
-#include "wfa_portall.h"
-#include "wfa_debug.h"
-#include "wfa_ver.h"
-#include "wfa_main.h"
-#include "wfa_types.h"
-#include "wfa_ca.h"
-#include "wfa_tlv.h"
-#include "wfa_sock.h"
-#include "wfa_tg.h"
-#include "wfa_cmds.h"
-#include "wfa_rsp.h"
-#endif
-
-
-#ifdef __GNUC__
-#define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, (a), (b))))
-#else
-#define PRINTF_FORMAT(a,b)
-#endif
-
-
-struct sigma_dut;
-
-#define MAX_PARAMS 50
-
-struct sigma_cmd {
-       char *params[MAX_PARAMS];
-       char *values[MAX_PARAMS];
-       int count;
-};
-
-#define MAX_CMD_LEN 2048
-
-struct sigma_conn {
-       int s;
-       struct sockaddr_in addr;
-       socklen_t addrlen;
-       char buf[MAX_CMD_LEN + 5];
-       int pos;
-};
-
-struct sigma_cmd_handler {
-       struct sigma_cmd_handler *next;
-       char *cmd;
-       int (*validate)(struct sigma_cmd *cmd);
-       /* process return value:
-        * -2 = failed, caller will send status,ERROR
-        * -1 = failed, caller will send status,INVALID
-        * 0 = success, response already sent
-        * 1 = success, caller will send status,COMPLETE
-        */
-       int (*process)(struct sigma_dut *dut, struct sigma_conn *conn,
-                      struct sigma_cmd *cmd);
-};
-
-#define P2P_GRP_ID_LEN 128
-#define IP_ADDR_STR_LEN 16
-
-struct wfa_cs_p2p_group {
-       struct wfa_cs_p2p_group *next;
-       char ifname[IFNAMSIZ];
-       int go;
-       char grpid[P2P_GRP_ID_LEN];
-       char ssid[33];
-};
-
-#ifdef CONFIG_TRAFFIC_AGENT
-
-#define MAX_SIGMA_STREAMS 16
-
-struct sigma_stream {
-       enum sigma_stream_profile {
-               SIGMA_PROFILE_FILE_TRANSFER,
-               SIGMA_PROFILE_MULTICAST,
-               SIGMA_PROFILE_IPTV,
-               SIGMA_PROFILE_TRANSACTION,
-               SIGMA_PROFILE_START_SYNC
-       } profile;
-       int sender;
-       struct in_addr dst;
-       int dst_port;
-       struct in_addr src;
-       int src_port;
-       int frame_rate;
-       int duration;
-       int payload_size;
-       int start_delay;
-       int max_cnt;
-       enum sigma_traffic_class {
-               SIGMA_TC_VOICE,
-               SIGMA_TC_VIDEO,
-               SIGMA_TC_BACKGROUND,
-               SIGMA_TC_BEST_EFFORT
-       } tc;
-       int started;
-
-       int sock;
-       pthread_t thr;
-       int stop;
-
-       /* Statistics */
-       int tx_frames;
-       int rx_frames;
-       int tx_payload_bytes;
-       int rx_payload_bytes;
-       int out_of_seq_frames;
-};
-
-#endif /* CONFIG_TRAFFIC_AGENT */
-
-
-struct sigma_dut {
-       int s; /* server TCP socket */
-        //int debug_level;  // by bbelief
-       struct sigma_cmd_handler *cmds;
-
-       /* Default timeout value (seconds) for commands */
-       unsigned int default_timeout;
-
-       int next_streamid;
-
-       const char *bridge; /* bridge interface to use in AP mode */
-
-       enum sigma_mode {
-               SIGMA_MODE_UNKNOWN,
-               SIGMA_MODE_STATION,
-               SIGMA_MODE_AP,
-               SIGMA_MODE_SNIFFER
-       } mode;
-
-       /*
-        * Local cached values to handle API that does not provide all the
-        * needed information with commands that actually trigger some
-        * operations.
-        */
-       int listen_chn;
-       int persistent;
-       int intra_bss;
-       int noa_duration;
-       int noa_interval;
-       int noa_count;
-       enum wfa_cs_wps_method {
-               WFA_CS_WPS_NOT_READY,
-               WFA_CS_WPS_PBC,
-               WFA_CS_WPS_PIN_DISPLAY,
-               WFA_CS_WPS_PIN_LABEL,
-               WFA_CS_WPS_PIN_KEYPAD
-       } wps_method;
-       char wps_pin[9];
-
-       struct wfa_cs_p2p_group *groups;
-
-       char infra_ssid[33];
-       int infra_network_id;
-
-       enum p2p_mode {
-               P2P_IDLE, P2P_DISCOVER, P2P_LISTEN, P2P_DISABLE
-       } p2p_mode;
-
-       int client_uapsd;
-
-       char arp_ipaddr[IP_ADDR_STR_LEN];
-       char arp_ifname[IFNAMSIZ + 1];
-
-       enum sta_pmf {
-               STA_PMF_DISABLED,
-               STA_PMF_OPTIONAL,
-               STA_PMF_REQUIRED
-       } sta_pmf;
-
-       /* AP configuration */
-       char ap_ssid[33];
-       enum ap_mode {
-               AP_11a,
-               AP_11g,
-               AP_11b,
-               AP_11na,
-               AP_11ng
-       } ap_mode;
-       int ap_channel;
-       int ap_rts;
-       int ap_frgmnt;
-       int ap_bcnint;
-       int ap_p2p_mgmt;
-       enum ap_key_mgmt {
-               AP_OPEN,
-               AP_WPA2_PSK,
-               AP_WPA_PSK,
-               AP_WPA2_EAP,
-               AP_WPA_EAP,
-               AP_WPA2_EAP_MIXED,
-               AP_WPA2_PSK_MIXED
-       } ap_key_mgmt;
-       enum ap_pmf {
-               AP_PMF_DISABLED,
-               AP_PMF_OPTIONAL,
-               AP_PMF_REQUIRED
-       } ap_pmf;
-       enum ap_cipher {
-               AP_CCMP,
-               AP_TKIP,
-               AP_WEP,
-               AP_PLAIN,
-               AP_CCMP_TKIP
-       } ap_cipher;
-       char ap_passphrase[65];
-       char ap_wepkey[27];
-       char ap_radius_ipaddr[20];
-       int ap_radius_port;
-       char ap_radius_password[200];
-       int ap_tdls_prohibit;
-       int ap_tdls_prohibit_chswitch;
-
-#ifdef CONFIG_TRAFFIC_AGENT
-       /* Traffic Agent */
-       struct sigma_stream streams[MAX_SIGMA_STREAMS];
-       int num_streams;
-#endif /* CONFIG_TRAFFIC_AGENT */
-
-       const char *sniffer_ifname;
-        int Concurrency;
-};
-
-
-enum sigma_dut_print_level {
-       DUT_MSG_DEBUG, DUT_MSG_INFO, DUT_MSG_ERROR
-};
-
-void sigma_dut_hexdump(int level, const char *title, const unsigned char *buf, size_t len, int show);
-
-#if 1 //  by bbelief
-void sigma_dut_print(int level, const char *fmt, ...)
-PRINTF_FORMAT(2, 3);
-#else
-void sigma_dut_print(struct sigma_dut *dut, int level, const char *fmt, ...)
-PRINTF_FORMAT(3, 4);
-#endif
-
-enum sigma_status {
-       SIGMA_RUNNING, SIGMA_INVALID, SIGMA_ERROR, SIGMA_COMPLETE
-};
-
-// by bbelief
-void send_resp_debug(enum sigma_status status, char *buf);
-#define send_resp(dummy1, dummy2, status, str)  send_resp_debug(status, str)
-
-
-struct sigma_dut *sigma_dut_ptr(void);
-
-#if 0
-void send_resp(struct sigma_dut *dut, struct sigma_conn *conn,
-              enum sigma_status status, char *buf);
-#endif
-
-const char * get_param(struct sigma_cmd *cmd, const char *name);
-
-int sigma_dut_reg_cmd(const char *cmd,
-                     int (*validate)(struct sigma_cmd *cmd),
-                     int (*process)(struct sigma_dut *dut,
-                                    struct sigma_conn *conn,
-                                    struct sigma_cmd *cmd));
-
-void sigma_dut_register_cmds(void);
-
-
-#endif /* SIGMA_DUT_H */
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/sta.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/sta.c
deleted file mode 100644 (file)
index b49c00d..0000000
+++ /dev/null
@@ -1,1863 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#ifdef __linux__
-#include <netpacket/packet.h>
-#include <linux/if_ether.h>
-#endif /* __linux__ */
-#include "wpa_helpers.h"
-
-#define CERTIFICATES_PATH    "/etc/wpa_supplicant"
-
-
-void disconnect_station(struct sigma_dut *dut);
-
-
-int is_ip_addr(const char *str)
-{
-       const char *pos = str;
-       struct in_addr addr;
-
-       while (*pos) {
-               if (*pos != '.' && (*pos < '0' || *pos > '9'))
-                       return 0;
-               pos++;
-       }
-
-       return inet_aton(str, &addr);
-}
-
-
-int get_ip_config(struct sigma_dut *dut, const char *ifname, char *buf,
-                 size_t buf_len)
-{
-       char tmp[256], *pos, *pos2;
-       FILE *f;
-       char ip[16], mask[15], dns[16], sec_dns[16];
-       int is_dhcp = 0;
-       int s;
-
-       ip[0] = '\0';
-       mask[0] = '\0';
-       dns[0] = '\0';
-       sec_dns[0] = '\0';
-
-       s = socket(PF_INET, SOCK_DGRAM, 0);
-       if (s >= 0) {
-               struct ifreq ifr;
-               struct sockaddr_in saddr;
-
-               memset(&ifr, 0, sizeof(ifr));
-               strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-               if (ioctl(s, SIOCGIFADDR, &ifr) < 0) {
-                       sigma_dut_print( DUT_MSG_INFO, "Failed to get "
-                                       "%s IP address: %s",
-                                       ifname, strerror(errno));
-               } else {
-                       memcpy(&saddr, &ifr.ifr_addr,
-                              sizeof(struct sockaddr_in));
-                       strncpy(ip, inet_ntoa(saddr.sin_addr), sizeof(ip));
-               }
-
-               if (ioctl(s, SIOCGIFNETMASK, &ifr) == 0) {
-                       memcpy(&saddr, &ifr.ifr_addr,
-                              sizeof(struct sockaddr_in));
-                       strncpy(mask, inet_ntoa(saddr.sin_addr), sizeof(mask));
-               }
-       }
-
-#ifdef __linux__
-       snprintf(tmp, sizeof(tmp), "ps ax | grep dhclient | grep -v grep | "
-                "grep -q %s", ifname);
-       if (system(tmp) == 0)
-               is_dhcp = 1;
-       else {
-               snprintf(tmp, sizeof(tmp), "ps ax | grep udhcpc | "
-                        "grep -v grep | grep -q %s", ifname);
-               if (system(tmp) == 0)
-                       is_dhcp = 1;
-       }
-#endif /* __linux__ */
-
-       f = fopen("/etc/resolv.conf", "r");
-       if (f) {
-               while (fgets(tmp, sizeof(tmp), f)) {
-                       if (strncmp(tmp, "nameserver", 10) != 0)
-                               continue;
-                       pos = tmp + 10;
-                       while (*pos == ' ' || *pos == '\t')
-                               pos++;
-                       pos2 = pos;
-                       while (*pos2) {
-                               if (*pos2 == '\n' || *pos2 == '\r') {
-                                       *pos2 = '\0';
-                                       break;
-                               }
-                               pos2++;
-                       }
-                       if (!dns[0]) {
-                               strncpy(dns, pos, sizeof(dns));
-                               dns[sizeof(dns) - 1] = '\0';
-                       } else if (!sec_dns[0]) {
-                               strncpy(sec_dns, pos, sizeof(sec_dns));
-                               sec_dns[sizeof(sec_dns) - 1] = '\0';
-                       }
-               }
-               fclose(f);
-       }
-
-       snprintf(buf, buf_len, "dhcp,%d,ip,%s,mask,%s,primary-dns,%s",
-                is_dhcp, ip, mask, dns);
-       buf[buf_len - 1] = '\0';
-       if (sec_dns[0]) {
-               snprintf(buf + strlen(buf), sizeof(buf_len) - strlen(buf),
-                        ",secondary-dns,%s", sec_dns);
-               buf[buf_len - 1] = '\0';
-       }
-
-       return 0;
-}
-
-
-static int cmd_sta_get_ip_config(struct sigma_dut *dut,
-                                struct sigma_conn *conn,
-                                struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ifname;
-       char buf[200];
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-       if (get_ip_config(dut, ifname, buf, sizeof(buf)) < 0)
-               return -2;
-
-       send_resp(dut, conn, SIGMA_COMPLETE, buf);
-       return 0;
-}
-
-
-static int cmd_sta_set_ip_config(struct sigma_dut *dut,
-                                struct sigma_conn *conn,
-                                struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ifname;
-       char buf[200];
-       const char *val, *ip, *mask;
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-       if (if_nametoindex(ifname) == 0) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,Unknown interface");
-               return 0;
-       }
-
-       val = get_param(cmd, "dhcp");
-       if (val && (strcmp(val, "1") == 0 || strcasecmp(val, "true") == 0)) {
-#ifdef __linux__
-               char path[128];
-               struct stat s;
-               snprintf(path, sizeof(path), "/var/run/dhclient-%s.pid",
-                        ifname);
-               if (stat(path, &s) == 0) {
-                       snprintf(buf, sizeof(buf), "kill `cat %s`", path);
-                       sigma_dut_print( DUT_MSG_INFO,
-                                       "Kill previous DHCP client: %s", buf);
-                       if (system(buf) != 0)
-                               sigma_dut_print( DUT_MSG_INFO,
-                                               "Failed to kill DHCP client");
-               }
-               snprintf(buf, sizeof(buf),
-                        "dhclient -nw -pf /var/run/dhclient-%s.pid %s",
-                        ifname, ifname);
-               sigma_dut_print( DUT_MSG_INFO, "Start DHCP client: %s",
-                               buf);
-               if (system(buf) != 0) {
-                       sigma_dut_print( DUT_MSG_INFO,
-                                       "Failed to start DHCP client");
-                       return -2;
-               }
-               return 1;
-#endif /* __linux__ */
-               return -2;
-       }
-
-       ip = get_param(cmd, "ip");
-       mask = get_param(cmd, "mask");
-       if (ip == NULL || !is_ip_addr(ip) ||
-           mask == NULL || !is_ip_addr(mask))
-               return -1;
-
-       snprintf(buf, sizeof(buf), "ifconfig %s %s netmask %s",
-                ifname, ip, mask);
-       if (system(buf) != 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Failed to set IP "
-                         "address");
-               return 0;
-       }
-
-       val = get_param(cmd, "defaultGateway");
-       if (val) {
-               if (!is_ip_addr(val))
-                       return -1;
-               snprintf(buf, sizeof(buf), "route add default gw %s", val);
-               if (system(buf) != 0) {
-                       send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Failed "
-                                 "to set default gateway");
-                       return 0;
-               }
-       }
-
-       val = get_param(cmd, "primary-dns");
-       if (val) {
-               /* TODO */
-               sigma_dut_print( DUT_MSG_INFO, "Ignored primary-dns %s "
-                               "setting", val);
-       }
-
-       val = get_param(cmd, "secondary-dns");
-       if (val) {
-               /* TODO */
-               sigma_dut_print( DUT_MSG_INFO, "Ignored secondary-dns %s "
-                               "setting", val);
-       }
-
-       return 1;
-}
-
-
-static int cmd_sta_get_info(struct sigma_dut *dut, struct sigma_conn *conn,
-                           struct sigma_cmd *cmd)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       /* TODO: could report more details here */
-       send_resp(dut, conn, SIGMA_COMPLETE, "vendor,Atheros");
-       return 0;
-}
-
-
-static int cmd_sta_get_mac_address(struct sigma_dut *dut,
-                                  struct sigma_conn *conn,
-                                  struct sigma_cmd *cmd)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       char addr[20], resp[50];
-
-       if (get_wpa_status(get_station_ifname(), "address", addr, sizeof(addr))
-           < 0)
-               return -2;
-
-       snprintf(resp, sizeof(resp), "mac,%s", addr);
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-       return 0;
-}
-
-
-static int cmd_sta_is_connected(struct sigma_dut *dut, struct sigma_conn *conn,
-                               struct sigma_cmd *cmd)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       int connected = 0;
-#ifdef __APPLE__
-       int res;
-       char buf[100];
-
-       snprintf(buf, sizeof(buf), "apple80211 en1 --assoc_status | "
-                "grep \"last association status: 0 \"");
-       sigma_dut_print( DUT_MSG_DEBUG, "%s: Running '%s'",
-                       __func__, buf);
-       res = system(buf);
-       sigma_dut_print( DUT_MSG_DEBUG, "system -> %d\n", res);
-       if (res == 0)
-               connected = 1;
-#else /* __APPLE__ */
-       char result[32];
-       if (get_wpa_status(get_station_ifname(), "wpa_state", result,
-                          sizeof(result)) < 0) {
-               sigma_dut_print( DUT_MSG_INFO, "Could not get interface "
-                               "%s status", get_station_ifname());
-               return -2;
-       }
-
-       sigma_dut_print( DUT_MSG_DEBUG, "wpa_state=%s", result);
-       if (strncmp(result, "COMPLETED", 9) == 0)
-               connected = 1;
-#endif /* __APPLE__ */
-
-       if (connected)
-               send_resp(dut, conn, SIGMA_COMPLETE, "connected,1");
-       else
-               send_resp(dut, conn, SIGMA_COMPLETE, "connected,0");
-
-       return 0;
-}
-
-
-static int cmd_sta_verify_ip_connection(struct sigma_dut *dut,
-                                       struct sigma_conn *conn,
-                                       struct sigma_cmd *cmd)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       const char *dst, *timeout;
-       int wait_time = 90;
-       char buf[100];
-       int res;
-
-       dst = get_param(cmd, "destination");
-       if (dst == NULL || !is_ip_addr(dst))
-               return -1;
-
-       timeout = get_param(cmd, "timeout");
-       if (timeout) {
-               wait_time = atoi(timeout);
-               if (wait_time < 1)
-                       wait_time = 1;
-       }
-
-       /* TODO: force renewal of IP lease if DHCP is enabled */
-
-       snprintf(buf, sizeof(buf), "ping %s -c 3 -W %d", dst, wait_time);
-       res = system(buf);
-       sigma_dut_print( DUT_MSG_DEBUG, "ping returned: %d", res);
-       if (res == 0)
-               send_resp(dut, conn, SIGMA_COMPLETE, "connected,1");
-       else if (res == 256)
-               send_resp(dut, conn, SIGMA_COMPLETE, "connected,0");
-       else
-               return -2;
-
-       return 0;
-}
-
-
-static int cmd_sta_get_bssid(struct sigma_dut *dut, struct sigma_conn *conn,
-                            struct sigma_cmd *cmd)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       char bssid[20], resp[50];
-
-       if (get_wpa_status(get_station_ifname(), "bssid", bssid, sizeof(bssid))
-           < 0)
-               strncpy(bssid, "00:00:00:00:00:00", sizeof(bssid));
-
-       snprintf(resp, sizeof(resp), "bssid,%s", bssid);
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-       return 0;
-}
-
-
-static int add_network_common(struct sigma_dut *dut, struct sigma_conn *conn,
-                             const char *ifname, struct sigma_cmd *cmd)
-{
-       const char *ssid = get_param(cmd, "ssid");
-       int id;
-
-       if (ssid == NULL)
-               return -1;
-
-       start_sta_mode(dut);
-
-       id = add_network(ifname);
-       if (id < 0)
-               return -2;
-       sigma_dut_print( DUT_MSG_DEBUG, "Adding network %d", id);
-
-       if (set_network_quoted(ifname, id, "ssid", ssid) < 0)
-               return -2;
-
-       dut->infra_network_id = id;
-       snprintf(dut->infra_ssid, sizeof(dut->infra_ssid), "%s", ssid);
-
-       return id;
-}
-
-
-static int cmd_sta_set_encryption(struct sigma_dut *dut,
-                                 struct sigma_conn *conn,
-                                 struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ssid = get_param(cmd, "ssid");
-       const char *type = get_param(cmd, "encpType");
-       const char *ifname;
-       char buf[200];
-       int id;
-
-       if (ssid == NULL)
-               return -1;
-
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-       id = add_network_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-       if (set_network(ifname, id, "key_mgmt", "NONE") < 0)
-               return -2;
-
-       if (type && strcasecmp(type, "wep") == 0) {
-               const char *val;
-               int i;
-
-               val = get_param(cmd, "activeKey");
-               if (val) {
-                       int keyid;
-                       keyid = atoi(val);
-                       if (keyid < 1 || keyid > 4)
-                               return -1;
-                       snprintf(buf, sizeof(buf), "%d", keyid - 1);
-                       if (set_network(ifname, id, "wep_tx_keyidx", buf) < 0)
-                               return -2;
-               }
-
-               for (i = 0; i < 4; i++) {
-                       snprintf(buf, sizeof(buf), "key%d", i + 1);
-                       val = get_param(cmd, buf);
-                       if (val == NULL)
-                               continue;
-                       snprintf(buf, sizeof(buf), "wep_key%d", i);
-                       if (set_network(ifname, id, buf, val) < 0)
-                               return -2;
-               }
-       }
-
-       return 1;
-}
-
-
-static int set_wpa_common(struct sigma_dut *dut, struct sigma_conn *conn,
-                         const char *ifname, struct sigma_cmd *cmd)
-{
-       const char *val;
-       int id;
-
-       id = add_network_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-#ifdef __APPLE__
-       /* TODO: Figure out how to set passphrase for native supplicant */
-       send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,Command not supported");
-       return -2;
-#endif /* __APPLE__ */
-
-       val = get_param(cmd, "keyMgmtType");
-       if (val == NULL)
-               return -1;
-       if (strcasecmp(val, "wpa") == 0) {
-               if (set_network(ifname, id, "proto", "WPA") < 0)
-                       return -2;
-       } else if (strcasecmp(val, "wpa2") == 0 ||
-                  strcasecmp(val, "wpa2-sha256") == 0) {
-               if (set_network(ifname, id, "proto", "WPA2") < 0)
-                       return -2;
-       } else
-               return -1;
-
-       val = get_param(cmd, "encpType");
-       if (val == NULL)
-               return -1;
-       if (strcasecmp(val, "tkip") == 0) {
-               if (set_network(ifname, id, "pairwise", "TKIP") < 0)
-                       return -2;
-       } else if (strcasecmp(val, "aes-ccmp") == 0) {
-               if (set_network(ifname, id, "pairwise", "CCMP") < 0)
-                       return -2;
-       } else
-               return -1;
-
-       dut->sta_pmf = STA_PMF_DISABLED;
-       val = get_param(cmd, "PMF");
-       if (val) {
-               if (strcasecmp(val, "Required") == 0) {
-                       dut->sta_pmf = STA_PMF_REQUIRED;
-                       if (set_network(ifname, id, "ieee80211w", "2") < 0)
-                               return -2;
-               } else if (strcasecmp(val, "Optional") == 0) {
-                       dut->sta_pmf = STA_PMF_OPTIONAL;
-                       if (set_network(ifname, id, "ieee80211w", "1") < 0)
-                               return -2;
-               } else if (strcasecmp(val, "Disabled") == 0) {
-                       dut->sta_pmf = STA_PMF_DISABLED;
-               } else
-                       return -1;
-       }
-
-       return id;
-}
-
-
-static int cmd_sta_set_psk(struct sigma_dut *dut, struct sigma_conn *conn,
-                          struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ifname, *val;
-       int id;
-
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-       id = set_wpa_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-       val = get_param(cmd, "keyMgmtType");
-       if ((val && strcasecmp(val, "wpa2-sha256") == 0) ||
-           dut->sta_pmf == STA_PMF_REQUIRED) {
-               if (set_network(ifname, id, "key_mgmt", "WPA-PSK-SHA256") < 0)
-                       return -2;
-       } else if (dut->sta_pmf == STA_PMF_OPTIONAL) {
-               if (set_network(ifname, id, "key_mgmt",
-                               "WPA-PSK WPA-PSK-SHA256") < 0)
-                       return -2;
-       } else {
-               if (set_network(ifname, id, "key_mgmt", "WPA-PSK") < 0)
-                       return -2;
-       }
-
-       val = get_param(cmd, "passPhrase");
-       if (val == NULL)
-               return -1;
-       if (set_network_quoted(ifname, id, "psk", val) < 0)
-               return -2;
-
-       return 1;
-}
-
-
-static int set_eap_common(struct sigma_dut *dut, struct sigma_conn *conn,
-                         const char *ifname, struct sigma_cmd *cmd)
-{
-       const char *val;
-       int id;
-       char buf[200];
-
-       id = set_wpa_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-       val = get_param(cmd, "keyMgmtType");
-       if ((val && strcasecmp(val, "wpa2-sha256") == 0) ||
-           dut->sta_pmf == STA_PMF_REQUIRED) {
-               if (set_network(ifname, id, "key_mgmt", "WPA-EAP-SHA256") < 0)
-                       return -2;
-       } else if (dut->sta_pmf == STA_PMF_OPTIONAL) {
-               if (set_network(ifname, id, "key_mgmt",
-                               "WPA-EAP WPA-EAP-SHA256") < 0)
-                       return -2;
-       } else {
-               if (set_network(ifname, id, "key_mgmt", "WPA-EAP") < 0)
-                       return -2;
-       }
-
-       val = get_param(cmd, "trustedRootCA");
-       if (val) {
-               snprintf(buf, sizeof(buf), CERTIFICATES_PATH "/%s", val);
-               if (set_network_quoted(ifname, id, "ca_cert", buf) < 0)
-                       return -2;
-       }
-
-       val = get_param(cmd, "username");
-       if (val) {
-               if (set_network_quoted(ifname, id, "identity", val) < 0)
-                       return -2;
-       }
-
-       val = get_param(cmd, "password");
-       if (val) {
-               if (set_network_quoted(ifname, id, "password", val) < 0)
-                       return -2;
-       }
-
-       return id;
-}
-
-
-static int cmd_sta_set_eaptls(struct sigma_dut *dut, struct sigma_conn *conn,
-                             struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ifname, *val;
-       int id;
-       char buf[200];
-
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-       id = set_eap_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-       if (set_network(ifname, id, "eap", "TLS") < 0)
-               return -2;
-
-       if (set_network_quoted(ifname, id, "identity",
-                              "wifi-user@wifilabs.local") < 0)
-               return -2;
-
-       val = get_param(cmd, "clientCertificate");
-       if (val == NULL)
-               return -1;
-       snprintf(buf, sizeof(buf), CERTIFICATES_PATH "/%s", val);
-       if (set_network_quoted(ifname, id, "private_key", buf) < 0)
-               return -2;
-
-       if (set_network_quoted(ifname, id, "private_key_passwd", "wifi") < 0)
-               return -2;
-
-       return 1;
-}
-
-
-static int cmd_sta_set_eapttls(struct sigma_dut *dut, struct sigma_conn *conn,
-                              struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ifname;
-       int id;
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-
-       id = set_eap_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-       if (set_network(ifname, id, "eap", "TTLS") < 0)
-               return -2;
-
-       if (set_network_quoted(ifname, id, "phase2", "auth=MSCHAPV2") < 0)
-               return -2;
-
-       return 1;
-}
-
-
-static int cmd_sta_set_eapsim(struct sigma_dut *dut, struct sigma_conn *conn,
-                             struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ifname;
-       int id;
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-
-       id = set_eap_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-       if (set_network(ifname, id, "eap", "SIM") < 0)
-               return -2;
-
-       return 1;
-}
-
-
-static int cmd_sta_set_eappeap(struct sigma_dut *dut, struct sigma_conn *conn,
-                              struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ifname, *val;
-       int id;
-       char buf[100];
-
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-       id = set_eap_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-       if (set_network(ifname, id, "eap", "PEAP") < 0)
-               return -2;
-
-       if (set_network_quoted(ifname, id, "anonymous_identity", "anonymous") <
-           0)
-               return -2;
-
-       val = get_param(cmd, "innerEAP");
-       if (val) {
-               if (strcasecmp(val, "MSCHAPv2") == 0) {
-                       if (set_network_quoted(ifname, id, "phase2",
-                                              "auth=MSCHAPV2") < 0)
-                               return -2;
-               } else if (strcasecmp(val, "GTC") == 0) {
-                       if (set_network_quoted(ifname, id, "phase2",
-                                              "auth=GTC") < 0)
-                               return -2;
-               } else
-                       return -1;
-       }
-
-       val = get_param(cmd, "peapVersion");
-       if (val) {
-               int ver = atoi(val);
-               if (ver < 0 || ver > 1)
-                       return -1;
-               snprintf(buf, sizeof(buf), "peapver=%d", ver);
-               if (set_network_quoted(ifname, id, "phase1", buf) < 0)
-                       return -2;
-       }
-
-       return 1;
-}
-
-
-static int cmd_sta_set_eapfast(struct sigma_dut *dut, struct sigma_conn *conn,
-                              struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ifname, *val;
-       int id;
-       char buf[100];
-
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-       id = set_eap_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-       if (set_network(ifname, id, "eap", "FAST") < 0)
-               return -2;
-
-       val = get_param(cmd, "innerEAP");
-       if (val) {
-               if (strcasecmp(val, "MSCHAPV2") == 0) {
-                       if (set_network_quoted(ifname, id, "phase2",
-                                              "auth=MSCHAPV2") < 0)
-                               return -2;
-               } else if (strcasecmp(val, "GTC") == 0) {
-                       if (set_network_quoted(ifname, id, "phase2",
-                                              "auth=GTC") < 0)
-                               return -2;
-               } else
-                       return -1;
-       }
-
-       val = get_param(cmd, "validateServer");
-       if (val) {
-               /* TODO */
-               sigma_dut_print( DUT_MSG_INFO, "Ignored EAP-FAST "
-                               "validateServer=%s", val);
-       }
-
-       val = get_param(cmd, "pacFile");
-       if (val) {
-               snprintf(buf, sizeof(buf), "blob://%s", val);
-               if (set_network_quoted(ifname, id, "pac_file", buf) < 0)
-                       return -2;
-       }
-
-       return 1;
-}
-
-
-static int cmd_sta_set_eapaka(struct sigma_dut *dut, struct sigma_conn *conn,
-                             struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *ifname;
-       int id;
-
-
-#if 0
-       if (strcmp(intf, get_main_ifname()) == 0)
-               ifname = get_station_ifname();
-       else
-               ifname = intf;
-#else
-        ifname = get_station_ifname();
-#endif
-
-       id = set_eap_common(dut, conn, ifname, cmd);
-       if (id < 0)
-               return id;
-
-       if (set_network(ifname, id, "eap", "AKA") < 0)
-               return -2;
-
-       return 1;
-}
-
-
-static int cmd_sta_set_uapsd(struct sigma_dut *dut, struct sigma_conn *conn,
-                            struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       /* const char *ssid = get_param(cmd, "ssid"); */
-       const char *val;
-       int max_sp_len = 4;
-       int ac_be = 1, ac_bk = 1, ac_vi = 1, ac_vo = 1;
-       char buf[100];
-
-       val = get_param(cmd, "maxSPLength");
-       if (val) {
-               max_sp_len = atoi(val);
-               if (max_sp_len != 0 && max_sp_len != 1 && max_sp_len != 2 &&
-                   max_sp_len != 4)
-                       return -1;
-       }
-
-       val = get_param(cmd, "acBE");
-       if (val)
-               ac_be = atoi(val);
-
-       val = get_param(cmd, "acBK");
-       if (val)
-               ac_bk = atoi(val);
-
-       val = get_param(cmd, "acVI");
-       if (val)
-               ac_vi = atoi(val);
-
-       val = get_param(cmd, "acVO");
-       if (val)
-               ac_vo = atoi(val);
-
-       dut->client_uapsd = ac_be || ac_bk || ac_vi || ac_vo;
-
-       snprintf(buf, sizeof(buf), "P2P_SET client_apsd %d,%d,%d,%d;%d",
-                ac_be, ac_bk, ac_vi, ac_vo, max_sp_len);
-       if (wpa_command(intf, buf)) {
-               sigma_dut_print( DUT_MSG_INFO, "Failed to set client mode "
-                               "UAPSD parameters.");
-               return -2;
-       }
-
-       return 1;
-}
-
-
-static int cmd_sta_associate(struct sigma_dut *dut, struct sigma_conn *conn,
-                            struct sigma_cmd *cmd)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       const char *ssid = get_param(cmd, "ssid");
-       const char *wps_param = get_param(cmd, "WPS");
-       int wps = 0;
-       char buf[100];
-
-       if (ssid == NULL)
-               return -1;
-
-       if (wps_param &&
-           (strcmp(wps_param, "1") == 0 || strcasecmp(wps_param, "On") == 0))
-               wps = 1;
-
-#ifdef __APPLE__
-       if (wps) {
-               send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,WPS connection "
-                         "not yet supported");
-               return 0;
-       }
-
-       snprintf(buf, sizeof(buf), "apple80211 en1 --ssid=\"%s\"", ssid);
-       sigma_dut_print( DUT_MSG_DEBUG, "%s: Running '%s'",
-                       __func__, buf);
-       system(buf);
-#else /* __APPLE__ */
-       if (wps) {
-               if (dut->wps_method == WFA_CS_WPS_NOT_READY) {
-                       send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,WPS "
-                                 "parameters not yet set");
-                       return 0;
-               }
-               if (dut->wps_method == WFA_CS_WPS_PBC) {
-                       if (wpa_command(get_station_ifname(), "WPS_PBC") < 0)
-                               return -2;
-               } else {
-                       snprintf(buf, sizeof(buf), "WPS_PIN any %s",
-                                dut->wps_pin);
-                       if (wpa_command(get_station_ifname(), buf) < 0)
-                               return -2;
-               }
-       } else {
-               if (strcmp(ssid, dut->infra_ssid) != 0) {
-                       printf("No network parameters known for network "
-                              "(ssid='%s')", ssid);
-                       send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,"
-                                 "No network parameters known for network");
-                       return 0;
-               }
-
-               snprintf(buf, sizeof(buf), "SELECT_NETWORK %d",
-                        dut->infra_network_id);
-               if (wpa_command(get_station_ifname(), buf) < 0) {
-                       sigma_dut_print( DUT_MSG_INFO, "Failed to select "
-                                       "network id %d on %s",
-                                       dut->infra_network_id,
-                                       get_station_ifname());
-                       return -2;
-               }
-       }
-#endif /* __APPLE__ */
-
-       return 1;
-}
-
-
-static int cmd_sta_preset_testparameters(struct sigma_dut *dut,
-                                        struct sigma_conn *conn,
-                                        struct sigma_cmd *cmd)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       const char *val;
-
-#if 0
-       val = get_param(cmd, "Supplicant");
-       if (val && strcasecmp(val, "Default") != 0) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,Only default(Vendor) supplicant "
-                         "supported");
-               return 0;
-       }
-#endif
-
-#if 0
-       val = get_param(cmd, "RTS");
-       if (val) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,Setting RTS not supported");
-               return 0;
-       }
-#endif
-
-#if 0
-       val = get_param(cmd, "FRGMNT");
-       if (val) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,Setting FRGMNT not supported");
-               return 0;
-       }
-#endif
-
-#if 0
-       val = get_param(cmd, "Preamble");
-       if (val) {
-               /* TODO: Long/Short */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,Setting Preamble not supported");
-               return 0;
-       }
-#endif
-
-#if 0
-       val = get_param(cmd, "Mode");
-       if (val) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,Setting Mode not supported");
-               return 0;
-       }
-#endif
-
-       val = get_param(cmd, "Powersave");
-       if (val) {
-               if (strcmp(val, "0") == 0 || strcasecmp(val, "off") == 0) {
-                       if (wpa_command(get_station_ifname(),
-                                       "P2P_SET ps 0") < 0)
-                               return -2;
-                       /* Make sure test modes are disabled */
-                       wpa_command(get_station_ifname(), "P2P_SET ps 98");
-                       wpa_command(get_station_ifname(), "P2P_SET ps 96");
-               } else if (strcmp(val, "1") == 0 ||
-                          strcasecmp(val, "PSPoll") == 0 ||
-                          strcasecmp(val, "on") == 0) {
-                       /* Disable default power save mode */
-                       wpa_command(get_station_ifname(), "P2P_SET ps 0");
-                       /* Enable PS-Poll test mode */
-                       if (wpa_command(get_station_ifname(),
-                                       "P2P_SET ps 97") < 0 ||
-                           wpa_command(get_station_ifname(),
-                                       "P2P_SET ps 99") < 0)
-                               return -2;
-               } else if (strcmp(val, "2") == 0 ||
-                          strcasecmp(val, "Fast") == 0) {
-                       /* TODO */
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,Powersave=Fast not supported");
-                       return 0;
-               } else if (strcmp(val, "3") == 0 ||
-                          strcasecmp(val, "PSNonPoll") == 0) {
-                       /* Make sure test modes are disabled */
-                       wpa_command(get_station_ifname(), "P2P_SET ps 98");
-                       wpa_command(get_station_ifname(), "P2P_SET ps 96");
-
-                       /* Enable default power save mode */
-                       if (wpa_command(get_station_ifname(),
-                                       "P2P_SET ps 1") < 0)
-                               return -2;
-               } else
-                       return -1;
-       }
-
-       val = get_param(cmd, "NoAck");
-       if (val) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,Setting NoAck not supported");
-               return 0;
-       }
-
-       return 1;
-}
-
-
-static int cmd_sta_set_11n(struct sigma_dut *dut, struct sigma_conn *conn,
-                          struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *val, *mcs32, *rate;
-       int ampdu = -1;
-       char buf[30];
-
-       val = get_param(cmd, "40_INTOLERANT");
-       if (val) {
-               if (strcmp(val, "1") == 0 || strcasecmp(val, "Enable") == 0) {
-                       /* TODO: iwpriv ht40intol through wpa_supplicant */
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,40_INTOLERANT not supported");
-                       return 0;
-               }
-       }
-
-       val = get_param(cmd, "ADDBA_REJECT");
-       if (val) {
-               if (strcmp(val, "1") == 0 || strcasecmp(val, "Enable") == 0) {
-                       /* reject any ADDBA with status "decline" */
-                       ampdu = 0;
-               } else {
-                       /* accept ADDBA */
-                       ampdu = 1;
-               }
-       }
-
-       val = get_param(cmd, "AMPDU");
-       if (val) {
-               if (strcmp(val, "1") == 0 || strcasecmp(val, "Enable") == 0) {
-                       /* enable AMPDU Aggregation */
-                       if (ampdu == 0) {
-                               send_resp(dut, conn, SIGMA_ERROR,
-                                         "ErrorCode,Mismatch in "
-                                         "addba_reject/ampdu - "
-                                         "not supported");
-                               return 0;
-                       } else
-                               ampdu = 1;
-               } else {
-                       /* disable AMPDU Aggregation */
-                       if (ampdu == 1) {
-                               send_resp(dut, conn, SIGMA_ERROR,
-                                         "ErrorCode,Mismatch in "
-                                         "addba_reject/ampdu - "
-                                         "not supported");
-                               return 0;
-                       } else
-                               ampdu = 0;
-               }
-       }
-
-       if (ampdu >= 0) {
-               sigma_dut_print( DUT_MSG_DEBUG, "%s A-MPDU aggregation",
-                               ampdu ? "Enabling" : "Disabling");
-               snprintf(buf, sizeof(buf), "SET ampdu %d", ampdu);
-               if (wpa_command(intf, buf) < 0) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,set aggr failed");
-                       return 0;
-               }
-       }
-
-       val = get_param(cmd, "AMSDU");
-       if (val) {
-               if (strcmp(val, "1") == 0 || strcasecmp(val, "Enable") == 0) {
-                       /* Enable AMSDU Aggregation */
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,AMSDU aggregation not supported");
-                       return 0;
-               }
-       }
-
-       val = get_param(cmd, "GREENFIELD");
-       if (val) {
-               if (strcmp(val, "1") == 0 || strcasecmp(val, "Enable") == 0) {
-                       /* Enable GD */
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,GF not supported");
-                       return 0;
-               }
-       }
-
-       val = get_param(cmd, "SGI20");
-       if (val) {
-               /* TODO: Enable/disable SGI20 */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,SGI20 not supported");
-               return 0;
-       }
-
-       val = get_param(cmd, "STBC_RX");
-       if (val) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,STBC_RX not supported");
-               return 0;
-       }
-
-       val = get_param(cmd, "WIDTH");
-       if (val) {
-               if (strcasecmp(val, "Auto") != 0) {
-                       /* TODO: 20/40/Auto */
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,WIDTH not supported");
-                       return 0;
-               }
-       }
-
-       mcs32 = get_param(cmd, "MCS32"); /* HT Duplicate Mode Enable/Disable */
-       rate = get_param(cmd, "MCS_FIXEDRATE"); /* Fixed MCS rate (0..31) */
-       
-       if (mcs32 && rate) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,MCS32,MCS_FIXEDRATE not supported");
-               return 0;
-       } else if (mcs32 && !rate) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,MCS32 not supported");
-               return 0;
-       } else if (!mcs32 && rate) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,MCS32_FIXEDRATE not supported");
-               return 0;
-       }
-
-       val = get_param(cmd, "SMPS");
-       if (val) {
-               /* TODO: Dynamic/0, Static/1, No Limit/2 */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,SMPS not supported");
-               return 0;
-       }
-
-       val = get_param(cmd, "TXSP_STREAM");
-       if (val) {
-               /* TODO: Tx Spacial Stream 1/2/3 */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,TXSP_STREAM not supported");
-               return 0;
-       }
-
-       val = get_param(cmd, "RXSP_STREAM");
-       if (val) {
-               /* TODO: Rx Spacial Stream 1/2/3 */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,RXSP_STREAM not supported");
-               return 0;
-       }
-
-       return 1;
-}
-
-
-static int cmd_sta_disconnect(struct sigma_dut *dut, struct sigma_conn *conn,
-                             struct sigma_cmd *cmd)
-{
-       /* const char *intf = get_param(cmd, "Interface"); */
-       disconnect_station(dut);
-       return 1;
-}
-
-
-static int cmd_sta_reset_default(struct sigma_dut *dut,
-                                struct sigma_conn *conn,
-                                struct sigma_cmd *cmd)
-{
-       int cmd_sta_p2p_reset(struct sigma_dut *dut, struct sigma_conn *conn,
-                             struct sigma_cmd *cmd);
-       /* const char *intf = get_param(cmd, "Interface"); */
-       /* const char *prog = get_param(cmd, "prog"); */
-       return cmd_sta_p2p_reset(dut, conn, cmd);
-}
-
-
-#ifdef __linux__
-
-int inject_frame(int s, const void *data, size_t len, int encrypt)
-{
-#define        IEEE80211_RADIOTAP_F_WEP        0x04
-#define        IEEE80211_RADIOTAP_F_FRAG       0x08
-       unsigned char rtap_hdr[] = {
-               0x00, 0x00, /* radiotap version */
-               0x0e, 0x00, /* radiotap length */
-               0x02, 0xc0, 0x00, 0x00, /* bmap: flags, tx and rx flags */
-               IEEE80211_RADIOTAP_F_FRAG, /* F_FRAG (fragment if required) */
-               0x00,       /* padding */
-               0x00, 0x00, /* RX and TX flags to indicate that */
-               0x00, 0x00, /* this is the injected frame directly */
-       };
-       struct iovec iov[2] = {
-               {
-                       .iov_base = &rtap_hdr,
-                       .iov_len = sizeof(rtap_hdr),
-               },
-               {
-                       .iov_base = (void *) data,
-                       .iov_len = len,
-               }
-       };
-       struct msghdr msg = {
-               .msg_name = NULL,
-               .msg_namelen = 0,
-               .msg_iov = iov,
-               .msg_iovlen = 2,
-               .msg_control = NULL,
-               .msg_controllen = 0,
-               .msg_flags = 0,
-       };
-
-       if (encrypt)
-               rtap_hdr[8] |= IEEE80211_RADIOTAP_F_WEP;
-
-       return sendmsg(s, &msg, 0);
-}
-
-
-int open_monitor(const char *ifname)
-{
-       struct sockaddr_ll ll;
-       int s;
-
-       memset(&ll, 0, sizeof(ll));
-       ll.sll_family = AF_PACKET;
-       ll.sll_ifindex = if_nametoindex(ifname);
-       if (ll.sll_ifindex == 0) {
-               perror("if_nametoindex");
-               return -1;
-       }
-       s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
-       if (s < 0) {
-               perror("socket[PF_PACKET,SOCK_RAW]");
-               return -1;
-       }
-
-       if (bind(s, (struct sockaddr *) &ll, sizeof(ll)) < 0) {
-               perror("monitor socket bind");
-               close(s);
-               return -1;
-       }
-
-       return s;
-}
-
-
-static int hex2num(char c)
-{
-       if (c >= '0' && c <= '9')
-               return c - '0';
-       if (c >= 'a' && c <= 'f')
-               return c - 'a' + 10;
-       if (c >= 'A' && c <= 'F')
-               return c - 'A' + 10;
-       return -1;
-}
-
-
-int hwaddr_aton(const char *txt, unsigned char *addr)
-{
-       int i;
-
-       for (i = 0; i < 6; i++) {
-               int a, b;
-
-               a = hex2num(*txt++);
-               if (a < 0)
-                       return -1;
-               b = hex2num(*txt++);
-               if (b < 0)
-                       return -1;
-               *addr++ = (a << 4) | b;
-               if (i < 5 && *txt++ != ':')
-                       return -1;
-       }
-
-       return 0;
-}
-
-#endif /* __linux__ */
-
-enum send_frame_type {
-               DISASSOC, DEAUTH, SAQUERY, AUTH, ASSOCREQ, REASSOCREQ
-};
-enum send_frame_protection {
-       CORRECT_KEY, INCORRECT_KEY, UNPROTECTED
-};
-
-
-static int sta_inject_frame(struct sigma_dut *dut, struct sigma_conn *conn,
-                           enum send_frame_type frame,
-                           enum send_frame_protection protected)
-{
-#ifdef __linux__
-       unsigned char buf[1000], *pos;
-       int s, res;
-       char bssid[20], addr[20];
-       char result[32], ssid[100];
-       size_t ssid_len;
-
-       if (get_wpa_status(get_station_ifname(), "wpa_state", result,
-                          sizeof(result)) < 0 ||
-           strncmp(result, "COMPLETED", 9) != 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Not connected");
-               return 0;
-       }
-
-       if (get_wpa_status(get_station_ifname(), "bssid", bssid, sizeof(bssid))
-           < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Could not get "
-                         "current BSSID");
-               return 0;
-       }
-
-       if (get_wpa_status(get_station_ifname(), "address", addr, sizeof(addr))
-           < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Could not get "
-                         "own MAC address");
-               return 0;
-       }
-
-       if (get_wpa_status(get_station_ifname(), "ssid", ssid, sizeof(ssid))
-           < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Could not get "
-                         "current SSID");
-               return 0;
-       }
-       ssid_len = strlen(ssid);
-
-       pos = buf;
-
-       /* Frame Control */
-       switch (frame) {
-       case DISASSOC:
-               *pos++ = 0xa0;
-               break;
-       case DEAUTH:
-               *pos++ = 0xc0;
-               break;
-       case SAQUERY:
-               *pos++ = 0xd0;
-               break;
-       case AUTH:
-               *pos++ = 0xb0;
-               break;
-       case ASSOCREQ:
-               *pos++ = 0x00;
-               break;
-       case REASSOCREQ:
-               *pos++ = 0x20;
-               break;
-       }
-
-       if (protected == INCORRECT_KEY)
-               *pos++ = 0x40; /* Set Protected field to 1 */
-       else
-               *pos++ = 0x00;
-
-       /* Duration */
-       *pos++ = 0x00;
-       *pos++ = 0x00;
-
-       /* addr1 = DA (current AP) */
-       hwaddr_aton(bssid, pos);
-       pos += 6;
-       /* addr2 = SA (own address) */
-       hwaddr_aton(addr, pos);
-       pos += 6;
-       /* addr3 = BSSID (current AP) */
-       hwaddr_aton(bssid, pos);
-       pos += 6;
-
-       /* Seq# (to be filled by driver/mac80211) */
-       *pos++ = 0x00;
-       *pos++ = 0x00;
-
-       if (protected == INCORRECT_KEY) {
-               /* CCMP parameters */
-               memcpy(pos, "\x61\x01\x00\x20\x00\x10\x00\x00", 8);
-               pos += 8;
-       }
-
-       if (protected == INCORRECT_KEY) {
-               switch (frame) {
-               case DEAUTH:
-                       /* Reason code (encrypted) */
-                       memcpy(pos, "\xa7\x39", 2);
-                       pos += 2;
-                       break;
-               case DISASSOC:
-                       /* Reason code (encrypted) */
-                       memcpy(pos, "\xa7\x39", 2);
-                       pos += 2;
-                       break;
-               case SAQUERY:
-                       /* Category|Action|TransID (encrypted) */
-                       memcpy(pos, "\x6f\xbd\xe9\x4d", 4);
-                       pos += 4;
-                       break;
-               default:
-                       return -1;
-               }
-
-               /* CCMP MIC */
-               memcpy(pos, "\xc8\xd8\x3b\x06\x5d\xb7\x25\x68", 8);
-               pos += 8;
-       } else {
-               switch (frame) {
-               case DEAUTH:
-                       /* reason code = 8 */
-                       *pos++ = 0x08;
-                       *pos++ = 0x00;
-                       break;
-               case DISASSOC:
-                       /* reason code = 8 */
-                       *pos++ = 0x08;
-                       *pos++ = 0x00;
-                       break;
-               case SAQUERY:
-                       /* Category - SA Query */
-                       *pos++ = 0x08;
-                       /* SA query Action - Request */
-                       *pos++ = 0x00;
-                       /* Transaction ID */
-                       *pos++ = 0x12;
-                       *pos++ = 0x34;
-                       break;
-               case AUTH:
-                       /* Auth Alg (Open) */
-                       *pos++ = 0x00;
-                       *pos++ = 0x00;
-                       /* Seq# */
-                       *pos++ = 0x01;
-                       *pos++ = 0x00;
-                       /* Status code */
-                       *pos++ = 0x00;
-                       *pos++ = 0x00;
-                       break;
-               case ASSOCREQ:
-                       /* Capability Information */
-                       *pos++ = 0x31;
-                       *pos++ = 0x04;
-                       /* Listen Interval */
-                       *pos++ = 0x0a;
-                       *pos++ = 0x00;
-                       /* SSID */
-                       *pos++ = 0x00;
-                       *pos++ = ssid_len;
-                       memcpy(pos, ssid, ssid_len);
-                       pos += ssid_len;
-                       /* Supported Rates */
-                       memcpy(pos, "\x01\x08\x02\x04\x0b\x16\x0c\x12\x18\x24",
-                              10);
-                       pos += 10;
-                       /* Extended Supported Rates */
-                       memcpy(pos, "\x32\x04\x30\x48\x60\x6c", 6);
-                       pos += 6;
-                       /* RSN */
-                       memcpy(pos, "\x30\x1a\x01\x00\x00\x0f\xac\x04\x01\x00"
-                              "\x00\x0f\xac\x04\x01\x00\x00\x0f\xac\x06\xc0"
-                              "\x00\x00\x00\x00\x0f\xac\x06", 28);
-                       pos += 28;
-                       break;
-               case REASSOCREQ:
-                       /* Capability Information */
-                       *pos++ = 0x31;
-                       *pos++ = 0x04;
-                       /* Listen Interval */
-                       *pos++ = 0x0a;
-                       *pos++ = 0x00;
-                       /* Current AP */
-                       hwaddr_aton(bssid, pos);
-                       pos += 6;
-                       /* SSID */
-                       *pos++ = 0x00;
-                       *pos++ = ssid_len;
-                       memcpy(pos, ssid, ssid_len);
-                       pos += ssid_len;
-                       /* Supported Rates */
-                       memcpy(pos, "\x01\x08\x02\x04\x0b\x16\x0c\x12\x18\x24",
-                              10);
-                       pos += 10;
-                       /* Extended Supported Rates */
-                       memcpy(pos, "\x32\x04\x30\x48\x60\x6c", 6);
-                       pos += 6;
-                       /* RSN */
-                       memcpy(pos, "\x30\x1a\x01\x00\x00\x0f\xac\x04\x01\x00"
-                              "\x00\x0f\xac\x04\x01\x00\x00\x0f\xac\x06\xc0"
-                              "\x00\x00\x00\x00\x0f\xac\x06", 28);
-                       pos += 28;
-                       break;
-               }
-       }
-
-       s = open_monitor("sigmadut");
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Failed to open "
-                         "monitor socket");
-               return 0;
-       }
-
-       res = inject_frame(s, buf, pos - buf, protected == CORRECT_KEY);
-       if (res < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Failed to "
-                         "inject frame");
-               return 0;
-       }
-       if (res < pos - buf) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Only partial "
-                         "frame sent");
-               return 0;
-       }
-
-       close(s);
-
-       return 1;
-#else /* __linux__ */
-       send_resp(dut, conn, SIGMA_ERROR, "errorCode,sta_send_frame not "
-                 "yet supported");
-       return 0;
-#endif /* __linux__ */
-}
-
-
-static int cmd_sta_send_frame_tdls(struct sigma_dut *dut,
-                                  struct sigma_conn *conn,
-                                  struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *sta, *val;
-       unsigned char addr[ETH_ALEN];
-       char buf[100];
-
-       sta = get_param(cmd, "peer");
-       if (sta == NULL)
-               sta = get_param(cmd, "station");
-       if (sta == NULL)
-               return -1;
-       if (hwaddr_aton(sta, addr) < 0)
-               return -1;
-
-       val = get_param(cmd, "type");
-       if (val == NULL)
-               return -1;
-
-       if (strcasecmp(val, "DISCOVERY") == 0) {
-               snprintf(buf, sizeof(buf), "TDLS_DISCOVER %s", sta);
-               if (wpa_command(intf, buf) < 0) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,Failed to send TDLS discovery");
-                       return 0;
-               }
-               return 1;
-       }
-
-       if (strcasecmp(val, "SETUP") == 0) {
-               snprintf(buf, sizeof(buf), "TDLS_SETUP %s", sta);
-               if (wpa_command(intf, buf) < 0) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,Failed to send TDLS setup");
-                       return 0;
-               }
-               return 1;
-       }
-
-       if (strcasecmp(val, "TEARDOWN") == 0) {
-               snprintf(buf, sizeof(buf), "TDLS_TEARDOWN %s", sta);
-               if (wpa_command(intf, buf) < 0) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,Failed to send TDLS teardown");
-                       return 0;
-               }
-               return 1;
-       }
-
-       send_resp(dut, conn, SIGMA_ERROR,
-                 "ErrorCode,Unsupported TDLS frame");
-       return 0;
-}
-
-
-static int cmd_sta_send_frame(struct sigma_dut *dut, struct sigma_conn *conn,
-                             struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *val;
-       enum send_frame_type frame;
-       enum send_frame_protection protected;
-       char buf[100];
-       unsigned char addr[ETH_ALEN];
-
-       val = get_param(cmd, "frame");
-       if (val && strcasecmp(val, "TDLS") == 0)
-               return cmd_sta_send_frame_tdls(dut, conn, cmd);
-
-       val = get_param(cmd, "TD_DISC");
-       if (val) {
-               if (hwaddr_aton(val, addr) < 0)
-                       return -1;
-               snprintf(buf, sizeof(buf), "TDLS_DISCOVER %s", val);
-               if (wpa_command(intf, buf) < 0) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,Failed to send TDLS discovery");
-                       return 0;
-               }
-               return 1;
-       }
-
-       val = get_param(cmd, "TD_Setup");
-       if (val) {
-               if (hwaddr_aton(val, addr) < 0)
-                       return -1;
-               snprintf(buf, sizeof(buf), "TDLS_SETUP %s", val);
-               if (wpa_command(intf, buf) < 0) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,Failed to start TDLS setup");
-                       return 0;
-               }
-               return 1;
-       }
-
-       val = get_param(cmd, "TD_TearDown");
-       if (val) {
-               if (hwaddr_aton(val, addr) < 0)
-                       return -1;
-               snprintf(buf, sizeof(buf), "TDLS_TEARDOWN %s", val);
-               if (wpa_command(intf, buf) < 0) {
-                       send_resp(dut, conn, SIGMA_ERROR,
-                                 "ErrorCode,Failed to tear down TDLS link");
-                       return 0;
-               }
-               return 1;
-       }
-
-       val = get_param(cmd, "TD_ChannelSwitch");
-       if (val) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,TD_ChannelSwitch not yet supported");
-               return 0;
-       }
-
-       val = get_param(cmd, "TD_NF");
-       if (val) {
-               /* TODO */
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,TD_NF not yet supported");
-               return 0;
-       }
-
-       val = get_param(cmd, "PMFFrameType");
-       if (val == NULL)
-               val = get_param(cmd, "Type");
-       if (val == NULL)
-               return -1;
-       if (strcasecmp(val, "disassoc") == 0)
-               frame = DISASSOC;
-       else if (strcasecmp(val, "deauth") == 0)
-               frame = DEAUTH;
-       else if (strcasecmp(val, "saquery") == 0)
-               frame = SAQUERY;
-       else if (strcasecmp(val, "auth") == 0)
-               frame = AUTH;
-       else if (strcasecmp(val, "assocreq") == 0)
-               frame = ASSOCREQ;
-       else if (strcasecmp(val, "reassocreq") == 0)
-               frame = REASSOCREQ;
-       else {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Unsupported "
-                         "PMFFrameType");
-               return 0;
-       }
-
-       val = get_param(cmd, "PMFProtected");
-       if (val == NULL)
-               val = get_param(cmd, "Protected");
-       if (val == NULL)
-               return -1;
-       if (strcasecmp(val, "Correct-key") == 0 ||
-           strcasecmp(val, "CorrectKey") == 0)
-               protected = CORRECT_KEY;
-       else if (strcasecmp(val, "IncorrectKey") == 0)
-               protected = INCORRECT_KEY;
-       else if (strcasecmp(val, "Unprotected") == 0)
-               protected = UNPROTECTED;
-       else {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Unsupported "
-                         "PMFProtected");
-               return 0;
-       }
-
-       if (protected != UNPROTECTED &&
-           (frame == AUTH || frame == ASSOCREQ || frame == REASSOCREQ)) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Impossible "
-                         "PMFProtected for auth/assocreq/reassocreq");
-               return 0;
-       }
-
-       if (if_nametoindex("sigmadut") == 0) {
-               snprintf(buf, sizeof(buf),
-                        "iw dev %s interface add sigmadut type monitor",
-                        get_station_ifname());
-               if (system(buf) != 0 ||
-                   if_nametoindex("sigmadut") == 0) {
-                       sigma_dut_print( DUT_MSG_ERROR, "Failed to add "
-                                       "monitor interface with '%s'", buf);
-                       return -2;
-               }
-       }
-
-       if (system("ifconfig sigmadut up") != 0) {
-               sigma_dut_print( DUT_MSG_ERROR, "Failed to set "
-                               "monitor interface up");
-               return -2;
-       }
-
-       return sta_inject_frame(dut, conn, frame, protected);
-}
-
-
-static int cmd_sta_set_macaddr(struct sigma_dut *dut, struct sigma_conn *conn,
-                              struct sigma_cmd *cmd)
-{
-       const char *intf = get_param(cmd, "Interface");
-       const char *mac = get_param(cmd, "MAC");
-
-       if (intf == NULL || mac == NULL)
-               return -1;
-
-       sigma_dut_print( DUT_MSG_INFO, "Change local MAC address for "
-                       "interface %s to %s", intf, mac);
-
-       /* TODO: add support for changing own MAC address */
-       send_resp(dut, conn, SIGMA_ERROR, "errorCode,Unsupported "
-                 "command");
-       return 0;
-}
-
-
-static int req_intf(struct sigma_cmd *cmd)
-{
-       return get_param(cmd, "interface") == NULL ? -1 : 0;
-}
-
-
-void sta_register_cmds(void)
-{
-       sigma_dut_reg_cmd("sta_get_ip_config", req_intf,
-                         cmd_sta_get_ip_config);
-       sigma_dut_reg_cmd("sta_set_ip_config", req_intf,
-                         cmd_sta_set_ip_config);
-       sigma_dut_reg_cmd("sta_get_info", req_intf, cmd_sta_get_info);
-       sigma_dut_reg_cmd("sta_get_mac_address", req_intf,
-                         cmd_sta_get_mac_address);
-       sigma_dut_reg_cmd("sta_is_connected", req_intf, cmd_sta_is_connected);
-       sigma_dut_reg_cmd("sta_verify_ip_connection", req_intf,
-                         cmd_sta_verify_ip_connection);
-       sigma_dut_reg_cmd("sta_get_bssid", req_intf, cmd_sta_get_bssid);
-       sigma_dut_reg_cmd("sta_set_encryption", req_intf,
-                         cmd_sta_set_encryption);
-       sigma_dut_reg_cmd("sta_set_psk", req_intf, cmd_sta_set_psk);
-       sigma_dut_reg_cmd("sta_set_eaptls", req_intf, cmd_sta_set_eaptls);
-       sigma_dut_reg_cmd("sta_set_eapttls", req_intf, cmd_sta_set_eapttls);
-       sigma_dut_reg_cmd("sta_set_eapsim", req_intf, cmd_sta_set_eapsim);
-       sigma_dut_reg_cmd("sta_set_eappeap", req_intf, cmd_sta_set_eappeap);
-       sigma_dut_reg_cmd("sta_set_eapfast", req_intf, cmd_sta_set_eapfast);
-       sigma_dut_reg_cmd("sta_set_eapaka", req_intf, cmd_sta_set_eapaka);
-       sigma_dut_reg_cmd("sta_set_uapsd", req_intf, cmd_sta_set_uapsd);
-       /* TODO: sta_set_ibss */
-       /* TODO: sta_set_mode */
-       /* TODO: sta_set_wmm */
-       sigma_dut_reg_cmd("sta_associate", req_intf, cmd_sta_associate);
-       /* TODO: sta_up_load */
-       sigma_dut_reg_cmd("sta_preset_testparameters", req_intf,
-                         cmd_sta_preset_testparameters);
-       /* TODO: sta_set_system */
-       sigma_dut_reg_cmd("sta_set_11n", req_intf, cmd_sta_set_11n);
-       /* TODO: sta_set_rifs_test */
-       /* TODO: sta_set_wireless */
-       /* TODO: sta_send_addba */
-       /* TODO: sta_send_coexist_mgmt */
-       sigma_dut_reg_cmd("sta_disconnect", req_intf, cmd_sta_disconnect);
-       /* TODO: sta_reassoc */
-       sigma_dut_reg_cmd("sta_reset_default", req_intf,
-                         cmd_sta_reset_default);
-       sigma_dut_reg_cmd("sta_send_frame", req_intf, cmd_sta_send_frame);
-       sigma_dut_reg_cmd("sta_set_macaddr", req_intf, cmd_sta_set_macaddr);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/traffic.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/traffic.c
deleted file mode 100644 (file)
index 0fe8f00..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <ctype.h>
-
-#if 1 // by bbelief
-#include "wfa_p2p.h"
-#endif
-
-
-
-int is_ip_addr(const char *str);
-
-
-int cmd_traffic_send_ping(struct sigma_dut *dut,
-                                        tgPingStart_t *staPing, 
-                                        dutCmdResponse_t *spresp)
-{
-       const char *dst;
-       int val, size, dur, pkts;
-       int id;
-       char resp[100];
-       float interval, rate;
-       FILE *f;
-       char buf[100];
-
-       dst = staPing->dipaddr;
-       if (strcmp(dst, "")  == 0 || !is_ip_addr(dst))
-               return -1;
-
-
-       //val = get_param(cmd, "frameSize");
-       val = staPing->frameSize;
-       if (val == 0)
-               return -1;
-       size = val; //atoi(val);
-
-
-       val = staPing->frameRate;
-       if (val == 0)
-               return -1;
-
-       rate = val; // atof(val);
-
-#if 0
-       if (rate < 1) {
-        return -1;
-    }
-#endif
-
-       val = staPing->duration;
-       if (val == 0)
-               return -1;
-       dur = val; // atoi(val);
-       if (dur <= 0)
-               dur = 3600;
-
-       pkts = dur * rate;
-       interval = (float) 1 / rate;
-
-       id = dut->next_streamid++;
-       snprintf(buf, sizeof(buf), "/tmp/sigma_dut-ping.%d", id);
-       unlink(buf);
-       snprintf(buf, sizeof(buf), "/tmp/sigma_dut-ping-pid.%d", id);
-       unlink(buf);
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Send ping: pkts=%d interval=%f "
-                       "streamid=%d",
-                       pkts, interval, id);
-
-
-       f = fopen("/tmp/sigma_dut-ping.sh", "w");
-       if (f == NULL)
-               return -2;
-
-       fprintf(f, "#!/bin/sh\n"
-               "ping -c %d -i %f -s %d -q %s > /tmp/sigma_dut-ping.%d &\n"
-               "echo $! > /tmp/sigma_dut-ping-pid.%d\n",
-               pkts, interval, size, dst, id, id);
-       fclose(f);
-       if (chmod("/tmp/sigma_dut-ping.sh", S_IRUSR | S_IWUSR | S_IXUSR) < 0)
-               return -2;
-
-       if (system("/tmp/sigma_dut-ping.sh") != 0) {
-               sigma_dut_print( DUT_MSG_ERROR, "Failed to start ping");
-               return -2;
-       }
-
-       unlink("/tmp/sigma_dut-ping.sh");
-
-       snprintf(resp, sizeof(resp), "streamID,%d", id);
-       send_resp(dut, conn, SIGMA_COMPLETE, resp);
-       return 0;
-}
-
-
-int cmd_traffic_stop_ping(struct sigma_dut *dut,
-                                int      streamID,
-                                dutCmdResponse_t *spresp)
-{
-       int val;
-       int id, pid;
-       FILE *f;
-       char buf[100];
-       int res_found = 0, sent = 0, received = 0;
-
-       val = streamID;
-       if (val < 0)
-               return -1;
-       id = val;
-
-       snprintf(buf, sizeof(buf), "/tmp/sigma_dut-ping-pid.%d", id);
-       f = fopen(buf, "r");
-       if (f == NULL) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,Unknown streamID");
-               return -1;
-       }
-       if (fscanf(f, "%d", &pid) != 1 || pid <= 0) {
-               sigma_dut_print( DUT_MSG_ERROR, "No PID for ping process");
-               fclose(f);
-               unlink(buf);
-               return -2;
-       }
-
-       fclose(f);
-       unlink(buf);
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Ping process pid %d", pid);
-       if (kill(pid, SIGINT) < 0 && errno != ESRCH) {
-               sigma_dut_print( DUT_MSG_DEBUG, "kill failed: %s",
-                               strerror(errno));
-       }
-       usleep(250000);
-
-       snprintf(buf, sizeof(buf), "/tmp/sigma_dut-ping.%d", id);
-       f = fopen(buf, "r");
-       if (f == NULL) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,No ping result file found");
-               return -1;
-       }
-
-       while (fgets(buf, sizeof(buf), f)) {
-               char *pos;
-
-               pos = strstr(buf, " packets transmitted");
-               if (pos) {
-                       pos--;
-                       while (pos > buf && isdigit(pos[-1]))
-                               pos--;
-                       sent = atoi(pos);
-                       res_found = 1;
-               }
-
-               pos = strstr(buf, " received");
-               if (pos) {
-                       pos--;
-                       while (pos > buf && isdigit(pos[-1]))
-                               pos--;
-                       received = atoi(pos);
-                       res_found = 1;
-               }
-       }
-       fclose(f);
-       snprintf(buf, sizeof(buf), "/tmp/sigma_dut-ping.%d", id);
-       unlink(buf);
-
-       if (!res_found) {
-               send_resp(dut, conn, SIGMA_ERROR,
-                         "ErrorCode,No ping results found");
-               return -1;
-       }
-
-       snprintf(buf, sizeof(buf), "sent,%d,replies,%d", sent, received);
-       send_resp(dut, conn, SIGMA_COMPLETE, buf);
-       return 0;
-}
-
-
-void traffic_register_cmds(void)
-{
-#if 0
-       sigma_dut_reg_cmd("traffic_send_ping", NULL, cmd_traffic_send_ping);
-       sigma_dut_reg_cmd("traffic_stop_ping", NULL, cmd_traffic_stop_ping);
-#endif    
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/traffic_agent.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/traffic_agent.c
deleted file mode 100644 (file)
index aa96000..0000000
+++ /dev/null
@@ -1,916 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-
-typedef unsigned int u32;
-typedef unsigned char u8;
-
-#define WPA_GET_BE32(a) ((((u8) (a)[0]) << 24) | (((u8) (a)[1]) << 16) | \
-                        (((u8) (a)[2]) << 8) | ((u8) (a)[3]))
-#define WPA_PUT_BE32(a, val)                                   \
-       do {                                                    \
-               (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff);   \
-               (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff);   \
-               (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff);    \
-               (a)[3] = (u8) (((u32) (val)) & 0xff);           \
-       } while (0)
-
-
-static int cmd_traffic_agent_config(struct sigma_dut *dut,
-                                   struct sigma_conn *conn,
-                                   struct sigma_cmd *cmd)
-{
-       struct sigma_stream *s;
-       const char *val;
-       char buf[100];
-
-       if (dut->num_streams == MAX_SIGMA_STREAMS) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,No more "
-                         "concurrent traffic streams supported");
-               return 0;
-       }
-
-       s = &dut->streams[dut->num_streams];
-       memset(s, 0, sizeof(*s));
-       s->sock = -1;
-
-       val = get_param(cmd, "profile");
-       if (!val)
-               return -1;
-
-       if (strcasecmp(val, "File_Transfer") == 0)
-               s->profile = SIGMA_PROFILE_FILE_TRANSFER;
-       else if (strcasecmp(val, "Multicast") == 0)
-               s->profile = SIGMA_PROFILE_MULTICAST;
-       else if (strcasecmp(val, "IPTV") == 0)
-               s->profile = SIGMA_PROFILE_IPTV;
-       else if (strcasecmp(val, "Transaction") == 0)
-               s->profile = SIGMA_PROFILE_TRANSACTION;
-       else if (strcasecmp(val, "Start_Sync") == 0)
-               s->profile = SIGMA_PROFILE_START_SYNC;
-       else {
-               send_resp(dut, conn, SIGMA_INVALID, "errorCode,Unsupported "
-                         "profile");
-               return 0;
-       }
-
-       val = get_param(cmd, "direction");
-       if (!val)
-               return -1;
-       if (strcasecmp(val, "send") == 0)
-               s->sender = 1;
-       else if (strcasecmp(val, "receive") == 0)
-               s->sender = 0;
-       else
-               return -1;
-
-       val = get_param(cmd, "destination");
-       if (val) {
-               if (inet_aton(val, &s->dst) == 0)
-                       return -1;
-       }
-
-       val = get_param(cmd, "source");
-       if (val) {
-               if (inet_aton(val, &s->src) == 0)
-                       return -1;
-       }
-
-       val = get_param(cmd, "destinationPort");
-       if (val)
-               s->dst_port = atoi(val);
-
-       val = get_param(cmd, "sourcePort");
-       if (val)
-               s->src_port = atoi(val);
-
-       val = get_param(cmd, "frameRate");
-       if (val)
-               s->frame_rate = atoi(val);
-
-       val = get_param(cmd, "duration");
-       if (val)
-               s->duration = atoi(val);
-
-       val = get_param(cmd, "payloadSize");
-       if (val)
-               s->payload_size = atoi(val);
-
-       val = get_param(cmd, "startDelay");
-       if (val)
-               s->start_delay = atoi(val);
-
-       val = get_param(cmd, "maxCnt");
-       if (val)
-               s->max_cnt = atoi(val);
-
-       val = get_param(cmd, "trafficClass");
-       if (val) {
-               if (strcasecmp(val, "Voice") == 0)
-                       s->tc = SIGMA_TC_VOICE;
-               else if (strcasecmp(val, "Video") == 0)
-                       s->tc = SIGMA_TC_VIDEO;
-               else if (strcasecmp(val, "Background") == 0)
-                       s->tc = SIGMA_TC_BACKGROUND;
-               else if (strcasecmp(val, "BestEffort") == 0)
-                       s->tc = SIGMA_TC_BEST_EFFORT;
-               else
-                       return -1;
-       }
-
-       dut->num_streams++;
-
-       snprintf(buf, sizeof(buf), "streamID,%d", dut->num_streams);
-       send_resp(dut, conn, SIGMA_COMPLETE, buf);
-       return 0;
-}
-
-
-static void stop_stream(struct sigma_stream *s)
-{
-       if (s->started) {
-               pthread_join(s->thr, NULL);
-               close(s->sock);
-               s->sock = -1;
-       }
-}
-
-
-static int cmd_traffic_agent_reset(struct sigma_dut *dut,
-                                  struct sigma_conn *conn,
-                                  struct sigma_cmd *cmd)
-{
-       int i;
-       for (i = 0; i < dut->num_streams; i++) {
-               struct sigma_stream *s = &dut->streams[i];
-               s->stop = 1;
-               stop_stream(s);
-       }
-       dut->num_streams = 0;
-       memset(&dut->streams, 0, sizeof(dut->streams));
-       return 1;
-}
-
-
-static int get_stream_id(const char *str, int streams[MAX_SIGMA_STREAMS])
-{
-       int count;
-
-       count = 0;
-       for (;;) {
-               if (count == MAX_SIGMA_STREAMS)
-                       return -1;
-               streams[count] = atoi(str);
-               if (streams[count] == 0)
-                       return -1;
-               count++;
-               str = strchr(str, ' ');
-               if (str == NULL)
-                       break;
-               while (*str == ' ')
-                       str++;
-       }
-
-       return count;
-}
-
-
-static int open_socket_file_transfer(struct sigma_stream *s)
-{
-       struct sockaddr_in addr;
-
-       s->sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
-       if (s->sock < 0) {
-               perror("socket");
-               return -1;
-       }
-
-       memset(&addr, 0, sizeof(addr));
-       addr.sin_family = AF_INET;
-       addr.sin_port = htons(s->sender ? s->src_port : s->dst_port);
-       if (bind(s->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
-               perror("bind");
-               close(s->sock);
-               s->sock = -1;
-               return -1;
-       }
-
-       memset(&addr, 0, sizeof(addr));
-       addr.sin_family = AF_INET;
-       addr.sin_addr.s_addr = s->sender ? s->dst.s_addr : s->src.s_addr;
-       addr.sin_port = htons(s->sender ? s->dst_port : s->src_port);
-       if (connect(s->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
-               perror("connect");
-               close(s->sock);
-               s->sock = -1;
-               return -1;
-       }
-
-       return 0;
-}
-
-
-static int set_socket_prio(struct sigma_stream *s)
-{
-       int tos = 0x00;
-
-       switch (s->tc) {
-       case SIGMA_TC_VOICE:
-               tos = 0xd0;
-               break;
-       case SIGMA_TC_VIDEO:
-               tos = 0xa0;
-               break;
-       case SIGMA_TC_BACKGROUND:
-               tos = 0x20;
-               break;
-       case SIGMA_TC_BEST_EFFORT:
-               tos = 0x00;
-               break;
-       }
-
-       if (setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) {
-               perror("setsockopt");
-               return -1;
-       }
-
-       return 0;
-}
-
-
-static int open_socket(struct sigma_dut *dut, struct sigma_stream *s)
-{
-       switch (s->profile) {
-       case SIGMA_PROFILE_FILE_TRANSFER:
-               return open_socket_file_transfer(s);
-       case SIGMA_PROFILE_MULTICAST:
-               sigma_dut_print( DUT_MSG_INFO, "Traffic stream profile %d "
-                               "not yet supported", s->profile);
-               /* TODO */
-               break;
-       case SIGMA_PROFILE_IPTV:
-               if (open_socket_file_transfer(s) < 0)
-                       return -1;
-               return set_socket_prio(s);
-       case SIGMA_PROFILE_TRANSACTION:
-               return open_socket_file_transfer(s);
-       case SIGMA_PROFILE_START_SYNC:
-               sigma_dut_print( DUT_MSG_INFO, "Traffic stream profile %d "
-                               "not yet supported", s->profile);
-               /* TODO */
-               break;
-       }
-
-       return -1;
-}
-
-
-static void send_file(struct sigma_stream *s)
-{
-       char *pkt;
-       struct timeval stop, now;
-       int res;
-       unsigned int counter = 0;
-       int sleep_time;
-
-       if (s->duration <= 0 || s->frame_rate < 0 || s->payload_size < 20)
-               return;
-
-       pkt = malloc(s->payload_size);
-       if (pkt == NULL)
-               return;
-       memset(pkt, 1, s->payload_size);
-       strncpy(pkt, "1345678", s->payload_size);
-
-       gettimeofday(&stop, NULL);
-       stop.tv_sec += s->duration;
-
-       if (s->frame_rate == 0)
-               sleep_time = 0;
-       else {
-               /* TODO: proper calibration of wait time */
-               sleep_time = 1000000 / s->frame_rate;
-               sleep_time -= 100;
-               if (sleep_time < 0)
-                       sleep_time = 0;
-       }
-
-       while (!s->stop) {
-               counter++;
-               WPA_PUT_BE32(&pkt[8], counter);
-
-               usleep(sleep_time);
-
-               gettimeofday(&now, NULL);
-               if (now.tv_sec > stop.tv_sec ||
-                   (now.tv_sec == stop.tv_sec && now.tv_usec >= stop.tv_usec))
-                       break;
-               WPA_PUT_BE32(&pkt[12], now.tv_sec);
-               WPA_PUT_BE32(&pkt[16], now.tv_usec);
-
-               res = send(s->sock, pkt, s->payload_size, 0);
-               if (res >= 0) {
-                       s->tx_frames++;
-                       s->tx_payload_bytes += res;
-               } else {
-                       switch (errno) {
-                       case EAGAIN:
-                       case ENOBUFS:
-                               usleep(1000);
-                               break;
-                       case ECONNRESET:
-                       case EPIPE:
-                               s->stop = 1;
-                               break;
-                       default:
-                               perror("send");
-                               break;
-                       }
-               }
-       }
-
-       free(pkt);
-}
-
-
-static void send_transaction(struct sigma_stream *s)
-{
-       char *pkt, *rpkt;
-       struct timeval stop, now, resp;
-       int res;
-       unsigned int counter = 0, rcounter;
-       int wait_time;
-       fd_set rfds;
-       struct timeval tv;
-
-       if (s->duration <= 0 || s->frame_rate <= 0 || s->payload_size < 20)
-               return;
-
-       pkt = malloc(s->payload_size);
-       if (pkt == NULL)
-               return;
-       rpkt = malloc(s->payload_size);
-       if (rpkt == NULL) {
-               free(pkt);
-               return;
-       }
-       memset(pkt, 1, s->payload_size);
-       strncpy(pkt, "1345678", s->payload_size);
-
-       gettimeofday(&stop, NULL);
-       stop.tv_sec += s->duration;
-
-       wait_time = 1000000 / s->frame_rate;
-
-       while (!s->stop) {
-               counter++;
-               if (s->max_cnt && counter > s->max_cnt)
-                       break;
-               WPA_PUT_BE32(&pkt[8], counter);
-
-               gettimeofday(&now, NULL);
-               if (now.tv_sec > stop.tv_sec ||
-                   (now.tv_sec == stop.tv_sec && now.tv_usec >= stop.tv_usec))
-                       break;
-               WPA_PUT_BE32(&pkt[12], now.tv_sec);
-               WPA_PUT_BE32(&pkt[16], now.tv_usec);
-
-               res = send(s->sock, pkt, s->payload_size, 0);
-               if (res >= 0) {
-                       s->tx_frames++;
-                       s->tx_payload_bytes += res;
-               } else {
-                       switch (errno) {
-                       case EAGAIN:
-                       case ENOBUFS:
-                               usleep(1000);
-                               break;
-                       case ECONNRESET:
-                       case EPIPE:
-                               s->stop = 1;
-                               break;
-                       default:
-                               perror("send");
-                               break;
-                       }
-               }
-
-               /* Wait for response */
-               tv.tv_sec = 0;
-               tv.tv_usec = wait_time;
-               FD_ZERO(&rfds);
-               FD_SET(s->sock, &rfds);
-               res = select(s->sock + 1, &rfds, NULL, NULL, &tv);
-               if (res < 0) {
-                       if (errno == EINTR)
-                               continue;
-                       perror("select");
-                       break;
-               }
-
-               if (res == 0) {
-                       /* timeout */
-                       continue;
-               }
-
-               if (FD_ISSET(s->sock, &rfds)) {
-                       /* response received */
-                       gettimeofday(&resp, NULL);
-                       res = recv(s->sock, rpkt, s->payload_size, 0);
-                       if (res < 0) {
-                               perror("recv");
-                               break;
-                       }
-                       rcounter = WPA_GET_BE32(&rpkt[8]);
-                       if (rcounter != counter)
-                               s->out_of_seq_frames++;
-                       s->rx_frames++;
-                       s->rx_payload_bytes += res;
-#if 0
-                       diff = (resp.tv_sec - now.tv_sec) * 1000000 +
-                               resp.tv_usec - now.tv_usec;
-#endif
-               }
-       }
-
-       free(pkt);
-       free(rpkt);
-}
-
-
-static void * send_thread(void *ctx)
-{
-       struct sigma_stream *s = ctx;
-
-       sleep(s->start_delay);
-
-       switch (s->profile) {
-       case SIGMA_PROFILE_FILE_TRANSFER:
-               send_file(s);
-               break;
-       case SIGMA_PROFILE_MULTICAST:
-               break;
-       case SIGMA_PROFILE_IPTV:
-               send_file(s);
-               break;
-       case SIGMA_PROFILE_TRANSACTION:
-               send_transaction(s);
-               break;
-       case SIGMA_PROFILE_START_SYNC:
-               break;
-       }
-
-       return NULL;
-}
-
-
-static int cmd_traffic_agent_send(struct sigma_dut *dut,
-                                 struct sigma_conn *conn,
-                                 struct sigma_cmd *cmd)
-{
-       const char *val;
-       int streams[MAX_SIGMA_STREAMS];
-       int i, j, ret, count;
-       char buf[100 + MAX_SIGMA_STREAMS * 60], *pos;
-
-       val = get_param(cmd, "streamID");
-       if (val == NULL)
-               return -1;
-       count = get_stream_id(val, streams);
-       if (count < 0)
-               return -1;
-       for (i = 0; i < count; i++) {
-               if (streams[i] > dut->num_streams) {
-                       snprintf(buf, sizeof(buf), "errorCode,StreamID %d "
-                                "not configured", streams[i]);
-                       send_resp(dut, conn, SIGMA_INVALID, buf);
-                       return 0;
-               }
-               for (j = 0; j < i; j++)
-                       if (streams[i] == streams[j])
-                               return -1;
-               if (!dut->streams[streams[i] - 1].sender) {
-                       snprintf(buf, sizeof(buf), "errorCode,Not configured "
-                                "as sender for streamID %d", streams[i]);
-                       send_resp(dut, conn, SIGMA_INVALID, buf);
-                       return 0;
-               }
-       }
-
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               sigma_dut_print( DUT_MSG_DEBUG, "Traffic agent: open "
-                               "socket for stream %d", streams[i]);
-               if (open_socket(dut, s) < 0)
-                       return -2;
-       }
-
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               int res;
-               sigma_dut_print( DUT_MSG_DEBUG, "Traffic agent: start "
-                               "send for stream %d", streams[i]);
-               res = pthread_create(&s->thr, NULL, send_thread, s);
-               if (res) {
-                       sigma_dut_print( DUT_MSG_INFO, "pthread_create "
-                                       "failed: %d", res);
-                       return -2;
-               }
-               s->started = 1;
-       }
-
-       for (i = 0; i < count; i++) {
-               sigma_dut_print( DUT_MSG_DEBUG, "Traffic agent: waiting "
-                               "for stream %d send to complete", streams[i]);
-               stop_stream(&dut->streams[streams[i] - 1]);
-       }
-
-       buf[0] = '\0';
-       pos = buf;
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, "streamID,");
-       for (i = 0; i < count; i++) {
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", streams[i]);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",txFrames,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->tx_frames);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",rxFrames,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->rx_frames);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",txPayloadBytes,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->tx_payload_bytes);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",rxPayloadBytes,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->rx_payload_bytes);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",outOfSequenceFrames,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->out_of_seq_frames);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       buf[sizeof(buf) - 1] = '\0';
-
-       send_resp(dut, conn, SIGMA_COMPLETE, buf);
-
-       return 0;
-}
-
-
-static void receive_file(struct sigma_stream *s)
-{
-       struct timeval tv;
-       fd_set rfds;
-       int res;
-       char *pkt;
-       int pktlen;
-       unsigned int last_rx = 0, counter;
-
-       pktlen = 65536 + 1;
-       pkt = malloc(pktlen);
-       if (pkt == NULL)
-               return;
-
-       while (!s->stop) {
-               FD_ZERO(&rfds);
-               FD_SET(s->sock, &rfds);
-               tv.tv_sec = 0;
-               tv.tv_usec = 300000;
-               res = select(s->sock + 1, &rfds, NULL, NULL, &tv);
-               if (res < 0) {
-                       perror("select");
-                       usleep(10000);
-               } else if (FD_ISSET(s->sock, &rfds)) {
-                       res = recv(s->sock, pkt, pktlen, 0);
-                       if (res >= 0) {
-                               s->rx_frames++;
-                               s->rx_payload_bytes += res;
-
-                               counter = WPA_GET_BE32(&pkt[8]);
-                               if (counter < last_rx)
-                                       s->out_of_seq_frames++;
-                               last_rx = counter;
-                       } else {
-                               perror("recv");
-                               break;
-                       }
-               }
-       }
-
-       free(pkt);
-}
-
-
-static void receive_transaction(struct sigma_stream *s)
-{
-       struct timeval tv;
-       fd_set rfds;
-       int res;
-       char *pkt;
-       int pktlen;
-       unsigned int last_rx = 0, counter;
-       struct sockaddr_in addr;
-       socklen_t addrlen;
-
-       if (s->payload_size)
-               pktlen = s->payload_size;
-       else
-               pktlen = 65536 + 1;
-       pkt = malloc(pktlen);
-       if (pkt == NULL)
-               return;
-
-       while (!s->stop) {
-               FD_ZERO(&rfds);
-               FD_SET(s->sock, &rfds);
-               tv.tv_sec = 0;
-               tv.tv_usec = 300000;
-               res = select(s->sock + 1, &rfds, NULL, NULL, &tv);
-               if (res < 0) {
-                       perror("select");
-                       usleep(10000);
-               } else if (FD_ISSET(s->sock, &rfds)) {
-                       addrlen = sizeof(addr);
-                       res = recvfrom(s->sock, pkt, pktlen, 0,
-                                      (struct sockaddr *) &addr, &addrlen);
-                       if (res < 0) {
-                               perror("recv");
-                               break;
-                       }
-
-                       s->rx_frames++;
-                       s->rx_payload_bytes += res;
-
-                       counter = WPA_GET_BE32(&pkt[8]);
-                       if (counter < last_rx)
-                               s->out_of_seq_frames++;
-                       last_rx = counter;
-
-                       /* send response */
-                       res = sendto(s->sock, pkt, pktlen, 0,
-                                    (struct sockaddr *) &addr, addrlen);
-                       if (res < 0) {
-                               perror("sendto");
-                       } else {
-                               s->tx_frames++;
-                               s->tx_payload_bytes += res;
-                       }
-               }
-       }
-
-       free(pkt);
-}
-
-
-static void * receive_thread(void *ctx)
-{
-       struct sigma_stream *s = ctx;
-
-       switch (s->profile) {
-       case SIGMA_PROFILE_FILE_TRANSFER:
-               receive_file(s);
-               break;
-       case SIGMA_PROFILE_MULTICAST:
-               break;
-       case SIGMA_PROFILE_IPTV:
-               receive_file(s);
-               break;
-       case SIGMA_PROFILE_TRANSACTION:
-               receive_transaction(s);
-               break;
-       case SIGMA_PROFILE_START_SYNC:
-               break;
-       }
-
-       return NULL;
-}
-
-
-static int cmd_traffic_agent_receive_start(struct sigma_dut *dut,
-                                          struct sigma_conn *conn,
-                                          struct sigma_cmd *cmd)
-{
-       const char *val;
-       int streams[MAX_SIGMA_STREAMS];
-       int i, j, count;
-       char buf[100];
-
-       val = get_param(cmd, "streamID");
-       if (val == NULL)
-               return -1;
-       count = get_stream_id(val, streams);
-       if (count < 0)
-               return -1;
-       for (i = 0; i < count; i++) {
-               if (streams[i] > dut->num_streams) {
-                       snprintf(buf, sizeof(buf), "errorCode,StreamID %d "
-                                "not configured", streams[i]);
-                       send_resp(dut, conn, SIGMA_INVALID, buf);
-                       return 0;
-               }
-               for (j = 0; j < i; j++)
-                       if (streams[i] == streams[j])
-                               return -1;
-               if (dut->streams[streams[i] - 1].sender) {
-                       snprintf(buf, sizeof(buf), "errorCode,Not configured "
-                                "as receiver for streamID %d", streams[i]);
-                       send_resp(dut, conn, SIGMA_INVALID, buf);
-                       return 0;
-               }
-       }
-
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               sigma_dut_print( DUT_MSG_DEBUG, "Traffic agent: open "
-                               "receive socket for stream %d", streams[i]);
-               if (open_socket(dut, s) < 0)
-                       return -2;
-       }
-
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               int res;
-               sigma_dut_print( DUT_MSG_DEBUG, "Traffic agent: start "
-                               "receive for stream %d", streams[i]);
-               res = pthread_create(&s->thr, NULL, receive_thread, s);
-               if (res) {
-                       sigma_dut_print( DUT_MSG_INFO, "pthread_create "
-                                       "failed: %d", res);
-                       return -2;
-               }
-               s->started = 1;
-       }
-
-       return 1;
-}
-
-
-static int cmd_traffic_agent_receive_stop(struct sigma_dut *dut,
-                                         struct sigma_conn *conn,
-                                         struct sigma_cmd *cmd)
-{
-       const char *val;
-       int streams[MAX_SIGMA_STREAMS];
-       int i, j, ret, count;
-       char buf[100 + MAX_SIGMA_STREAMS * 60], *pos;
-
-       val = get_param(cmd, "streamID");
-       if (val == NULL)
-               return -1;
-       count = get_stream_id(val, streams);
-       if (count < 0)
-               return -1;
-       for (i = 0; i < count; i++) {
-               if (streams[i] > dut->num_streams) {
-                       snprintf(buf, sizeof(buf), "errorCode,StreamID %d "
-                                "not configured", streams[i]);
-                       send_resp(dut, conn, SIGMA_INVALID, buf);
-                       return 0;
-               }
-               for (j = 0; j < i; j++)
-                       if (streams[i] == streams[j])
-                               return -1;
-               if (!dut->streams[streams[i] - 1].started) {
-                       snprintf(buf, sizeof(buf), "errorCode,Receive not "
-                                "started for streamID %d", streams[i]);
-                       send_resp(dut, conn, SIGMA_INVALID, buf);
-                       return 0;
-               }
-       }
-
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               s->stop = 1;
-       }
-
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               sigma_dut_print( DUT_MSG_DEBUG, "Traffic agent: stop "
-                               "receive for stream %d", streams[i]);
-               stop_stream(s);
-       }
-
-       buf[0] = '\0';
-       pos = buf;
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, "streamID,");
-       for (i = 0; i < count; i++) {
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", streams[i]);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",txFrames,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->tx_frames);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",rxFrames,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->rx_frames);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",txPayloadBytes,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->tx_payload_bytes);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",rxPayloadBytes,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->rx_payload_bytes);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       pos += snprintf(pos, buf + sizeof(buf) - pos, ",outOfSequenceFrames,");
-       for (i = 0; i < count; i++) {
-               struct sigma_stream *s = &dut->streams[streams[i] - 1];
-               ret = snprintf(pos, buf + sizeof(buf) - pos, "%s%d",
-                              i > 0 ? " " : "", s->out_of_seq_frames);
-               if (ret < 0 || ret >= buf + sizeof(buf) - pos)
-                       break;
-               pos += ret;
-       }
-
-       buf[sizeof(buf) - 1] = '\0';
-
-       send_resp(dut, conn, SIGMA_COMPLETE, buf);
-
-       return 0;
-}
-
-
-void traffic_agent_register_cmds(void)
-{
-       sigma_dut_reg_cmd("traffic_agent_config", NULL,
-                         cmd_traffic_agent_config);
-       sigma_dut_reg_cmd("traffic_agent_reset", NULL,
-                         cmd_traffic_agent_reset);
-       sigma_dut_reg_cmd("traffic_agent_send", NULL,
-                         cmd_traffic_agent_send);
-       sigma_dut_reg_cmd("traffic_agent_receive_start", NULL,
-                         cmd_traffic_agent_receive_start);
-       sigma_dut_reg_cmd("traffic_agent_receive_stop", NULL,
-                         cmd_traffic_agent_receive_stop);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_agt.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_agt.h
deleted file mode 100644 (file)
index e1d7794..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-#ifndef WFA_AGT_H
-#define WFA_AGT_H
-
-typedef int (*xcCommandFuncPtr)(int len, BYTE *parms, int *respLen, BYTE *respBuf);
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_agtctrl.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_agtctrl.h
deleted file mode 100644 (file)
index 051f17d..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */ 
-
-#ifndef WFA_AGTCTRL_H
-#define WFA_AGTCTRL_H
-
-typedef int (*commandStrProcFuncPtr)(char *, BYTE *, int *);
-
-typedef struct type_name_str_table
-{
-     int type;
-     char name[32];
-     commandStrProcFuncPtr cmdProcFunc;
-} typeNameStr_t;
-
-extern int buildCommandProcessTable(void);
-
-typedef int (*dutCommandRespFuncPtr)(BYTE *cmdBuf);
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_ca.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_ca.h
deleted file mode 100644 (file)
index e540ffe..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-#ifndef _WFA_CA_H_
-#define _WFA_CA_H_
-
-#define ENCRYPT_NONE         0
-#define ENCRYPT_WEP          1
-#define ENCRYPT_TKIP         2
-#define ENCRYPT_AESCCMP      3
-#define WMMAC_UPLINK         0
-#define WMMAC_DOWNLINK       1
-#define WMMAC_BIDIR          3
-#define GROUP_WMMAC          0
-#define GROUP_WMMCONF        1
-#define WMMAC_ADDTS          0
-#define WMMAC_DELTS          1
-#define WMMAC_AC_BE          0
-#define WMMAC_AC_BK          1
-#define WMMAC_AC_VI          2
-#define WMMAC_AC_VO          3
-
-extern int wfaStaAssociate(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaIsConnected(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaGetIpConfig(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetIpConfig(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaVerifyIpConnection(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaGetMacAddress(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetMacAddress(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-
-extern int wfaStaGetBSSID(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaGetStats(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaSetEncryption(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetEapTLS(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetPSK(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaGetInfo(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaDeviceGetInfo(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaDeviceListIF(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetEapTTLS(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetEapSim(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetPEAP(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetEapSIM(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetPEAP(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetUAPSD(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetIBSS(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaDebugSet(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetMode(int, BYTE *, int *, BYTE *);
-extern int wfaStaUpload(int, BYTE *, int *, BYTE *);
-extern int wfaStaSetWMM(int, BYTE *, int *, BYTE *);
-
-extern int wfaStaPresetParams(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetEapFAST(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetEapAKA(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetSystime(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaResetTspecs(char* ifname);
-extern int wfaStaSet11n(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetWireless(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSendADDBA(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetRIFS(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSendCoExistMGMT(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaResetDefault(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaDisconnect(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaReAssociate(int, BYTE*, int*, BYTE*);
-
-extern int wfaStaSetPwrSave(int, BYTE *, int *, BYTE *);
-extern int wfaStaResetDefault(int, BYTE *, int *, BYTE *);
-extern int wfaStaSendNeigReq(int, BYTE *, int *, BYTE *);
-extern int wfaStaTestBedCmd(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-
-
-extern int  wfaStaGetP2pDevAddress(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);      
-extern int wfaStaSetP2p(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);                 
-extern int wfaStaP2pConnect(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);             
-extern int wfaStaStartAutoGo(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);            
-extern int wfaStaP2pStartGrpFormation(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);           
-
-extern int wfaStaP2pDissolve(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);                    
-extern int wfaStaSendP2pInvReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);          
-extern int wfaStaAcceptP2pInvReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);                
-extern int wfaStaSendP2pProvDisReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);              
-extern int wfaStaSetWpsPbc(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-
-extern int wfaStaWpsReadPin(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);                                             
-extern int wfaStaWpsEnterPin(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);                     
-extern int wfaStaGetPsk(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);                  
-extern int wfaStaP2pReset(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaWpsReadLabel(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);                                           
-extern int wfaStaGetP2pIpConfig(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSendServiceDiscoveryReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSendP2pPresenceReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetSleepReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaSetOpportunisticPsReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaAddArpTableEntry(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaStaBlockICMPResponse(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_cmds.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_cmds.h
deleted file mode 100644 (file)
index cf6ba37..0000000
+++ /dev/null
@@ -1,688 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
- ******************************************************************************
- *     Revision History:
- *     02/11/2008   Change encrytype from 8 bytes to 9, BUG #5.
- */
-
-/*
- * wfa_cmds.h:
- *   definitions of command types.
- */
-#ifndef _WFA_CMDS_H
-#define _WFA_CMDS_H
-
-typedef struct _tg_ping_start
-{
-    char dipaddr[IPV4_ADDRESS_STRING_LEN];  /* destination/remote ip address */
-    int  frameSize;
-    int  frameRate;
-    int  duration;
-    int  type;
-       int  qos;
-} tgPingStart_t;
-
-typedef struct ca_sta_set_ip_config
-{
-    char intf[WFA_IF_NAME_LEN];
-    int isDhcp;
-    char ipaddr[WFA_IP_ADDR_STR_LEN];
-    char mask[WFA_IP_MASK_STR_LEN];
-    char defGateway[WFA_IP_ADDR_STR_LEN];
-    char pri_dns[WFA_IP_ADDR_STR_LEN];
-    char sec_dns[WFA_IP_ADDR_STR_LEN];
-} caStaSetIpConfig_t;
-/* P2P */
-typedef struct ca_sta_associate
-{
-    char ssid[WFA_SSID_NAME_LEN];
-    unsigned char wps_flag;
-    int wps;
-} caStaAssociate_t;
-/* P2P */
-
-typedef struct ca_sta_verify_ip_connection
-{
-   char dipaddr[WFA_IP_ADDR_STR_LEN];
-   int timeout;
-} caStaVerifyIpConnect_t;
-
-typedef struct ca_sta_set_encryption
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   int encpType;
-   char keys[4][32];  /* 26 hex */
-   int activeKeyIdx;
-} caStaSetEncryption_t;
-
-typedef enum wfa_enableType
-{
-   eEnable = 1,
-   eDisable
-} wfaEnableType;
-
-typedef struct ca_sta_set_mode
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   char mode;
-   int encpType;
-   int channel;
-   char keys[4][32];  /* 26 hex */
-   int activeKeyIdx;
-} caStaSetMode_t;
-
-typedef struct ca_sta_set_psk
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   BYTE passphrase[64];
-   char keyMgmtType[8];  /* WPA-PSK */
-   int encpType;    /* TKIP    */
-} caStaSetPSK_t;
-
-typedef struct ca_sta_set_eaptls
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   char keyMgmtType[8];
-   char encrptype[9];
-   char trustedRootCA[128];
-   char clientCertificate[128];
-} caStaSetEapTLS_t;
-
-typedef struct ca_sta_set_eapttls
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   char username[32];
-   char passwd[16];
-   char keyMgmtType[8];
-   char encrptype[9];
-   char trustedRootCA[32];
-   char clientCertificate[32];
-} caStaSetEapTTLS_t;
-
-typedef struct ca_sta_set_eapsim
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   char username[32];
-   char passwd[96];
-   char keyMgmtType[8];
-   char encrptype[9];
-   char        tripletCount;
-   char tripletSet[3][64];
-} caStaSetEapSIM_t;
-
-typedef struct ca_sta_set_eappeap
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   char username[32];
-   char passwd[16];
-   char keyMgmtType[8];
-   char encrptype[9];
-   char trustedRootCA[32];
-   char innerEAP[16];
-   int peapVersion;
-} caStaSetEapPEAP_t;
-
-typedef struct ca_sta_set_eapfast
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   char username[32];
-   char passwd[16];
-   char keyMgmtType[8];
-   char encrptype[9];
-   char trustedRootCA[32];
-   char innerEAP[16];
-   char        validateServer;
-   char pacFileName[32];
-} caStaSetEapFAST_t;
-
-typedef struct ca_sta_set_eapaka
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   char username[32];
-   char passwd[96];
-   char keyMgmtType[8];
-   char encrptype[9];
-   char        tripletCount;
-   char tripletSet[3][96];
-} caStaSetEapAKA_t;
-
-typedef struct ca_sta_set_systime
-{
-   BYTE month;
-   BYTE date;
-   WORD year;
-   BYTE hours;
-   BYTE minutes;
-   BYTE seconds;
-} caStaSetSystime_t;
-
-
-typedef enum wfa_supplicant_names
-{      
-   eWindowsZeroConfig = 1,     
-   eMarvell,
-   eIntelProset,
-   eWpaSupplicant,     
-   eCiscoSecureClient, 
-   eOpen1x,
-   eDefault
-} wfaSupplicantName;
-/* P2P */
-/*
-typedef struct ca_sta_get_p2p_dev_address
-{
-   char intf[WFA_IF_NAME_LEN];
-} caStaGetP2pDevAddress_t;
-*/
-typedef struct ca_sta_set_p2p
-{
-   char intf[WFA_IF_NAME_LEN];
-
-   unsigned char listen_chn_flag;
-   WORD listen_chn;  
-
-   unsigned char p2p_mode_flag;
-   char p2p_mode[16];
-
-   unsigned char presistent_flag;
-   int presistent;
-
-   unsigned char intra_bss_flag;
-   int intra_bss;
-
-   unsigned char noa_duration_flag;
-   int noa_duration;
-
-   unsigned char noa_interval_flag;
-   int noa_interval;
-
-   unsigned char noa_count_flag;
-   int noa_count;   
-
-       unsigned char concurrency_flag;
-       int concurrency;         
-
-       unsigned char p2p_invitation_flag;
-       int p2p_invitation;      
-
-
-       unsigned char bcn_int_flag;
-       int bcn_int;    
-       
-       unsigned char ext_listen_time_int_flag;
-       int ext_listen_time_int;        
-
-       unsigned char ext_listen_time_period_flag;
-       int ext_listen_time_period;     
-
-       unsigned char discoverability_flag;
-       int discoverability;    
-
-
-       unsigned char service_discovry_flag;
-       int service_discovery;  
-       
-       unsigned char crossconnection_flag;
-       int crossconnection;            
-       
-       unsigned char p2pmanaged_flag;
-       int p2pmanaged;         
-       
-       unsigned char go_apsd_flag;
-       int go_apsd;            
-
-   
-} caStaSetP2p_t;
-
-typedef struct ca_sta_p2p_connect
-{
-   char intf[WFA_IF_NAME_LEN];
-   char grpid[WFA_P2P_GRP_ID_LEN];
-   char devId[WFA_P2P_DEVID_LEN];
-} caStaP2pConnect_t;
-
-typedef struct ca_sta_start_auto_go
-{
-   char intf[WFA_IF_NAME_LEN];
-   WORD oper_chn;
-   unsigned char ssid_flag;   
-   char ssid[WFA_SSID_NAME_LEN];    
-} caStaStartAutoGo_t;
-
-
-typedef struct ca_sta_p2p_start_grp_formation
-{
-   char intf[WFA_IF_NAME_LEN];
-   char devId[WFA_P2P_DEVID_LEN];
-   WORD intent_val;
-   WORD init_go_neg;
-   unsigned char oper_chn_flag;
-   WORD oper_chn;      
-   unsigned char ssid_flag;
-   char ssid[WFA_SSID_NAME_LEN];    
-} caStaP2pStartGrpForm_t;
-
-typedef struct ca_sta_p2p_dissolve
-{
-   char intf[WFA_IF_NAME_LEN];
-   char grpId[WFA_P2P_GRP_ID_LEN];   
-} caStaP2pDissolve_t;
-
-typedef struct ca_sta_send_p2p_inv_req
-{
-   char intf[WFA_IF_NAME_LEN];
-   char devId[WFA_P2P_DEVID_LEN];   
-   char grpId[WFA_P2P_GRP_ID_LEN];   
-   int reinvoke;
-} caStaSendP2pInvReq_t;
-
-typedef struct ca_sta_accept_p2p_inv_req
-{
-   char intf[WFA_IF_NAME_LEN];
-   char devId[WFA_P2P_DEVID_LEN];   
-   char grpId[WFA_P2P_GRP_ID_LEN];   
-   int reinvoke;
-} caStaAcceptP2pInvReq_t;
-
-
-typedef struct ca_sta_send_p2p_prov_dis_req
-{
-   char intf[WFA_IF_NAME_LEN];
-   char confMethod[16]; 
-   char devId[WFA_P2P_DEVID_LEN];
-} caStaSendP2pProvDisReq_t;
-
-typedef struct ca_sta_set_wps_pbc
-{
-   char intf[WFA_IF_NAME_LEN];
-   unsigned char grpid_flag;   
-   char grpId[WFA_P2P_GRP_ID_LEN]; 
-} caStaSetWpsPbc_t;
-
-typedef struct ca_sta_wps_read_pin
-{
-   char intf[WFA_IF_NAME_LEN];
-   unsigned char grpid_flag;   
-   char grpId[WFA_P2P_GRP_ID_LEN]; 
-} caStaWpsReadPin_t;
-
-typedef struct ca_sta_wps_read_label
-{
-   char intf[WFA_IF_NAME_LEN];
-   unsigned char grpid_flag;   
-   char grpId[WFA_P2P_GRP_ID_LEN]; 
-} caStaWpsReadLabel_t;
-
-typedef struct ca_sta_wps_enter_pin
-{
-   char intf[WFA_IF_NAME_LEN];
-   char wpsPin[WFA_WPS_PIN_LEN];
-   unsigned char grpid_flag;   
-   char grpId[WFA_P2P_GRP_ID_LEN];  
-} caStaWpsEnterPin_t;
-
-typedef struct ca_sta_get_psk
-{
-   char intf[WFA_IF_NAME_LEN];
-   char grpId[WFA_P2P_GRP_ID_LEN];      
-} caStaGetPsk_t;
-
-typedef struct ca_sta_get_p2p_ip_config
-{
-   char intf[WFA_IF_NAME_LEN];
-   char grpId[WFA_P2P_GRP_ID_LEN];      
-} caStaGetP2pIpConfig_t;
-
-typedef struct ca_sta_send_service_discovery_req
-{
-   char intf[WFA_IF_NAME_LEN];
-   char devId[WFA_P2P_DEVID_LEN];
-} caStaSendServiceDiscoveryReq_t;
-
-typedef struct ca_sta_send_p2p_presence_req
-{
-   char intf[WFA_IF_NAME_LEN];
-   long long int duration;
-   long long int interval;
-} caStaSendP2pPresenceReq_t;
-
-typedef struct ca_sta_add_arp_table_entry
-{
-   char intf[WFA_IF_NAME_LEN];
-   char macaddress [WFA_MAC_ADDR_STR_LEN];
-   char ipaddress [WFA_MAC_ADDR_STR_LEN];
-} caStaAddARPTableEntry_t;
-
-typedef struct ca_sta_block_icmp_reponse
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ipaddress [WFA_MAC_ADDR_STR_LEN];
-   char grpId[WFA_P2P_GRP_ID_LEN];      
-} caStaBlockICMPResponse_t;
-
-
-typedef struct ca_sta_set_sleep
-{
-   char intf[WFA_IF_NAME_LEN];
-   char grpId[WFA_P2P_GRP_ID_LEN];      
-} caStaSetSleep_t;
-
-typedef struct ca_sta_set_opportunistic_ps
-{
-   char intf[WFA_IF_NAME_LEN];
-   int ctwindow;
-   char grpId[WFA_P2P_GRP_ID_LEN];      
-} caStaSetOpprPs_t;
-
-/* P2P */
-
-typedef enum wfa_preambleType
-{      
-   eLong = 1,  
-   eShort
-} wfaPreambleType;
-
-typedef enum wfa_WirelessMode
-{      
-   eModeB = 1,
-   eModeBG,
-   eModeA,
-   eModeABG,
-   eModeAN,
-   eModeGN,
-   eModeNL,
-} wfaWirelessMode;
-
-typedef enum wfa_reset_prog
-{
-   eResetProg11n =1,
-} wfaResetProg;
-
-typedef struct ca_sta_preset_parameters
-{
-   char intf[WFA_IF_NAME_LEN]; 
-   wfaSupplicantName supplicant;
-   BYTE rtsFlag;
-   WORD rtsThreshold;
-   BYTE fragFlag;
-   WORD fragThreshold;
-   BYTE preambleFlag;
-   wfaPreambleType preamble;
-   BYTE modeFlag;
-   wfaWirelessMode wirelessMode;
-   BYTE psFlag;
-   BYTE legacyPowerSave;
-   BYTE wmmFlag;
-   BYTE wmmState;
-   BYTE reset;
-   BYTE ht;    // temperary for high throughput
-   BYTE ftoa;
-   BYTE ftds;
-   BYTE activescan;
-} caStaPresetParameters_t;
-
-typedef struct ca_sta_set_11n
-{
-   char intf[WFA_IF_NAME_LEN];
-   BOOL _40_intolerant;
-   BOOL addba_reject;
-   BOOL ampdu;
-   BOOL amsdu;
-   BOOL greenfield;
-   BOOL sgi20;
-   unsigned short stbc_rx;
-   unsigned short smps;
-   char width[8];
-   char mcs_fixedrate[4];
-   BOOL mcs32;
-   BOOL rifs_test;
-   unsigned char txsp_stream;
-   unsigned char rxsp_stream;
-} caSta11n_t;
-
-
-#define WFA_ENABLE 1
-#define WFA_DISABLE 0
-#define WFA_INVALID_BOOL 0xFF
-
-typedef struct ca_sta_set_wireless
-{
-   char intf[WFA_IF_NAME_LEN];
-   char band [8];
-#define NOACK_BE       0
-#define NOACK_BK       1
-#define NOACK_VI       2
-#define NOACK_VO       3
-   unsigned char noAck[4];
-} caStaSetWireless_t;
-
-typedef struct ca_sta_send_addba
-{
-   char intf[WFA_IF_NAME_LEN];
-   unsigned short tid; 
-} caStaSetSendADDBA_t;
-
-typedef struct ca_sta_set_rifs
-{
-   char intf [WFA_IF_NAME_LEN];
-   unsigned int action;
-
-} caStaSetRIFS_t;
-
-typedef struct ca_sta_send_coexist_mgmt
-{
-   char intf[WFA_IF_NAME_LEN];
-   char type[16];
-   char value[16];
-} caStaSendCoExistMGMT_t;
-
-typedef struct ca_sta_set_uapsd
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   int maxSPLength;
-   BYTE acBE;
-   BYTE acBK;
-   BYTE acVI;
-   BYTE acVO;
-} caStaSetUAPSD_t;
-
-typedef struct ca_sta_set_ibss
-{
-   char intf[WFA_IF_NAME_LEN];
-   char ssid[WFA_SSID_NAME_LEN];
-   int channel;
-   int encpType;
-   char keys[4][32];
-   int activeKeyIdx;
-} caStaSetIBSS_t;
-
-typedef struct sta_upload
-{
-   int type;
-   int next;     /* sequence number, 0 is the last one */
-} caStaUpload_t;
-
-typedef struct sta_debug_set
-{
-   unsigned short level;
-   unsigned short state;
-} staDebugSet_t;
-typedef struct config
-{
-   BYTE wmm;
-   int  rts_thr ;
-   int  frag_thr ;
-} wmmconf_t;
-
-typedef struct wmm_tsinfo
-{
-   unsigned int Reserved1 :1;
-   unsigned int TID       :4;
-   unsigned int direction :2;
-   unsigned int dummy1    :1;
-   unsigned int dummy2    :1;
-   unsigned int Reserved2 :1;
-   unsigned int PSB       :1;
-   unsigned int UP        :3;
-   unsigned int Reserved3 :2;
-   unsigned int Reserved4 :1;
-   unsigned int Reserved5 :7;
-}wmmtsinfo_t;
-
-typedef struct wmm_tspec
-{
-   wmmtsinfo_t      tsinfo;
-   BOOL Fixed;//The MSDU Fixed Bit
-   unsigned short size;//The MSDU Size
-   unsigned short maxsize;//MAximum MSDU Size
-   unsigned int   min_srvc;//The minimum Service Interval
-   unsigned int   max_srvc;//The maximum Service Interval
-   unsigned int inactivity;//Inactivity Interval
-   unsigned int suspension;//The Suspension Interval
-   unsigned int srvc_strt_tim;//The Service Start Time
-   unsigned int mindatarate;//The Minimum Data Rate
-   unsigned int meandatarate;//The Minimum Data Rate
-   unsigned int peakdatarate;//The Minimum Data Rate
-   unsigned int burstsize;//The Maximum Burst Size
-   unsigned int delaybound;//The Delay Bound
-   unsigned int PHYrate;//The minimum PHY Rate
-   float sba;//The Surplus Bandwidth Allownce
-   unsigned short medium_time;//The medium time
-}wmmtspec_t;
-
-typedef struct wmmac_addts
-{
-   BYTE       dialog_token;
-   BYTE       accesscat;
-   wmmtspec_t tspec;
-} wmmacadd_t;
-
-typedef struct ca_sta_set_wmm
-{
-   char intf[WFA_IF_NAME_LEN];
-   BYTE group;
-   BYTE action;
-#ifdef WFA_WMM_AC
-   BYTE       send_trig;
-   char       dipaddr[WFA_IP_ADDR_STR_LEN];
-   BYTE       trig_ac;
-#endif
-
-   union _action
-   {
-       wmmconf_t   config;
-       wmmacadd_t  addts;
-       BYTE        delts;
-   } actions;
-} caStaSetWMM_t;
-
-typedef struct ca_sta_set_pwrsave
-{
-   char intf[WFA_IF_NAME_LEN];
-   char mode[8];
-} caStaSetPwrSave_t;
-
-typedef struct ca_sta_reset_default
-{
-   char intf[WFA_IF_NAME_LEN];
-   char prog[8];
-} caStaResetDefault_t;
-
-typedef struct ca_dev_info
-{
-   BYTE fw;
-} caDevInfo_t;
-
-typedef struct dut_commands
-{
-   char intf[WFA_IF_NAME_LEN];
-   union _cmds
-   {
-       int streamId;
-       int iftype;
-       tgProfile_t profile;
-       tgPingStart_t startPing;
-       char ssid[WFA_SSID_NAME_LEN];
-          char resetProg[16];
-       caStaSetIpConfig_t ipconfig;
-       caStaVerifyIpConnect_t verifyIp;
-       caStaSetEncryption_t wep;       
-       caStaSetPSK_t        psk;
-       caStaSetEapTLS_t     tls;
-       caStaSetEapTTLS_t    ttls;
-       caStaSetEapSIM_t     sim;
-       caStaSetEapPEAP_t    peap;
-       caStaSetUAPSD_t      uapsd;
-       caStaSetIBSS_t       ibss;
-       caStaUpload_t        upload;
-       caStaSetWMM_t        setwmm;
-       staDebugSet_t        dbg;
-       caDevInfo_t          dev;
-       caStaAssociate_t         wps_assoc;        
-   } cmdsu;    
-} dutCommand_t;
-
-
-extern int buildCommandProcessTable(void);
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_cmdtbl.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_cmdtbl.c
deleted file mode 100644 (file)
index 64e6ede..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-/*
- * File: wfa_cmdtbl.c 
- *   The file contains a predefined function array. The command process and
- *   execution functions of a DUT traffic generator and control will be 
- *   registered in the array/table by the order of the defined commands TLV  
- *   values.
- *
- *   Revision History:
- *      2006/03/10 -- initially created by qhu
- *      2006/06/01 -- BETA release by qhu
- *      2006/06/13 -- 00.02 release by qhu
- *      2006/06/30 -- 00.10 Release by qhu
- *      2006/07/10 -- 01.00 Release by qhu
- *      2006/09/01 -- 01.05 Release by qhu
- *      2007/02/15  -- WMM Extension Beta released by qhu, mkaroshi
- *      2007/03/30 -- 01.40 WPA2 and Official WMM Beta release by qhu
- *      2007/04/20 -- 02.00 WPA2 and Official WMM release by qhu
- *      2007/08/15 --  02.10 WMM-Power Save release by qhu
- *      2007/10/10 --  02.20 Voice SOHO beta -- qhu
- *      2007/11/07 --  02.30 Voice HSO -- qhu
- *      2007/12/10 --  02.32 Add a function to upload test results.
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include "wfa_debug.h"
-#include "wfa_types.h"
-#include "wfa_main.h"
-#include "wfa_tlv.h"
-#include "wfa_tg.h"
-#include "wfa_miscs.h"
-#include "wfa_ca.h"
-#include "wfa_sock.h"
-#include "wfa_agt.h"
-#include "wfa_rsp.h"
-
-/* extern defined variables */
-extern int gxcSockfd, btSockfd;
-
-int NotDefinedYet(int len, unsigned char *params, int *respLen, BYTE *respBuf);
-extern int agtCmdProcGetVersion(int len, BYTE *parms, int *respLen, BYTE *respBuf);
-
-extern unsigned short wfa_defined_debug;
-
-/* globally define the function table */
-xcCommandFuncPtr gWfaCmdFuncTbl[WFA_STA_COMMANDS_END+(WFA_STA_NEW_COMMANDS_END - WFA_STA_NEW_COMMANDS_START - 1)+1] =
-{
-    /* Traffic Agent Commands */
-    NotDefinedYet,            /*    None                               (0) */
-    agtCmdProcGetVersion,     /*    WFA_GET_VERSION_TLV                (1) */ 
-    wfaTGSendPing,            /*    WFA_TRAFFIC_SEND_PING_TLV          (2) */
-    wfaTGStopPing,            /*    WFA_TRAFFIC_STOP_PING_TLV          (3) */
-    wfaTGConfig,              /*    WFA_TRAFFIC_AGENT_CONFIG_TLV       (4) */
-    wfaTGSendStart,           /*    WFA_TRAFFIC_AGENT_SEND_TLV         (5) */
-    wfaTGRecvStart,           /*    WFA_TRAFFIC_AGENT_RECV_START_TLV   (6) */
-    wfaTGRecvStop,            /*    WFA_TRAFFIC_AGENT_RECV_STOP_TLV    (7) */
-    wfaTGReset,               /*    WFA_TRAFFIC_AGENT_RESET_TLV        (8) */
-    NotDefinedYet,            /*    WFA_TRAFFIC_AGENT_STATUS_TLV       (9) */
-
-    /* Control and Configuration Commands */ 
-    wfaStaGetIpConfig,        /*    WFA_STA_GET_IP_CONFIG_TLV          (10)*/
-    wfaStaSetIpConfig,        /*    WFA_STA_SET_IP_CONFIG_TLV          (11)*/
-    wfaStaGetMacAddress,      /*    WFA_STA_GET_MAC_ADDRESS_TLV        (12)*/
-    NotDefinedYet,            /*    WFA_STA_SET_MAC_ADDRESS_TLV        (13)*/
-    wfaStaIsConnected,        /*    WFA_STA_IS_CONNECTED_TLV           (14)*/
-    wfaStaVerifyIpConnection, /*    WFA_STA_VERIFY_IP_CONNECTION_TLV   (15)*/
-    wfaStaGetBSSID,           /*    WFA_STA_GET_BSSID_TLV              (16)*/
-    wfaStaGetStats,           /*    WFA_STA_GET_STATS_TLV              (17)*/
-    wfaSetEncryption,         /*    WFA_STA_SET_ENCRYPTION_TLV         (18)*/
-    wfaStaSetPSK,             /*    WFA_STA_SET_PSK_TLV                (19)*/
-    wfaStaSetEapTLS,          /*    WFA_STA_SET_EAPTLS_TLV             (20)*/
-    wfaStaSetUAPSD,           /*    WFA_STA_SET_UAPSD_TLV              (21)*/
-    wfaStaAssociate,          /*    WFA_STA_ASSOCIATE_TLV              (22)*/
-    wfaStaSetEapTTLS,         /*    WFA_STA_SET_EAPTTLS_TLV            (23)*/
-    wfaStaSetEapSIM,          /*    WFA_STA_SET_EAPSIM_TLV             (24)*/
-    wfaStaSetPEAP,            /*    WFA_STA_SET_PEAP_TLV               (25)*/
-    wfaStaSetIBSS,            /*    WFA_STA_SET_IBSS_TLV               (26)*/
-    wfaStaGetInfo,            /*    WFA_STA_GET_INFO_TLV               (27)*/
-    wfaDeviceGetInfo,         /*    WFA_DEVICE_GET_INFO_TLV            (28)*/
-    wfaDeviceListIF,          /*    WFA_DEVICE_LIST_IF_TLV]            (29)*/ 
-    wfaStaDebugSet,           /*    WFA_STA_DEBUG_SET                  (30)*/
-    wfaStaSetMode,            /*    WFA_STA_SET_MODE                   (31)*/
-    wfaStaUpload,             /*    WFA_STA_UPLOAD                     (32)*/
-    wfaStaSetWMM,             /*    WFA_STA_SETWMM                     (33)*/
-    wfaStaReAssociate,        /*    WFA_STA_REASSOCIATE                (34)*/
-    wfaStaSetPwrSave,         /*    WFA_STA_SET_PWRSAVE                (35)*/
-
-    wfaStaSendNeigReq,        /*    WFA_STA_SEND_NEIGREQ               (36)*/
-    wfaStaPresetParams,       /*    WFA_STA_PRESET_PARAMETERS          (37)*/
-
-    wfaStaSetEapFAST,        /*    WFA_STA_SET_EAPFAST_TLV            (38)*/
-    wfaStaSetEapAKA,         /*    WFA_STA_SET_EAPAKA_TLV             (39)*/
-    wfaStaSetSystime,        /*    WFA_STA_SET_SYSTIME_TLV            (40)*/
-
-    wfaStaSet11n,            /*    WFA_STA_SET_11n_TLV                (41)*/
-    wfaStaSetWireless,       /*    WFA_STA_SET_WIRELESS_TLV           (42)*/
-    wfaStaSendADDBA,         /*    WFA_STA_SEND_ADDBA_TLV             (43)*/
-    wfaStaSendCoExistMGMT,    /*    WFA_STA_SET_COEXIST_MGMT_TLV       (44)*/
-    wfaStaSetRIFS,            /*    WFA_STA_SET_RIFS_TEST_TLV          (45)*/
-    wfaStaResetDefault,       /*    WFA_STA_RESET_DEFAULT_TLV          (46)*/
-    wfaStaDisconnect,          /*    WFA_STA_DISCONNECT_TLV             (47)*/
-       wfaStaGetP2pDevAddress,     /*    WFA_STA_GET_P2P_DEV_ADDRESS_TLV                     (48)*/
-       wfaStaSetP2p,                       /*  WFA_STA_SET_P2P_TLV                         (49)*/              
-       wfaStaP2pConnect,           /*    WFA_STA_P2P_CONNECT_TLV                     (50)*/   
-       wfaStaStartAutoGo,                  /* WFA_STA_START_AUTO_GO            (51)*/
-       wfaStaP2pStartGrpFormation, /*    WFA_STA_P2P_START_GRP_FORMATION_TLV                     (52)*/
-
-       wfaStaP2pDissolve,          /*    WFA_STA_P2P_DISSOLVE_TLV                     (53)*/
-       wfaStaSendP2pInvReq,            /*      WFA_STA_SEND_P2P_INV_REQ_TLV                        (54)*/              
-       wfaStaAcceptP2pInvReq,                  /*      WFA_STA_ACCEPT_P2P_INV_REQ_TLV                      (55)*/              
-       wfaStaSendP2pProvDisReq,    /*    WFA_STA_SEND_P2P_PROV_DIS_REQ_TLV                     (56)*/    
-       wfaStaSetWpsPbc,            /*    WFA_STA_SET_WPS_PBC_TLV                     (57)*/    
-
-       wfaStaWpsReadPin,           /*    WFA_STA_WPS_READ_PIN_TLV                     (58)*/
-       wfaStaWpsEnterPin,                      /*      WFA_STA_WPS_ENTER_PIN_TLV                           (59)*/              
-       wfaStaGetPsk,               /*    WFA_STA_GET_PSK_TLV                     (60)*/    
-       wfaStaP2pReset,             /*    WFA_STA_P2P_RESET_TLV                     (61)*/    
-       wfaStaWpsReadLabel,             /*    WFA_STA_WPS_READ_LABEL_TLV                     (62)*/
-       wfaStaGetP2pIpConfig,             /*    WFA_STA_GET_P2P_IP_CONFIG_TLV                     (63)*/
-       wfaStaSendServiceDiscoveryReq,             /*    WFA_STA_SEND_SERVICE_DISCOVERY_REQ_TLV                     (64)*/
-       wfaStaSendP2pPresenceReq,             /*    WFA_STA_SEND_P2P_PRESENCE_REQ_TLV                     (65)*/
-       wfaStaSetSleepReq,             /*    WFA_STA_SEND_P2P_PRESENCE_REQ_TLV                     (66)*/
-       wfaStaSetOpportunisticPsReq,             /*    WFA_STA_SET_OPPORTUNISTIC_PS_TLV                     (67)*/
-
-       wfaStaAddArpTableEntry,    /*    WFA_STA_ADD_ARP_TABLE_ENTRY_TLV      (68)*/
-       wfaStaBlockICMPResponse    /*    WFA_STA_BLOCK_ICMP_RESPONSE_TLV      (69)*/
-
-};
-    
-
-/*
- * NotDefinedYet(): a dummy function
- */
-int NotDefinedYet(int len, unsigned char *params, int *respLen, BYTE *respBuf)
-{
-    DPRINT_WARNING(WFA_WNG, "The command processing function not defined.\n");
-
-
-    /* need to send back a response */
-
-    return TRUE;
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_cs.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_cs.c
deleted file mode 100644 (file)
index 2d966c5..0000000
+++ /dev/null
@@ -1,3196 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-/* 
- *   File: wfa_cs.c -- configuration and setup
- *   This file contains all implementation for the dut setup and control 
- *   functions, such as network interfaces, ip address and wireless specific
- *   setup with its supplicant.
- *
- *   The current implementation is to show how these functions
- *   should be defined in order to support the Agent Control/Test Manager 
- *   control commands. To simplify the current work and avoid any GPL licenses,
- *   the functions mostly invoke shell commands by calling linux system call,
- *   system("<commands>"). 
- *
- *   It depends on the differnt device and platform, vendors can choice their
- *   own ways to interact its systems, supplicants and process these commands
- *   such as using the native APIs.
- *
- *   Revision History:
- *        2006/03/10  -- initially created by qhu
- *        2006/06/01  -- BETA Release by qhu
- *        2006/06/13  -- 00.02 Release by qhu
- *        2006/06/30  -- 00.10 Release by qhu
- *        2006/07/10  -- 01.00 Release by qhu
- *        2006/09/01  -- 01.05 Release by qhu
- *        2006/10/26  -- 01.06 Released by qhu
- *                       replace hardcoded buf size with macro
- *        2006/12/02  -- bugs: 1. fixes incorrect order of getipconfig.sh
- *                                input parameters reported by p.schwann
- *                             2. will add a new network for wap_cli command
- *                                in case the network id 0 not present,
- *                                recommended by c.benson
- *                                the solution is to reimplement with calling
- *                                native C API
- *        2007/01/11  -- 01.10 released by qhu
- *        2007/02/15  -- WMM Extension Beta released by qhu, mkaroshi
- *        2007/03/18  -- add file close statements
- *        2007/03/21  -- rename the file to avoid the confusion.
- *        2007/03/30  -- 01.40 WPA2 and Official WMM Beta Release by qhu
- *        2007/04/20  -- 02.00 WPA2 and Official WMM Release by qhu
- *        2007/08/15 --  02.10 WMM-Power Save release by qhu
- *        2007/10/10 --  02.20 Voice SOHO beta -- qhu
- *        2007/11/07 --  02.30 Voice HSO -- qhu
- *        2007/12/10 --  02.32 Add a function to upload test results.
- *        2008/01/03 --  02.34 Support the result upload command.
- *        2008/03/12 --  02.41 Bug #16, incorrect file descriptor used. Change 
- *                       the "tmpfile" to "tmpfd" and a few places. Make a macro
- *                       WFA_STAUT_IF in file "inc/wfa_cs.h" for WLAN interface
- *                       name in the function "wfaDeviceListIF()
- *                      
- *                       Not A Bug. Put back to the function from 
- *                       wfaSetEncryption1() to wfaSetEncryption() for 
- *                       supporting WEP. Porting could select which should be 
- *                       used according to WEP support or not.
- *                        
- *        
- */ 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <linux/types.h>
-#include <linux/socket.h>
-#include <poll.h>
-
-#include "wfa_portall.h"
-#include "wfa_debug.h"
-#include "wfa_ver.h"
-#include "wfa_main.h"
-#include "wfa_types.h"
-#include "wfa_ca.h"
-#include "wfa_tlv.h"
-#include "wfa_sock.h"
-#include "wfa_tg.h"
-#include "wfa_cmds.h"
-#include "wfa_rsp.h"
-#include "wfa_utils.h"
-#ifdef WFA_WMM_PS_EXT
-#include "wfa_wmmps.h"
-#endif
-
-#if 1 // by bbelief
-#include "wpa_helpers.h"
-#include "wfa_p2p.h"
-#endif
-
-#define CERTIFICATES_PATH    "/etc/wpa_supplicant"
-
-/* Some device may only support UDP ECHO, activate this line */
-//#define WFA_PING_UDP_ECHO_ONLY 1
-
-extern unsigned short wfa_defined_debug;
-int wfaExecuteCLI(char *CLI);
-
-/* Since the two definitions are used all over the CA function */
-char gCmdStr[WFA_CMD_STR_SZ];
-dutCmdResponse_t gGenericResp;
-int wfaTGSetPrio(int sockfd, int tgClass);
-void create_apts_msg(int msg, unsigned int txbuf[],int id);
-
-extern char e2eResults[];
-//extern char *e2eResults;
-FILE *e2efp = NULL;
-int chk_ret_status()
-{
-    char *ret = getenv(WFA_RET_ENV);
-
-    if(*ret == '1')
-       return TRUE;
-    else
-       return FALSE;
-}
-
-/*
- * agtCmdProcGetVersion(): response "ca_get_version" command to controller
- *  input:  cmd --- not used
- *          valLen -- not used
- *  output: parms -- a buffer to store the version info response.
- */
-int agtCmdProcGetVersion(int len, BYTE *parms, int *respLen, BYTE *respBuf)
-{
-    dutCmdResponse_t *getverResp = &gGenericResp;
-
-    DPRINT_INFO(WFA_OUT, "entering agtCmdProcGetVersion ...\n");
-
-    getverResp->status = STATUS_COMPLETE;
-    wSTRNCPY(getverResp->cmdru.version, WFA_SYSTEM_VER, WFA_VERNAM_LEN);
-
-    wfaEncodeTLV(WFA_GET_VERSION_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)getverResp, respBuf);
-
-    *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-    return TRUE;
-}
-
-/*
- * wfaStaAssociate():
- *    The function is to force the station wireless I/F to re/associate 
- *    with the AP.
- */
-int wfaStaAssociate(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCommand_t *assoc = (dutCommand_t *)caCmdBuf;
-   char *ifname = assoc->intf;
-   dutCmdResponse_t *staAssocResp = &gGenericResp;
-   // WPS stations only        
-   caStaAssociate_t *assoc_wps = (caStaAssociate_t *)&(assoc->cmdsu.wps_assoc);
-
-   DPRINT_INFO(WFA_OUT, "entering wfaStaAssociate ...\n");
-   /* use 'ifconfig' command to bring down the interface (linux specific) */
-   sprintf(gCmdStr, "ifconfig %s down", ifname);
-   system(gCmdStr);
-
-
-   // WPS stations
-       DPRINT_INFO(WFA_OUT, "The WPS option is : %d \n",assoc_wps->wps);               
-   /* use 'ifconfig' command to bring up the interface (linux specific) */
-   sprintf(gCmdStr, "ifconfig %s up", ifname);
-   system(gCmdStr);
-
-   /* 
-    *  use 'wpa_cli' command to force a 802.11 re/associate 
-    *  (wpa_supplicant specific) 
-    */
-   sprintf(gCmdStr, "wpa_cli -i%s reassociate", ifname);
-   system(gCmdStr);
-
-   /*
-    * Then report back to control PC for completion.
-    * This does not have failed/error status. The result only tells
-    * a completion.
-    */
-   staAssocResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_ASSOCIATE_RESP_TLV, 4, (BYTE *)staAssocResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE; 
-}
-
-/*
- * wfaStaReAssociate():
- *    The function is to force the station wireless I/F to re/associate 
- *    with the AP.
- */
-int wfaStaReAssociate(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCommand_t *assoc = (dutCommand_t *)caCmdBuf;
-   char *ifname = assoc->intf;
-   dutCmdResponse_t *staAssocResp = &gGenericResp;
-
-   DPRINT_INFO(WFA_OUT, "entering wfaStaAssociate ...\n");
-   /* use 'ifconfig' command to bring down the interface (linux specific) */
-   sprintf(gCmdStr, "ifconfig %s down", ifname);
-   system(gCmdStr);
-
-   /* use 'ifconfig' command to bring up the interface (linux specific) */
-   sprintf(gCmdStr, "ifconfig %s up", ifname);
-
-   /* 
-    *  use 'wpa_cli' command to force a 802.11 re/associate 
-    *  (wpa_supplicant specific) 
-    */
-   sprintf(gCmdStr, "wpa_cli -i%s reassociate", ifname);
-   system(gCmdStr);
-
-   /*
-    * Then report back to control PC for completion.
-    * This does not have failed/error status. The result only tells
-    * a completion.
-    */
-   staAssocResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_ASSOCIATE_RESP_TLV, 4, (BYTE *)staAssocResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE; 
-}
-
-/*
- * wfaStaIsConnected():
- *    The function is to check whether the station's wireless I/F has 
- *    already connected to an AP.
- */
-int wfaStaIsConnected(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCommand_t *connStat = (dutCommand_t *)caCmdBuf;
-   dutCmdResponse_t *staConnectResp = &gGenericResp;
-   char *ifname = connStat->intf;
-   FILE *tmpfile = NULL;
-   char result[32];
-
-
-   DPRINT_INFO(WFA_OUT, "Entering isConnected ...\n"); 
-
-#if 1
-    if (get_wpa_status(ifname, "wpa_state", result, sizeof(result)) < 0)
-            return -2;
-   DPRINT_INFO(WFA_OUT, "wpa_state : %s\n", result); 
-   
-    if(strcmp(result, "COMPLETED") == 0)
-        staConnectResp->cmdru.connected = 1;
-   else
-      staConnectResp->cmdru.connected = 0;
-
-#else
-#ifdef WFA_NEW_CLI_FORMAT
-   sprintf(gCmdStr, "wfa_chkconnect %s\n", ifname); 
-   system(gCmdStr);
-
-   if(chk_ret_status() == TRUE)
-      staConnectResp->cmdru.connected = 1;
-   else
-      staConnectResp->cmdru.connected = 0;
-#else
-   /*
-    * use 'wpa_cli' command to check the interface status
-    * none, scanning or complete (wpa_supplicant specific)
-    */
-   sprintf(gCmdStr, "/sbin/wpa_cli -i%s status | grep ^wpa_state= | cut -f2- -d= > /tmp/.isConnected", ifname);
-   system(gCmdStr);
-
-   /*
-    * the status is saved in a file.  Open the file and check it.
-    */
-   tmpfile = fopen("/tmp/.isConnected", "r+");
-   if(tmpfile == NULL)
-   {
-      staConnectResp->status = STATUS_ERROR;
-      wfaEncodeTLV(WFA_STA_IS_CONNECTED_RESP_TLV, 4, (BYTE *)staConnectResp, respBuf);
-      *respLen = WFA_TLV_HDR_LEN + 4;
-
-      DPRINT_ERR(WFA_ERR, "file open failed\n");
-      return FALSE;
-   }
-
-   fscanf(tmpfile, "%s", result);
-
-   if(strncmp(result, "COMPLETED", 9) == 0)
-      staConnectResp->cmdru.connected = 1;
-   else
-      staConnectResp->cmdru.connected = 0;
-#endif
-#endif
-
-   /*
-    * Report back the status: Complete or Failed.
-    */
-   staConnectResp->status = STATUS_COMPLETE;
-   
-   wfaEncodeTLV(WFA_STA_IS_CONNECTED_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)staConnectResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-   return TRUE;
-}
-
-/*
- * wfaStaGetIpConfig():
- * This function is to retriev the ip info including
- *     1. dhcp enable
- *     2. ip address
- *     3. mask 
- *     4. primary-dns
- *     5. secondary-dns
- *
- *     The current implementation is to use a script to find these information
- *     and store them in a file. 
- */
-int wfaStaGetIpConfig(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    int slen, ret, i = 0;
-    dutCommand_t *getIpConf = (dutCommand_t *)caCmdBuf;
-    dutCmdResponse_t *ipconfigResp = &gGenericResp; 
-    char *ifname = getIpConf->intf;
-    caStaGetIpConfigResp_t *ifinfo = &ipconfigResp->cmdru.getIfconfig;
-
-    FILE *tmpfd;
-    char string[256];
-    char *str;
-
-    /*
-     * check a script file (the current implementation specific)
-     */
-    ret = access("/usr/local/sbin/getipconfig.sh", F_OK);
-    if(ret == -1)
-    {
-       ipconfigResp->status = STATUS_ERROR;
-       wfaEncodeTLV(WFA_STA_GET_IP_CONFIG_RESP_TLV, 4, (BYTE *)ipconfigResp, respBuf);   
-       *respLen = WFA_TLV_HDR_LEN + 4;
-
-       DPRINT_ERR(WFA_ERR, "file not exist\n");
-       return FALSE; 
-
-    }
-
-    strcpy(ifinfo->dns[0], "0");
-    strcpy(ifinfo->dns[1], "0");
-    
-    /*
-     * Run the script file "getipconfig.sh" to check the ip status 
-     * (current implementation  specific). 
-     * note: "getipconfig.sh" is only defined for the current implementation
-     */
-    sprintf(gCmdStr, "getipconfig.sh /tmp/ipconfig.txt %s\n", ifname); 
-
-    system(gCmdStr);
-
-    /* open the output result and scan/retrieve the info */
-    tmpfd = fopen("/tmp/ipconfig.txt", "r+");
-
-    if(tmpfd == NULL)
-    {
-      ipconfigResp->status = STATUS_ERROR;
-      wfaEncodeTLV(WFA_STA_GET_IP_CONFIG_RESP_TLV, 4, (BYTE *)ipconfigResp, respBuf);
-      *respLen = WFA_TLV_HDR_LEN + 4;
-
-      DPRINT_ERR(WFA_ERR, "file open failed\n");
-      return FALSE;
-    }
-
-    for(;;)
-    {
-        if(fgets(string, 256, tmpfd) == NULL)
-           break; 
-
-        /* check dhcp enabled */
-        if(strncmp(string, "dhcpcli", 7) ==0)
-        {
-            str = strtok(string, "=");
-            str = strtok(NULL, "=");
-            if(str != NULL)
-               ifinfo->isDhcp = 1;
-            else
-               ifinfo->isDhcp = 0;
-        }
-
-        /* find out the ip address */
-        if(strncmp(string, "ipaddr", 6) == 0)
-        {
-            str = strtok(string, "=");
-            str = strtok(NULL, " ");
-            if(str != NULL)
-            {
-               wSTRNCPY(ifinfo->ipaddr, str, 15);
-               ifinfo->ipaddr[15]='\0';
-            }
-            else
-               wSTRNCPY(ifinfo->ipaddr, "none", 15);
-        }
-
-        /* check the mask */
-        if(strncmp(string, "mask", 4) == 0)
-        {
-            char ttstr[16];
-            char *ttp = ttstr;
-
-            str = strtok_r(string, "=", &ttp);
-            if(*ttp != '\0')
-            {
-               strcpy(ifinfo->mask, ttp);
-               slen = strlen(ifinfo->mask);
-               ifinfo->mask[slen-1] = '\0';
-            }
-            else
-               strcpy(ifinfo->mask, "none");
-        }
-
-        /* find out the dns server ip address */
-        if(strncmp(string, "nameserv", 8) == 0)
-        {
-            char ttstr[16];
-            char *ttp = ttstr;
-            
-            str = strtok_r(string, " ", &ttp);
-            if(str != NULL && i < 2)
-            {
-               strcpy(ifinfo->dns[i], ttp);
-               slen = strlen(ifinfo->dns[i]);
-               ifinfo->dns[i][slen-1] = '\0';
-            }
-            else
-               strcpy(ifinfo->dns[i], "none");
-
-            i++;
-        }
-     }
-
-     /*
-      * Report back the results
-      */
-     ipconfigResp->status = STATUS_COMPLETE;
-     wfaEncodeTLV(WFA_STA_GET_IP_CONFIG_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)ipconfigResp, respBuf);   
-
-     *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-#if 0
-     DPRINT_INFO(WFA_OUT, "%i %i %s %s %s %s %i\n", ipconfigResp->status, 
-        ifinfo->isDhcp, ifinfo->ipaddr, ifinfo->mask, 
-            ifinfo->dns[0], ifinfo->dns[1], *respLen);
-#endif
-
-     fclose(tmpfd);
-     return TRUE;
-}
-
-/*
- * wfaStaSetIpConfig():
- *   The function is to set the ip configuration to a wireless I/F.
- *   1. IP address
- *   2. Mac address
- *   3. default gateway
- *   4. dns nameserver (pri and sec).  
- */
-int wfaStaSetIpConfig(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCommand_t *setIpConf = (dutCommand_t *)caCmdBuf;
-   caStaSetIpConfig_t *ipconfig = &setIpConf->cmdsu.ipconfig;
-   dutCmdResponse_t *staSetIpResp = &gGenericResp;
-
-   DPRINT_INFO(WFA_OUT, "entering wfaStaSetIpConfig ...\n");
-
-   /*
-    * Use command 'ifconfig' to configure the interface ip address, mask.
-    * (Linux specific).
-    */
-   sprintf(gCmdStr, "/sbin/ifconfig %s %s netmask %s > /dev/null 2>&1 ", ipconfig->intf, ipconfig->ipaddr, ipconfig->mask);
-   system(gCmdStr);
-
-   /* use command 'route add' to set set gatewway (linux specific) */ 
-   if(ipconfig->defGateway[0] != '\0')
-   {
-      sprintf(gCmdStr, "/sbin/route add default gw %s > /dev/null 2>&1", ipconfig->defGateway);
-      system(gCmdStr);
-   }
-
-   /* set dns (linux specific) */
-   sprintf(gCmdStr, "cp /etc/resolv.conf /tmp/resolv.conf.bk");
-   system(gCmdStr);
-   sprintf(gCmdStr, "echo nameserv %s > /etc/resolv.conf", ipconfig->pri_dns);
-   system(gCmdStr);
-   sprintf(gCmdStr, "echo nameserv %s >> /etc/resolv.conf", ipconfig->sec_dns);
-   system(gCmdStr);
-
-   /*
-    * report status
-    */
-   staSetIpResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_IP_CONFIG_RESP_TLV, 4, (BYTE *)staSetIpResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-/*
- * wfaStaVerifyIpConnection():
- * The function is to verify if the station has IP connection with an AP by
- * send ICMP/pings to the AP.
- */ 
-int wfaStaVerifyIpConnection(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCommand_t *verip = (dutCommand_t *)caCmdBuf;
-   dutCmdResponse_t *verifyIpResp = &gGenericResp;
-
-#ifndef WFA_PING_UDP_ECHO_ONLY
-   char strout[64], *pcnt;
-   FILE *tmpfile;
-   
-   DPRINT_INFO(WFA_OUT, "Entering wfaStaVerifyIpConnection ...\n");
-
-   /* set timeout value in case not set */
-   if(verip->cmdsu.verifyIp.timeout <= 0)
-   {
-        verip->cmdsu.verifyIp.timeout = 10;
-   }
-   
-   /* execute the ping command  and pipe the result to a tmp file */
-   sprintf(gCmdStr, "ping %s -c 3 -W %u | grep loss | cut -f3 -d, 1>& /tmp/pingout.txt", verip->cmdsu.verifyIp.dipaddr, verip->cmdsu.verifyIp.timeout);
-   system(gCmdStr); 
-
-   /* scan/check the output */
-   tmpfile = fopen("/tmp/pingout.txt", "r+");
-   if(tmpfile == NULL)
-   {
-      verifyIpResp->status = STATUS_ERROR;
-      wfaEncodeTLV(WFA_STA_VERIFY_IP_CONNECTION_RESP_TLV, 4, (BYTE *)verifyIpResp, respBuf);   
-      *respLen = WFA_TLV_HDR_LEN + 4;
-
-      DPRINT_ERR(WFA_ERR, "file open failed\n");
-      return FALSE;
-   }
-   
-   verifyIpResp->status = STATUS_COMPLETE;
-   if(fscanf(tmpfile, "%s", strout) == EOF)
-       verifyIpResp->cmdru.connected = 0;
-   else
-   {
-       pcnt = strtok(strout, "%"); 
-       
-       /* if the loss rate is 100%, not able to connect */
-       if(atoi(pcnt) == 100)
-          verifyIpResp->cmdru.connected = 0;
-       else
-          verifyIpResp->cmdru.connected = 1;
-   }
-
-   fclose(tmpfile);
-#else
-   int btSockfd;
-   struct pollfd fds[2];
-   int timeout = 2000;
-   char anyBuf[64];
-   struct sockaddr_in toAddr;
-   int done = 1, cnt = 0, ret, nbytes;
-
-   verifyIpResp->status = STATUS_COMPLETE;
-   verifyIpResp->cmdru.connected = 0;
-
-   btSockfd = wfaCreateUDPSock("127.0.0.1", WFA_UDP_ECHO_PORT);
-
-   if(btSockfd == -1)
-   {
-      verifyIpResp->status = STATUS_ERROR;
-      wfaEncodeTLV(WFA_STA_VERIFY_IP_CONNECTION_RESP_TLV, 4, (BYTE *)verifyIpResp, respBuf);   
-      *respLen = WFA_TLV_HDR_LEN + 4;
-      return FALSE;;
-   }
-
-   toAddr.sin_family = AF_INET;
-   toAddr.sin_addr.s_addr = inet_addr(verip->cmdsu.verifyIp.dipaddr);
-   toAddr.sin_port = htons(WFA_UDP_ECHO_PORT);
-
-   while(done)
-   {
-       wfaTrafficSendTo(btSockfd, (char *)anyBuf, 64, (struct sockaddr *)&toAddr);
-       cnt++;
-
-       fds[0].fd = btSockfd;
-       fds[0].events = POLLIN | POLLOUT; 
-
-       ret = poll(fds, 1, timeout);
-       switch(ret)
-       {
-           case 0:
-             /* it is time out, count a packet lost*/
-           break;
-           case -1:
-             /* it is an error */
-           default:
-           {
-              switch(fds[0].revents)
-              {
-                  case POLLIN:
-                  case POLLPRI:
-                  case POLLOUT:
-                  nbytes = wfaTrafficRecv(btSockfd, (char *)anyBuf, (struct sockaddr *)&toAddr);
-                  if(nbytes != 0)
-                      verifyIpResp->cmdru.connected = 1;
-                      done = 0;
-                  break;
-                  default:
-                  /* errors but not care */
-                   ;
-              } 
-           }
-       } 
-       if(cnt == 3)
-       {
-          done = 0;
-       }
-   }
-       
-#endif
-
-   wfaEncodeTLV(WFA_STA_VERIFY_IP_CONNECTION_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)verifyIpResp, respBuf);   
-
-   *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-   
-   return TRUE;
-}
-
-/*
- * wfaStaGetMacAddress()
- *    This function is to retrieve the MAC address of a wireless I/F.
- */
-int wfaStaGetMacAddress(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    dutCommand_t *getMac = (dutCommand_t *)caCmdBuf;
-    dutCmdResponse_t *getmacResp = &gGenericResp;
-    char *str;
-    char *ifname = getMac->intf;
-
-    FILE *tmpfd;
-    char string[128];
-
-    DPRINT_INFO(WFA_OUT, "Entering wfaStaGetMacAddress ...\n");
-    /*
-     * run the script "getipconfig.sh" to find out the mac
-     */
-    //sprintf(gCmdStr, "getipconfig.sh /tmp/ipconfig.txt %s", ifname); 
-    sprintf(gCmdStr, "ifconfig %s > /tmp/ipconfig.txt ", ifname); 
-    system(gCmdStr);
-
-    tmpfd = fopen("/tmp/ipconfig.txt", "r+");
-    if(tmpfd == NULL)
-    {
-      getmacResp->status = STATUS_ERROR;
-      wfaEncodeTLV(WFA_STA_GET_MAC_ADDRESS_RESP_TLV, 4, (BYTE *)getmacResp, respBuf);   
-      *respLen = WFA_TLV_HDR_LEN + 4;
-
-      DPRINT_ERR(WFA_ERR, "file open failed\n");
-      return FALSE;
-    }
-
-        if(fgets(string, 256, tmpfd) == NULL)
-        {
-           getmacResp->status = STATUS_ERROR;
-        }
-
-         str = strtok(string, " ");
-         while(str && ((strcmp(str,"HWaddr")) != 0))
-        {
-            str = strtok(NULL, " ");
-        }
-         
-        /* get mac */
-        if(str)
-            {
-          str = strtok(NULL, " ");
-          strcpy(getmacResp->cmdru.mac, str);
-               getmacResp->status = STATUS_COMPLETE;
-    }
-    wfaEncodeTLV(WFA_STA_GET_MAC_ADDRESS_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)getmacResp, respBuf);   
-
-    *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-    fclose(tmpfd);
-    return TRUE;
-}
-
-/*
- * wfaStaGetStats():
- * The function is to retrieve the statistics of the I/F's layer 2 txFrames, 
- * rxFrames, txMulticast, rxMulticast, fcsErrors/crc, and txRetries.
- * Currently there is not definition how to use these info. 
- */
-int wfaStaGetStats(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t *statsResp = &gGenericResp;
-
-   /* this is never used, you can skip this call */
-
-   statsResp->status = STATUS_ERROR;
-   wfaEncodeTLV(WFA_STA_GET_STATS_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)statsResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-
-   return TRUE;
-}
-
-/*
- * wfaSetEncryption():
- *   The function is to set the wireless interface with WEP or none.
- *
- *   Since WEP is optional test, current function is only used for 
- *   resetting the Security to NONE/Plaintext (OPEN). To test WEP, 
- *   this function should be replaced by the next one (wfaSetEncryption1())
- *
- *   Input parameters: 
- *     1. I/F
- *     2. ssid
- *     3. encpType - wep or none
- *     Optional:
- *     4. key1
- *     5. key2
- *     6. key3
- *     7. key4
- *     8. activeKey Index
- */
-
-int wfaSetEncryption1(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetEncryption_t *setEncryp = (caStaSetEncryption_t *)caCmdBuf;
-   dutCmdResponse_t *setEncrypResp = &gGenericResp;
-   
-   /*
-    * disable the network first
-    */
-   sprintf(gCmdStr, "wpa_cli -i %s disable_network 0", setEncryp->intf);
-   system(gCmdStr);
-
-   /*
-    * set SSID
-    */    
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", setEncryp->intf, setEncryp->ssid);
-   system(gCmdStr);
-
-   /*
-    * Tell the supplicant for infrastructure mode (1)
-    */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 mode 0", setEncryp->intf);
-   system(gCmdStr);
-
-   /*
-    * set Key management to NONE (NO WPA) for plaintext or WEP
-    */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt NONE", setEncryp->intf);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", setEncryp->intf);
-   system(gCmdStr);
-
-   setEncrypResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_ENCRYPTION_RESP_TLV, 4, (BYTE *)setEncrypResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-/*
- *  Since WEP is optional, this function could be used to replace
- *  wfaSetEncryption() if necessary. 
- */
-int wfaSetEncryption(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetEncryption_t *setEncryp = (caStaSetEncryption_t *)caCmdBuf;
-   dutCmdResponse_t *setEncrypResp = &gGenericResp;
-   int i;
-
-   /*
-    * disable the network first
-    */
-   sprintf(gCmdStr, "wpa_cli -i %s disable_network 0", setEncryp->intf);
-   system(gCmdStr);
-
-   /*
-    * set SSID
-    */    
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", setEncryp->intf, setEncryp->ssid);
-   system(gCmdStr);
-
-   /*
-    * Tell the supplicant for infrastructure mode (1)
-    */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 mode 0", setEncryp->intf);
-   system(gCmdStr);
-
-   /*
-    * set Key management to NONE (NO WPA) for plaintext or WEP
-    */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt NONE", setEncryp->intf);
-   system(gCmdStr);
-
-   /* set keys */
-   if(setEncryp->encpType == 1)
-   {
-      for(i=0; i<4; i++)
-      {
-         if(setEncryp->keys[i][0] != '\0')
-         {
-             sprintf(gCmdStr, "wpa_cli -i %s set_network 0 wep_key%i %s",
-                   setEncryp->intf, i, setEncryp->keys[i]);
-             system(gCmdStr);
-         }
-      }
-
-      /* set active key */
-      i = setEncryp->activeKeyIdx;
-      if(setEncryp->keys[i][0] != '\0')
-      {
-          sprintf(gCmdStr, "wpa_cli -i %s set_network 0 wep_tx_keyidx %i",
-            setEncryp->intf, setEncryp->activeKeyIdx);
-          system(gCmdStr);
-      }
-   }
-   else /* clearly remove the keys -- reported by p.schwann */
-   {
-         
-      for(i = 0; i < 4; i++)
-      {
-          sprintf(gCmdStr, "wpa_cli -i %s set_network 0 wep_key%i \"\"", setEncryp->intf, i);
-          system(gCmdStr);
-      }
-   }
-
-   sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", setEncryp->intf);
-   system(gCmdStr);
-
-   setEncrypResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_ENCRYPTION_RESP_TLV, 4, (BYTE *)setEncrypResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-/*
- * wfaStaSetEapTLS():
- *   This is to set
- *   1. ssid
- *   2. encrypType - tkip or aes-ccmp
- *   3. keyManagementType - wpa or wpa2
- *   4. trustedRootCA
- *   5. clientCertificate
- */
-int wfaStaSetEapTLS(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetEapTLS_t *setTLS = (caStaSetEapTLS_t *)caCmdBuf;
-   char *ifname = setTLS->intf;
-   dutCmdResponse_t *setEapTlsResp = &gGenericResp;
-
-   DPRINT_INFO(WFA_OUT, "Entering wfaStaSetEapTLS ...\n");
-
-   /*
-    * need to store the trustedROOTCA and clientCertificate into a file first.
-    */
-#ifdef WFA_NEW_CLI_FORMAT
-   sprintf(gCmdStr, "wfa_set_eaptls -i %s %s %s %s", ifname, setTLS->ssid, setTLS->trustedRootCA, setTLS->clientCertificate);
-   system(gCmdStr);
-#else
-
-   sprintf(gCmdStr, "wpa_cli -i %s disable_network 0", ifname);
-   system(gCmdStr);
-
-   /* ssid */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", ifname, setTLS->ssid);
-   system(gCmdStr);
-
-   /* key management */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt WPA-EAP", ifname);
-   system(gCmdStr);
-
-   /* protocol WPA */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 proto WPA", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 eap TLS", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ca_cert '\"%s\"'", ifname, setTLS->trustedRootCA);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 identity '\"wifi-user@wifilabs.local\"'", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 private_key '\"%s/%s\"'", ifname, CERTIFICATES_PATH, setTLS->clientCertificate);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 private_key_passwd '\"wifi\"'", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", ifname);
-   system(gCmdStr);
-#endif
-
-   setEapTlsResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_EAPTLS_RESP_TLV, 4, (BYTE *)setEapTlsResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-/*
- * The function is to set 
- *   1. ssid
- *   2. passPhrase
- *   3. keyMangementType - wpa/wpa2
- *   4. encrypType - tkip or aes-ccmp
- */
-int wfaStaSetPSK(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetPSK_t *setPSK = (caStaSetPSK_t *)caCmdBuf;
-   dutCmdResponse_t *setPskResp = &gGenericResp;
-
-#ifdef WFA_NEW_CLI_FORMAT
-   sprintf(gCmdStr, "wfa_set_psk %s %s %s", setPSK->intf, setPSK->ssid, setPSK->passphrase); 
-   system(gCmdStr);
-#else
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", setPSK->intf, setPSK->ssid); 
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt WPA-PSK", setPSK->intf); 
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 psk '\"%s\"'", setPSK->intf, setPSK->passphrase); 
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", setPSK->intf);
-   system(gCmdStr);
-#endif
-
-   setPskResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_PSK_RESP_TLV, 4, (BYTE *)setPskResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE; 
-}
-
-/*
- * wfaStaGetInfo(): 
- * Get vendor specific information in name/value pair by a wireless I/F.
- */
-int wfaStaGetInfo(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   dutCommand_t *getInfo = (dutCommand_t *)caCmdBuf;
-
-   /*
-    * Normally this is called to retrieve the vendor information
-    * from a interface, no implement yet
-    */
-   sprintf(infoResp.cmdru.info, "interface,%s,vendor,XXX,cardtype,802.11a/b/g", getInfo->intf);
-
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_GET_INFO_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-/*
- * wfaStaSetEapTTLS():
- *   This is to set
- *   1. ssid
- *   2. username
- *   3. passwd
- *   4. encrypType - tkip or aes-ccmp
- *   5. keyManagementType - wpa or wpa2
- *   6. trustedRootCA
- */
-int wfaStaSetEapTTLS(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetEapTTLS_t *setTTLS = (caStaSetEapTTLS_t *)caCmdBuf;
-   char *ifname = setTTLS->intf;
-   dutCmdResponse_t *setEapTtlsResp = &gGenericResp;
-
-#ifdef WFA_NEW_CLI_FORMAT
-   sprintf(gCmdStr, "wfa_set_eapttls %s %s %s %s %s", ifname, setTTLS->ssid, setTTLS->username, setTTLS->passwd, setTTLS->trustedRootCA);
-   system(gCmdStr);
-#else
-
-   sprintf(gCmdStr, "wpa_cli -i %s disable_network 0", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", ifname, setTTLS->ssid);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 identity '\"%s\"'", ifname, setTTLS->username);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 password '\"%s\"'", ifname, setTTLS->passwd);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt WPA-EAP", ifname);
-   system(gCmdStr);
-
-/* This may not need to set. if it is not set, default to take all */
-//   sprintf(cmdStr, "wpa_cli -i %s set_network 0 pairwise '\"%s\"", ifname, setTTLS->encrptype);
-//   system(cmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 eap TTLS", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ca_cert '\"%s/%s\"'", ifname, CERTIFICATES_PATH, setTTLS->trustedRootCA);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 proto WPA", ifname);
-   system(gCmdStr);
-
-//   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 anonymous_identity '\"anonymous\"'", ifname);
-//   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 phase2 '\"auth=MSCHAPV2\"'", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", ifname);
-   system(gCmdStr);
-#endif
-
-   setEapTtlsResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_EAPTTLS_RESP_TLV, 4, (BYTE *)setEapTtlsResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-/*
- * wfaStaSetEapSIM():
- *   This is to set
- *   1. ssid
- *   2. user name
- *   3. passwd
- *   4. encrypType - tkip or aes-ccmp
- *   5. keyMangementType - wpa or wpa2
- */
-int wfaStaSetEapSIM(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetEapSIM_t *setSIM = (caStaSetEapSIM_t *)caCmdBuf;
-   char *ifname = setSIM->intf;
-   dutCmdResponse_t *setEapSimResp = &gGenericResp;
-
-#ifdef WFA_NEW_CLI_FORMAT
-   sprintf(gCmdStr, "wfa_set_eapsim %s %s %s %s", ifname, setSIM->ssid, setSIM->username, setSIM->encrptype);
-   system(gCmdStr);
-#else
-
-   sprintf(gCmdStr, "wpa_cli -i %s disable_network 0", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", ifname, setSIM->ssid);
-   system(gCmdStr);
-
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 identity '\"%s\"'", ifname, setSIM->username);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt WPA-EAP", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 pairwise '\"%s\"'", ifname, setSIM->encrptype);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 eap SIM", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 proto WPA", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", ifname);
-   system(gCmdStr);
-#endif
-
-   setEapSimResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_EAPSIM_RESP_TLV, 4, (BYTE *)setEapSimResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-/*
- * wfaStaSetPEAP()
- *   This is to set
- *   1. ssid
- *   2. user name
- *   3. passwd
- *   4. encryType - tkip or aes-ccmp
- *   5. keyMgmtType - wpa or wpa2
- *   6. trustedRootCA
- *   7. innerEAP
- *   8. peapVersion
- */
-int wfaStaSetPEAP(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetEapPEAP_t *setPEAP = (caStaSetEapPEAP_t *)caCmdBuf;
-   char *ifname = setPEAP->intf;
-   dutCmdResponse_t *setPeapResp = &gGenericResp;
-
-#ifdef WFA_NEW_CLI_FORMAT
-   sprintf(gCmdStr, "wfa_set_peap %s %s %s %s %s %s %i %s", ifname, setPEAP->ssid, setPEAP->username, 
-                                                          setPEAP->passwd, setPEAP->trustedRootCA,
-                                                         setPEAP->encrptype, setPEAP->peapVersion,
-                                                         setPEAP->innerEAP);
-   system(gCmdStr);
-#else
-
-   sprintf(gCmdStr, "wpa_cli -i %s disable_network 0", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", ifname, setPEAP->ssid);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 eap PEAP", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 anonymous_identity '\"anonymous\"' ", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 identity '\"%s\"'", ifname, setPEAP->username);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 password '\"%s\"'", ifname, setPEAP->passwd);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ca_cert '\"%s/%s\"'", ifname, CERTIFICATES_PATH, setPEAP->trustedRootCA);
-   system(gCmdStr);
-
-   /* if this not set, default to set support all */
-   //sprintf(gCmdStr, "wpa_cli -i %s set_network 0 pairwise '\"%s\"'", ifname, setPEAP->encrptype);
-   //system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt WPA-EAP", ifname);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 phase1 '\"peaplabel=%i\"'", ifname, setPEAP->peapVersion);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 phase2 '\"auth=%s\"'", ifname, setPEAP->innerEAP);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", ifname);
-   system(gCmdStr);
-#endif
-
-   setPeapResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_PEAP_RESP_TLV, 4, (BYTE *)setPeapResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-/*
- * wfaStaSetUAPSD()
- *    This is to set
- *    1. acBE
- *    2. acBK
- *    3. acVI
- *    4. acVO
- */
-int wfaStaSetUAPSD(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetUAPSD_t *setUAPSD = (caStaSetUAPSD_t *)caCmdBuf;
-   char *ifname = setUAPSD->intf;
-   char tmpStr[10];
-   char line[100];
-   char *pathl="/etc/Wireless/RT61STA";
-   dutCmdResponse_t *setUAPSDResp = &gGenericResp;
-   BYTE acBE=1;
-   BYTE acBK=1;
-   BYTE acVO=1;
-   BYTE acVI=1;
-   BYTE APSDCapable;
-   FILE *pipe;
-
-   /*
-    * A series of setting need to be done before doing WMM-PS
-    * Additional steps of configuration may be needed.
-    */
-
-   /*
-    * bring down the interface
-    */
-   sprintf(gCmdStr, "ifconfig %s down",ifname);
-   system(gCmdStr);
-   /*
-    * Unload the Driver
-    */
-   sprintf(gCmdStr, "rmmod rt61");
-   system(gCmdStr);
-#ifndef WFA_WMM_AC
-   if(setUAPSD->acBE != 1)
-     acBE=setUAPSD->acBE = 0;
-   if(setUAPSD->acBK != 1)
-     acBK=setUAPSD->acBK = 0;
-   if(setUAPSD->acVO != 1)
-     acVO=setUAPSD->acVO = 0;
-   if(setUAPSD->acVI != 1)
-     acVI=setUAPSD->acVI = 0;
-#else
-     acBE=setUAPSD->acBE;
-     acBK=setUAPSD->acBK;
-     acVO=setUAPSD->acVO;
-     acVI=setUAPSD->acVI;
-#endif
-
-   APSDCapable = acBE||acBK||acVO||acVI;
-   /*
-    * set other AC parameters
-    */
-
-   sprintf(tmpStr,"%d;%d;%d;%d",setUAPSD->acBE,setUAPSD->acBK,setUAPSD->acVI,setUAPSD->acVO);
-   sprintf(gCmdStr, "sed -e \"s/APSDCapable=.*/APSDCapable=%d/g\" -e \"s/APSDAC=.*/APSDAC=%s/g\" %s/rt61sta.dat >/tmp/wfa_tmp",APSDCapable,tmpStr,pathl);
-   system(gCmdStr);
-   
-   sprintf(gCmdStr, "mv /tmp/wfa_tmp %s/rt61sta.dat",pathl);
-   system(gCmdStr);
-  pipe = popen("uname -r", "r");
-  /* Read into line the output of uname*/
-       fscanf(pipe,"%s",line);
-       pclose(pipe);
-
-   /*
-    * load the Driver
-    */
-   sprintf(gCmdStr, "insmod /lib/modules/%s/extra/rt61.ko",line);
-   system(gCmdStr);
-   
-   sprintf(gCmdStr, "ifconfig %s up",ifname);
-   system(gCmdStr);
-
-   setUAPSDResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_UAPSD_RESP_TLV, 4, (BYTE *)setUAPSDResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-   return TRUE;
-}
-
-int wfaDeviceGetInfo(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCommand_t *dutCmd = (dutCommand_t *)caCmdBuf;
-   caDevInfo_t *devInfo = &dutCmd->cmdsu.dev;   
-
-#if 0 // by bbelief   
-   dutCmdResponse_t *infoResp = &gGenericResp;
-   /*a vendor can fill in the proper info or anything non-disclosure */
-   caDeviceGetInfoResp_t dinfo = {"WFA Lab", "DemoUnit", WFA_SYSTEM_VER};
-
-   DPRINT_INFO(WFA_OUT, "Entering wfaDeviceGetInfo ...\n");
-
-   if(devInfo->fw == 0)
-      memcpy(&infoResp->cmdru.devInfo, &dinfo, sizeof(caDeviceGetInfoResp_t));
-   else
-   {
-      // Call internal API to pull the version ID */
-      memcpy(infoResp->cmdru.devInfo.firmware, "NOVERSION", 15);
-   }
-#else
-    dutCmdResponse_t infoResp;   
-
-    memset(&infoResp, 0, sizeof(infoResp));
-    DPRINT_INFO(WFA_OUT, "Entering wfaDeviceGetInfo ...\n");
-
-    if(cmd_device_get_info(sigma_dut_ptr(), dutCmd, &infoResp) < 0){
-        infoResp.status = STATUS_ERROR;  
-        *respLen = 0;
-        return FALSE;
-    }
-
-#endif
-
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_DEVICE_GET_INFO_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-   return TRUE;
-
-}
-
-/*
- * This funciton is to retrieve a list of interfaces and return
- * the list back to Agent control.
- * ********************************************************************
- * Note: We intend to make this WLAN interface name as a hardcode name.
- * Therefore, for a particular device, you should know and change the name
- * for that device while doing porting. The MACRO "WFA_STAUT_IF" is defined in 
- * the file "inc/wfa_ca.h". If the device OS is not linux-like, this most 
- * likely is hardcoded just for CAPI command responses.
- * *******************************************************************
- * 
- */
-int wfaDeviceListIF(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t *infoResp = &gGenericResp;
-   dutCommand_t *ifList = (dutCommand_t *)caCmdBuf;
-   caDeviceListIFResp_t *ifListResp = &infoResp->cmdru.ifList;
-
-   DPRINT_INFO(WFA_OUT, "Entering wfaDeviceListIF ...\n");
-   
-   switch(ifList->cmdsu.iftype)
-   {
-      case IF_80211:
-      infoResp->status = STATUS_COMPLETE;
-      ifListResp->iftype = IF_80211; 
-
-#if 0      // by bbelief
-      strcpy(ifListResp->ifs[0], WFA_STAUT_IF);
-#else
-      strcpy(ifListResp->ifs[0], get_main_ifname());   
-#endif
-
-      strcpy(ifListResp->ifs[1], "NULL");
-      strcpy(ifListResp->ifs[2], "NULL");
-      break;
-      case IF_ETH:
-      infoResp->status = STATUS_COMPLETE;
-      ifListResp->iftype = IF_ETH; 
-      strcpy(ifListResp->ifs[0], "eth0");
-      strcpy(ifListResp->ifs[1], "NULL");
-      strcpy(ifListResp->ifs[2], "NULL");
-      break;
-      default:
-      {
-         infoResp->status = STATUS_ERROR;
-         wfaEncodeTLV(WFA_DEVICE_LIST_IF_RESP_TLV, 4, (BYTE *)infoResp, respBuf);   
-         *respLen = WFA_TLV_HDR_LEN + 4;
-
-         return TRUE; 
-      }
-   }
-   
-   wfaEncodeTLV(WFA_DEVICE_LIST_IF_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-   return TRUE;
-}
-
-int wfaStaDebugSet(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t *debugResp = &gGenericResp;
-   dutCommand_t *debugSet = (dutCommand_t *)caCmdBuf;
-
-   DPRINT_INFO(WFA_OUT, "Entering wfaStaDebugSet ...\n");
-
-   if(debugSet->cmdsu.dbg.state == 1) /* enable */
-      wfa_defined_debug |= debugSet->cmdsu.dbg.level;
-   else
-      wfa_defined_debug = (~debugSet->cmdsu.dbg.level & wfa_defined_debug);
-
-   debugResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_GET_INFO_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)debugResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-
-   return TRUE;
-}
-
-
-/*
- *   wfaStaGetBSSID():
- *     This function is to retrieve BSSID of a specific wireless I/F.
- */ 
-int wfaStaGetBSSID(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   char string[64]; 
-   char *str;
-   FILE *tmpfd;
-   dutCmdResponse_t *bssidResp = &gGenericResp;
-
-   DPRINT_INFO(WFA_OUT, "Entering wfaStaGetBSSID ...\n");
-   /* retrieve the BSSID */
-   sprintf(gCmdStr, "wpa_cli status > /tmp/bssid.txt");
-
-   system(gCmdStr);
-
-   tmpfd = fopen("/tmp/bssid.txt", "r+");
-   if(tmpfd == NULL)
-   {
-      bssidResp->status = STATUS_ERROR;
-      wfaEncodeTLV(WFA_STA_GET_BSSID_RESP_TLV, 4, (BYTE *)bssidResp, respBuf);   
-      *respLen = WFA_TLV_HDR_LEN + 4;
-
-      DPRINT_ERR(WFA_ERR, "file open failed\n");
-      return FALSE;
-   }
-
-   for(;;)
-   {
-      if(fscanf(tmpfd, "%s", string) == EOF)
-      {
-         bssidResp->status = STATUS_COMPLETE; 
-         strcpy(bssidResp->cmdru.bssid, "00:00:00:00:00:00");
-         break; 
-      }
-
-      if(strncmp(string, "bssid", 5) == 0)
-      {
-         str = strtok(string, "=");
-         str = strtok(NULL, "=");
-         if(str != NULL)
-         {
-            strcpy(bssidResp->cmdru.bssid, str);
-            bssidResp->status = STATUS_COMPLETE;
-            break;
-         }
-      }
-   }
-   wfaEncodeTLV(WFA_STA_GET_BSSID_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)bssidResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-   fclose(tmpfd);
-   return TRUE;
-}
-
-/*
- * wfaStaSetIBSS()
- *    This is to set
- *    1. ssid
- *    2. channel
- *    3. encrypType - none or wep
- *    optional
- *    4. key1
- *    5. key2
- *    6. key3
- *    7. key4
- *    8. activeIndex - 1, 2, 3, or 4
- */
-int wfaStaSetIBSS(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetIBSS_t *setIBSS = (caStaSetIBSS_t *)caCmdBuf;
-   dutCmdResponse_t *setIbssResp = &gGenericResp;
-   int i;
-
-   /*
-    * disable the network first
-    */ 
-   sprintf(gCmdStr, "wpa_cli -i %s disable_network 0", setIBSS->intf); 
-   system(gCmdStr);
-
-   /*
-    * set SSID
-    */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", setIBSS->intf, setIBSS->ssid); 
-   system(gCmdStr);
-
-   /*
-    * Set channel for IBSS
-    */
-   sprintf(gCmdStr, "iwconfig %s channel %i", setIBSS->intf, setIBSS->channel);
-   system(gCmdStr);
-
-   /*
-    * Tell the supplicant for IBSS mode (1)
-    */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 mode 1", setIBSS->intf);
-   system(gCmdStr);
-
-   /*
-    * set Key management to NONE (NO WPA) for plaintext or WEP
-    */
-   sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt NONE", setIBSS->intf);
-   system(gCmdStr);
-
-   if(setIBSS->encpType == 1)
-   {
-      for(i=0; i<4; i++)
-      {
-         if(strlen(setIBSS->keys[i]) ==5 || strlen(setIBSS->keys[i]) == 13)
-         {
-             sprintf(gCmdStr, "wpa_cli -i %s set_network 0 wep_key%i \"%s\"", 
-                setIBSS->intf, i, setIBSS->keys[i]);
-             system(gCmdStr);
-         }
-      } 
-
-      i = setIBSS->activeKeyIdx;
-      if(strlen(setIBSS->keys[i]) ==5 || strlen(setIBSS->keys[i]) == 13)
-      {
-         sprintf(gCmdStr, "wpa_cli -i %s set_network 0 wep_tx_keyidx %i", 
-            setIBSS->intf, setIBSS->activeKeyIdx);
-         system(gCmdStr);
-      }
-   }
-
-   sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", setIBSS->intf);
-   system(gCmdStr);
-
-   setIbssResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_IBSS_RESP_TLV, 4, (BYTE *)setIbssResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-/*
- *  wfaSetMode():
- *  The function is to set the wireless interface with a given mode (possible 
- *  adhoc)
- *  Input parameters:
- *    1. I/F
- *    2. ssid
- *    3. mode adhoc or managed
- *    4. encType
- *    5. channel
- *    6. key(s)
- *    7. active  key
- */ 
-int wfaStaSetMode(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetMode_t *setmode = (caStaSetMode_t *)caCmdBuf;
-   dutCmdResponse_t *SetModeResp = &gGenericResp;
-   int i;
-
-   /*
-    * bring down the interface
-    */
-   sprintf(gCmdStr, "ifconfig %s down",setmode->intf);
-   system(gCmdStr);
-
-   /*
-    * distroy the interface
-    */
-   sprintf(gCmdStr, "wlanconfig %s destroy",setmode->intf);
-   system(gCmdStr);
-
-
-   /*
-    * re-create the interface with the given mode
-    */
-   if(setmode->mode == 1)
-        sprintf(gCmdStr, "wlanconfig %s create wlandev wifi0 wlanmode adhoc",setmode->intf);
-   else
-        sprintf(gCmdStr, "wlanconfig %s create wlandev wifi0 wlanmode managed",setmode->intf);
-
-   system(gCmdStr);
-   if(setmode->encpType == ENCRYPT_WEP)
-    {
-      int j = setmode->activeKeyIdx;
-      for(i=0; i<4; i++)
-      {
-         if(setmode->keys[i][0] != '\0')
-         {
-             sprintf(gCmdStr, "iwconfig  %s key  s:%s",
-                   setmode->intf, setmode->keys[i]);
-             system(gCmdStr);
-         }
-      /* set active key */
-         if(setmode->keys[j][0] != '\0')
-             sprintf(gCmdStr, "iwconfig  %s key  s:%s",
-                   setmode->intf, setmode->keys[j]);
-         system(gCmdStr);
-      }
-
-    }
-   /*
-    * Set channel for IBSS
-    */
-    if(setmode->channel)
-    {
-      sprintf(gCmdStr, "iwconfig %s channel %i", setmode->intf, setmode->channel);
-      system(gCmdStr);
-    }
-
-
-   /*
-    * set SSID
-    */
-   sprintf(gCmdStr, "iwconfig %s essid %s", setmode->intf, setmode->ssid);
-   system(gCmdStr);
-
-   /*
-    * bring up the interface
-    */
-   sprintf(gCmdStr, "ifconfig %s up",setmode->intf);
-   system(gCmdStr);
-
-   SetModeResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_MODE_RESP_TLV, 4, (BYTE *)SetModeResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-int wfaStaSetPwrSave(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetPwrSave_t *setps = (caStaSetPwrSave_t *)caCmdBuf;
-   dutCmdResponse_t *SetPSResp = &gGenericResp;
-
-   sprintf(gCmdStr, "iwconfig %s power %s", setps->intf, setps->mode);
-   system(gCmdStr);
-
-
-   SetPSResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_PWRSAVE_RESP_TLV, 4, (BYTE *)SetPSResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-int wfaStaUpload(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaUpload_t *upload = &((dutCommand_t *)caCmdBuf)->cmdsu.upload;
-   dutCmdResponse_t *upLoadResp = &gGenericResp;
-   caStaUploadResp_t *upld = &upLoadResp->cmdru.uld;
-   
-   if(upload->type == WFA_UPLOAD_VHSO_RPT)
-   {
-       int rbytes;
-       /*
-        * if asked for the first packet, always to open the file
-        */
-       if(upload->next == 1)
-       {
-          if(e2efp != NULL)
-          {
-              fclose(e2efp);
-              e2efp = NULL;
-          }
-
-          e2efp = fopen(e2eResults, "r");
-       }
-
-       if(e2efp == NULL)
-       {
-           upLoadResp->status = STATUS_ERROR;
-           wfaEncodeTLV(WFA_STA_UPLOAD_RESP_TLV, 4, (BYTE *)upLoadResp, respBuf);
-           *respLen = WFA_TLV_HDR_LEN + 4;
-           return FALSE;
-       }
-        
-       rbytes = fread(upld->bytes, 1, 256, e2efp); 
-
-       if(rbytes < 256)  
-       {
-           /* 
-            * this means no more bytes after this read
-            */
-           upld->seqnum = 0;
-           fclose(e2efp);
-           e2efp=NULL;
-       }
-       else
-       { 
-           upld->seqnum = upload->next;
-       }
-
-       upld->nbytes = rbytes;
-
-       upLoadResp->status = STATUS_COMPLETE;
-       wfaEncodeTLV(WFA_STA_UPLOAD_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)upLoadResp, respBuf);
-       *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-   }
-   else
-   {
-       upLoadResp->status = STATUS_ERROR;
-       wfaEncodeTLV(WFA_STA_UPLOAD_RESP_TLV, 4, (BYTE *)upLoadResp, respBuf);
-       *respLen = WFA_TLV_HDR_LEN + 4;
-   }
-
-   return TRUE;
-}
-/*
- * wfaStaSetWMM()
- *  TO be ported on a specific plaform for the DUT
- *  This is to set the WMM related parameters at the DUT.
- *  Currently the function is used for GROUPS WMM-AC and WMM general configuration for setting RTS Threshhold, Fragmentation threshold and wmm (ON/OFF)
- *  It is expected that this function will set all the WMM related parametrs for a particular GROUP .
- */
-int wfaStaSetWMM(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-#ifdef WFA_WMM_AC
-    caStaSetWMM_t *setwmm = (caStaSetWMM_t *)caCmdBuf;
-    char *ifname = setwmm->intf;
-    dutCmdResponse_t *setwmmResp = &gGenericResp;
-    //IEEEtypes_WMM_TSPEC_t tspec;
-
-    switch(setwmm->group)
-    {
-    case GROUP_WMMAC:
-       if (setwmm->send_trig)
-       {
-           int Sockfd;
-           struct sockaddr_in psToAddr;
-           unsigned int TxMsg[512];
-         
-            Sockfd = wfaCreateUDPSock(setwmm->dipaddr, 12346);
-           memset(&psToAddr, 0, sizeof(psToAddr));
-           psToAddr.sin_family = AF_INET;
-           psToAddr.sin_addr.s_addr = inet_addr(setwmm->dipaddr);
-           psToAddr.sin_port = htons(12346);
-
-
-           switch (setwmm->trig_ac)
-           {
-           case WMMAC_AC_VO:
-               wfaTGSetPrio(Sockfd, 7);
-               create_apts_msg(APTS_CK_VO, TxMsg, 0);
-               DPRINT_INFO(WFA_OUT, "\r\nSending AC_VO trigger packet\n");
-               break;
-
-           case WMMAC_AC_VI:
-               wfaTGSetPrio(Sockfd, 5);
-               create_apts_msg(APTS_CK_VI, TxMsg, 0);
-               DPRINT_INFO(WFA_OUT, "\r\nSending AC_VI trigger packet\n");
-               break;
-
-           case WMMAC_AC_BK:
-               wfaTGSetPrio(Sockfd, 2);
-               create_apts_msg(APTS_CK_BK, TxMsg, 0);
-               DPRINT_INFO(WFA_OUT, "\r\nSending AC_BK trigger packet\n");
-               break;
-
-           default:
-            case WMMAC_AC_BE:
-               wfaTGSetPrio(Sockfd, 0);
-               create_apts_msg(APTS_CK_BE, TxMsg, 0);
-               DPRINT_INFO(WFA_OUT, "\r\nSending AC_BE trigger packet\n");
-               break;
-            }
-
-           sendto(Sockfd, TxMsg, 256, 0, (struct sockaddr *)&psToAddr,
-                  sizeof(struct sockaddr));
-           close(Sockfd);
-           usleep(1000000);
-       } 
-       else if (setwmm->action == WMMAC_ADDTS)
-        {
-           //wmmtspec_t* pCmdTspec = &(setwmm->actions.addts.tspec);
-            DPRINT_INFO(WFA_OUT, "ADDTS AC PARAMS: dialog id: %d, TID: %d, "
-                  "DIRECTION: %d, PSB: %d, UP: %d, "
-                  "Fixed %d, MSDU Size: %d, Max MSDU Size %d, "
-                  "MIN SERVICE INTERVAL: %d, MAX SERVICE INTERVAL: %d, "
-                  "INACTIVITY: %d, SUSPENSION %d, SERVICE START TIME: %d, "
-                  "MIN DATARATE: %d, MEAN DATA RATE: %d, PEAK DATA RATE: %d, "
-                  "BURSTSIZE: %d, DELAY BOUND: %d, PHYRATE: %d, SPLUSBW: %f, "
-                  "MEDIUM TIME: %d, ACCESSCAT: %d\n",
-                  setwmm->actions.addts.dialog_token,
-                  setwmm->actions.addts.tspec.tsinfo.TID,
-                  setwmm->actions.addts.tspec.tsinfo.direction,
-                  setwmm->actions.addts.tspec.tsinfo.PSB,
-                  setwmm->actions.addts.tspec.tsinfo.UP,
-                  setwmm->actions.addts.tspec.Fixed,
-                  setwmm->actions.addts.tspec.size,
-                  setwmm->actions.addts.tspec.maxsize,
-                  setwmm->actions.addts.tspec.min_srvc,
-                  setwmm->actions.addts.tspec.max_srvc,
-                  setwmm->actions.addts.tspec.inactivity,
-                  setwmm->actions.addts.tspec.suspension,
-                  setwmm->actions.addts.tspec.srvc_strt_tim,
-                  setwmm->actions.addts.tspec.mindatarate,
-                  setwmm->actions.addts.tspec.meandatarate,
-                  setwmm->actions.addts.tspec.peakdatarate,
-                  setwmm->actions.addts.tspec.burstsize,
-                  setwmm->actions.addts.tspec.delaybound,
-                  setwmm->actions.addts.tspec.PHYrate,
-                  setwmm->actions.addts.tspec.sba,
-                  setwmm->actions.addts.tspec.medium_time,
-                  setwmm->actions.addts.accesscat);
-
-            // you should set your tspec here.
-
-            system(gCmdStr);
-        }
-        else if (setwmm->action == WMMAC_DELTS)
-       {
-             // send del tspec 
-        }
-
-        setwmmResp->status = STATUS_COMPLETE;
-        break;
-
-    case GROUP_WMMCONF:
-        sprintf(gCmdStr, "iwconfig %s rts %d",
-                ifname,setwmm->actions.config.rts_thr);
-
-        system(gCmdStr);
-        sprintf(gCmdStr, "iwconfig %s frag %d",
-                ifname,setwmm->actions.config.frag_thr);
-
-        system(gCmdStr);
-        sprintf(gCmdStr, "iwpriv %s wmmcfg %d",
-                ifname, setwmm->actions.config.wmm);
-
-        system(gCmdStr);
-        setwmmResp->status = STATUS_COMPLETE;
-        break;
-
-    default:
-        DPRINT_ERR(WFA_ERR, "The group %d is not supported\n",setwmm->group);
-        setwmmResp->status = STATUS_ERROR;
-        break;
-
-    }
-
-    wfaEncodeTLV(WFA_STA_SET_WMM_RESP_TLV, 4, (BYTE *)setwmmResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + 4;
-#endif
-
-    return TRUE;
-}
-
-int wfaStaSendNeigReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   //dutCommand_t *sendNeigReq = (dutCommand_t *)caCmdBuf;
-   dutCmdResponse_t *sendNeigReqResp = &gGenericResp;
-
-   /*
-    *  run your device to send NEIGREQ
-    */
-
-   sendNeigReqResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SEND_NEIGREQ_RESP_TLV, 4, (BYTE *)sendNeigReqResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-int wfaStaSetEapFAST(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    caStaSetEapFAST_t *setFAST= (caStaSetEapFAST_t *)caCmdBuf;
-    char *ifname = setFAST->intf;
-    dutCmdResponse_t *setEapFastResp = &gGenericResp;
-
-#ifdef WFA_NEW_CLI_FORMAT
-    sprintf(gCmdStr, "wfa_set_eapfast %s %s %s %s %s %s", ifname, setFAST->ssid, setFAST->username,
-                                                          setFAST->passwd, setFAST->pacFileName,
-                                                          setFAST->innerEAP);
-    system(gCmdStr);
-#else
-
-    sprintf(gCmdStr, "wpa_cli -i %s disable_network 0", ifname);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", ifname, setFAST->ssid);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 identity '\"%s\"'", ifname, setFAST->username);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 password '\"%s\"'", ifname, setFAST->passwd);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt WPA-EAP", ifname);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 eap FAST", ifname);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 pac_file '\"%s/%s\"'", ifname, CERTIFICATES_PATH,     setFAST->pacFileName);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 anonymous_identity '\"anonymous\"'", ifname);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 phase1 '\"fast_provisioning=1\"'", ifname);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 phase2 '\"auth=%s\"'", ifname,setFAST->innerEAP);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", ifname);
-    system(gCmdStr);
-#endif
-
-    setEapFastResp->status = STATUS_COMPLETE;
-    wfaEncodeTLV(WFA_STA_SET_EAPFAST_RESP_TLV, 4, (BYTE *)setEapFastResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + 4;
-
-    return TRUE;
-}
-
-int wfaStaSetEapAKA(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    caStaSetEapAKA_t *setAKA= (caStaSetEapAKA_t *)caCmdBuf;
-    char *ifname = setAKA->intf;
-    dutCmdResponse_t *setEapAkaResp = &gGenericResp;
-
-#ifdef WFA_NEW_CLI_FORMAT
-    sprintf(gCmdStr, "wfa_set_eapaka %s %s %s %s", ifname, setAKA->ssid, setAKA->username, setAKA->passwd);
-    system(gCmdStr);
-#else
-
-    sprintf(gCmdStr, "wpa_cli -i %s disable_network 0", ifname);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 ssid '\"%s\"'", ifname, setAKA->ssid);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 key_mgmt WPA-EAP", ifname);
-    system(gCmdStr);
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 proto WPA2", ifname);
-    system(gCmdStr);
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 proto CCMP", ifname);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 eap AKA", ifname);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 phase1 \"result_ind=1\"", ifname);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 identity '\"%s\"'", ifname, setAKA->username);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s set_network 0 password '\"%s\"'", ifname, setAKA->passwd);
-    system(gCmdStr);
-
-    sprintf(gCmdStr, "wpa_cli -i %s enable_network 0", ifname);
-    system(gCmdStr);
-#endif
-
-    setEapAkaResp->status = STATUS_COMPLETE;
-    wfaEncodeTLV(WFA_STA_SET_EAPAKA_RESP_TLV, 4, (BYTE *)setEapAkaResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-int wfaStaSetSystime(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaSetSystime_t *systime = (caStaSetSystime_t *)caCmdBuf;
-   dutCmdResponse_t *setSystimeResp = &gGenericResp;
-
-   DPRINT_INFO(WFA_OUT, "Entering wfaStaSetSystime ...\n");
-
-   sprintf(gCmdStr, "date %d-%d-%d",systime->month,systime->date,systime->year);
-   system(gCmdStr);
-
-   sprintf(gCmdStr, "time %d:%d:%d", systime->hours,systime->minutes,systime->seconds);
-   system(gCmdStr);
-
-   setSystimeResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_SYSTIME_RESP_TLV, 4, (BYTE *)setSystimeResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-#ifdef WFA_STA_TB
-int wfaStaPresetParams(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t *PresetParamsResp = &gGenericResp;
-   caStaPresetParameters_t *presetParams = (caStaPresetParameters_t *)caCmdBuf;
-   //int ret;
-   //char *intfname = presetParams->intf;
-   BYTE presetDone = 1;
-   int st = 0;
-
-   DPRINT_INFO(WFA_OUT, "Inside wfaStaPresetParameters function ...\n");
-
-   if(presetParams->wmmFlag)
-   {
-      st = wfaExecuteCLI(gCmdStr);
-      switch(st)
-      {
-         case 0:
-         presetDone = 1;
-         break;
-         case 1:
-         presetDone = 0;
-         break;
-         case 2:
-         presetDone = 0;
-         break;
-      }
-   }
-
-   if(presetParams->modeFlag != 0)
-   {
-      switch(presetParams->wirelessMode)
-      {
-         default:
-         DPRINT_INFO(WFA_OUT, "other mode does not need to support\n");
-      }
-
-      st = wfaExecuteCLI(gCmdStr);
-      switch(st)
-      {
-         case 0:
-         presetDone = 1;
-         break;
-         case 1:
-         presetDone = 0;
-         case 2:
-         presetDone = 0;
-         break;
-      }
-   }
-
-
-   if(presetParams->psFlag)
-   {
-
-      DPRINT_INFO(WFA_OUT, "%s\n", gCmdStr);
-      system(gCmdStr);
-   }
-
-   /************the followings are used for Voice Enterprise **************/
-   if(presetParams->ftoa == eEnable)
-   {
-      // enable Fast BSS Transition Over the Air
-   }
-   else
-   {
-      // disable Fast BSS Transition Over the Air
-
-   }
-
-   if(presetParams->ftds == eEnable)
-   {
-      // enable Fast BSS Transition Over the DS 
-
-   }
-   else
-   {
-      // disable Fast BSS Transition Over the DS 
-
-   }
-
-   if(presetParams->activescan == eEnable)
-   {
-      // Enable Active Scan on STA 
-
-   }
-   else
-   {
-      // disable Active Scan on STA 
-
-   }
-
-
-   if (presetDone)
-   {
-      PresetParamsResp->status = STATUS_COMPLETE;
-   }
-   else
-   {
-      PresetParamsResp->status = STATUS_INVALID;
-   }
-
-   wfaEncodeTLV(WFA_STA_PRESET_PARAMETERS_RESP_TLV, 4, (BYTE *)PresetParamsResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-#endif
-
-int wfaStaSetWireless(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    dutCmdResponse_t *staWirelessResp = &gGenericResp;
-
-    staWirelessResp->status = STATUS_COMPLETE;
-    wfaEncodeTLV(WFA_STA_SET_WIRELESS_RESP_TLV, 4, (BYTE *)staWirelessResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + 4;
-    return TRUE;
-}
-
-int wfaStaSendADDBA(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    dutCmdResponse_t *staSendADDBAResp = &gGenericResp;
-
-    wfaEncodeTLV(WFA_STA_SET_SEND_ADDBA_RESP_TLV, 4, (BYTE *)staSendADDBAResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + 4;
-    return TRUE;
-}
-
-int wfaStaSetRIFS(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-        dutCmdResponse_t *staSetRIFSResp = &gGenericResp;
-
-        wfaEncodeTLV(WFA_STA_SET_RIFS_TEST_RESP_TLV, 4, (BYTE *)staSetRIFSResp, respBuf);
-        *respLen = WFA_TLV_HDR_LEN + 4;
-
-        return TRUE;
-
-}
-
-int wfaStaSendCoExistMGMT(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    dutCmdResponse_t *staSendMGMTResp = &gGenericResp;
-
-    wfaEncodeTLV(WFA_STA_SEND_COEXIST_MGMT_RESP_TLV, 4, (BYTE *)staSendMGMTResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + 4;
-
-    return TRUE;
-
-}
-
-int wfaStaResetDefault(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   caStaResetDefault_t *reset = (caStaResetDefault_t *)caCmdBuf;
-   dutCmdResponse_t *ResetResp = &gGenericResp;
-
-
-   // need to make your own command available for this, here is only an example
-   sprintf(gCmdStr, "myresetdefault %s program %s", reset->intf, reset->prog);
-   system(gCmdStr);
-
-   ResetResp->status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_RESET_DEFAULT_RESP_TLV, 4, (BYTE *)ResetResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-
-int wfaStaTestBedCmd(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    dutCmdResponse_t *staCmdResp = &gGenericResp;
-
-    wfaEncodeTLV(WFA_STA_DISCONNECT_RESP_TLV, 4, (BYTE *)staCmdResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + 4;
-
-    return TRUE;
-}
-
-
-int wfaStaDisconnect(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    //dutCommand_t *disc = (dutCommand_t *)caCmdBuf;
-    //char *intf = disc->intf;
-    dutCmdResponse_t *staDiscResp = &gGenericResp;
-
-    // stop the supplicant
-
-       // Remove the profile / disconnect the STA from the current AP ( make sure it should not reassociate automatically)
-       
-       staDiscResp->status = STATUS_COMPLETE;
-
-    wfaEncodeTLV(WFA_STA_DISCONNECT_RESP_TLV, 4, (BYTE *)staDiscResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + 4;
-
-    return TRUE;
-}
-
-/* Execute CLI, read the status from Environment variable */
-int wfaExecuteCLI(char *CLI)
-{
-   char *retstr;
-
-   system(CLI);
-
-   retstr = getenv("WFA_CLI_STATUS");
-   DPRINT_INFO(WFA_OUT, "cli status %s\n", retstr);
-   return atoi(retstr);
-}
-
-/* Supporting Functions */
-
-void wfaSendPing(tgPingStart_t *staPing, float *interval, int streamid)
-{
-    int totalpkts;
-    char cmdStr[128];
-//    char *addr = staPing->dipaddr;
-#ifdef WFA_PC_CONSOLE
-    char addr[20];
-    char bflag[] = "-b";
-    char *tmpstr;
-    int inum=0;
-#else
-    char bflag[] = "  ";
-#endif
-    totalpkts = staPing->duration * staPing->frameRate;
-#ifdef WFA_PC_CONSOLE
-
-    DPRINT_INFO(WFA_OUT, "\nCS : The Stream ID is %d",streamid);
-    DPRINT_INFO(WFA_OUT, "\nCS :the addr is %s ",addr);
-    strcpy(addr,staPing->dipaddr);
-    DPRINT_INFO(WFA_OUT, "\nCS :Inside the WFA_PC_CONSLE BLOCK");
-    DPRINT_INFO(WFA_OUT, "\nCS :the addr is %s ",addr);
-    tmpstr = strtok(addr, ".");
-
-    inum = atoi(tmpstr);
-
-    DPRINT_INFO(WFA_OUT, "interval %f\n", *interval);
-
-    if(inum >= 224 && inum <= 239) // multicast
-    {
-    }
-    else // if not MC, check if it is BC address
-    {
-       DPRINT_INFO(WFA_OUT, "\nCS :Inside the BC address BLOCK");
-       DPRINT_INFO(WFA_OUT, "\nCS :the inum %d",inum);
-       strtok(NULL, ".");
-       //strtok(NULL, ".");
-       tmpstr = strtok(NULL, ".");
-       DPRINT_INFO(WFA_OUT, "tmpstr %s\n", tmpstr);
-       inum = atoi(tmpstr);
-       DPRINT_INFO(WFA_OUT, "\nCS : The string is %s",tmpstr);
-       if(inum != 255)
-          memset(bflag, 0, strlen(bflag));
-    }
-#endif
-    DPRINT_INFO(WFA_OUT, "\nCS : The Stream ID is %d",streamid);
-
-    sprintf(cmdStr, "echo streamid=%i > /tmp/spout_%d.txt;wfaping.sh %s %s -i %f -c %i -s %i -q >> /tmp/spout_%d.txt 2>/dev/null",
-          streamid,streamid,bflag, staPing->dipaddr, *interval, totalpkts, staPing->frameSize,streamid);
-    system(cmdStr);
-    DPRINT_INFO(WFA_OUT, "\nCS : The command string is %s",cmdStr);
-
-    sprintf(cmdStr, "updatepid.sh /tmp/spout_%d.txt",streamid);
-    system(cmdStr);
-    DPRINT_INFO(WFA_OUT, "\nCS : The command string is %s",cmdStr);
-
-}
-
-int wfaStopPing(dutCmdResponse_t *stpResp, int streamid)
-{
-    char strout[256];
-    FILE *tmpfile = NULL;
-    char cmdStr[128];
-    DPRINT_INFO(WFA_OUT, "Ping stop id %d\n", streamid);
-    sprintf(cmdStr, "getpid.sh /tmp/spout_%d.txt /tmp/pid.txt",streamid);
-    system(cmdStr);
-
-    DPRINT_INFO(WFA_OUT, "\nCS : The command string is %s",cmdStr);
-
-    system("stoping.sh /tmp/pid.txt ; sleep 2");
-
-    sprintf(cmdStr, "getpstats.sh /tmp/spout_%d.txt",streamid);
-    system(cmdStr);
-
-    DPRINT_INFO(WFA_OUT, "\nCS : The command string is %s",cmdStr);
-
-    tmpfile = fopen("/tmp/stpsta.txt", "r+");
-
-    if(tmpfile == NULL)
-    {
-        return FALSE;
-    }
-
-    if(fscanf(tmpfile, "%s", strout) != EOF)
-    {
-        if(*strout == '\0')
-        {
-            stpResp->cmdru.pingStp.sendCnt = 0;
-        }
-
-        else
-            stpResp->cmdru.pingStp.sendCnt = atoi(strout);
-    }
-
-    DPRINT_INFO(WFA_OUT, "after scan sent count %i\n", stpResp->cmdru.pingStp.sendCnt);
-
-
-    if(fscanf(tmpfile, "%s", strout) != EOF)
-    {
-        if(*strout == '\0')
-        {
-            stpResp->cmdru.pingStp.repliedCnt = 0;
-        }
-        else
-            stpResp->cmdru.pingStp.repliedCnt = atoi(strout);
-    }
-    DPRINT_INFO(WFA_OUT, "after scan replied count %i\n", stpResp->cmdru.pingStp.repliedCnt);
-
-    fclose(tmpfile);
-
-    return TRUE;
-}
-
-/*
- * wfaStaGetP2pDevAddress(): 
- */
-int wfaStaGetP2pDevAddress(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   dutCommand_t *getInfo = (dutCommand_t *)caCmdBuf;
-
-    DPRINT_INFO(WFA_OUT, "\n Entry wfaStaGetP2pDevAddress... ");
-    memset(&infoResp, 0, sizeof(infoResp));
-
-    if(cmd_sta_get_p2p_dev_address(sigma_dut_ptr(), getInfo, &infoResp) < 0){
-        infoResp.status = STATUS_ERROR;  
-        *respLen = 0;
-       return FALSE;
-    }
-    
-    DPRINT_INFO(WFA_OUT, "%s :%s", __func__, &infoResp.cmdru.devid[0]);
-
-    infoResp.status = STATUS_COMPLETE;
-    wfaEncodeTLV(WFA_STA_GET_P2P_DEV_ADDRESS_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-    *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-
-/*
- * wfaStaSetP2p(): 
- */
-int wfaStaSetP2p(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaSetP2p_t *getStaSetP2p = (caStaSetP2p_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaSetP2p... ");    
-
-       // Implement the function and this does not return any thing back.
-    memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_set_p2p(sigma_dut_ptr(), getStaSetP2p, &infoResp) < 0){
-        infoResp.status = STATUS_ERROR;  
-        *respLen = 0;
-        return FALSE;
-     }    
-   
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_P2P_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-/*
- * wfaStaP2pConnect(): 
- */
-int wfaStaP2pConnect(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaP2pConnect_t *getStaP2pConnect = (caStaP2pConnect_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaP2pConnect... ");
-
-       // Implement the function and does not return anything.
-       memset(&infoResp, 0, sizeof(infoResp));
-       if(cmd_sta_p2p_connect(sigma_dut_ptr(), getStaP2pConnect, &infoResp) < 0){        
-           infoResp.status = STATUS_ERROR;  
-           *respLen = 0;
-            return FALSE;
-        }    
-
-       
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_P2P_CONNECT_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-/*
- * wfaStaStartAutoGo(): 
- */
-int wfaStaStartAutoGo(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaStartAutoGo_t *getStaStartAutoGo = (caStaStartAutoGo_t *)caCmdBuf;
-
-    DPRINT_INFO(WFA_OUT, "\n Entry wfaStaStartAutoGo... ");
-
-    memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_start_autonomous_go(sigma_dut_ptr(), getStaStartAutoGo, &infoResp) < 0){        
-        infoResp.status = STATUS_ERROR;  
-        *respLen = 0;
-        return FALSE;
-    }    
-
-#if 0        
-        // Fetch the group ID and store into   infoResp->cmdru.grpid 
-       strcpy(&infoResp.cmdru.grpid[0], "ABCDEFGH");
-#endif
-
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_P2P_START_AUTO_GO_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-
-
-/*
- * wfaStaP2pStartGrpFormation(): 
- */
-int wfaStaP2pStartGrpFormation(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaP2pStartGrpForm_t *getStaP2pStartGrpForm = (caStaP2pStartGrpForm_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaP2pStartGrpFormation... ");
-
-    memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_p2p_start_group_formation(sigma_dut_ptr(), getStaP2pStartGrpForm, &infoResp) < 0){        
-        infoResp.status = STATUS_ERROR;  
-        *respLen = 0;
-        return FALSE;
-    }    
-
-#if 0
-       // Fetch the device mode and put in     infoResp->cmdru.p2presult 
-       //strcpy(infoResp->cmdru.p2presult, "GO");
-
-       // Fetch the device grp id and put in   infoResp->cmdru.grpid 
-       //strcpy(infoResp->cmdru.grpid, "AA:BB:CC:DD:EE:FF_DIRECT-SSID");
-       
-       strcpy(infoResp.cmdru.grpFormInfo.result, "CLIENT");
-       strcpy(infoResp.cmdru.grpFormInfo.grpId, "AA:BB:CC:DD:EE:FF_DIRECT-SSID");
-#endif
-
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_P2P_START_GRP_FORM_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-/*
- * wfaStaP2pDissolve(): 
- */
-int wfaStaP2pDissolve(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaP2pDissolve_t *getStap2pDissolve= (caStaP2pDissolve_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaP2pDissolve... ");
-
-       // Implement the function and this does not return any thing back.
-    memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_p2p_dissolve(sigma_dut_ptr(), getStap2pDissolve, &infoResp) < 0){        
-        infoResp.status = STATUS_ERROR;  
-        *respLen = 0;
-        return FALSE;
-    }    
-
-    
-   
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_P2P_DISSOLVE_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-/*
- * wfaStaSendP2pInvReq(): 
- */
-int wfaStaSendP2pInvReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaSendP2pInvReq_t *getStaP2pInvReq= (caStaSendP2pInvReq_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaSendP2pInvReq... ");
-
-       // Implement the function and this does not return any thing back.
-   memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_send_p2p_invitation_req(sigma_dut_ptr(), getStaP2pInvReq, &infoResp) < 0){        
-        infoResp.status = STATUS_ERROR;  
-        *respLen = 0;
-        return FALSE;
-    }  
-   
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SEND_P2P_INV_REQ_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-/*
- * wfaStaAcceptP2pInvReq(): 
- */
-int wfaStaAcceptP2pInvReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaAcceptP2pInvReq_t *getStaP2pInvReq= (caStaAcceptP2pInvReq_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaAcceptP2pInvReq... ");
-
-       // Implement the function and this does not return any thing back.
-
-    memset(&infoResp, 0, sizeof(infoResp));
-     if(cmd_sta_accept_p2p_invitation_req(sigma_dut_ptr(), getStaP2pInvReq, &infoResp) < 0){        
-         infoResp.status = STATUS_ERROR;  
-         *respLen = 0;
-         return FALSE;
-     }   
-
-   
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_ACCEPT_P2P_REQ_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-/*
- * wfaStaSendP2pProvDisReq(): 
- */
-int wfaStaSendP2pProvDisReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaSendP2pProvDisReq_t *getStaP2pProvDisReq= (caStaSendP2pProvDisReq_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaSendP2pProvDisReq... ");
-
-       // Implement the function and this does not return any thing back.
-    
-    memset(&infoResp, 0, sizeof(infoResp));
-     if(cmd_sta_send_p2p_provision_dis_req(sigma_dut_ptr(), getStaP2pProvDisReq, &infoResp) < 0){        
-         infoResp.status = STATUS_ERROR;  
-         *respLen = 0;
-         return FALSE;
-     }   
-
-   
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SEND_P2P_PROV_DIS_REQ_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-/*
- * wfaStaSetWpsPbc(): 
- */
-int wfaStaSetWpsPbc(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaSetWpsPbc_t *getStaSetWpsPbc= (caStaSetWpsPbc_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaSetWpsPbc... ");
-
-       // Implement the function and this does not return any thing back.
-    memset(&infoResp, 0, sizeof(infoResp));
-     if(cmd_sta_set_wps_pbc(sigma_dut_ptr(), getStaSetWpsPbc, &infoResp) < 0){        
-         infoResp.status = STATUS_ERROR;  
-         *respLen = 0;
-         return FALSE;
-     }   
-
-      
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_WPS_PBC_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-/*
- * wfaStaWpsReadPin(): 
- */
-int wfaStaWpsReadPin(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaWpsReadPin_t *getStaWpsReadPin= (caStaWpsReadPin_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaWpsReadPin... ");
-
-        memset(&infoResp, 0, sizeof(infoResp));
-         if(cmd_sta_wps_read_pin(sigma_dut_ptr(), getStaWpsReadPin, &infoResp) < 0){        
-             infoResp.status = STATUS_ERROR;  
-             *respLen = 0;
-             return FALSE;
-         }   
-
-#if 0
-       // Fetch the device PIN and put in      infoResp->cmdru.wpsPin 
-       //strcpy(infoResp->cmdru.wpsPin, "12345678");
-       strcpy(&infoResp.cmdru.wpsPin[0], "1234456");
-#endif
-   
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_WPS_READ_PIN_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-
-/*
- * wfaStaWpsReadLabel(): 
- */
-int wfaStaWpsReadLabel(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaWpsReadLabel_t *getStaWpsReadLabel= (caStaWpsReadLabel_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaWpsReadLabel... ");
-    memset(&infoResp, 0, sizeof(infoResp));
-     if(cmd_sta_wps_read_label(sigma_dut_ptr(), getStaWpsReadLabel, &infoResp) < 0){        
-         infoResp.status = STATUS_ERROR;  
-         *respLen = 0;
-         return FALSE;
-     }   
-    
-#if 0
-       // Fetch the device Label and put in    infoResp->cmdru.wpsPin 
-       //strcpy(infoResp->cmdru.wpsPin, "12345678");
-       strcpy(&infoResp.cmdru.wpsPin[0], "1234456");
-#endif
-   
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_WPS_READ_PIN_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);  
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-/*
- * wfaStaWpsEnterPin(): 
- */
-int wfaStaWpsEnterPin(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaWpsEnterPin_t *getStaWpsEnterPin= (caStaWpsEnterPin_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaWpsEnterPin... ");
-
-   // Implement the function and this does not return any thing back.
-   memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_wps_enter_pin(sigma_dut_ptr(), getStaWpsEnterPin, &infoResp) < 0){        
-        infoResp.status = STATUS_ERROR;  
-        *respLen = 0;
-        return FALSE;
-    }   
-
-   
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_WPS_ENTER_PIN_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-/*
- * wfaStaGetPsk(): 
- */
-int wfaStaGetPsk(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaGetPsk_t *getStaGetPsk= (caStaGetPsk_t *)caCmdBuf;
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaGetPsk... ");
-
-    memset(&infoResp, 0, sizeof(infoResp));
-     if(cmd_sta_get_psk(sigma_dut_ptr(), getStaGetPsk, &infoResp) < 0){        
-         infoResp.status = STATUS_ERROR;  
-         *respLen = 0;
-         return FALSE;
-     }   
-
-#if 0
-       // Fetch the device PP and SSID  and put in     infoResp->cmdru.pskInfo 
-       //strcpy(infoResp->cmdru.wpsPin, "12345678");
-       strcpy(&infoResp.cmdru.pskInfo.passPhrase[0], "1234456");
-       strcpy(&infoResp.cmdru.pskInfo.ssid[0], "WIFI_DIRECT"); 
-#endif
-   
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_GET_PSK_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-/*
- * wfaStaP2pReset(): 
- */
-int wfaStaP2pReset(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   dutCommand_t *getStaP2pReset= (dutCommand_t *)caCmdBuf;
-
-    DPRINT_INFO(WFA_OUT, "\n Entry wfaStaP2pReset... ");
-
-    // Implement the function and this does not return any thing back.
-    memset(&infoResp, 0, sizeof(infoResp));
-     if(cmd_sta_p2p_reset(sigma_dut_ptr(), getStaP2pReset, &infoResp) < 0){        
-         infoResp.status = STATUS_ERROR;  
-         *respLen = 0;
-         return FALSE;
-     }      
-
-    infoResp.status = STATUS_COMPLETE;
-    wfaEncodeTLV(WFA_STA_P2P_RESET_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-    *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-/*
- * wfaStaGetP2pIpConfig(): 
- */
-int wfaStaGetP2pIpConfig(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaGetP2pIpConfig_t *staGetP2pIpConfig= (caStaGetP2pIpConfig_t *)caCmdBuf;
-   
-  // caStaGetIpConfigResp_t *ifinfo = &(infoResp.cmdru.getIfconfig);
-
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaGetP2pIpConfig... ");
-
-       memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_get_p2p_ip_config(sigma_dut_ptr(), staGetP2pIpConfig, &infoResp) < 0){        
-           infoResp.status = STATUS_ERROR;  
-           *respLen = 0;
-            return FALSE;
-        }    
-    
-#if 0
-       // Fetch the device IP config  and put in       infoResp->cmdru 
-       //strcpy(infoResp->cmdru.wpsPin, "12345678");
-       ifinfo->isDhcp =0;
-       strcpy(&(ifinfo->ipaddr[0]), "192.165.100.111");
-       strcpy(&(ifinfo->mask[0]), "255.255.255.0");
-       strcpy(&(ifinfo->dns[0][0]), "192.165.100.1");
-       strcpy(&(ifinfo->mac[0]), "ba:ba:ba:ba:ba:ba");
-#endif 
-       
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_GET_P2P_IP_CONFIG_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-
-
-/*
- * wfaStaSendServiceDiscoveryReq(): 
- */
-int wfaStaSendServiceDiscoveryReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaSendServiceDiscoveryReq_t *staSendServiceDiscoveryReq= (caStaSendServiceDiscoveryReq_t *)caCmdBuf;
-   
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaSendServiceDiscoveryReq... ");
-       // Implement the function and this does not return any thing back.
-       memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_send_service_discovery_req(sigma_dut_ptr(), staSendServiceDiscoveryReq, &infoResp) < 0){        
-           infoResp.status = STATUS_ERROR;  
-           *respLen = 0;
-            return FALSE;
-        }
-
-  infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SEND_SERVICE_DISCOVERY_REQ_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-
-
-/*
- * wfaStaSendP2pPresenceReq(): 
- */
-int wfaStaSendP2pPresenceReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-        dutCmdResponse_t infoResp;
-        caStaSendP2pPresenceReq_t *staSendP2pPresenceReq= (caStaSendP2pPresenceReq_t *)caCmdBuf;
-   
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaSendP2pPresenceReq... ");
-       // Implement the function and this does not return any thing back.
-       DPRINT_INFO(WFA_OUT, "\n The long long Duration: %lld... ",staSendP2pPresenceReq->duration);
-       DPRINT_INFO(WFA_OUT, "\n The long long interval : %lld.. ",staSendP2pPresenceReq->interval);
-
-        memset(&infoResp, 0, sizeof(infoResp));
-        if(cmd_sta_send_p2p_presence_req(sigma_dut_ptr(), staSendP2pPresenceReq, &infoResp) < 0){        
-           infoResp.status = STATUS_ERROR;  
-           *respLen = 0;
-            return FALSE;
-        }    
-
-        infoResp.status = STATUS_COMPLETE;
-        wfaEncodeTLV(WFA_STA_SEND_P2P_PRESENCE_REQ_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-        *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-        return TRUE;
-}
-
-/*
- * wfaStaSetSleepReq(): 
- */
-int wfaStaSetSleepReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaSetSleep_t *staSetSleepReq= (caStaSetSleep_t *)caCmdBuf;
-   
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaSetSleepReq... ");
-
-       // Implement the function and this does not return any thing back.
-    memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_set_sleep(sigma_dut_ptr(), staSetSleepReq, &infoResp) < 0){        
-       infoResp.status = STATUS_ERROR;  
-       *respLen = 0;
-        return FALSE;
-    }    
-       
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_SLEEP_REQ_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN +4;
-
-   return TRUE;
-}
-
-/*
- * wfaStaSetOpportunisticPsReq(): 
- */
-int wfaStaSetOpportunisticPsReq(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaSetOpprPs_t *staSetOpperPsReq= (caStaSetOpprPs_t *)caCmdBuf;
-   
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaSetOpportunisticPsReq... ");
-       // Implement the function and this does not return any thing back.
-    memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_set_opportunistic_ps(sigma_dut_ptr(), staSetOpperPsReq, &infoResp) < 0){        
-       infoResp.status = STATUS_ERROR;  
-       *respLen = 0;
-        return FALSE;
-    }    
-       
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_SET_OPPORTUNISTIC_PS_REQ_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-#ifndef WFA_STA_TB
-/*
- * wfaStaPresetParams(): 
- */
-
-int wfaStaPresetParams(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-       dutCmdResponse_t infoResp;
-
-   caStaPresetParameters_t *presetParams = (caStaPresetParameters_t *)caCmdBuf;
-
-
-   DPRINT_INFO(WFA_OUT, "Inside wfaStaPresetParameters function ...\n");
-
-       // Implement the function and its sub commands 
-       infoResp.status = STATUS_COMPLETE;
-
-   wfaEncodeTLV(WFA_STA_PRESET_PARAMETERS_RESP_TLV, 4, (BYTE *)&infoResp, respBuf);
-   *respLen = WFA_TLV_HDR_LEN + 4;
-
-   return TRUE;
-}
-int wfaStaSet11n(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf) 
-{
-       
-       caSta11n_t * v11nParams = (caSta11n_t *)caCmdBuf;
-       dutCmdResponse_t infoResp;
-       dutCmdResponse_t *v11nParamsResp = &infoResp;
-       
-
-
-       int st =0; // SUCCESS
-       
-       DPRINT_INFO(WFA_OUT, "Inside wfaStaSet11n function....\n"); 
-
-
-       if(v11nParams->addba_reject != 0xFF && v11nParams->addba_reject < 2)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_addba_reject failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-       
-    if(v11nParams->ampdu != 0xFF && v11nParams->ampdu < 2)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_ampdu failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-       
-    if(v11nParams->amsdu != 0xFF && v11nParams->amsdu < 2)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_amsdu failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-
-    if(v11nParams->greenfield != 0xFF && v11nParams->greenfield < 2)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "_set_greenfield failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-
-    if(v11nParams->mcs32!= 0xFF && v11nParams->mcs32 < 2 && v11nParams->mcs_fixedrate[0] != '\0')
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_mcs failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       } 
-       else if (v11nParams->mcs32!= 0xFF && v11nParams->mcs32 < 2 && v11nParams->mcs_fixedrate[0] == '\0')
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_mcs32 failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-
-       } 
-       else if (v11nParams->mcs32 == 0xFF && v11nParams->mcs_fixedrate[0] != '\0')
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_mcs32 failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-
-    if(v11nParams->rifs_test != 0xFF && v11nParams->rifs_test < 2)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_rifs_test failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-
-    if(v11nParams->sgi20 != 0xFF && v11nParams->sgi20 < 2)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_sgi20 failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-
-       if(v11nParams->smps != 0xFFFF)
-       {
-           if(v11nParams->smps == 0)
-           {
-                       // implement the funciton
-                       //st = wfaExecuteCLI(gCmdStr); 
-                       ;
-
-           }
-           else if(v11nParams->smps == 1)
-           {
-                       // implement the funciton
-                       //st = wfaExecuteCLI(gCmdStr); 
-                       ;
-           }           
-           else if(v11nParams->smps == 2)
-               {
-                       // implement the funciton
-                       //st = wfaExecuteCLI(gCmdStr); 
-                       ;               
-           }
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_smps failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-
-       if(v11nParams->stbc_rx != 0xFFFF)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_stbc_rx failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-       
-       if(v11nParams->width[0] != '\0')
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_11n_channel_width failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-
-       }
-       
-    if(v11nParams->_40_intolerant != 0xFF && v11nParams->_40_intolerant < 2)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-            v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_40_intolerant failed");
-               wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-               *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-
-       }
-
-       if(v11nParams->txsp_stream != 0 && v11nParams->txsp_stream <4)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-                       v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_txsp_stream failed");
-                       wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-                       *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-
-       }
-
-       if(v11nParams->rxsp_stream != 0 && v11nParams->rxsp_stream < 4)
-       {
-               // implement the funciton
-               //st = wfaExecuteCLI(gCmdStr); 
-               if(st != 0)
-               {
-                       v11nParamsResp->status = STATUS_ERROR;
-                       strcpy(v11nParamsResp->cmdru.info, "set_rxsp_stream failed");
-                       wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)v11nParamsResp, respBuf);
-                       *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-                       return FALSE;
-               }
-       }
-
-       v11nParamsResp->status = STATUS_COMPLETE;
-       wfaEncodeTLV(WFA_STA_SET_11N_RESP_TLV, 4, (BYTE *)v11nParamsResp, respBuf);
-       *respLen = WFA_TLV_HDR_LEN + 4;
-       return TRUE;
-}
-#endif
-/*
- * wfaStaAddArpTableEntry(): 
- */
-int wfaStaAddArpTableEntry(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaAddARPTableEntry_t *staAddARPTableEntry= (caStaAddARPTableEntry_t *)caCmdBuf;
-   
-       DPRINT_INFO(WFA_OUT, "\n Entry wfastaAddARPTableEntry... ");
-       // Implement the function and this does not return any thing back.
-    memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_add_arp_table_entry(sigma_dut_ptr(), staAddARPTableEntry, &infoResp) < 0){        
-       infoResp.status = STATUS_ERROR;  
-       *respLen = 0;
-        return FALSE;
-    }      
-
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_ADD_ARP_TABLE_ENTRY_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
-
-/*
- * wfaStaBlockICMPResponse(): 
- */
-int wfaStaBlockICMPResponse(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-   dutCmdResponse_t infoResp;
-   caStaBlockICMPResponse_t *staBlockICMPRes= (caStaBlockICMPResponse_t *)caCmdBuf;
-   
-       DPRINT_INFO(WFA_OUT, "\n Entry wfaStaBlockICMPResponse... ");
-       // Implement the function and this does not return any thing back.
-    memset(&infoResp, 0, sizeof(infoResp));
-    if(cmd_sta_block_icmp_response(sigma_dut_ptr(), staBlockICMPRes, &infoResp) < 0){        
-       infoResp.status = STATUS_ERROR;  
-       *respLen = 0;
-        return FALSE;
-    }      
-
-
-   infoResp.status = STATUS_COMPLETE;
-   wfaEncodeTLV(WFA_STA_BLOCK_ICMP_RESPONSE_RESP_TLV, sizeof(infoResp), (BYTE *)&infoResp, respBuf);   
-   *respLen = WFA_TLV_HDR_LEN + sizeof(infoResp);
-
-   return TRUE;
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_debug.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_debug.h
deleted file mode 100644 (file)
index abd35a2..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-#ifndef WFA_DEBUG_H
-#define WFA_DEBUG_H
-
-#include "sigma_dut.h"
-
-#define WFA_ERR     DUT_MSG_ERROR
-#define WFA_OUT     DUT_MSG_INFO
-#define WFA_WNG    DUT_MSG_ERROR
-
-#define WFA_DEBUG_DEFAULT          0x0001
-#define WFA_DEBUG_ERR              0x0001
-#define WFA_DEBUG_INFO             0x0002
-#define WFA_DEBUG_WARNING          0x0004
-
-#define WFA_DEBUG 1
-
-#define DPRINT_ERR          sigma_dut_print
-
-#define DPRINT_INFO         sigma_dut_print
-
-#define DPRINT_WARNING      sigma_dut_print
-
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_main.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_main.h
deleted file mode 100644 (file)
index ec37f61..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-#ifndef _WFA_MAIN_H
-#define _WFA_MAIN_H
-
-#ifdef WFA_PC_CONSOLE
-#define WFA_MAX_TRAFFIC_STREAMS           32 
-
-/* WMM THREADS NUMBER */
-#define WFA_THREADS_NUM   32 
-#else /* for STAION */
-#define WFA_MAX_TRAFFIC_STREAMS           8
-
-/* WMM THREADS NUMBER */
-#define WFA_THREADS_NUM   8 
-#endif
-
-#define MAX_CMD_BUFF        1024 
-#define MAX_PARMS_BUFF      640 
-
-#define MAX_TRAFFIC_BUF_SZ  1536
-
-#define WFA_BUFF_32         32
-#define WFA_BUFF_64         64
-#define WFA_BUFF_128        128
-#define WFA_BUFF_512        512
-#define WFA_BUFF_1K         1024
-#define WFA_BUFF_4K         4096
-
-#ifdef WFA_PC_CONSOLE
-#define WFA_RESP_BUF_SZ    WFA_BUFF_4K
-#else
-#define WFA_RESP_BUF_SZ    WFA_BUFF_1K
-#endif
-
-#define WFA_CMD_STR_SZ      512 
-
-enum tg_port
-{
-    UDP_PORT_BE1 = 0,
-    UDP_PORT_BE2 = 1,
-    UDP_PORT_BK1 = 2,
-    UDP_PORT_BK2 = 3,
-    UDP_PORT_VI1 = 4,
-    UDP_PORT_VI2 = 5,
-    UDP_PORT_VO1 = 6,
-    UDP_PORT_VO2 = 7,
-    UDP_PORT_ND1 = 8,
-    UDP_PORT_ND2 = 9
-};
-
-#ifndef _WINDOWS
-#define min(a,b)        ((a) < (b) ? (a) : (b))
-#define max(a,b)        ((a) > (b) ? (a) : (b))
-
-#endif
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_miscs.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_miscs.h
deleted file mode 100644 (file)
index a20ce34..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-#ifndef _WFA_MISCS_H_
-#define _WFA_MISCS_H_
-
-extern int isString(char *);
-extern int isNumber(char *);
-extern int isIpV4Addr(char *);
-extern inline double wfa_timeval2double(struct timeval *tval);
-extern inline void wfa_double2timeval(struct timeval *tval, double dval);
-extern inline double wfa_ftime_diff(struct timeval *t1, struct timeval *t2);
-extern int wfa_itime_diff(struct timeval *t1, struct timeval *t2);
-extern inline void int2BuffBigEndian(int val, char *buf);
-extern inline int bigEndianBuff2Int(char *buff);
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_p2p.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_p2p.h
deleted file mode 100644 (file)
index 38dfe1f..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#ifndef _WFA_P2P_H_
-#define _WFA_P2P_H_
-
-#include "wfa_portall.h"
-#include "wfa_debug.h"
-#include "wfa_ver.h"
-#include "wfa_main.h"
-#include "wfa_types.h"
-#include "wfa_ca.h"
-#include "wfa_tlv.h"
-#include "wfa_sock.h"
-#include "wfa_tg.h"
-#include "wfa_miscs.h"
-#include "wfa_agt.h"
-#include "wfa_rsp.h"
-#include "wfa_cmds.h"
-
-
-extern int cmd_device_get_info(struct sigma_dut *dut, dutCommand_t *command,
-                                             dutCmdResponse_t *resp);
-
-extern int cmd_sta_get_p2p_dev_address(struct sigma_dut *dut, dutCommand_t *command,
-                                             dutCmdResponse_t *resp);
-
-extern int cmd_sta_set_p2p(struct sigma_dut *dut, caStaSetP2p_t *command, dutCmdResponse_t *resp);
-
-extern int cmd_sta_start_autonomous_go(struct sigma_dut *dut, caStaStartAutoGo_t *command, dutCmdResponse_t *resp);
-extern int cmd_sta_p2p_connect(struct sigma_dut *dut, caStaP2pConnect_t *command, dutCmdResponse_t *resp);
-
-extern int cmd_sta_p2p_start_group_formation(struct sigma_dut *dut,
-                                            caStaP2pStartGrpForm_t *command,
-                                            dutCmdResponse_t *cmdresp);
-
-extern int cmd_sta_p2p_dissolve(struct sigma_dut *dut, caStaP2pDissolve_t *command,
-                    dutCmdResponse_t *cmdresp);
-
-extern int cmd_sta_send_p2p_invitation_req(struct sigma_dut *dut,
-                                          caStaSendP2pInvReq_t *command,
-                                          dutCmdResponse_t *cmdresp);
-
-extern int cmd_sta_accept_p2p_invitation_req(struct sigma_dut *dut,
-                                            caStaAcceptP2pInvReq_t *command,
-                                            dutCmdResponse_t *cmdresp);
-
-extern int cmd_sta_send_p2p_provision_dis_req(struct sigma_dut *dut,
-                                             caStaSendP2pProvDisReq_t *command,
-                                             dutCmdResponse_t *cmdresp);
-
-extern int cmd_sta_set_wps_pbc(struct sigma_dut *dut, caStaSetWpsPbc_t *command,
-                              dutCmdResponse_t *cmdresp);
-
-
-extern int cmd_sta_wps_read_pin(struct sigma_dut *dut, caStaWpsReadPin_t *command,
-                               dutCmdResponse_t *cmdresp);
-
-extern int cmd_sta_wps_read_label(struct sigma_dut *dut,
-                                 caStaWpsReadLabel_t *command,
-                                 dutCmdResponse_t *cmdresp);
-
-extern  int cmd_sta_wps_enter_pin(struct sigma_dut *dut,
-                                caStaWpsEnterPin_t *command,
-                                dutCmdResponse_t *cmdresp);
-
-extern int cmd_sta_get_psk(struct sigma_dut *dut, caStaGetPsk_t *command,
-                          dutCmdResponse_t *cmdresp);
-
-
-extern int cmd_sta_p2p_reset(struct sigma_dut *dut, dutCommand_t *command,
-                     dutCmdResponse_t *resp);
-
-extern int cmd_sta_get_p2p_ip_config(struct sigma_dut *dut,
-                                    caStaGetP2pIpConfig_t *command,
-                                    dutCmdResponse_t *cmdRes);
-
-
-extern int cmd_sta_send_p2p_presence_req(struct sigma_dut *dut,
-                                        caStaSendP2pPresenceReq_t *command,
-                                        dutCmdResponse_t *cmdRes);
-
-extern int cmd_sta_set_sleep(struct sigma_dut *dut, caStaSetSleep_t *command,
-                     dutCmdResponse_t *cmdRes);
-
-extern int cmd_sta_send_service_discovery_req(struct sigma_dut *dut,
-                                             caStaSendServiceDiscoveryReq_t *command,
-                                             dutCmdResponse_t *cmdRes);
-
-extern int cmd_sta_set_opportunistic_ps(struct sigma_dut *dut,
-                                       caStaSetOpprPs_t *command,
-                                       dutCmdResponse_t *cmdRes);
-
-extern int cmd_sta_add_arp_table_entry(struct sigma_dut *dut,
-                                      caStaAddARPTableEntry_t *command,
-                                      dutCmdResponse_t *cmdRes);
-
-extern int cmd_sta_block_icmp_response(struct sigma_dut *dut,
-                                      caStaBlockICMPResponse_t *command,
-                                      dutCmdResponse_t *cmdRes);
-
-extern int cmd_traffic_send_ping(struct sigma_dut *dut,
-                                        tgPingStart_t *staPing, 
-                                        dutCmdResponse_t *spresp);
-
-int cmd_traffic_stop_ping(struct sigma_dut *dut,
-                                int      streamID,
-                                dutCmdResponse_t *spresp);
-
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_portall.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_portall.h
deleted file mode 100644 (file)
index be325df..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-#ifndef _WFA_PORTALL_H_
-#define _WFA_PORTALL_H_
-
-/* The fixed definition for the device interface name */
-/* For different OSes or your platforms, you may not  */ 
-/* need to use fixed definition                       */
-#define WFA_STAUT_IF        "wlan0"
-
-/* the path to store EAP certificates. This is used   */
-/* for Linux-like OS for wpa_supplicant               */
-#define CERTIFICATES_PATH    "/etc/wpa_supplicant"
-
-
-#define wSTRNCPY(dstr, sstr, len) \
-                           strncpy(dstr, sstr, len)
-
-#define wSTRCPY(dstr, sstr) \
-                           strcpy(dstr, sstr)
-
-#define wSTRNCPY(dstr, sstr, len) \
-                           strncpy(dstr, sstr, len)
-
-#define wSTRNCMP(str1, str2, size) \
-                           strncmp(str1, str2, size)
-
-#define wSTRLEN(str)     \
-                           strlen(str)
-
-#define wSOCKET(family, type, protocol) \
-                           socket(family, type, protocol)
-
-#define wSELECT(maxfdn, rsockSet, wsockSet, exceptSet, timer)  \
-                           select(maxfdn, rsockSet, wsockSet, exceptSet, timer)
-
-#define wSETSOCKOPT(sock, level, optname, optval, optlen) \
-                           setsockopt(sock, level, optname, optval, optlen)
-
-#define wBIND(sock, sockaddr, sizeaddr) \
-                           bind(sock, sockaddr, sizeaddr)
-
-#define wLISTEN(sock, maxnumpending)  \
-                           listen(sock, maxnumpending)
-
-#define wBZERO(ap, memsize) \
-                           bzero(ap, memsize)
-
-#define wCONNECT(sock, peeraddr, sizeaddr) \
-                           connect(sock, peeraddr, sizeaddr)
-
-#define wACCEPT(sock, addr, sizeaddr) \
-                           accept(sock, addr, sizeaddr)
-
-#define wSEND(sock, buf, len, flag) \
-                           send(sock, buf, len, flag)
-
-#define wSENDTO(sock, buf, len, flag, toaddr, sizeaddr) \
-                           sendto(sock, buf, len, flag, toaddr, sizeaddr)
-
-#define wRECV(sock, buf, len, flag) \
-                           recv(sock, buf, len, flag)
-
-#define wRECVFROM(sock, buf, len, flag, fromaddr, sizeaddr) \
-                           recvfrom(sock, buf, len, flag, fromaddr, sizeaddr)
-
-
-#define wFCNTL(fd, cmd, args) \
-                           fcntl(fd, cmd, args)
-
-#define wSYSTEM(cmd) \
-                          system(cmd)
-
-#define wSPRINTF(buf, format...) \
-                          sprintf(buf, ## format)
-
-#define wIOCTL(fd, cmd, intf) \
-                           ioctl(fd, cmd, intf)
-
-#define wMALLOC(size)  \
-                           malloc(size)
-
-#define wMEMCPY(dp, sp, size) \
-                           memcpy(dp, sp, size)
-
-#define wMEMSET(memp, val, size)  \
-                           memset(memp, val, size)
-
-#define wFREE(memp)      \
-                           free(memp); 
-
-#define wGETTIMEOFDAY(tmval, zone) \
-                           gettimeofday(tmval, zone) 
-
-#define wSETTIMEOFDAY(tmval, zone) \
-                           settimeofday(tmval, zone) 
-
-#define wSIGNAL(signum, sighandler) \
-                           signal(signum, sighandler)
-
-#define wALARM(duration) \
-                           alarm(duration)
-
-#define wCLOSE(fd)       \
-                           close(fd);
-
-#define wUSLEEP(usecs)   \
-                           usleep(usecs)
-
-
-#define wSLEEP(secs)   \
-                           sleep(secs)
-
-#define wEXIT(num)     \
-                           exit(num)
-
-#define wATOI(c)       \
-                           atoi(c)
-
-#define wSHUTDOWN(fd, type)      \
-                           shutdown(fd, type)
-
-#define wGETSOFD(sockfd, proto, tosval, ptosval, psize) \
-                           getsockopt(sockfd, proto, tosval, ptosval, psize)
-
-#define wPT_ATTR_INIT(ptattr) \
-                           pthread_attr_init(ptattr)
-
-#define wPT_ATTR_SETSCH(ptattr, policy) \
-                           pthread_attr_setschedpolicy(ptattr, policy)   
-
-#define wPT_ATTR_SETSCHPARAM(ptattr, param) \
-                           pthread_attr_setschedparam(ptattr, param)
-
-#define wPT_MUTEX_LOCK(lock) \
-                           pthread_mutex_lock(lock)
-
-#define wPT_MUTEX_UNLOCK(lock) \
-                           pthread_mutex_unlock(lock)
-
-#define wFFLUSH(out) \
-                           fflush(out)
-
-#define wPT_COND_SIGNAL(signal) \
-                           pthread_cond_signal(signal)
-
-#define wPT_COND_WAIT(pcond, pmlock) \
-                           pthread_cond_wait(pcond, pmlock)
-
-#define wPT_MUTEX_INIT(pmlock, initval) \
-                           pthread_mutex_init(pmlock, initval)
-
-#define wPT_COND_INIT(pcond, initval) \
-                           pthread_cond_init(pcond, initval)
-
-#define wPT_CREATE(t, ptattr, func, pdata) \
-                           pthread_create(t, ptattr, func, pdata)
-
-
-typedef struct _memblock
-{
-    int id;
-    int size;    /* number of blocks 512 byte/block */
-    void *mem;
-} wfaMemBlk_t;
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_rsp.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_rsp.h
deleted file mode 100644 (file)
index c47b182..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-#ifndef WFA_RSP_H
-#define WFA_RSP_H
-
-#include "wfa_ver.h"
-
-#ifdef WFA_WMM_VOICE
-#define WFA_INFO_BUFSIZE       128   /* used to upload test data */
-#else
-#define WFA_INFO_BUFSIZE       128 
-#endif
-
-typedef struct _tg_ping_stop_resp
-{
-    int sendCnt;
-    int repliedCnt;
-} tgPingStopResp_t;
-
-typedef struct ca_sta_get_ipconfig_resp
-{
-    int isDhcp;
-    char ipaddr[WFA_IP_ADDR_STR_LEN];
-    char mask[WFA_IP_MASK_STR_LEN];
-    char dns[WFA_MAX_DNS_NUM][WFA_IP_ADDR_STR_LEN];
-    char mac[WFA_MAC_ADDR_STR_LEN];
-       
-} caStaGetIpConfigResp_t;
-
-typedef struct ca_sta_get_stats_resp
-{
-   int status;
-   int txFrames;
-   int rxFrames;
-   int txMulticast;
-   int rxMulticast;
-   int fcsErrors ;
-   int txRetries;
-} caStaGetStatsResp_t;
-
-typedef struct ca_device_get_info_resp
-{
-   char vendor[16];
-   char model[16];
-   char version[WFA_VERNAM_LEN];
-   char firmware[16];
-} caDeviceGetInfoResp_t;
-
-typedef struct ca_sta_upload_resp
-{
-   short seqnum;
-   short nbytes;
-   char bytes[256]; 
-} caStaUploadResp_t;
-
-typedef struct ca_device_list_if_resp
-{
-   int status;
-#define IF_80211   1
-#define IF_ETH     2
-   int iftype;
-   char ifs[3][16];
-} caDeviceListIFResp_t;
-
-/* P2P */
-typedef struct ca_P2p_sta_get_psk_resp
-{
-   char ssid[WFA_SSID_NAME_LEN];
-   char passPhrase[WFA_PSK_PP_LEN];
-} caP2pStaGetPskResp_t;
-
-typedef struct ca_P2p_start_grp_form_resp
-{
-   char result[8];
-   char grpId[WFA_P2P_GRP_ID_LEN];
-} caP2pStartGrpFormResp_t;
-/* P2P */
-
-
-typedef struct dut_cmd_response
-{
-   int status;
-   int streamId;
-   union _cmdru
-   {
-       tgStats_t stats;
-       tgPingStopResp_t pingStp;
-       caStaGetIpConfigResp_t getIfconfig;
-       caStaGetStatsResp_t ifStats;
-       caDeviceGetInfoResp_t devInfo;
-       caDeviceListIFResp_t ifList;
-       caStaUploadResp_t  uld;
-       char version[WFA_VERSION_LEN];
-       char info[WFA_INFO_BUFSIZE];
-       char bssid[WFA_MAC_ADDR_STR_LEN];
-       char mac[WFA_MAC_ADDR_STR_LEN];       
-/* P2P */
-       char devid[WFA_P2P_DEVID_LEN];
-               char grpid[WFA_P2P_GRP_ID_LEN]; 
-          char p2presult[8];
-          char wpsPin[WFA_WPS_PIN_LEN];
-          caP2pStaGetPskResp_t pskInfo;
-          caP2pStartGrpFormResp_t grpFormInfo;
-/* P2P */
-       int connected;
-   } cmdru;
-}dutCmdResponse_t;
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_sock.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_sock.h
deleted file mode 100644 (file)
index aacf773..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-#ifndef _WFA_SOCK_H
-#define _WFA_SOCK_H
-
-#include <stdio.h>      /* for printf() and fprintf() */
-#ifdef _WINDOWS
-#include <winsock.h> /* for socket(), bind(), and connect() */
-#else
-#include <sys/socket.h> /* for socket(), bind(), and connect() */
-#include <arpa/inet.h>  /* for sockaddr_in and inet_ntoa() */
-#include <stdlib.h>     /* for atoi() and exit() */
-#include <string.h>     /* for memset() */
-#include <unistd.h>     /* for close() */
-#include <sys/time.h>       /* for struct timeval {} */
-#endif
-#include <stdlib.h>     /* for atoi() and exit() */
-#include <string.h>     /* for memset() */
-#include <fcntl.h>          /* for fcntl() */
-#include <errno.h>
-
-#define MAX_UDP_LEN     2048
-
-struct sockfds
-{
-   int *agtfd;      /* dut agent main socket fd */
-   int *cafd;       /* sock fd to control agent */
-   int *tgfd;       /* traffic agent fd         */
-   int *wmmfds;     /* wmm stream ids           */
-   int *psfd;       /* wmm-ps socket id         */
-};
-
-extern int wfaCreateTCPServSock(unsigned short sport);
-extern int wfaCreateUDPSock(char *sipaddr, unsigned short sport);
-extern int wfaAcceptTCPConn(int servSock);
-extern int wfaConnectUDPPeer(int sock, char *dipaddr, int dport);
-extern void wfaSetSockFiDesc(fd_set *sockset, int *, struct sockfds *);
-#ifdef _WINDOWS
-extern int wfaCtrlSend(SOCKET sock, unsigned char *buf, int bufLen);
-#else
-extern int wfaCtrlSend(int sock, unsigned char *buf, int bufLen);
-#endif
-extern int wfaCtrlRecv(int sock, unsigned char *buf);
-extern int wfaTrafficSendTo(int sock, char *buf, int bufLen, struct sockaddr *to);
-extern int wfaTrafficRecv(int sock, char *buf, struct sockaddr *from);
-extern int wfaGetifAddr(char *ifname, struct sockaddr_in *sa);
-extern struct timeval *wfaSetTimer(int, int, struct timeval *);
-extern int wfaSetSockMcastRecvOpt(int, char*);
-extern int wfaSetSockMcastSendOpt(int);
-extern int wfaSetProcPriority(int);
-
-
-#endif /* _WFA_SOCK_H */
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_stdincs.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_stdincs.h
deleted file mode 100644 (file)
index 5ab51c5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdio.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <time.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <linux/types.h>
-#include <linux/socket.h>
-#include <sys/select.h>
-#include <poll.h>
-#include <linux/if.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sched.h>
-#include <math.h>
-#include <errno.h>
-
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tg.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tg.c
deleted file mode 100644 (file)
index ef74129..0000000
+++ /dev/null
@@ -1,1324 +0,0 @@
-
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-/*
- *    File: wfa_tg.c 
- *    Library functions for traffic generator.
- *    They are shared with both TC and DUT agent.
- * 
- *    Revision History:
- *       2006/03/10 -- initially created by qhu 
- *       2006/06/01 -- BETA release by qhu 
- *       2006/06/13 -- 00.02 release by qhu
- *       2006/06/30 -- 00.10 Release by qhu
- *       2006/07/10 -- 01.00 Release by qhu
- *       2006/08/01 -- 01.03 fix ping result unreachable caused by random output
- *                           timing. Add 2 seconds wait-time. 
- *                           change priority level to 40 max while traffic
- *                           sending/receiving and 60 min for normal state.
- *       2006/09/01 -- 01.05 Release by qhu
- *       2006/10/26 -- 01.06 released by qhu
- *       2006/10.20 -- bug fixes report by n. ojannen
- *       2006/12/30 -- bug fix. a potential race condition for transaction test, *                     reported by c.benson.
- *       2006/01/11 -- 01.10 released by qhu
- *       2007/02/15  -- WMM Extension Beta released by qhu, mkaroshi
- *       2007/03/15  -- develop a better rate control method for sendLong
- *                      a major bug fix for File receive that opens socket with
- *                      source port. It should be destination port. This was
- *                      an early mistake because of interpretation.
- *       2007/03/30 -- 01.40 WPA2 and Official WMM Beta Release by qhu
- *       2007/04/20 -- 02.00 WPA2 and Official WMM Release by qhu
- *       2007/08/15 --  02.10 WMM-Power Save release by qhu
- *       2007/10/10 -- 02.20 Voice SOHO beta -- qhu
- *       2007/11/07 -- 02.30 Voice HSO -- qhu
- *           -- revise the code for traffic throttled control
- *           -- take care of EAGAIN error return by socket sendto() -- suggested
- *              by tterhaar
- *       2007/12/10 -- 02.32 Further modify the throttled mechanism for traffic
- *                     test.
- *       2008/01/03 -- 02.34 Support the result upload command
- *       2008/02/07 -- 02.40 Support Updated WMM-PS method
- *                     Comment out the process priority settings, user could
- *                     decide to use them
- *       2008/03/14 -- 02.41 Bug #12, reset a socket before closing it, change 
- *                           to close the socket id first then reset it to -1 
- *                           in function tmout_stop_send()
- *
- *                           Bug #14. Not A Bug, impove the rate control by
- *                           change 50 ms period to 20 ms period and lower
- *                           max rate from 3000 to 2500 in function 
- *                           wfaTxSleepTime().
- */
-#include <sys/time.h>
-#include <time.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <pthread.h>
-#include <math.h>
-
-#include "wfa_portall.h"
-#include "wfa_stdincs.h"
-#include "wfa_debug.h"
-#include "wfa_ver.h"
-#include "wfa_main.h"
-#include "wfa_tlv.h"
-#include "wfa_tg.h"
-#include "wfa_cmds.h"
-#include "wfa_sock.h"
-#include "wfa_rsp.h"
-#include "wfa_wmmps.h"
-#include "wfa_miscs.h"
-
-extern tgStream_t gStreams[];
-extern BOOL gtgRecv;
-extern BOOL gtgSend;
-extern BOOL gtgTransac;
-extern int gtimeOut;
-extern int gRegSec;
-extern BOOL gtgCaliRTD;
-
-int btSockfd = -1;
-int adj_latency;
-
-extern tgStream_t *findStreamProfile(int);
-extern int wfaTrafficSendTo(int, char *, int, struct sockaddr *);
-extern int wfaTrafficRecv(int, char *, struct sockaddr *);
-extern void wfaSendPing(tgPingStart_t *staPing, float *interval, int streamid);
-extern int wfaStopPing(dutCmdResponse_t *stpResp, int streamid);
-extern unsigned short wfa_defined_debug;
-extern int tgSockfds[];
-
-extern tgWMM_t wmm_thr[];
-
-extern double min_rttime;
-extern double gtgPktRTDelay;
-extern void int2BuffBigEndian(int val, char *buf);
-extern int bigEndianBuff2Int(char *buff);
-
-#ifdef WFA_WMM_PS_EXT
-extern int gtgWmmPS;
-extern wfaWmmPS_t wmmps_info;
-extern int psSockfd;
-extern unsigned int psTxMsg[];
-extern unsigned int psRxMsg[];
-extern int gtgPsPktRecvd;
-
-extern void wfaSetDUTPwrMgmt(int mode);
-void wmmps_wait_state_proc();
-
-#endif
-
-
-
-static int streamId = 0;
-static int totalTranPkts = 0, sentTranPkts = 0;
-int slotCnt = 0;
-
-extern int usedThread;
-extern int runLoop;
-extern int sendThrId;
-
-char e2eResults[124];
-#if 0  /* for test purpose only */
-char *e2eResults = "/tmp/e2e1198798626.txt";
-#endif
-
-
-extern dutCmdResponse_t gGenericResp;
-
-/* Some devices may only support UDP ECHO and do not have ICMP level ping */
-// #define WFA_PING_UDP_ECHO_ONLY     1
-
-/*
- * findStreamProfile(): search existing stream profile by stream id
- * input: id - stream id;
- * return: matched stream profile
- */
-tgStream_t *findStreamProfile(int id)
-{
-    int i;
-    tgStream_t *myStream = gStreams;
-
-    for(i = 0; i< WFA_MAX_TRAFFIC_STREAMS; i++)
-    {
-       if(myStream->id == id)
-          return myStream;
-       
-       myStream++;
-    }
-
-    return NULL;
-}
-
-/*
- * wfaTGSendPing(): Instruct Traffic Generator to send ping packets
- *
- */
-int wfaTGSendPing(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    int streamid = ++streamId;
-    float interval;      /* it could be subseconds/100s minisecond */
-    tgPingStart_t *staPing = (tgPingStart_t *)caCmdBuf;
-    dutCmdResponse_t *spresp = &gGenericResp;
-
-#ifdef WFA_PING_UDP_ECHO_ONLY
-    tgStream_t *myStream = NULL;
-#endif
-
-    DPRINT_INFO(WFA_OUT, "Entering wfaTSendPing ...\n");
-    if(staPing->frameSize == 0)
-         staPing->frameSize = 100;
-
-    printf("fr %i\n", staPing->frameRate);
-    if(staPing->frameRate == 0)
-         staPing->frameRate = 1;
-
-    interval = (float) 1/staPing->frameRate;
-    printf("TG: interval %f\n", interval);
-
-    if(staPing->duration == 0)
-         staPing->duration = 30;
-
-    switch(staPing->type)
-    {
-    case WFA_PING_ICMP_ECHO:
-#ifndef WFA_PING_UDP_ECHO_ONLY
-        printf("The steam ID is:%d \n",streamId);
-
-        if(cmd_traffic_send_ping(sigma_dut_ptr(), staPing, spresp) < 0){        
-               spresp->status = STATUS_ERROR;  
-               *respLen = 0;
-                return FALSE;
-        }
-        //wfaSendPing(staPing, &interval, streamId);
-
-        spresp->status = STATUS_COMPLETE;
-        spresp->streamId = streamid;
-#else
-        printf("Only support UDP ECHO\n");
-#endif
-        break;
-
-    case WFA_PING_UDP_ECHO:
-    {
-#ifdef WFA_PING_UDP_ECHO_ONLY
-        /*
-         * Make this like a transaction testing
-         * Then make it a profile and run it
-         */
-        myStream = &gStreams[slotCnt++];
-        memset(myStream, 0, sizeof(tgStream_t));
-        memcpy(&myStream->profile, caCmdBuf, len);
-        myStream->id = streamid; /* the id start from 1 */
-        myStream->tblidx = slotCnt-1;
-
-        btSockfd = wfaCreateUDPSock("127.0.0.1", WFA_UDP_ECHO_PORT);
-        if((btSockfd = wfaConnectUDPPeer(btSockfd, staPing->dipaddr, WFA_UDP_ECHO_PORT)) > 0)
-        {
-            gtgTransac = streamid;
-            gtgSend = streamid;
-            totalTranPkts = 512;
-            sentTranPkts = 0;
-
-            /*
-             * the framerate here is used to derive the timeout
-             * value for waiting transaction echo responses.
-             */
-            gtimeOut = MINISECONDS/staPing->frameRate;  /* in msec */
-
-            /* set to longest time */
-            if(staPing->duration == 0)
-                staPing->duration = 3600;
-        }
-#else
-        printf("Doesn't support UDP Echo\n");
-#endif
-        break;
-    }
-    default:
-    {
-        spresp->status = STATUS_INVALID;
-        spresp->streamId = streamid;
-    }
-    }
-
-
-    wfaEncodeTLV(WFA_TRAFFIC_SEND_PING_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)spresp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-    return TRUE;
-}
-
-/*
- * tgStopPing(): Instruct Traffic Generator to stop ping packets
- *
- */
-int wfaTGStopPing(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    int streamid = *(int *)(caCmdBuf);
-    dutCmdResponse_t *stpResp = &gGenericResp;
-    tgStream_t *myStream;
-    int i;
-
-    stpResp->status = STATUS_COMPLETE;
-
-    printf("CS: The length %d\n and the command buff is \n",len);
-
-    for (i=0;i<8;i++)
-       printf(" %x ",caCmdBuf[i]);
-
-    printf("\nthe stream id is %d",streamid);
-
-    if( gtgTransac == streamid&&gtgSend == streamid)
-    {
-        gtgTransac =0;
-        gtgSend = 0;
-//        gtimeOut = 0;
-        gtgRecv = 0;
-        alarm(0);
-
-        myStream = findStreamProfile(streamid);
-        if(myStream == NULL)
-        {
-            stpResp->status = STATUS_INVALID;
-        }
-
-        stpResp->cmdru.pingStp.sendCnt = myStream->stats.txFrames;
-        stpResp->cmdru.pingStp.repliedCnt = myStream->stats.rxFrames;
-    }
-    else
-    {
-#if 0
-        if(wfaStopPing(stpResp, streamid)== FALSE)
-        {
-            stpResp->status = STATUS_COMPLETE;
-
-            wfaEncodeTLV(WFA_TRAFFIC_STOP_PING_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)stpResp, respBuf);
-            *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-        }
-#endif
-
-        if(cmd_traffic_stop_ping(sigma_dut_ptr(), streamid, stpResp) < 0){        
-                       stpResp->status = STATUS_ERROR;  
-                       *respLen = 0;
-                        return FALSE;
-        }        
-        //wfaStopPing(stpResp, streamid);
-     }
-
-     wfaEncodeTLV(WFA_TRAFFIC_STOP_PING_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)stpResp, respBuf);
-     *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-    return TRUE;
-}
-
-/*
- * wfaTGConfig: store the traffic profile setting that will be used to
- *           instruct traffic generation.
- * input: cmd -- not used
- * response: send success back to controller
- * return: success or fail
- * Note: the profile storage is a global space.
- */
-int wfaTGConfig(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
-{
-    int ret = FALSE;
-    tgStream_t *myStream = NULL;
-    dutCmdResponse_t *confResp = &gGenericResp;
-    
-    /* if the stream table over maximum, reset it */ 
-    if(slotCnt == WFA_MAX_TRAFFIC_STREAMS)
-       slotCnt = 0;
-
-    if(slotCnt == 0)
-    {
-       printf("resetting stream table\n");
-       wMEMSET(gStreams, 0, WFA_MAX_TRAFFIC_STREAMS*sizeof(tgStream_t));
-    }
-   
-    DPRINT_INFO(WFA_OUT, "entering tcConfig ...\n");
-    myStream = &gStreams[slotCnt++];
-    wMEMSET(myStream, 0, sizeof(tgStream_t));
-    wMEMCPY(&myStream->profile, caCmdBuf, len);
-    myStream->id = ++streamId; /* the id start from 1 */ 
-    myStream->tblidx = slotCnt-1;
-
-#if 0
-    DPRINT_INFO(WFA_OUT, "profile %i direction %i dest ip %s dport %i source %s sport %i rate %i duration %i size %i class %i delay %i\n", myStream->profile.profile, myStream->profile.direction, myStream->profile.dipaddr, myStream->profile.dport, myStream->profile.sipaddr, myStream->profile.sport, myStream->profile.rate, myStream->profile.duration, myStream->profile.pksize, myStream->profile.trafficClass, myStream->profile.startdelay);
-#endif
-    confResp->status = STATUS_COMPLETE; 
-    confResp->streamId = myStream->id;
-    wfaEncodeTLV(WFA_TRAFFIC_AGENT_CONFIG_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)confResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t); 
-
-
-    return ret;
-}
-
-/* RecvStart: instruct traffic generator to start receiving 
- *                 based on a profile
- * input:      cmd -- not used
- * response:   inform controller for "running"
- * return:     success or failed 
- */
-int wfaTGRecvStart(int len, BYTE *parms, int *respLen, BYTE *respBuf)
-{
-    int status = STATUS_COMPLETE, i;
-    int numStreams = len/4;
-    int streamid;
-    tgProfile_t *theProfile;
-    tgStream_t *myStream;
-
-    DPRINT_INFO(WFA_OUT, "entering tgRecvStart\n");
-
-    /*
-     * The function wfaSetProcPriority called here is to enhance the real-time
-     * performance for packet receiving. It is only for tuning and optional
-     * to implement
-     */
-    //wfaSetProcPriority(60);
-
-    for(i=0; i<numStreams; i++)
-    {
-        wMEMCPY(&streamid, parms+(4*i), 4); /* changed from 2 to 4, bug reported by n.ojanen */
-        myStream = findStreamProfile(streamid); 
-        if(myStream == NULL)
-        {
-            status = STATUS_INVALID;
-            return status;    
-        }
-
-        theProfile = &myStream->profile;
-        if(theProfile == NULL)
-        {
-           status = STATUS_INVALID;
-           return status;
-        }
-
-        /* calculate the frame interval which is used to derive its jitter */
-        if(theProfile->rate != 0 && theProfile->rate < 5000)
-           myStream->fmInterval = 1000000/theProfile->rate; /* in ms */
-        else
-           myStream->fmInterval = 0;
-
-        if(theProfile->direction != DIRECT_RECV)
-        {
-           status = STATUS_INVALID;
-           return status;
-        }
-
-        wMEMSET(&myStream->stats, 0, sizeof(tgStats_t));
-
-        // mark the stream active
-        myStream->state = WFA_STREAM_ACTIVE;
-       
-        switch(theProfile->profile)
-        {
-#ifdef WFA_WPA2_SINGLE_THREAD  
-           case PROF_MCAST:
-           case PROF_FILE_TX:
-//           case PROF_IPTV:
-               btSockfd = wfaCreateUDPSock(theProfile->dipaddr, theProfile->dport);
-               gtgRecv = streamid;
-
-               if(btSockfd < 0)
-                  status = STATUS_ERROR;
-               else
-               {
-                  /* get current flags setting */
-                  int ioflags = wFCNTL(btSockfd, F_GETFL, 0);
-
-                  /* set only BLOCKING flag to non-blocking */
-                  wFCNTL(btSockfd, F_SETFL, ioflags | O_NONBLOCK);
-               }
-           break;
-#else
-
-           case PROF_TRANSC:
-          case PROF_CALI_RTD:  /* Calibrate roundtrip delay */
-              gtgTransac = streamid;
-           case PROF_MCAST:
-           case PROF_FILE_TX:
-           case PROF_IPTV:
-              gtgRecv = streamid;
-              wmm_thr[usedThread].thr_flag = streamid;
-              wPT_MUTEX_LOCK(&wmm_thr[usedThread].thr_flag_mutex);
-              wPT_COND_SIGNAL(&wmm_thr[usedThread].thr_flag_cond);
-              wPT_MUTEX_UNLOCK(&wmm_thr[usedThread].thr_flag_mutex);
-              printf("Recv Start in thread %i for streamid %i\n", usedThread, streamid);
-             usedThread++;
-           break;
-#endif       
-           case PROF_UAPSD:
-#ifdef WFA_WMM_PS_EXT
-           status = STATUS_COMPLETE;
-           psSockfd = wfaCreateUDPSock(theProfile->dipaddr, WFA_WMMPS_UDP_PORT);
-
-           wmmps_info.sta_state = 0;
-           wmmps_info.wait_state = WFA_WAIT_STAUT_00;
-
-           wMEMSET(&wmmps_info.psToAddr, 0, sizeof(wmmps_info.psToAddr));
-           wmmps_info.psToAddr.sin_family = AF_INET;
-           wmmps_info.psToAddr.sin_addr.s_addr = inet_addr(theProfile->sipaddr);
-           wmmps_info.psToAddr.sin_port = htons(theProfile->sport);
-          wmmps_info.reset = 0;
-
-           wmm_thr[usedThread].thr_flag = streamid;
-           wmmps_info.streamid = streamid;
-           wPT_MUTEX_LOCK(&wmm_thr[usedThread].thr_flag_mutex);
-           wPT_COND_SIGNAL(&wmm_thr[usedThread].thr_flag_cond);
-           gtgWmmPS = streamid;;
-           wPT_MUTEX_UNLOCK(&wmm_thr[usedThread].thr_flag_mutex);
-           usedThread++;
-#endif   /* WFA_WMM_PS_EXT */
-           break;
-       }
-    }
-
-    /* encode a TLV for response for "complete/error ..." */
-    wfaEncodeTLV(WFA_TRAFFIC_AGENT_RECV_START_RESP_TLV, sizeof(int), 
-                 (BYTE *)&status, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + sizeof(int); 
-
-    return TRUE;
-}
-
-/*
- * tgRecvStop: instruct traffic generator to stop receiving based on a profile
- * input:      cmd -- not used
- * response:   inform controller for "complete"
- * return:     success or failed 
- */
-int wfaTGRecvStop(int len, BYTE *parms, int *respLen, BYTE *respBuf)
-{
-    int status = STATUS_COMPLETE, i;
-    int numStreams = len/4;
-    unsigned int streamid;
-    tgProfile_t *theProfile;
-    tgStream_t *myStream=NULL;
-    dutCmdResponse_t statResp;
-    BYTE dutRspBuf[WFA_RESP_BUF_SZ];
-    int id_cnt = 0;
-
-    DPRINT_INFO(WFA_OUT, "entering tgRecvStop with length %d\n",len);
-
-    /* in case that send-stream not done yet, an optional delay */
-    while(sendThrId != 0)
-      sleep(1);
-
-    /*
-     * After finishing the receiving command, it should lower itself back to 
-     * normal level. It is optional implementation if it is not called 
-     * while it starts receiving for raising priority level.
-     */
-    //wfaSetProcPriority(30);
-    wMEMSET(dutRspBuf, 0, WFA_RESP_BUF_SZ);
-    for(i=0; i<numStreams; i++)
-    {
-        wMEMCPY(&streamid, parms+(4*i), 4);
-        printf(" stop stream id %i\n", streamid);
-        myStream = findStreamProfile(streamid); 
-        if(myStream == NULL)
-        {
-            status = STATUS_INVALID;
-            wfaEncodeTLV(WFA_TRAFFIC_AGENT_RECV_STOP_RESP_TLV, 4, (BYTE *)&status, respBuf);
-            *respLen = WFA_TLV_HDR_LEN + 4;
-            printf("stream table empty\n");
-            continue;    
-        }
-
-        theProfile = &myStream->profile;
-        if(theProfile == NULL)
-        {
-           status = STATUS_INVALID;
-           wfaEncodeTLV(WFA_TRAFFIC_AGENT_RECV_STOP_RESP_TLV, 4, (BYTE *)&status, respBuf);
-           *respLen = WFA_TLV_HDR_LEN + 4;
-
-           return TRUE;
-        }
-
-        if(theProfile->direction != DIRECT_RECV)
-        {
-           status = STATUS_INVALID;
-           wfaEncodeTLV(WFA_TRAFFIC_AGENT_RECV_STOP_RESP_TLV, 4, (BYTE *)&status, respBuf);
-           *respLen = WFA_TLV_HDR_LEN + 4;
-
-           return TRUE;
-        }
-
-        /* reset its flags , close sockets */
-        switch(theProfile->profile)
-        {
-         case PROF_TRANSC:
-        case PROF_CALI_RTD:
-            gtgTransac = 0;
-         case PROF_MCAST:
-         case PROF_FILE_TX:
-         case PROF_IPTV:
-             gtgRecv = 0;
-             if(tgSockfds[myStream->tblidx] != -1)
-             {
-                wCLOSE(tgSockfds[myStream->tblidx]);
-                tgSockfds[myStream->tblidx] = -1;
-             }
-         break;
-
-        case PROF_UAPSD:
-#ifdef WFA_WMM_PS_EXT
-         gtgWmmPS = 0;
-         gtgPsPktRecvd = 0;
-
-         if(psSockfd != -1)
-         {
-             wCLOSE(psSockfd);
-             psSockfd = -1;
-         }
-
-         wMEMSET(&wmmps_info, 0, sizeof(wfaWmmPS_t));
-
-         wfaSetDUTPwrMgmt(PS_OFF);
-#endif /* WFA_WMM_PS_EXT */
-         break;
-
-         }
-       /* encode a TLV for response for "complete/error ..." */
-       statResp.status = STATUS_COMPLETE; 
-       statResp.streamId = streamid; 
-
-#if 1
-       DPRINT_INFO(WFA_OUT, "stream Id %u rx %u total %llu\n", streamid, myStream->stats.rxFrames, myStream->stats.rxPayloadBytes);
-#endif
-       wMEMCPY(&statResp.cmdru.stats, &myStream->stats, sizeof(tgStats_t));
-       wMEMCPY((dutRspBuf + i * sizeof(dutCmdResponse_t)), (BYTE *)&statResp, sizeof(dutCmdResponse_t));
-       id_cnt++;
-
-        // Not empty it but require to reset the entire table before test starts.
-        //wMEMSET(myStream, 0, sizeof(tgStream_t));
-    }
-
-    // mark the stream inactive
-    myStream->state = WFA_STREAM_INACTIVE;
-
-    printf("Sending back the statistics at recvstop\n");
-    wfaEncodeTLV(WFA_TRAFFIC_AGENT_RECV_STOP_RESP_TLV, id_cnt * sizeof(dutCmdResponse_t), dutRspBuf, respBuf);
-
-    /* done here */
-    *respLen = WFA_TLV_HDR_LEN + numStreams * sizeof(dutCmdResponse_t); 
-
-    return TRUE;
-}
-
-/*
- * wfaTGSendStart: instruct traffic generator to start sending based on a profile
- * input:      cmd -- not used
- * response:   inform controller for "running"
- * return:     success or failed 
- */
-int wfaTGSendStart(int len, BYTE *parms, int *respLen, BYTE *respBuf)
-{
-    int i=0, streamid=0;
-    int numStreams = len/4;
-
-    tgProfile_t *theProfile;
-    tgStream_t *myStream = NULL;
-
-    dutCmdResponse_t staSendResp;
-
-    DPRINT_INFO(WFA_OUT, "Entering tgSendStart for %i streams ...\n", numStreams);
-    for(i=0; i<numStreams; i++)
-    {
-        wMEMCPY(&streamid, parms+(4*i), 4);
-        myStream = findStreamProfile(streamid); 
-        if(myStream == NULL)
-        {
-           staSendResp.status = STATUS_INVALID;
-           wfaEncodeTLV(WFA_TRAFFIC_AGENT_SEND_RESP_TLV, 4, (BYTE *)&staSendResp, respBuf);
-           *respLen = WFA_TLV_HDR_LEN + 4;
-           return TRUE;
-        }
-
-        theProfile = &myStream->profile;
-        if(theProfile == NULL)
-        {
-           staSendResp.status = STATUS_INVALID;
-           wfaEncodeTLV(WFA_TRAFFIC_AGENT_SEND_RESP_TLV, 4, (BYTE *)&staSendResp, respBuf);
-           *respLen = WFA_TLV_HDR_LEN + 4;
-
-           return TRUE;
-        }
-               
-        if(theProfile->direction != DIRECT_SEND)
-        {
-           staSendResp.status = STATUS_INVALID;
-           wfaEncodeTLV(WFA_TRAFFIC_AGENT_SEND_RESP_TLV, 4, (BYTE *)&staSendResp, respBuf);
-           *respLen = WFA_TLV_HDR_LEN + 4;
-
-           return TRUE;
-        }
-
-        /*
-         * need to reset the stats
-         */
-        wMEMSET(&myStream->stats, 0, sizeof(tgStats_t));
-
-        // mark the stream active;
-        myStream->state = WFA_STREAM_ACTIVE;
-
-        switch(theProfile->profile)
-        {
-        case PROF_FILE_TX:
-        case PROF_MCAST:
-        case PROF_TRANSC:
-        gtgTransac = streamid;
-        gtgSend = streamid;
-        case PROF_CALI_RTD:
-        gtgCaliRTD = streamid;
-        case PROF_IPTV:
-        gtgSend = streamid;
-        /*
-         * singal the thread to Sending WMM traffic 
-         */
-         
-        //if(usedThread < 
-        wmm_thr[usedThread].thr_flag = streamid;
-        wPT_MUTEX_LOCK(&wmm_thr[usedThread].thr_flag_mutex);
-        wPT_COND_SIGNAL(&wmm_thr[usedThread].thr_flag_cond);
-        wPT_MUTEX_UNLOCK(&wmm_thr[usedThread].thr_flag_mutex);
-        usedThread++;
-        //wfaSetProcPriority(90);
-
-        break;
-        } 
-    }
-
-    *respLen = 0;
-    return TRUE;
-}
-
-int wfaTGReset(int len, BYTE *parms, int *respLen, BYTE *respBuf)
-{
-    dutCmdResponse_t *resetResp = &gGenericResp;
-    int i;
-
-    /* need to reset all traffic socket fds */
-    if(btSockfd != -1)
-    {
-       wCLOSE(btSockfd);
-       btSockfd = -1;
-    }
-
-    for(i = 0; i<WFA_MAX_TRAFFIC_STREAMS; i++)
-    {
-        if(tgSockfds[i] != -1)
-        {
-            wCLOSE(tgSockfds[i]);
-            tgSockfds[i] = -1;
-        }
-    }
-
-    /* reset the timer alarm if it was armed */
-    wALARM(0);
-
-    /* just reset the flags for the command */
-    gtgRecv = 0;
-    gtgSend = 0;
-    gtgTransac = 0;
-#ifdef WFA_VOICE_EXT
-    gtgCaliRTD = 0;
-    min_rttime = 0xFFFFFFFF;
-    gtgPktRTDelay = 0xFFFFFFFF;
-#endif
-
-    totalTranPkts = 0;
-    //gtimeOut = 0;
-
-    runLoop = 0;
-
-    usedThread = 0;
-#ifdef WFA_WMM_PS_EXT
-    gtgWmmPS = 0;
-    gtgPsPktRecvd = 0;
-
-    if(psSockfd != -1)
-    {
-       wCLOSE(psSockfd);
-       psSockfd = -1;
-    }
-
-    wMEMSET(&wmmps_info, 0, sizeof(wfaWmmPS_t));
-
-//         wfaSetDUTPwrMgmt(PS_OFF);
-#endif
-
-    e2eResults[0] = '\0';
-
-    /* Also need to clean up WMM streams NOT DONE YET!*/
-    slotCnt = 0;             /* reset stream profile container */
-    wMEMSET(gStreams, 0, WFA_MAX_TRAFFIC_STREAMS); 
-
-    /*
-     * After be asked to reset, it should lower itself back to 
-     * normal level. It is optional implementation if it is not called 
-     * while it starts sending/receiving for raising priority level.
-     */
-    //wfaSetProcPriority(20);
-
-    /* encode a TLV for response for "complete ..." */
-    resetResp->status = STATUS_COMPLETE; 
-    wfaEncodeTLV(WFA_TRAFFIC_AGENT_RESET_RESP_TLV, 4, 
-                 (BYTE *)resetResp, respBuf);
-    *respLen = WFA_TLV_HDR_LEN + 4; 
-
-    return TRUE;
-}
-
-/*
- * calculate the sleep time for different frame rate
- * It should be done according the device
- * This is just one way to adjust the packet delivery speed. If you find 
- * you device does not meet the test requirements, you MUST re-adjust 
- * the method.
- */
-
-/* The HZ value could be found in the build header file */
-/* 100 -> 10ms, 1000 -> 1ms , etc                       */
-#define WFA_KERNEL_MIN_TIMER_RES   100   /* HZ Value for 10 ms */
-
-void wfaTxSleepTime(int profile, int rate, int *sleepTime, int *throttledRate)
-{
-    *sleepTime=0;     /* in microseconds */
-    /* calculate the sleep time based on frame rate */
-
-    /*
-     * Framerate is still required for Multicast traffic
-     * Sleep and hold for a timeout.
-     *
-     * For WMM traffic, the framerate must also need for VO and VI.
-     * the framerate 500, OS may not handle it precisely.
-     */
-    switch(profile)
-    {
-        /*
-         * make it a fix rate
-         * according to test plan, it requires ~80kbps which is around 50 frames/s
-         * For other cases which may want to run experiments for very high rate, 
-         * the change should accommodate the requirement.
-         */
-        case PROF_MCAST:
-        if(rate < 500 && rate >= 50)
-        {
-            *sleepTime = 100000;  /* sleep for 100 ms */
-            *throttledRate = WFA_MCAST_FRATE;
-        }
-        else
-        {
-            *sleepTime = 100000;
-            *throttledRate = rate;
-        }
-#if 0
-        *throttledRate = WFA_MCAST_FRATE;
-#endif
-        break;
-
-        /*
-         * Vendor must find ways to better adjust the speed for their own device
-         */
-        case PROF_IPTV:
-        case PROF_FILE_TX:
-        if(rate >=50 || rate == 0)
-        {
-           /* 
-            * this sleepTime indeed is now being used for time period  
-            * to send packets in the throttled Rate.  
-            * The idea here is that in each fixed 20 minisecond period,
-            * The device will send rate/50 (rate = packets / second),
-            * then go sleep for rest of time.
-            */
-            *sleepTime = 20000; /* fixed 20 miniseconds */
-            *throttledRate = (rate?rate:25000)/50; 
-           printf("Sleep time %i, throttledRate %i\n", *sleepTime, *throttledRate);
-        }
-        else if (rate > 0 && rate <= 50) /* typically for voice */
-        {
-            *throttledRate = 1;
-            *sleepTime = 1000*1000/rate;
-        }
-        break;
-        default:
-          DPRINT_ERR(WFA_ERR, "Incorrect profile\n");
-    } 
-}
-
-#define WFA_TIME_DIFF(before, after, rtime, dtime) \
-             dtime = rtime + (after.tv_sec*1000000 + after.tv_usec) - (before.tv_sec*1000000 + before.tv_usec);
-
-void buzz_time(int delay)
-{
-    struct timeval now, stop;
-    int diff;
-    int remain_time = 0;
-
-    wGETTIMEOFDAY(&stop, 0);
-
-    stop.tv_usec += delay;
-    if(stop.tv_usec > 1000000)
-    {
-        stop.tv_usec -=1000000;
-       stop.tv_sec +=1;
-    }
-
-    do
-    {
-        wGETTIMEOFDAY(&now, 0);
-       WFA_TIME_DIFF(now, stop, remain_time, diff);
-    } while(diff>0);
-}
-
-/**************************************************/
-/* the actually functions to send/receive packets */
-/**************************************************/
-
-/* This is going to be a blocking SEND till it finishes */
-int wfaSendLongFile(int mySockfd, int streamid, BYTE *aRespBuf, int *aRespLen)
-{
-    tgProfile_t           *theProf = NULL;
-    tgStream_t            *myStream = NULL;
-    struct sockaddr_in    toAddr;
-    char                  *packBuf; 
-    int  packLen;
-    int  bytesSent;
-    dutCmdResponse_t sendResp;
-    int sleepTime = 0;
-    int throttledRate = 0;
-    struct timeval before, after,af; 
-    int difftime = 0, counter = 0;
-    struct timeval stime;
-    int throttled_est_cost;
-    int act_sleep_time;
-    gettimeofday(&af,0);
-   
-    DPRINT_INFO(WFA_OUT, "Entering sendLongFile %i\n", streamid);
-
-    /* find the profile */
-    myStream = findStreamProfile(streamid);
-    if(myStream == NULL)
-    {
-        return FALSE;    
-    }
-
-    theProf = &myStream->profile;
-
-    if(theProf == NULL)
-    {
-        return FALSE;
-    }
-
-    packLen = theProf->pksize;
-
-    /* allocate a buf */
-    packBuf = (char *)malloc(packLen);
-    wMEMSET(packBuf, 1, packLen);
-
-    /* fill in the header */
-    wSTRNCPY(packBuf, "1345678", sizeof(tgHeader_t));
-
-    /* initialize the destination address */
-    wMEMSET(&toAddr, 0, sizeof(toAddr));
-    toAddr.sin_family = AF_INET;
-    toAddr.sin_addr.s_addr = inet_addr(theProf->dipaddr);
-    toAddr.sin_port = htons(theProf->dport); 
-
-    /* if a frame rate and duration are defined, then we know
-     * interval for each packet and how many packets it needs to
-     * send.
-     */
-    if(theProf->duration != 0)
-    {
-        printf("duration %i\n", theProf->duration);
-        
-        /* 
-         *  use this to decide periodical interval sleep time and frames to send
-         *  int the each interval.
-         *  Each device should adopt a own algorithm for better performance
-         */
-        wfaTxSleepTime(theProf->profile, theProf->rate, &sleepTime, &throttledRate);
-        /* 
-         * alright, we need to raise the priority level of the process
-         * to improve the real-time performance of packet sending.
-         * Since this is for tuning purpose, it is optional implementation.
-         */
-        //wfaSetProcPriority(60);
-       
-       //interval = 1*1000000/theProf->rate ; // in usec;
-
-       // Here assumes it takes 20 usec to send a packet
-       throttled_est_cost = throttledRate * 20;  // MUST estimate the cost per ppk
-       act_sleep_time = sleepTime - adj_latency;
-       if (act_sleep_time <= 0)
-           act_sleep_time = sleepTime;  
-
-        printf("sleep time %i act_sleep_time %i\n", sleepTime, act_sleep_time);
-
-        runLoop=1;
-        while(runLoop)
-        {
-          counter++;
-           /* fill in the counter */
-           int2BuffBigEndian(counter, &((tgHeader_t *)packBuf)->hdr[8]);
-
-           /*
-            * the following code is only used to slow down
-            * over fast traffic flooding the buffer and cause
-            * packet drop or the other end not able to receive due to
-            * some limitations, purely for experiment purpose.
-            * each implementation needs some fine tune to it.
-            */
-          if(counter ==1)
-          {
-               wGETTIMEOFDAY(&before, NULL);
-
-               before.tv_usec += sleepTime;
-               if(before.tv_usec > 1000000)
-               {
-                   before.tv_usec -= 1000000;
-                   before.tv_sec +=1;
-               }
-           }
-
-           if(throttledRate != 0)
-           {
-              if(counter%throttledRate == 0)
-              {
-                 wGETTIMEOFDAY(&after, NULL);
-                difftime = wfa_itime_diff(&after, &before);
-
-                 if(difftime > adj_latency)
-                 {
-                    // too much time left, go sleep
-                    wUSLEEP(difftime-adj_latency);
-
-                    wGETTIMEOFDAY(&after, NULL);
-                   difftime = wfa_itime_diff(&after, &before);
-                 }
-
-                // burn the rest to absort latency
-                if(difftime >0)
-                    buzz_time(difftime);
-
-                before.tv_usec += sleepTime;
-                if(before.tv_usec > 1000000)
-                {
-                    before.tv_usec -= 1000000;
-                    before.tv_sec +=1;
-                }
-              }
-           } // otherwise, it floods 
-
-          /*
-           * Fill the timestamp to the header.
-           */
-          wGETTIMEOFDAY(&stime, NULL);
-
-          int2BuffBigEndian(stime.tv_sec, &((tgHeader_t *)packBuf)->hdr[12]);
-          int2BuffBigEndian(stime.tv_usec, &((tgHeader_t *)packBuf)->hdr[16]);
-
-           bytesSent = wfaTrafficSendTo(mySockfd, packBuf, packLen, 
-                            (struct sockaddr *)&toAddr);
-
-           if(bytesSent != -1)
-           {
-              myStream->stats.txPayloadBytes += bytesSent; 
-              myStream->stats.txFrames++ ;
-           }
-           else
-           {
-               int errsv = errno;
-               switch(errsv)
-               {
-                  case EAGAIN:
-                   case ENOBUFS:
-                        DPRINT_ERR(WFA_ERR, "send error\n");
-                        wUSLEEP(1000);             /* hold for 1 ms */
-                        counter-- ;
-                        myStream->stats.txFrames--;
-                   break;
-                   case ECONNRESET:
-                        runLoop = 0;
-                   break;
-                   case EPIPE:
-                        runLoop = 0;
-                   break;
-                   default:
-                      perror("sendto: ");
-                      DPRINT_ERR(WFA_ERR, "Packet sent error\n");
-               }
-           }
-
-        }
-
-
-        /*
-         * lower back to an original level if the process is raised previously
-         * It is optional.
-         */
-        //wfaSetProcPriority(30); 
-    }
-    else /* invalid parameters */
-    {
-        /* encode a TLV for response for "invalid ..." */
-        sendResp.status = STATUS_INVALID;
-        wfaEncodeTLV(WFA_TRAFFIC_AGENT_SEND_RESP_TLV, 4, 
-                 (BYTE *)&sendResp, (BYTE *)aRespBuf);
-
-        /* done here */
-        *aRespLen = WFA_TLV_HDR_LEN + 4; 
-
-        return DONE;
-    }
-
-    gtgSend = 0;
-
-    /* free the buffer */
-    wFREE(packBuf);
-
-    //printf("done sending long\n");
-    /* return statistics */
-    sendResp.status = STATUS_COMPLETE;
-    sendResp.streamId = myStream->id;
-    wMEMCPY(&sendResp.cmdru.stats, &myStream->stats, sizeof(tgStats_t)); 
-
-#if 0
-    DPRINT_INFO(WFA_OUT, "stream Id %u tx %u total %llu\n", myStream->id, myStream->stats.txFrames, myStream->stats.txPayloadBytes);
-#endif
-
-    wfaEncodeTLV(WFA_TRAFFIC_AGENT_SEND_RESP_TLV, sizeof(dutCmdResponse_t), 
-                 (BYTE *)&sendResp, (BYTE *)aRespBuf);
-
-    *aRespLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-
-    return DONE;
-}
-
-/* this only sends one packet a time */
-int wfaSendShortFile(int mySockfd, int streamid, BYTE *sendBuf, int pksize, BYTE *aRespBuf, int *aRespLen)
-{
-   BYTE *packBuf = sendBuf; 
-   struct sockaddr_in toAddr;
-   tgProfile_t *theProf;
-   tgStream_t *myStream;
-   int packLen, bytesSent=-1;
-   dutCmdResponse_t sendResp;
-
-   if(mySockfd == -1)
-   {
-      /* stop */ 
-      gtgTransac = 0;
-      //gtimeOut = 0; 
-      gtgRecv = 0;
-      gtgSend = 0;
-      printf("stop short traffic\n");
-
-      myStream = findStreamProfile(streamid);
-      if(myStream != NULL)
-      {
-          sendResp.status = STATUS_COMPLETE;
-          sendResp.streamId = streamid;
-          wMEMCPY(&sendResp.cmdru.stats, &myStream->stats, sizeof(tgStats_t)); 
-    
-          wfaEncodeTLV(WFA_TRAFFIC_AGENT_SEND_RESP_TLV, sizeof(dutCmdResponse_t), (BYTE *)&sendResp, aRespBuf);
-
-          *aRespLen = WFA_TLV_HDR_LEN + sizeof(dutCmdResponse_t);
-      }
-
-      return DONE;
-   }
-
-   /* find the profile */
-   myStream = findStreamProfile(streamid);
-
-   if(myStream == NULL)
-   {
-        return FALSE;
-   }
-
-   theProf = &myStream->profile;
-   if(theProf == NULL)
-   {
-        return FALSE;
-   }
-
-   if(pksize == 0)
-      packLen = theProf->pksize;
-   else
-      packLen = pksize;
-
-   wMEMSET(&toAddr, 0, sizeof(toAddr));
-   toAddr.sin_family = AF_INET;
-   toAddr.sin_addr.s_addr = inet_addr(theProf->sipaddr);
-   toAddr.sin_port = htons(theProf->sport); 
-
-   if(gtgRecv && gtgTransac)
-   {
-//      printf("mySock %i sipaddr %s sport %i\n", mySockfd, theProf->sipaddr, theProf->sport); 
-      toAddr.sin_addr.s_addr = inet_addr(theProf->sipaddr);
-      toAddr.sin_port = htons(theProf->sport); 
-   }
-   else if(gtgSend && gtgTransac)
-   {
-//      printf("mySock %i dipaddr %s dport %i\n", mySockfd, theProf->dipaddr, theProf->dport); 
-      toAddr.sin_addr.s_addr = inet_addr(theProf->dipaddr);
-      toAddr.sin_port = htons(theProf->dport); 
-   }
-
-   int2BuffBigEndian(myStream->stats.txFrames, &((tgHeader_t *)packBuf)->hdr[8]);
-
-   if(mySockfd != -1)
-      bytesSent = wfaTrafficSendTo(mySockfd, (char *)packBuf, packLen, (struct sockaddr *)&toAddr);
-
-   if(bytesSent != -1)
-   {
-      myStream->stats.txFrames++;
-      myStream->stats.txPayloadBytes += bytesSent;
-   }
-   else
-   {
-      int errsv = errno;
-      switch(errsv)
-      {
-          case EAGAIN:
-          case ENOBUFS:
-             DPRINT_ERR(WFA_ERR, "send error\n");
-             wUSLEEP(1000);             /* hold for 1 ms */
-             myStream->stats.txFrames--;
-         break;
-         default:
-              ;;
-             //perror("sendto: ");
-      }
-   }
-
-   sentTranPkts++;
-
-   return TRUE;
-}
-
-/* always receive from a specified IP address and Port */
-int wfaRecvFile(int mySockfd, int streamid, char *recvBuf)
-{
-    /* how many packets are received */  
-    char *packBuf = recvBuf; 
-    struct sockaddr_in fromAddr;
-    tgProfile_t *theProf;
-    tgStream_t *myStream;
-    unsigned int bytesRecvd;
-    int lostPkts;
-
-    /* find the profile */
-    myStream = findStreamProfile(streamid);
-    if(myStream == NULL)
-    {
-        return FALSE;
-    }
-
-    theProf = &myStream->profile;
-    if(theProf == NULL)
-    {
-        return FALSE;
-    }
-
-    wMEMSET(packBuf, 0, MAX_UDP_LEN);
-
-    wMEMSET(&fromAddr, 0, sizeof(fromAddr));
-    fromAddr.sin_family = AF_INET;
-    fromAddr.sin_addr.s_addr = inet_addr(theProf->dipaddr);
-    fromAddr.sin_port = htons(theProf->dport); 
-
-    if(gtgRecv && gtgTransac)
-    {
-       fromAddr.sin_addr.s_addr = inet_addr(theProf->sipaddr);
-       fromAddr.sin_port = htons(theProf->sport); 
-    }
-    else if(gtgSend && gtgTransac)
-    {
-       fromAddr.sin_addr.s_addr = inet_addr(theProf->dipaddr);
-       fromAddr.sin_port = htons(theProf->dport); 
-    }
-
-    /* it is always to receive at least one packet, in case more in the
-       queue, just pick them up.
-     */
-    bytesRecvd = wfaTrafficRecv(mySockfd, packBuf, (struct sockaddr *)&fromAddr);
-    if(bytesRecvd != -1)
-    {
-       myStream->stats.rxFrames++;    
-       myStream->stats.rxPayloadBytes +=bytesRecvd;
-
-       /*
-        *  Get the lost packet count
-        */
-       lostPkts = bigEndianBuff2Int(&((tgHeader_t *)packBuf)->hdr[8]) - 1 - myStream->lastPktSN; 
-       myStream->stats.lostPkts += lostPkts; 
-       myStream->lastPktSN = bigEndianBuff2Int(&((tgHeader_t *)packBuf)->hdr[8]); 
-    }
-    else
-    {
-#if 0
-       DPRINT_ERR(WFA_ERR, "Packet received error\n");
-       perror("receive error");
-#endif
-    }
-    return (bytesRecvd);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tg.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tg.h
deleted file mode 100644 (file)
index 58835c0..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-/*
- * wfa_tg.h:
- *   Definitions used in Traffic Generator Modules
- */
-#ifndef _WFA_TG_H
-#define _WFA_TG_H
-
-#include <sys/time.h>
-#if 1 // by bbelief
-#include <pthread.h>
-#endif
-
-/* maximum number of streams to support */
-#define IPV4_ADDRESS_STRING_LEN    16
-
-#define  MINISECONDS            1000
-#define  MICROSECONDS           1000000
-#define  NANOSECONDS            1000000000
-#define  LINUX_TIMER_RES        20000000      /* 20 MINSECONDS */
-#define  CA_RESPONSE_BUF_SIZE   128
-
-/* Profile Key words */
-#define KW_PROFILE                 1 
-#define KW_DIRECTION               2
-#define KW_DIPADDR                 3
-#define KW_DPORT                   4
-#define KW_SIPADDR                 5
-#define KW_SPORT                   6
-#define KW_FRATE                   7
-#define KW_DURATION                8
-#define KW_PLOAD                   9
-#define KW_TCLASS                  10
-#define KW_STREAMID                11
-#define KW_COMPLETE                12
-#define KW_ERROR                   13
-#define KW_STARTDELAY              14
-#define KW_NUMFRAME                15
-#define KW_USESYNCCLOCK            16
-#define KW_USERPRIORITY            17
-#define KW_MAXCNT                  18
-
-/* Profile Types */
-#define PROF_FILE_TX               1
-#define PROF_MCAST                 2
-#define PROF_IPTV                  3
-#define PROF_TRANSC                4
-#define PROF_START_SYNC            5      /* this will be outdated */
-#define PROF_CALI_RTD              5
-#define PROF_UAPSD                 6
-#define PROF_LAST                  7
-
-/* stream state */
-#define WFA_STREAM_INACTIVE        0
-#define WFA_STREAM_ACTIVE          1
-
-/* Traffic Directions */
-#define DIRECT_SEND                1 
-#define DIRECT_RECV                2 
-
-#define TG_PROTO_TCP               0 
-#define TG_PROTO_UDP               1
-
-#define TG_WMM_AC_UP0         12     /* User Priority 0 */
-#define TG_WMM_AC_UP1         13     /*               1 */
-#define TG_WMM_AC_UP2         14     /*               2 */
-#define TG_WMM_AC_UP3         15     /*               3 */
-#define TG_WMM_AC_UP4         16     /*               4 */
-#define TG_WMM_AC_UP5         17     /*               5 */
-#define TG_WMM_AC_UP6         18     /*               6 */
-#define TG_WMM_AC_UP7         19     /*               7 */
-
-#define TG_WMM_AC_BE          1      /* Best Effort */
-#define TG_WMM_AC_BK          2      /* Background  */
-#define TG_WMM_AC_VI          3      /* Video       */
-#define TG_WMM_AC_VO          4      /* Voice       */
-#define TG_WMM_AC_UAPSD       5      /* UAPSD        */
-
-#if 0
-/* For wireless station, 802.11 defines 8 priority queues and 2 for each
- *  four catergories
- */
-#define TG_WMM_AC_BE2       0x0a
-#define TG_WMM_AC_BK2       0x0b
-#define TG_WMM_AC_VI2       0x0c
-#define TG_WMM_AC_VO2       0x0d
-#endif
-
-/* wmm defs */
-#define TOS_VO      0xD0         // 110 0  0000 (6)  AC_VO tos/dscp values
-//Atheros Madwifi use 0x88 for UPSD/Voice
-//#define TOS_VO      0x88       // 110 0  0000 (6)  AC_VO tos/dscp values
-#define TOS_VI      0xA0         // 101 0  0000 (5)  AC_VI
-#define TOS_BE      0x00         // 000 0  0000 (0)  AC_BE
-#define TOS_BK      0x20         // 001 0  0000 (1)  AC_BK
-
-#define WFA_UDP_ECHO_STREAM_ID    0xFFFF
-#define WFA_UDP_ECHO_PORT         07
-
-#define WFA_PING_ICMP_ECHO         0
-#define WFA_PING_UDP_ECHO          1
-
-#define WFA_UPLOAD_VHSO_RPT        1
-
-#define WFA_MCAST_FRATE            50       /* Multicast test rate is fixed at 50 frames/sec */
-
-#define WFA_G_CODEC_RATE           50       /* G.729 50 pkt per second  = 20 ms interval */
-
-typedef struct _tg_stats
-{
-    unsigned int txFrames;
-    unsigned int rxFrames;
-    unsigned long long txPayloadBytes;
-    unsigned long long rxPayloadBytes;
-    unsigned int outOfSequenceFrames; 
-    unsigned int lostPkts;        /* voice over wi-fi */
-    unsigned long jitter;         /* voice over wi-fi */
-} tgStats_t;
-
-typedef struct _e2e_stats
-{
-   int seqnum;
-   int lsec;
-   int lusec;
-   int rsec;
-   int rusec;
-} tgE2EStats_t;
-
-typedef struct _tg_profile
-{
-    int  profile;                           /* profile id                    */
-    int  direction;
-    char dipaddr[IPV4_ADDRESS_STRING_LEN];  /* destination/remote ip address */
-    int  dport;
-    char sipaddr[IPV4_ADDRESS_STRING_LEN];  /* source/local ip address       */
-    int  sport;
-    int  rate;
-    int  duration;
-    int  pksize;
-    short trafficClass;      /* VO, VI, BK, BE */
-    int  startdelay;
-    int  maxcnt;
-} tgProfile_t;
-
-typedef struct _tg_stream
-{
-    int id;
-    int sockfd;
-    int tblidx;
-    int lastPktSN;        /* use for Jitter calculation */
-    int fmInterval;       
-    int rxTimeLast;       /* use for pkLost             */
-    int state;            /* indicate if the stream being active */
-    tgProfile_t profile;
-    tgStats_t stats;
-} tgStream_t;
-
-typedef struct _traffic_header
-{
-   char hdr[20];   /* always wfa */
-} tgHeader_t;
-
-//typedef struct _traffic_header
-//{
-//   char wfaname[8];   /* always wfa */
-//   long int  counter; /* incremental counter */
-//   long int first4;   /*            */
-//   long int second4;  /*            */
-//} tgHeader_t;
-
-typedef struct _tg_wmm
-{
-    int thr_flag;    /* this is used to indicate stream id */
-    int stop_flag;    /* this is used to indicate stream id */
-#ifndef _WINDOWS
-    pthread_t thr;
-    int thr_id;
-    pthread_cond_t thr_flag_cond;
-    pthread_cond_t thr_stop_cond;
-    pthread_mutex_t thr_flag_mutex;
-    pthread_mutex_t thr_stop_mutex;
-#else
-       //LPCTSTR lpszMutex;
-    HANDLE thr;
-    DWORD thr_id;
-       int timerid;
-    HANDLE thr_flag_mutex;
-    HANDLE thr_stop_mutex;
-#endif
-}tgWMM_t;
-
-typedef int (*StationStateFunctionPtr)( char, int,int *); //PS,sleep period,state
-
-typedef struct station_state_table
-{
-   StationStateFunctionPtr statefunc;
-   char                    pw_offon;
-   int                     sleep_period;
-} StationProcStatetbl_t;
-
-typedef int (*stationRecvStateFunctionPtr)(unsigned int *, int,int * ); //Recieved message buffer, length,state
-
-typedef struct console_rcv_state_table
-{
-   stationRecvStateFunctionPtr statefunc;
-} StationRecvProcStatetbl_t;
-
-typedef struct _tg_thr_data
-{
-   int tid;
-   StationProcStatetbl_t  *state;
-   int state_num;
-} tgThrData_t;
-
-extern int wfaTGConfig(int len, BYTE *buf, int *respLen, BYTE *respBuf);
-extern int wfaSendLongFile(int fromSockfd, int streamId, BYTE *respBuf, int *respLen);
-extern int wfaRecvFile(int mySockfi, int profId, char *buf);
-extern int wfaTGRecvStart(int len, BYTE *parms, int *respLen, BYTE *respBuf);
-extern int wfaTGRecvStop(int len, BYTE *parms, int *respLen, BYTE *respBuf);
-extern int wfaTGSendStart(int len, BYTE *parms, int *respLen, BYTE *respBuf);
-extern int wfaTGReset(int len, BYTE *parms, int *respLen, BYTE *respBuf);
-extern int wfaSendShortFile(int fromSockfd, int profId, BYTE *buf, int size, BYTE *respBuf, int *respLen);
-extern int wfaFlushSockQueue(int profId);
-extern int wfaTGSendPing(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-extern int wfaTGStopPing(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf);
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_thr.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_thr.c
deleted file mode 100644 (file)
index c164957..0000000
+++ /dev/null
@@ -1,1114 +0,0 @@
-
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *  ******************************************************************************
- */
-/*       Revision History:
- *       2006/11/10  -- initial created by qhu
- *       2007/02/15  -- WMM Extension Beta released by qhu, mkaroshi
- *       2007/03/30  -- 01.40 WPA2 and Official WMM Beta Release by qhu
- *       2007/04/20 --  02.00 WPA2 and Official WMM Release by qhu
- *       2007/08/15 --  02.10 WMM-Power Save release by qhu
- *       2007/10/10 --  02.20 Voice SOHO beta -- qhu
- *       2007/11/07 --  02.30 Voice HSO -- qhu
- *       2007/12/10 --  02.32 no change
- *       2008/03/12 --  02.41 Bug #15, could cause "buffer overflow" in 
- *                            function "wfaSendStatsResp()" by increasing 
- *                            the "BYTE buff[]" size.
- *
- *                            Bug #19, potential race condition in function 
- *                            "sender()". Change the order of calling 
- *                            "wfaWMMPwrOn()" and "usleep()", also add 
- *                            "wfaSetDUTPwrMgmt(psave)" to turn PS ON before 
- *                            confirming start a test in function 
- *                            wfaStaSndConfirm().
- *
- *                            Bug #18, the hello counter limit could fails 
- *                            other tests. Reset num_hello count in function 
- *                            WfaSndHello()
- *
- */
-
-/*
- * For MADWIFI driver, the TOS to 11E queue mapping as:
- *    0x08, 0x20            ----> WME_AC_BK;
- *    0x28, 0xa0            ----> WMC_AC_VI;
- *    0x30, 0xe0 0x88, 0xb8 ----> WME_AC_VO
- *      here 0x88 for UPSD, will be implemented later
- *    all other/default     ----> WME_AC_BE;
- */
-
-#include "wfa_portall.h"
-#include "wfa_stdincs.h"
-#include "wfa_types.h"
-#include "wfa_main.h"
-#include "wfa_tg.h"
-#include "wfa_debug.h"
-#include "wfa_tlv.h"
-#include "wfa_sock.h"
-#include "wfa_rsp.h"
-#include "wfa_wmmps.h"
-#include "wfa_miscs.h"
-
-/*
- * external global thread sync variables
- */
-tgWMM_t wmm_thr[WFA_THREADS_NUM];
-extern int resetsnd;
-extern int resetrcv;
-extern int newCmdOn;
-
-extern tgStream_t *findStreamProfile(int id);
-extern int gxcSockfd;
-int vend;
-extern int wfaSetProcPriority(int);
-tgStream_t gStreams[WFA_MAX_TRAFFIC_STREAMS];
-int tgSockfds[WFA_MAX_TRAFFIC_STREAMS];
-
-//extern tgStream_t *gStreams;
-extern unsigned short wfa_defined_debug;
-extern unsigned int recvThr;
-extern int tgWMMTestEnable;
-int num_stops=0;
-int num_hello=0;
-
-BOOL gtgCaliRTD;
-
-#ifdef WFA_WMM_PS_EXT
-BOOL gtgWmmPS;
-int psSockfd = -1;
-extern int **ac_seq;
-wfaWmmPS_t wmmps_info;
-int msgsize=256;
-
-extern void wfaSetDUTPwrMgmt(int mode);
-extern void BUILD_APTS_MSG(int msg, unsigned long *txbuf);
-extern void wmmps_wait_state_proc();
-
-extern void mpx(char *m, void *buf_v, int len);
-
-unsigned int psTxMsg[512];
-unsigned int psRxMsg[512];
-#endif /* WFA_WMM_PS_EXT */
-
-extern void tmout_stop_send(int);
-extern StationProcStatetbl_t stationProcStatetbl[LAST_TEST+1][11];
-
-int nsent;
-
-int runLoop = 0;
-int usedThread=0;
-BOOL gtgTransac = 0;
-BOOL gtgSend = 0;
-BOOL gtgRecv = 0;
-
-extern int slotCnt;
-extern int btSockfd;
-int totalTranPkts=0, sentTranPkts=0;
-BYTE *trafficBuf=NULL, *respBuf=NULL;
-
-#ifdef WFA_VOICE_EXT
-double gtgPktRTDelay = 0xFFFFFFFF;
-double min_rttime = 0xFFFFFFFF;
-static double rttime = 0;
-#endif
-int sendThrId = 0;
-
-/* this is to stop sending packets by timer       */
-void tmout_stop_send(int num)
-{
-    struct timeval af;
-    int i =0;
-
-    gettimeofday(&af,0);
-    DPRINT_INFO(WFA_OUT, "Exiting at sec %d usec %d\n", (int )af.tv_sec, (int)af.tv_usec);
-    DPRINT_INFO(WFA_OUT, "timer fired, stop sending traffic\n");
-
-    /*
-     *  After runLoop reset, all sendLong will stop
-     */
-    runLoop = 0;
-
-    /*
-     * once usedThread is reset, WMM tests using multithread is ended
-     * the threads will be reused for the next test.
-     */
-    usedThread = 0;
-
-    /*
-     * once the stream table slot count is reset, it implies that the test
-     * is done. When the next set profile command comes in, it will reset/clean
-     * the stream table.
-     */
-    slotCnt = 0;
-
-    /*
-     * The test is for DT3 transaction test.
-     * Timeout to stop it.
-     */
-    if(gtgTransac != 0)
-    {
-        gtgSend = 0;
-        gtgRecv = 0;
-        gtgTransac = 0;
-    }
-
-    /*
-     * all WMM streams also stop
-     */
-    for(i=0; i<WFA_THREADS_NUM; i++)
-    {
-        wmm_thr[i].thr_flag = 0;
-    }
-
-    /* all alarms need to reset */
-    wALARM(0);
-}
-
-
-
-/*
- * wfaTGSetPrio(): This depends on the network interface card.
- *               So you might want to remap according to the driver
- *               provided.
- *               The current implementation is to set the TOS/DSCP bits
- *               in the IP header
- */
-int wfaTGSetPrio(int sockfd, int tgUserPriority)
-{
-    int tosval;
-    
-    socklen_t size = sizeof(tosval);
-    wGETSOFD(sockfd, IPPROTO_IP, IP_TOS, &tosval, &size);
-
-    switch(tgUserPriority)
-    {
-       case TG_WMM_AC_BK:   // user priority "1"
-       /*Change this value to the ported device*/
-       //tosval = 0x08;
-       tosval = TOS_BK;    
-       break;
-
-       case TG_WMM_AC_VI:   // user priority "5"
-       /*Change this value to the ported device*/
-       //tosval = 0x28;
-       tosval = TOS_VI;
-       break;
-
-       case TG_WMM_AC_UAPSD:
-       tosval = 0x88;
-       break;
-
-       case TG_WMM_AC_VO:   // user priority "6"
-       /*Change this value to the ported device*/
-       tosval = TOS_VO;
-//       tosval = 0x88;
-       break;
-
-       case TG_WMM_AC_BE:   // user priority "0"
-       tosval = TOS_BE;
-       break;
-
-       /* For WMM-AC Program User Priority Defintions */
-       case TG_WMM_AC_UP0:
-       break;
-
-       case TG_WMM_AC_UP1:
-       break;
-
-       case TG_WMM_AC_UP2:
-       break;
-
-       case TG_WMM_AC_UP3:
-       break;
-
-       case TG_WMM_AC_UP4:
-       break;
-       case TG_WMM_AC_UP5:
-       break;
-
-       case TG_WMM_AC_UP6:
-       break;
-
-       case TG_WMM_AC_UP7:
-       break;
-
-       default:
-       tosval = 0x00;
-           /* default */
-         ;
-    }
-
-#ifdef WFA_WMM_PS_EXT
-    psTxMsg[1] = tosval;
-#endif
-
-    if(wSETSOCKOPT ( sockfd, IPPROTO_IP, IP_TOS, &tosval, sizeof(tosval)) != 0)
-    {
-       DPRINT_ERR(WFA_ERR, "Failed to set IP_TOS\n");
-    }
-
-    return (tosval == 0xE0)?0xD8:tosval;
-}
-
-/*
- * wfaSetThreadPrio():
- *    Set thread priorities
- *    It is an optional experiment if you decide not necessary.
- */
-void wfaSetThreadPrio(int tid, int userPriority)
-{
-    struct sched_param tschedParam;
-    pthread_attr_t tattr;
-
-    wPT_ATTR_INIT(&tattr);
-    wPT_ATTR_SETSCH(&tattr, SCHED_RR);
-
-    switch(userPriority)
-    {
-       case TG_WMM_AC_BK:
-       tschedParam.sched_priority = 70-3;
-       break;
-       case TG_WMM_AC_VI:
-       tschedParam.sched_priority = 70-1;
-       break;
-       case TG_WMM_AC_VO:
-       tschedParam.sched_priority = 70;
-       break;
-       case TG_WMM_AC_BE:
-       tschedParam.sched_priority = 70-2;
-       default:
-           /* default */
-         ;
-    }
-
-    wPT_ATTR_SETSCHPARAM(&tattr, &tschedParam);
-}
-
-/* 
- * collects the traffic statistics from other threads and 
- * sends the collected information to CA
- */
-void  wfaSentStatsResp(int sock, BYTE *buf)
-{
-   int i, total=0, pkLen;
-   tgStream_t *allStreams = gStreams;
-   dutCmdResponse_t *sendStatsResp = (dutCmdResponse_t *)buf, *first;
-   char buff[WFA_RESP_BUF_SZ];
-
-   if(sendStatsResp == NULL)
-      return;
-
-   first = sendStatsResp;
-   for(i = 0; i < WFA_MAX_TRAFFIC_STREAMS; i++)
-   {
-      if((allStreams->id != 0) && (allStreams->profile.direction == DIRECT_SEND) && (allStreams->state == WFA_STREAM_ACTIVE))
-      {
-          sendStatsResp->status = STATUS_COMPLETE;
-          sendStatsResp->streamId = allStreams->id;
-          printf("stats stream id %i\n", allStreams->id);
-          wMEMCPY(&sendStatsResp->cmdru.stats, &allStreams->stats, sizeof(tgStats_t));          
-
-          sendStatsResp++;
-          total++;
-      } 
-      allStreams->state = WFA_STREAM_INACTIVE;
-      allStreams++;
-   } 
-
-#if 1
-   printf("%u %u %llu %llu\n", first->cmdru.stats.txFrames,
-                                  first->cmdru.stats.rxFrames,
-                                  first->cmdru.stats.txPayloadBytes,
-                                  first->cmdru.stats.rxPayloadBytes); 
-#endif
-
-   wfaEncodeTLV(WFA_TRAFFIC_AGENT_SEND_RESP_TLV, total*sizeof(dutCmdResponse_t),
-                 (BYTE *)first, (BYTE *)buff);
-
-   pkLen = WFA_TLV_HDR_LEN + total*sizeof(dutCmdResponse_t); 
-   printf("pkLen %i\n", pkLen);
-
-#if 0
-   for(i = 0; i< pkLen; i++)
-   printf("%x ", buff[i]);
-
-   printf("\n");
-#endif
-
-   if(wfaCtrlSend(sock, (BYTE *)buff, pkLen) != pkLen)
-   {
-       DPRINT_WARNING(WFA_WNG, "wfaCtrlSend Error\n");
-   }
-
-   return;
-}
-
-#ifdef WFA_WMM_PS_EXT
-/*
- * sender(): This is a generic function to send a packed for the given dsc 
- *               (ac:VI/VO/BE/BK), before sending the packet the function
- *               puts the station into the PS mode indicated by psave and 
- *               sends the packet after sleeping for sllep_period
- */
-int sender(char psave,int sleep_period, int userPriority)
-{
-   int r;
-
-   PRINTF("\nsleeping for %d",sleep_period);
-   wfaSetDUTPwrMgmt(psave);
-   wUSLEEP(sleep_period);
-   PRINTF("\nAfter create sending UP%d\n",userPriority);
-   create_apts_msg(APTS_DEFAULT, psTxMsg,wmmps_info.my_sta_id);
-   wfaTGSetPrio(psSockfd, userPriority);
-   PRINTF("\nAfter create");
-   PRINTF("\nlock met");
-   r = wSENDTO(psSockfd, psTxMsg, msgsize, 0, (struct sockaddr *)&wmmps_info.psToAddr, sizeof(struct sockaddr));
-   return r;
-}
-/*
- * wfaStaSndHello(): This function sends a Hello packet 
- *                and sleeps for sleep_period, the idea is
- *                to keep sending hello packets till the console
- *                responds, the function keeps a check on the MAX
- *                Hellos and if number of Hellos exceed that it quits
- */
-int WfaStaSndHello(char psave,int sleep_period,int *state)
-{
-   int r;
-   tgWMM_t *my_wmm = &wmm_thr[wmmps_info.ps_thread];
-
-   usleep(sleep_period);
-   wfaSetDUTPwrMgmt(psave);
-   if(!(num_hello++))
-       create_apts_msg(APTS_HELLO, psTxMsg,0);
-   wfaTGSetPrio(psSockfd, 0);
-   r = wSENDTO(psSockfd, psTxMsg, msgsize, 0, (struct sockaddr *)&wmmps_info.psToAddr, sizeof(struct sockaddr));
-
-
-   wPT_MUTEX_LOCK(&my_wmm->thr_flag_mutex);
-   if(my_wmm->thr_flag)
-   {
-       (*state)++;
-       num_hello=0;
-       my_wmm->thr_flag=0;
-   }
-
-   wPT_MUTEX_UNLOCK(&my_wmm->thr_flag_mutex);
-   if(num_hello > MAXHELLO)
-   {
-       DPRINT_ERR(WFA_ERR, "Too many Hellos sent\n");
-       gtgWmmPS = 0;
-       num_hello=0;
-       if(psSockfd != -1)
-       {
-          wCLOSE(psSockfd);
-          psSockfd = -1;
-       }
-       wSIGNAL(SIGALRM, SIG_IGN);
-   } 
-
-   return 0;
-}
-
-/*
- * wfaStaSndConfirm(): This function sends the confirm packet
- *                which is sent after the console sends the
- *                test name to the station
- */
-int WfaStaSndConfirm(char psave,int sleep_period,int *state)
-{
-   int r;
-   static int num_hello=0;
-   wfaSetDUTPwrMgmt(psave);
-   if(!num_hello)
-      create_apts_msg(APTS_CONFIRM, psTxMsg,0);
-   r = wSENDTO(psSockfd, psTxMsg, msgsize, 0, (struct sockaddr *)&wmmps_info.psToAddr, sizeof(struct sockaddr));
-   mpx("STA msg",psTxMsg,64);
-   printf("Confirm Sent\n");
-
-   (*state)++;
-
-   return 0;
-}
-
-/*
- * WfaStaSndVO(): This function sends a AC_VO packet
- *                after the time specified by sleep_period
- *                and advances to the next state for the given test case
- */
-int WfaStaSndVO(char psave,int sleep_period,int *state)
-{
-   int r;
-   static int en=1;
-   PRINTF("\r\nEnterring WfastasndVO %d",en++);
-   if ((r=sender(psave,sleep_period,TG_WMM_AC_VO))>=0)
-      (*state)++;
-   else
-      PRINTF("\r\nError\n");
-
-   return 0;
-}
-
-/*
- * WfaStaSnd2VO(): This function sends two AC_VO packets
- *                after the time specified by sleep_period
- *                and advances to the next state for the given test case
- */
-int WfaStaSnd2VO(char psave,int sleep_period,int *state)
-{
-   int r;
-   static int en=1;
-
-   PRINTF("\r\nEnterring WfastasndVO %d",en++);
-   if ((r=sender(psave,sleep_period,TG_WMM_AC_VO))>=0)
-   {
-       r = wSENDTO(psSockfd, psTxMsg, msgsize, 0, (struct sockaddr *)&wmmps_info.psToAddr, sizeof(struct sockaddr));
-       mpx("STA msg",psTxMsg,64);
-       (*state)++;
-   }
-   else
-      PRINTF("\r\nError\n");
-
-   return 0;
-}
-
-/*
- * WfaStaSndVI(): This function sends a AC_VI packet
- *                after the time specified by sleep_period
- *                and advances to the next state for the given test case
- */
-int WfaStaSndVI(char psave,int sleep_period,int *state)
-{
-   int r;
-   static int en=1;
-
-   PRINTF("\r\nEnterring WfastasndVI %d",en++);
-   if ((r=sender(psave,sleep_period,TG_WMM_AC_VI))>=0)
-      (*state)++;
-
-   return 0;
-}
-
-/*
- * WfaStaSndBE(): This function sends a AC_BE packet
- *                after the time specified by sleep_period
- *                and advances to the next state for the given test case
- */
-int WfaStaSndBE(char psave,int sleep_period,int *state)
-{
-   int r;
-   static int en=1;
-
-   PRINTF("\r\nEnterring WfastasndBE %d",en++);
-   if ((r=sender(psave,sleep_period,TG_WMM_AC_BE))>=0)
-      (*state)++;
-
-   return 0;
-}
-/*
- * WfaStaSndBK(): This function sends a AC_BK packet
- *                after the time specified by sleep_period
- *                and advances to the next state for the given test case
- */
-int WfaStaSndBK(char psave,int sleep_period,int *state)
-{
-   int r;
-   static int en=1;
-
-   PRINTF("\r\nEnterring WfastasndBK %d",en++);
-   if ((r=sender(psave,sleep_period,TG_WMM_AC_BK))>=0)
-      (*state)++;
-
-   return 0;
-}
-
-/*
- * WfaStaSndVOCyclic(): The function is the traffic generator for the L.1 test
- *                      caseThis function sends 3000 AC_VO packet
- *                      after the time specified by sleep_period (20ms)
- */
-int WfaStaSndVOCyclic(char psave,int sleep_period,int *state)
-{
-   int i;
-   static int en=1;
-
-   for(i=0;i<3000;i++)
-   {
-       PRINTF("\r\nEnterring WfastasndVOCyclic %d",en++);
-       sender(psave,sleep_period,TG_WMM_AC_VO);
-       if(!(i%50))
-       {
-         PRINTF(".");
-         fflush(stdout);
-       }
-   }
-
-   (*state)++;
-
-   return 0;
-}
-
-/*
- * WfaStaWaitStop(): This function sends the stop packet on behalf of the
- *                   station, the idea is to keep sending the Stop
- *                   till a stop is recd from the console,the functions
- *                   quits after stop threshold reaches.
- */
-int WfaStaWaitStop(char psave,int sleep_period,int *state)
-{
-   int r;
-   int myid=wmmps_info.ps_thread;
-   PRINTF("\n Entering Sendwait");
-   wUSLEEP(sleep_period);
-   if(!num_stops)
-   {
-       wfaSetDUTPwrMgmt(psave);
-       wfaTGSetPrio(psSockfd, TG_WMM_AC_BE);
-   }
-
-   num_stops++;
-   create_apts_msg(APTS_STOP, psTxMsg,wmmps_info.my_sta_id);
-   r = wSENDTO(psSockfd, psTxMsg, msgsize, 0, (struct sockaddr *)&wmmps_info.psToAddr, sizeof(struct sockaddr));
-   mpx("STA msg",psTxMsg,64);
-
-   wmm_thr[myid].stop_flag = 1;
-   wPT_MUTEX_LOCK(&wmm_thr[myid].thr_stop_mutex);
-   wPT_COND_SIGNAL(&wmm_thr[myid].thr_stop_cond);
-   wPT_MUTEX_UNLOCK(&wmm_thr[myid].thr_stop_mutex);
-
-   if(num_stops > MAX_STOPS)
-   {
-       DPRINT_ERR(WFA_ERR, "Too many stops sent\n");
-       gtgWmmPS = 0;
-       if(psSockfd != -1)
-       {
-          wCLOSE(psSockfd);
-          psSockfd = -1;
-       }
-       wSIGNAL(SIGALRM, SIG_IGN);
-       //wfaSetDUTPwrMgmt(PS_OFF);
-   }
-
-   return 0;
-}
-
-#endif 
-
-void * wfa_wmm_thread(void *thr_param)
-{
-    int myId = ((tgThrData_t *)thr_param)->tid;
-    tgWMM_t *my_wmm = &wmm_thr[myId];
-    tgStream_t *myStream = NULL;
-    int myStreamId;
-    int mySock = -1, status, respLen, nbytes = 0;
-    tgProfile_t *myProfile;
-    pthread_attr_t tattr;
-#ifdef WFA_WMM_PS_EXT
-    tgThrData_t *tdata =(tgThrData_t *) thr_param;
-    StationProcStatetbl_t  curr_state;
-#endif
-
-#ifdef WFA_VOICE_EXT
-    struct timeval lstime, lrtime;
-    int asn = 1;  /* everytime it starts from 1, and to ++ */
-#endif
-    
-    wPT_ATTR_INIT(&tattr);
-    wPT_ATTR_SETSCH(&tattr, SCHED_RR);
-
-    while(1)
-    {
-       pthread_mutex_lock(&my_wmm->thr_flag_mutex);
-       /* it needs to reset the thr_flag to wait again */
-       while(my_wmm->thr_flag == 0)
-       {
-         printf("Mutex wait\n");
-          /*
-           * in normal situation, the signal indicates the thr_flag changed to
-           * a valid number (stream id), then it will go out the loop and do
-           * work.
-           */
-          wPT_COND_WAIT(&my_wmm->thr_flag_cond, &my_wmm->thr_flag_mutex);
-       }
-       wPT_MUTEX_UNLOCK(&my_wmm->thr_flag_mutex);
-       myStreamId = my_wmm->thr_flag;
-       my_wmm->thr_flag=0;
-
-       /* use the flag as a stream id to file the profile */ 
-       myStream = findStreamProfile(myStreamId); 
-       myProfile = &myStream->profile;
-
-       if(myProfile == NULL)
-       {
-          status = STATUS_INVALID;
-          wfaEncodeTLV(WFA_TRAFFIC_AGENT_SEND_RESP_TLV, 4, (BYTE *)&status, respBuf);
-          respLen = WFA_TLV_HDR_LEN+4;
-          /*
-           * send it back to control agent.
-           */
-           continue;
-       }
-
-       printf("Mutex unlocked\n");
-       switch(myProfile->direction)
-       {
-           case DIRECT_SEND:
-           mySock = wfaCreateUDPSock(myProfile->sipaddr, myProfile->sport);
-           mySock = wfaConnectUDPPeer(mySock, myProfile->dipaddr, myProfile->dport);
-           sendThrId = myId;
-           /*
-            * Set packet/socket priority TOS field
-            */
-           wfaTGSetPrio(mySock, myProfile->trafficClass);
-
-           /*
-            * set a proper priority 
-            */
-           wfaSetThreadPrio(myId, myProfile->trafficClass);
-
-           /* if delay is too long, it must be something wrong */
-           if(myProfile->startdelay > 0 && myProfile->startdelay<100)
-           {
-               wSLEEP(myProfile->startdelay);
-           }
-
-           /*
-            * set timer fire up
-            */
-           if(myProfile->maxcnt == 0)
-           {
-              wSIGNAL(SIGALRM, tmout_stop_send);
-              wALARM(myProfile->duration);
-           }
-
-           if(myProfile->profile == PROF_MCAST)
-           {
-              wfaSetSockMcastSendOpt(mySock);
-           }
-
-          if (myProfile->profile == PROF_IPTV || myProfile->profile == PROF_FILE_TX || myProfile->profile == PROF_MCAST)
-           {
-              wfaSendLongFile(mySock, myStreamId, respBuf, &respLen);
-              if(mySock != -1)
-              {
-                 wCLOSE(mySock);
-                 mySock = -1;
-              }
-           }
-           else if(myProfile->profile == PROF_TRANSC || myProfile->profile == PROF_START_SYNC || myProfile->profile == PROF_CALI_RTD)
-           {
-#if 0
-              struct timeval nxtime, curtime;
-              int ioflags = wFCNTL(mySock, F_GETFL, 0);
-#endif
-              struct timeval tmout;
-
-              gtgTransac = myStreamId;
-              sentTranPkts = 0;
-
-#if 0
-              //gtimeOut = MINISECONDS/theProfile->rate;  /* in msec */
-              gettimeofday(&nxtime, NULL);
-              nxtime.tv_usec += 20000;   /* fixed 20 min sec timeout */
-              if(nxtime.tv_usec >= 1000000)
-              {
-                 nxtime.tv_sec +=1;
-                 nxtime.tv_usec -= 1000000;
-              }
-              wFCNTL(mySock, F_SETFL, ioflags | O_NONBLOCK);
-#endif
-
-
-              tmout.tv_sec = 0;
-              tmout.tv_usec = 15000;    // set for 20 min sec timeout              
-              setsockopt(mySock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tmout, (socklen_t) sizeof(tmout)); 
-
-              while(gtgTransac != 0)
-              {
-#ifdef WFA_VOICE_EXT
-                 gettimeofday(&lstime, NULL);
-                 /*
-                  * If your device is BIG ENDIAN, you need to
-                  * modify the the function calls
-                  */
-                 int2BuffBigEndian(asn++, &((tgHeader_t *)trafficBuf)->hdr[8]);
-                 int2BuffBigEndian(lstime.tv_sec, &((tgHeader_t *)trafficBuf)->hdr[12]);
-                 int2BuffBigEndian(lstime.tv_usec, &((tgHeader_t *)trafficBuf)->hdr[16]);
-#endif /* WFA_VOICE_EXT */
-
-                 if(gtgTransac != 0 && nbytes <= 0)
-                 {
-                    if(respBuf == NULL)
-                    {
-                       printf("a Null buff\n");
-                    }
-                    memset(respBuf, 0, WFA_RESP_BUF_SZ);
-                    respLen = 0;
-
-                    if(wfaSendShortFile(mySock, myStreamId,
-                       trafficBuf, 0, respBuf, &respLen) == DONE)
-                    {
-                       if(wfaCtrlSend(gxcSockfd, respBuf, respLen) != respLen)
-                       {
-                          DPRINT_WARNING(WFA_WNG, "wfaCtrlSend Error\n");
-                       }
-                    }
-
-                    sentTranPkts++;
-
-                    if(sentTranPkts == myProfile->maxcnt)
-                    {
-                       break;
-                    }
-                 }
-
-                 int nbytes = wfaRecvFile(mySock, myStreamId, (char  *)trafficBuf);
-                 if(nbytes <= 0)
-                 {
-                     setsockopt(mySock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tmout, (socklen_t) sizeof(tmout)); 
-                     printf("time out event, resend a new packet ...\n");
-
-                     tmout.tv_sec = 0;
-                     tmout.tv_usec = 10000;    // set for 20 min sec timeout              
-                     setsockopt(mySock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tmout, (socklen_t) sizeof(tmout)); 
-#if 0  /* if your socket APIs does not support "recvfrom" timeout, this is the way to loop the descriptor */
-                     gettimeofday(&curtime, NULL);
-                     if(((curtime.tv_sec - nxtime.tv_sec) * 1000000 + (curtime.tv_usec -  nxtime.tv_usec)) < 20000) 
-                     {
-                        continue;
-                     } 
-
-                     nxtime.tv_usec = curtime.tv_usec += 20000;
-                     if(nxtime.tv_usec >= 1000000)
-                     {
-                        nxtime.tv_sec = curtime.tv_sec +=1;
-                        nxtime.tv_usec -= 1000000;
-                     }
-#endif
-                     continue;
-                 }
-
-#ifdef WFA_VOICE_EXT               
-                 /*
-                  * Roundtrip time delay:
-                  *   1. retrieve the timestamp
-                  *   2. calculate the Trt(1) roundtrip delay
-                  *   3. store the minimum Trt(1)
-                  *   4. store Cdut(t1) and Ctm(2)
-                  */
-                 gettimeofday(&lrtime, NULL);
-
-                 /* get a round trip time */
-                 rttime = wfa_ftime_diff(&lstime, &lrtime);
-
-                 if(min_rttime > rttime)
-                 {
-
-                    min_rttime = rttime;
-                    if(gtgCaliRTD != 0)
-                    {
-                       gtgPktRTDelay = min_rttime;
-                    }
-                 }
-
-                 if(gtgCaliRTD != 0 )
-                 {
-                   usleep(20000); /* wait a few min seconds before retrying the next calibration */
-                }
-#endif /* WFA_VOICE_EXT */
-              } /* while */
-
-              if(mySock != -1)
-              {
-                 wCLOSE(mySock);
-                 mySock = -1;
-              }
-           }
-
-           wMEMSET(respBuf, 0, WFA_RESP_BUF_SZ);
-           wSLEEP(1);
-
-              /*
-            * uses thread that is saved at last to pack the items and ships 
-            * it to CA.
-            */
-              if(myId == sendThrId) 
-              {
-               printf("Sending stats back\n");
-               wfaSentStatsResp(gxcSockfd, respBuf);
-               printf("done stats\n");
-               sendThrId = 0;
-              }
-
-           break;
-
-          case DIRECT_RECV:
-           /*
-            * Test WMM-PS
-            */
-           if(myProfile->profile == PROF_UAPSD)
-           {           
-#ifdef WFA_WMM_PS_EXT
-                wmmps_info.sta_test = B_D;
-                //wmmps_info.sta_test = WMMAC_525_T07t10;
-                wmmps_info.ps_thread = myId;
-                wmmps_info.rcv_state = 0;
-                wmmps_info.tdata = tdata;
-               wmmps_info.dscp = wfaTGSetPrio(psSockfd, TG_WMM_AC_BE);
-               tdata->state_num=0;
-               /*
-                * default timer value
-                */
-
-               while(gtgWmmPS>0)
-               {
-                  if(resetsnd)
-                  {
-                     tdata->state_num = 0;
-                     resetsnd = 0;
-                  }
-                  if (wmmps_info.sta_test > LAST_TEST)
-                     break;
-                            
-                  tdata->state =  stationProcStatetbl[wmmps_info.sta_test];
-                  curr_state = tdata->state[tdata->state_num];                      
-                 curr_state.statefunc(curr_state.pw_offon,curr_state.sleep_period,&(tdata->state_num));     
-               }
-#endif /* WFA_WMM_PS_EXT */
-           }
-          else if (myProfile->profile == PROF_IPTV || myProfile->profile == PROF_FILE_TX || myProfile->profile == PROF_MCAST)
-          {
-              char recvBuf[3072];
-               int iOptVal, iOptLen;
-               struct timeval tmout;
-
-#ifdef WFA_VOICE_EXT
-               struct timeval currtime;
-               FILE *e2eoutp = NULL;
-               char e2eResults[124];
-               int le2eCnt = 0;
-#endif
-
-              mySock = wfaCreateUDPSock(myProfile->dipaddr, myProfile->dport);
-               if(mySock == -1)
-               {
-                  printf("Error open socket\n");
-                  continue;
-               }
-
-              tgSockfds[myStream->tblidx] = mySock;
-
-#ifdef WFA_VOICE_EXT
-               /* only for receive stream needs to create a stats storage */
-               tgE2EStats_t *e2esp = NULL;
-               int totalE2Cnt = myProfile->duration * WFA_G_CODEC_RATE;
-               if(myProfile->profile == PROF_IPTV)
-               {
-                  e2esp = malloc(totalE2Cnt * sizeof(tgE2EStats_t));
-
-                  if(e2esp == NULL)
-                  {
-
-                  }
-               }
-#endif
-
-               /* increase the rec queue size */
-              getsockopt(mySock, SOL_SOCKET, SO_RCVBUF, (char *)&iOptVal, (socklen_t *)&iOptLen);
-              iOptVal = iOptVal * 10;
-              setsockopt(mySock, SOL_SOCKET, SO_RCVBUF, (char *)&iOptVal, (socklen_t )iOptLen);
-
-               /* set timeout for blocking receive */
-               tmout.tv_sec = 0;
-               tmout.tv_usec = 200000;   /* set the receive time out to 200 ms */             
-               setsockopt(mySock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tmout, (socklen_t) sizeof(tmout)); 
-
-               wfaSetThreadPrio(myId, TG_WMM_AC_VO);   /* try to raise the receiver higher priority than sender */
-              for(;;)
-              {
-                 nbytes = wfaRecvFile(mySock, myStreamId, (char *)recvBuf);
-                 if(nbytes <= 0)
-                 {
-                     /* due to timeout */
-                     if(tgSockfds[myStream->tblidx] >=0 )
-                        continue;
-
-                    break;
-                 }
-
-#ifdef WFA_VOICE_EXT
-                  if(myProfile->profile == PROF_IPTV)
-                  {
-                     struct timeval ttval, currTimeVal;
-
-                     int sn = bigEndianBuff2Int(&((tgHeader_t *)recvBuf)->hdr[8]);
-                     ttval.tv_sec = bigEndianBuff2Int(&((tgHeader_t *)recvBuf)->hdr[12]);
-                     ttval.tv_usec = bigEndianBuff2Int(&((tgHeader_t *)recvBuf)->hdr[16]);
-                     gettimeofday(&currTimeVal, NULL);
-
-                     /*
-                      * take the end2end stats, limit to the max voice pkt number
-                      */
-                     if(le2eCnt < totalE2Cnt)
-                     {
-                        tgE2EStats_t *ep = e2esp + le2eCnt++;
-                        ep->seqnum = sn;
-                        ep->rsec = ttval.tv_sec;
-                        ep->rusec = ttval.tv_usec;
-
-                        ep->lsec = currTimeVal.tv_sec;
-                        ep->lusec = currTimeVal.tv_usec;
-
-                        if(ep->lusec  < 0)
-                        {
-                           ep->lsec -=1;
-                           ep->lusec += 1000000;
-                        }
-                        else if(ep->lusec >= 1000000)
-                        {
-                           ep->lsec += 1;
-                           ep->lusec -= 1000000;
-                        }
-                     }
-                  }
-#endif /* WFA_VOICE_EXT */
-                  wfaSetThreadPrio(myId, TG_WMM_AC_BE); /* put it back down */
-              } /* while */   
-
-               my_wmm->thr_flag = 0;
-
-#ifdef WFA_VOICE_EXT
-               if(myProfile->profile == PROF_IPTV)
-               {
-                  int j;
-
-                  wGETTIMEOFDAY(&currtime, NULL);
-                  sprintf(e2eResults, "/tmp/e2e%u-%i.txt", (unsigned int) currtime.tv_sec, myStreamId);
-                  printf("file %s cnt %i\n", e2eResults, le2eCnt); 
-                  e2eoutp = fopen(e2eResults, "w+");
-                  if(e2eoutp != NULL)
-                  {
-                     fprintf(e2eoutp, "roundtrip delay: %i\n", (int) (1000000*gtgPktRTDelay));
-                     for(j = 0; j< le2eCnt; j++)                  
-                     {
-                        tgE2EStats_t *ep = e2esp+j;
-                        fprintf(e2eoutp, "%i:%i:%i:%i:%i\n", ep->seqnum, ep->lsec, ep->lusec, ep->rsec, ep->rusec); 
-                     }
-                     fclose(e2eoutp);
-                  }
-
-                  if(e2esp != NULL)
-                     free(e2esp);
-               }
-#endif
-          }
-          else if(myProfile->profile == PROF_TRANSC || myProfile->profile == PROF_START_SYNC || myProfile->profile == PROF_CALI_RTD)
-          {
-              mySock = wfaCreateUDPSock(myProfile->sipaddr, myProfile->sport);
-               if(mySock < 0)
-               {
-                  /* return error */
-                  my_wmm->thr_flag = 0;
-                  continue;
-               }
-
-              tgSockfds[myStream->tblidx] = mySock;
-
-               totalTranPkts = 0xFFFFFFF0;
-               gtgTransac = myStreamId;
-
-              while(gtgTransac != 0)
-              {
-                   memset(trafficBuf, 0, sizeof(trafficBuf));
-
-                   if(mySock != -1)
-                   {
-                      int i = gtgTransac;
-
-                      nbytes = wfaRecvFile(mySock, i, (char  *)trafficBuf);
-                      if(nbytes <= 0)
-                         break;
-                   }
-                   else
-                   {
-                      break;
-                   }
-
-#ifdef WFA_VOICE_EXT
-                   /* for a transaction receiver, it just needs to send the local time back */
-                   gettimeofday(&lstime, NULL);
-                   int2BuffBigEndian(lstime.tv_sec, &((tgHeader_t *)trafficBuf)->hdr[12]);
-                   int2BuffBigEndian(lstime.tv_usec, &((tgHeader_t *)trafficBuf)->hdr[16]);
-#endif
-                   memset(respBuf, 0, WFA_RESP_BUF_SZ);
-                   respLen = 0;
-                   if(wfaSendShortFile(mySock, gtgTransac, trafficBuf, nbytes, respBuf, &respLen) == DONE)
-                   {
-                      if(wfaCtrlSend(gxcSockfd, (BYTE *)respBuf, respLen)!=respLen)
-                      {
-                         DPRINT_WARNING(WFA_WNG, "wfaCtrlSend Error\n");
-                      }
-                   }
-               }
-
-               my_wmm->thr_flag = 0;
-          }
-           break;
-
-           default:
-              DPRINT_ERR(WFA_ERR, "Unknown covered case\n");
-       }
-
-    }
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tlv.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tlv.c
deleted file mode 100644 (file)
index efd53cc..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-/*
- * file: wfa_tlv.c
- * The file contains all TLV process functions, including Encode, Decode, etc
- * TLV stands for Tag, Length, Value.
- *
- *   Revision History:
- *      2006/03/10 -- initially created by qhu
- *      2006/06/01 -- BETA release by qhu
- *      2006/06/13 -- 00.02 release by qhu
- *      2006/06/30 -- 00.10 Release by qhu
- *      2006/07/10 -- 01.00 Release by qhu
- *      2006/09/01 -- 01.05 Release by qhu
- *      2007/02/15  -- WMM Extension Beta released by qhu, mkaroshi
- *      2007/03/30 -- 01.40 WPA2 and Official WMM Beta Release by qhu
- *      2007/04/20 -- 02.00 WPA2 and Official WMM Release by qhu
- *      2007/08/15 --  02.10 WMM-Power Save release by qhu
- *      2007/10/10 --  02.20 Voice SOHO beta -- qhu
- *      2007/11/07 -- 02.30 Voice HSO -- qhu
- *          -- make sure the the data len must be less than buffer size, 
- *             a potential bug reported by rmaeder and ydror
- *
- */
-#include "wfa_portall.h"
-#include "wfa_stdincs.h"
-#include "wfa_main.h"
-#include "wfa_debug.h"
-#include "wfa_types.h"
-#include "wfa_tlv.h"
-
-#include "sigma_dut.h"
-
-extern unsigned short wfa_defined_debug;
-
-
-/*
- * wfaEncodeTLV(): Encoding a packet to TLV format 
- * input: the_tag - packet type
- *        the_len - the value length
- *        the_value - the value buffer
- *
- * output: tlv_data - encoded TLV packet buffer. Caller must allocate the buffer
- */
-BOOL wfaEncodeTLV(WORD the_tag, WORD the_len, BYTE *the_value, BYTE *tlv_data)
-{
-   void *data = tlv_data;
-
-   ((wfaTLV *)data)->tag = the_tag;
-   ((wfaTLV *)data)->len = the_len;
-   if(the_value != NULL && the_len != 0)
-      wMEMCPY((data+4), (BYTE *)the_value, the_len);
-
-   return TRUE;
-}
-
-/*
- * wfaDecodeTLV(); Decoding a TLV format into actually values
- * input:  tlv_data - the TLV format packet buffer
- *         tlv_len  - the total length of the TLV
- * output: ptag - the TLV type
- *         pval_len - the value length
- *         pvalue - value buffer, caller must allocate the buffer
- */
-
-BOOL wfaDecodeTLV(BYTE *tlv_data, int tlv_len, WORD *ptag, int *pval_len, BYTE *pvalue)
-{ 
-   wfaTLV *data = (wfaTLV *)tlv_data;
-
-   if(pvalue == NULL)
-   {
-        sigma_dut_print(DUT_MSG_ERROR, "Parm buf invalid\n");
-       return FALSE;
-   }
-   *ptag = data->tag; 
-   *pval_len = data->len;
-
-   if(tlv_len < *pval_len)
-       return FALSE;
-
-   if(*pval_len != 0 && *pval_len < MAX_PARMS_BUFF)
-   {
-      wMEMCPY(pvalue, tlv_data+4, *pval_len);
-   }
-
-   return TRUE;
-}
-
-/*
- * wfaGetTLVTag(): the individual function to retrieve a TLV type.
- * input: tlv_data - TLV buffer
- * return: the TLV type.
- */
-
-WORD wfaGetTLVTag(BYTE *tlv_data)
-{
-   wfaTLV *ptlv = (wfaTLV *)tlv_data;
-
-   if(ptlv != NULL)
-      return ptlv->tag;
-   
-   return TRUE;
-}
-
-/*
- * wfaSetTLVTag(): the individual function to set TLV type.
- * input: new_tag - the new TLV type.
- * Output: tlv_data - a TLV buffer, caller must allocate this buffer.
- */
-
-BOOL wfaSetTLVTag(WORD new_tag, BYTE *tlv_data)
-{
-   wfaTLV *ptlv = (wfaTLV *)tlv_data;
-
-   if(tlv_data == NULL)
-      return FALSE;
-
-   ptlv->tag = new_tag;
-
-   return TRUE;
-}
-
-/*
- * wfaGetTLVLen(): retrieve a TLV value length
- * input: tlv_data - a TLV buffer
- * return: the value length.
- */
-
-WORD wfaGetTLVLen(BYTE *tlv_data)
-{
-   wfaTLV *ptlv = (wfaTLV *)tlv_data;
-
-   if(tlv_data == NULL)
-     return FALSE;
-
-   return ptlv->len;
-}
-
-/*
- * wfaGetTLVValue(): retrieve a TLV value
- * input: value_len - TLV value length
- *        tlv_data - a TLV data buffer
- * output: pvalue - the value buffer, caller must allocate it.
- */
-
-BOOL wfaGetTLVvalue(int value_len, BYTE *tlv_data, BYTE *pvalue)
-{
-    if(tlv_data == NULL)
-      return FALSE;
-
-    wMEMCPY(pvalue, tlv_data+WFA_TLV_HEAD_LEN, value_len);
-
-    return TRUE;
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tlv.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_tlv.h
deleted file mode 100644 (file)
index 55a74eb..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-/*
- * File: wfa_tlv.h
- *  definitions for each of command types. 
- *  format:
- *  ---------------------------------------------------
- *  |  tag   | length |   value   
- *  --------------------------------------------------- 
- *   2 bytes   2bytes    defined by length 
- */
-#ifndef _WFA_TLV_H
-#define _WFA_TLV_H
-
-#include "wfa_types.h"
-
-#define INTEGER_1 0x0001            /* byte */
-#define INTEGER_2 0x0002            /* word */
-#define OCTET_STRING 0x0003         /* string */
-
-typedef struct _wfatlvHdr 
-{
-    WORD tag;   /* tag/type */
-    WORD len;   /* value length */
-} wfaTLV;
-
-#define WFA_TLV_HDR_LEN sizeof(wfaTLV)
-
-/* Commands */
-#define WFA_GET_VERSION_TLV                                         0x01
-
-/* Generic TRAFFIC GENERATOR Commands */
-#define WFA_TRAFFIC_SEND_PING_TLV        (WFA_GET_VERSION_TLV + 0x01)                  /* 2 */
-#define WFA_TRAFFIC_STOP_PING_TLV        (WFA_TRAFFIC_SEND_PING_TLV + 0x01)            /* 3 */
-#define WFA_TRAFFIC_AGENT_CONFIG_TLV     (WFA_TRAFFIC_STOP_PING_TLV + 0x01)            /* 4 */
-#define WFA_TRAFFIC_AGENT_SEND_TLV       (WFA_TRAFFIC_AGENT_CONFIG_TLV + 0x01)         /* 5 */
-#define WFA_TRAFFIC_AGENT_RECV_START_TLV (WFA_TRAFFIC_AGENT_SEND_TLV + 0x01)           /* 6 */
-#define WFA_TRAFFIC_AGENT_RECV_STOP_TLV  (WFA_TRAFFIC_AGENT_RECV_START_TLV + 0x01)     /* 7 */
-#define WFA_TRAFFIC_AGENT_RESET_TLV      (WFA_TRAFFIC_AGENT_RECV_STOP_TLV + 0x01)      /* 8 */
-#define WFA_TRAFFIC_AGENT_STATUS_TLV     (WFA_TRAFFIC_AGENT_RESET_TLV + 0x01)          /* 9 */
-
-/* STATION/DUT Commands */
-#define WFA_STA_GET_IP_CONFIG_TLV        (WFA_TRAFFIC_AGENT_STATUS_TLV + 0x01)         /* 10 */
-#define WFA_STA_SET_IP_CONFIG_TLV        (WFA_STA_GET_IP_CONFIG_TLV + 0x01)            /* 11 */
-#define WFA_STA_GET_MAC_ADDRESS_TLV      (WFA_STA_SET_IP_CONFIG_TLV + 0x01)            /* 12 */
-#define WFA_STA_SET_MAC_ADDRESS_TLV      (WFA_STA_GET_MAC_ADDRESS_TLV + 0x01)          /* 13 */ 
-#define WFA_STA_IS_CONNECTED_TLV         (WFA_STA_SET_MAC_ADDRESS_TLV + 0x01)          /* 14 */
-#define WFA_STA_VERIFY_IP_CONNECTION_TLV (WFA_STA_IS_CONNECTED_TLV + 0x01)             /* 15 */
-#define WFA_STA_GET_BSSID_TLV            (WFA_STA_VERIFY_IP_CONNECTION_TLV + 0x01)     /* 16 */
-#define WFA_STA_GET_STATS_TLV            (WFA_STA_GET_BSSID_TLV + 0x01)                /* 17 */ 
-#define WFA_STA_SET_ENCRYPTION_TLV       (WFA_STA_GET_STATS_TLV + 0x01)                /* 18 */
-#define WFA_STA_SET_PSK_TLV              (WFA_STA_SET_ENCRYPTION_TLV + 0x01)           /* 19 */
-#define WFA_STA_SET_EAPTLS_TLV           (WFA_STA_SET_PSK_TLV + 0x01)                  /* 20 */
-#define WFA_STA_SET_UAPSD_TLV            (WFA_STA_SET_EAPTLS_TLV + 0x01)               /* 21 */
-#define WFA_STA_ASSOCIATE_TLV            (WFA_STA_SET_UAPSD_TLV + 0x01)                /* 22 */
-#define WFA_STA_SET_EAPTTLS_TLV          (WFA_STA_ASSOCIATE_TLV + 0x01)                /* 23 */
-#define WFA_STA_SET_EAPSIM_TLV           (WFA_STA_SET_EAPTTLS_TLV + 0x01)              /* 24 */
-#define WFA_STA_SET_PEAP_TLV             (WFA_STA_SET_EAPSIM_TLV + 0x01)               /* 25 */
-#define WFA_STA_SET_IBSS_TLV             (WFA_STA_SET_PEAP_TLV + 0x01)                 /* 26 */
-#define WFA_STA_GET_INFO_TLV             (WFA_STA_SET_IBSS_TLV + 0x01)                 /* 27 */
-#define WFA_DEVICE_GET_INFO_TLV          (WFA_STA_GET_INFO_TLV + 0x01)                 /* 28 */
-#define WFA_DEVICE_LIST_IF_TLV           (WFA_DEVICE_GET_INFO_TLV + 0x01)              /* 29 */
-
-#define WFA_STA_DEBUG_SET_TLV            (WFA_DEVICE_LIST_IF_TLV + 0x01)               /* 30 */
-#define WFA_STA_SET_MODE_TLV             (WFA_STA_DEBUG_SET_TLV + 0x01)                /* 31 */
-#define WFA_STA_UPLOAD_TLV               (WFA_STA_SET_MODE_TLV + 0x01)                 /* 32 */
-
-
-#define WFA_STA_SET_WMM_TLV              (WFA_STA_UPLOAD_TLV + 0x01)                   /* 33 */
-
-
-#define WFA_STA_REASSOCIATE_TLV          (WFA_STA_SET_WMM_TLV + 0x01)                  /* 34 */
-#define WFA_STA_SET_PWRSAVE_TLV          (WFA_STA_REASSOCIATE_TLV + 0x01)              /* 35 */
-#define WFA_STA_SEND_NEIGREQ_TLV         (WFA_STA_SET_PWRSAVE_TLV + 0x01)              /* 36 */
-
-#define WFA_STA_COMMANDS_END             (WFA_STA_SEND_NEIGREQ_TLV + 0x01)             /* 37 */
-
-
-/* Version response */
-#define WFA_GET_VERSION_RESP_TLV         (WFA_STA_COMMANDS_END +       0x01)           /* 38 */
-
-/* Generic Traffic Generator Responses */
-#define WFA_TRAFFIC_SEND_PING_RESP_TLV   (WFA_GET_VERSION_RESP_TLV +  0x01)            /* 39 */ 
-#define WFA_TRAFFIC_STOP_PING_RESP_TLV   (WFA_TRAFFIC_SEND_PING_RESP_TLV + 0x01)       /* 40 */
-#define WFA_TRAFFIC_AGENT_CONFIG_RESP_TLV (WFA_TRAFFIC_STOP_PING_RESP_TLV + 0x01)      /* 41 */
-#define WFA_TRAFFIC_AGENT_SEND_RESP_TLV  (WFA_TRAFFIC_AGENT_CONFIG_RESP_TLV + 0x01)    /* 42 */
-#define WFA_TRAFFIC_AGENT_RECV_START_RESP_TLV (WFA_TRAFFIC_AGENT_SEND_RESP_TLV + 0x01) /* 43 */
-#define WFA_TRAFFIC_AGENT_RECV_STOP_RESP_TLV (WFA_TRAFFIC_AGENT_RECV_START_RESP_TLV + 0x01)
-#define WFA_TRAFFIC_AGENT_RESET_RESP_TLV (WFA_TRAFFIC_AGENT_RECV_STOP_RESP_TLV + 0x01) /* 45 */
-#define WFA_TRAFFIC_AGENT_STATUS_RESP_TLV (WFA_TRAFFIC_AGENT_RESET_RESP_TLV + 0x01)    /* 46 */
-
-/* STATION/DUT Responses */
-#define WFA_STA_GET_IP_CONFIG_RESP_TLV (WFA_TRAFFIC_AGENT_STATUS_RESP_TLV + 0x01)      /* 47 */ 
-#define WFA_STA_SET_IP_CONFIG_RESP_TLV (WFA_STA_GET_IP_CONFIG_RESP_TLV + 0x01)         /* 48 */
-#define WFA_STA_GET_MAC_ADDRESS_RESP_TLV (WFA_STA_SET_IP_CONFIG_RESP_TLV + 0x01)       /* 49 */
-#define WFA_STA_SET_MAC_ADDRESS_RESP_TLV (WFA_STA_GET_MAC_ADDRESS_RESP_TLV + 0x01)     /* 50 */ 
-#define WFA_STA_IS_CONNECTED_RESP_TLV (WFA_STA_SET_MAC_ADDRESS_RESP_TLV + 0x01)        /* 51 */
-#define WFA_STA_VERIFY_IP_CONNECTION_RESP_TLV  (WFA_STA_IS_CONNECTED_RESP_TLV + 0x01)  /* 52 */
-#define WFA_STA_GET_BSSID_RESP_TLV (WFA_STA_VERIFY_IP_CONNECTION_RESP_TLV + 0x01)      /* 53 */
-#define WFA_STA_GET_STATS_RESP_TLV (WFA_STA_GET_BSSID_RESP_TLV + 0x01)                 /* 54 */
-#define WFA_STA_SET_ENCRYPTION_RESP_TLV (WFA_STA_GET_STATS_RESP_TLV + 0x01)
-#define WFA_STA_SET_PSK_RESP_TLV (WFA_STA_SET_ENCRYPTION_RESP_TLV + 0x01)
-#define WFA_STA_SET_EAPTLS_RESP_TLV (WFA_STA_SET_PSK_RESP_TLV + 0x01)
-#define WFA_STA_SET_UAPSD_RESP_TLV (WFA_STA_SET_EAPTLS_RESP_TLV + 0x01)
-#define WFA_STA_ASSOCIATE_RESP_TLV (WFA_STA_SET_UAPSD_RESP_TLV + 0x01)                 /* 59 */
-#define WFA_STA_SET_EAPTTLS_RESP_TLV   (WFA_STA_ASSOCIATE_RESP_TLV + 0x01)             /* 60 */
-#define WFA_STA_SET_EAPSIM_RESP_TLV   (WFA_STA_SET_EAPTTLS_RESP_TLV + 0x01)
-#define WFA_STA_SET_PEAP_RESP_TLV      (WFA_STA_SET_EAPSIM_RESP_TLV + 0x01)
-#define WFA_STA_SET_IBSS_RESP_TLV         (WFA_STA_SET_PEAP_RESP_TLV + 0x01)
-#define WFA_STA_GET_INFO_RESP_TLV      (WFA_STA_SET_IBSS_RESP_TLV + 0x01)              /* 64 */
-#define WFA_DEVICE_GET_INFO_RESP_TLV  (WFA_STA_GET_INFO_RESP_TLV + 0x01)
-#define WFA_DEVICE_LIST_IF_RESP_TLV (WFA_DEVICE_GET_INFO_RESP_TLV + 0x01)              /* 66 */ 
-
-#define WFA_STA_DEBUG_SET_RESP_TLV  (WFA_DEVICE_LIST_IF_RESP_TLV + 0x01)               /* 67 */
-#define WFA_STA_SET_MODE_RESP_TLV   (WFA_STA_DEBUG_SET_RESP_TLV + 0x01)                /* 68 */
-#define WFA_STA_UPLOAD_RESP_TLV     (WFA_STA_SET_MODE_RESP_TLV + 0x01)                 /* 69 */
-
-
-#define WFA_STA_SET_WMM_RESP_TLV    (WFA_STA_UPLOAD_RESP_TLV + 0x01)                   /* 70 */
-
-
-#define WFA_STA_REASSOCIATE_RESP_TLV  (WFA_STA_SET_WMM_RESP_TLV + 0x01)                 /* 71 */
-#define WFA_STA_SET_PWRSAVE_RESP_TLV      (WFA_STA_REASSOCIATE_RESP_TLV + 0x01)        /* 72 */
-#define WFA_STA_SEND_NEIGREQ_RESP_TLV    (WFA_STA_SET_PWRSAVE_RESP_TLV + 0x01)         /* 73 */
-
-#define WFA_STA_RESPONSE_END (WFA_STA_SEND_NEIGREQ_RESP_TLV + 0x01)                    /* 74 */
-
-#define WFA_TLV_END WFA_STA_RESPONSE_END 
-// New STA/DUT commands
-
-#define WFA_STA_NEW_COMMANDS_START             0x100                                  /* 256 */
-#define WFA_STA_PRESET_PARAMETERS_TLV      (WFA_STA_NEW_COMMANDS_START + 0x01)        /* 257 */
-#define WFA_STA_SET_EAPFAST_TLV                    (WFA_STA_PRESET_PARAMETERS_TLV + 0x01)     /* 258 */
-#define WFA_STA_SET_EAPAKA_TLV             (WFA_STA_SET_EAPFAST_TLV + 0x01)           /* 259 */
-#define WFA_STA_SET_SYSTIME_TLV                    (WFA_STA_SET_EAPAKA_TLV + 0x01)            /* 260 */
-
-#define WFA_STA_SET_11N_TLV                (WFA_STA_SET_SYSTIME_TLV + 0x01)           /* 261 */
-#define WFA_STA_SET_WIRELESS_TLV           (WFA_STA_SET_11N_TLV + 0x01)               /* 262 */
-#define WFA_STA_SEND_ADDBA_TLV             (WFA_STA_SET_WIRELESS_TLV + 0x01)          /* 263 */
-
-#define WFA_STA_SEND_COEXIST_MGMT_TLV       (WFA_STA_SEND_ADDBA_TLV + 0x01)            /* 264 */
-#define WFA_STA_SET_RIFS_TEST_TLV           (WFA_STA_SEND_COEXIST_MGMT_TLV +0x01)      /* 265 */
-#define WFA_STA_RESET_DEFAULT_TLV           (WFA_STA_SET_RIFS_TEST_TLV + 0x01)         /* 266 */
-#define WFA_STA_DISCONNECT_TLV              (WFA_STA_RESET_DEFAULT_TLV +0x01)          /* 267 */
-/* P2P */
-
-#define WFA_STA_GET_P2P_DEV_ADDRESS_TLV           (WFA_STA_DISCONNECT_TLV + 0x01)  /* 268 */
-#define WFA_STA_SET_P2P_TLV           (WFA_STA_GET_P2P_DEV_ADDRESS_TLV + 0x01)  /* 269 */
-#define WFA_STA_P2P_CONNECT_TLV           (WFA_STA_SET_P2P_TLV + 0x01)  /* 270 */
-#define WFA_STA_START_AUTO_GO           (WFA_STA_P2P_CONNECT_TLV + 0x01)  /* 271 */
-#define WFA_STA_P2P_START_GRP_FORMATION_TLV           (WFA_STA_START_AUTO_GO + 0x01)  /* 272 */
-#define WFA_STA_P2P_DISSOLVE_TLV           (WFA_STA_P2P_START_GRP_FORMATION_TLV + 0x01)  /* 273 */
-#define WFA_STA_SEND_P2P_INV_REQ_TLV           (WFA_STA_P2P_DISSOLVE_TLV + 0x01)  /* 274 */
-#define WFA_STA_ACCEPT_P2P_INV_REQ_TLV           (WFA_STA_SEND_P2P_INV_REQ_TLV + 0x01)  /* 275 */
-#define WFA_STA_SEND_P2P_PROV_DIS_REQ_TLV           (WFA_STA_ACCEPT_P2P_INV_REQ_TLV + 0x01)  /* 276 */
-#define WFA_STA_SET_WPS_PBC_TLV           (WFA_STA_SEND_P2P_PROV_DIS_REQ_TLV + 0x01)  /* 277 */
-#define WFA_STA_WPS_READ_PIN_TLV           (WFA_STA_SET_WPS_PBC_TLV + 0x01)  /* 278 */
-#define WFA_STA_WPS_ENTER_PIN_TLV           (WFA_STA_WPS_READ_PIN_TLV + 0x01)  /* 279 */
-#define WFA_STA_GET_PSK_TLV           (WFA_STA_WPS_ENTER_PIN_TLV + 0x01)  /* 280 */
-#define WFA_STA_P2P_RESET_TLV           (WFA_STA_GET_PSK_TLV + 0x01)  /* 281 */
-#define WFA_STA_WPS_READ_LABEL_TLV           (WFA_STA_P2P_RESET_TLV + 0x01)  /* 282 */
-#define WFA_STA_GET_P2P_IP_CONFIG_TLV           (WFA_STA_WPS_READ_LABEL_TLV + 0x01)  /* 283 */
-#define WFA_STA_SEND_SERVICE_DISCOVERY_REQ_TLV           (WFA_STA_GET_P2P_IP_CONFIG_TLV + 0x01)  /* 284 */
-#define WFA_STA_SEND_P2P_PRESENCE_REQ_TLV           (WFA_STA_SEND_SERVICE_DISCOVERY_REQ_TLV + 0x01)  /* 285 */
-#define WFA_STA_SET_SLEEP_TLV           (WFA_STA_SEND_P2P_PRESENCE_REQ_TLV + 0x01)  /* 286 */
-#define WFA_STA_SET_OPPORTUNISTIC_PS_TLV           (WFA_STA_SET_SLEEP_TLV + 0x01)  /* 287 */
-
-#define WFA_STA_ADD_ARP_TABLE_ENTRY_TLV (WFA_STA_SET_OPPORTUNISTIC_PS_TLV +0x01) /* 288 */
-#define WFA_STA_BLOCK_ICMP_RESPONSE_TLV (WFA_STA_ADD_ARP_TABLE_ENTRY_TLV +0x01) /* 289 */ 
-/* P2P */
-
-#define WFA_STA_NEW_COMMANDS_END            (WFA_STA_BLOCK_ICMP_RESPONSE_TLV + 0x01)            /* 290 */
-
-
-//New STA/DUT command responses
-#define WFA_STA_NEW_COMMANDS_RESPONSE_START        0x200 /* 512 */
-#define WFA_STA_PRESET_PARAMETERS_RESP_TLV  (WFA_STA_NEW_COMMANDS_RESPONSE_START + 0x01)   /* 513 */
-#define WFA_STA_SET_EAPFAST_RESP_TLV       (WFA_STA_PRESET_PARAMETERS_RESP_TLV + 0x01)    /* 514 */
-#define WFA_STA_SET_EAPAKA_RESP_TLV        (WFA_STA_SET_EAPFAST_RESP_TLV + 0x01)          /* 515 */
-#define WFA_STA_SET_SYSTIME_RESP_TLV       (WFA_STA_SET_EAPAKA_RESP_TLV + 0x01)           /* 516 */
-
-#define WFA_STA_SET_11N_RESP_TLV           (WFA_STA_SET_SYSTIME_RESP_TLV + 0x01)          /* 517 */
-#define WFA_STA_SET_WIRELESS_RESP_TLV      (WFA_STA_SET_11N_RESP_TLV + 0x01)              /* 518 */
-#define WFA_STA_SET_SEND_ADDBA_RESP_TLV            (WFA_STA_SET_WIRELESS_RESP_TLV + 0x01)         /* 519 */
-
-#define WFA_STA_SEND_COEXIST_MGMT_RESP_TLV  (WFA_STA_SET_SEND_ADDBA_RESP_TLV + 0x01)
-#define WFA_STA_SET_RIFS_TEST_RESP_TLV      (WFA_STA_SEND_COEXIST_MGMT_RESP_TLV +0x01)
-#define WFA_STA_RESET_DEFAULT_RESP_TLV      (WFA_STA_SET_RIFS_TEST_RESP_TLV + 0x01)
-#define WFA_STA_DISCONNECT_RESP_TLV         (WFA_STA_RESET_DEFAULT_RESP_TLV + 0x01)
-/* P2P */
-
-#define WFA_STA_GET_P2P_DEV_ADDRESS_RESP_TLV           (WFA_STA_DISCONNECT_RESP_TLV + 0x01)  /* 524 */
-#define WFA_STA_SET_P2P_RESP_TLV           (WFA_STA_GET_P2P_DEV_ADDRESS_RESP_TLV + 0x01)  /* 525 */
-#define WFA_STA_P2P_CONNECT_RESP_TLV           (WFA_STA_SET_P2P_RESP_TLV + 0x01)  /* 526 */
-#define WFA_STA_P2P_START_AUTO_GO_RESP_TLV           (WFA_STA_P2P_CONNECT_RESP_TLV + 0x01)  /* 527 */
-#define WFA_STA_P2P_START_GRP_FORM_RESP_TLV           (WFA_STA_P2P_START_AUTO_GO_RESP_TLV + 0x01)  /* 528 */
-#define WFA_STA_P2P_DISSOLVE_RESP_TLV           (WFA_STA_P2P_START_GRP_FORM_RESP_TLV + 0x01)  /* 529 */
-#define WFA_STA_SEND_P2P_INV_REQ_RESP_TLV           (WFA_STA_P2P_DISSOLVE_RESP_TLV + 0x01)  /* 530 */
-#define WFA_STA_ACCEPT_P2P_REQ_RESP_TLV           (WFA_STA_SEND_P2P_INV_REQ_RESP_TLV + 0x01)  /* 531 */
-#define WFA_STA_SEND_P2P_PROV_DIS_REQ_RESP_TLV           (WFA_STA_ACCEPT_P2P_REQ_RESP_TLV + 0x01)  /* 532 */
-#define WFA_STA_SET_WPS_PBC_RESP_TLV           (WFA_STA_SEND_P2P_PROV_DIS_REQ_RESP_TLV + 0x01)  /* 533 */
-#define WFA_STA_WPS_READ_PIN_RESP_TLV           (WFA_STA_SET_WPS_PBC_RESP_TLV + 0x01)  /* 534 */
-#define WFA_STA_WPS_ENTER_PIN_RESP_TLV           (WFA_STA_WPS_READ_PIN_RESP_TLV + 0x01)  /* 535 */
-#define WFA_STA_GET_PSK_RESP_TLV           (WFA_STA_WPS_ENTER_PIN_RESP_TLV + 0x01)  /* 536 */
-#define WFA_STA_P2P_RESET_RESP_TLV           (WFA_STA_GET_PSK_RESP_TLV + 0x01)  /* 537 */
-#define WFA_STA_WPS_READ_LABEL_RESP_TLV           (WFA_STA_P2P_RESET_RESP_TLV + 0x01)  /* 538 */
-#define WFA_STA_GET_P2P_IP_CONFIG_RESP_TLV           (WFA_STA_WPS_READ_LABEL_RESP_TLV + 0x01)  /* 539 */
-#define WFA_STA_SEND_SERVICE_DISCOVERY_REQ_RESP_TLV           (WFA_STA_GET_P2P_IP_CONFIG_RESP_TLV + 0x01)  /* 540 */
-#define WFA_STA_SEND_P2P_PRESENCE_REQ_RESP_TLV           (WFA_STA_SEND_SERVICE_DISCOVERY_REQ_RESP_TLV + 0x01)  /* 541 */
-#define WFA_STA_SET_SLEEP_REQ_RESP_TLV           (WFA_STA_SEND_P2P_PRESENCE_REQ_RESP_TLV + 0x01)  /* 542 */
-#define WFA_STA_SET_OPPORTUNISTIC_PS_REQ_RESP_TLV           (WFA_STA_SET_SLEEP_REQ_RESP_TLV + 0x01)  /* 543 */
-
-#define WFA_STA_ADD_ARP_TABLE_ENTRY_RESP_TLV (WFA_STA_SET_OPPORTUNISTIC_PS_REQ_RESP_TLV + 0x01) /* 544 */
-#define WFA_STA_BLOCK_ICMP_RESPONSE_RESP_TLV (WFA_STA_ADD_ARP_TABLE_ENTRY_RESP_TLV + 0x01) /* 545 */
-
-/* P2P */
-#define WFA_STA_NEW_COMMANDS_RESPONSE_END   (WFA_STA_BLOCK_ICMP_RESPONSE_RESP_TLV + 0x01) /* 546 */
-
-
-
-
-
-
-#define WFA_TLV_HEAD_LEN 1+2
-
-extern WORD wfaGetTag(BYTE *tlv_data);
-extern void wfaSetTag(BYTE *tlv_data, BYTE new_tag);
-extern WORD wfaGetTLVLen(BYTE *tlv_data);
-extern WORD wfaGetValueLen(BYTE *tlv_data);
-extern BOOL wfaGetValue(BYTE *pstr, int value_len, BYTE *tlv_data);
-extern BOOL wfaIsValidTag(BYTE the_tag);
-extern void wfaAliasByTag(BYTE the_tag, char *aliasStr);
-extern BOOL wfaDecodeTLV(BYTE *tlv_data, int tlv_len, WORD *ptlv_tag, int *ptlv_val_len, BYTE *ptlv_value);
-extern BOOL wfaEncodeTLV(WORD the_tag, WORD the_len, BYTE *the_value, BYTE *tlv_data);
-
-extern WORD wfaGetValueType(BYTE the_tag, BYTE *tlv_data);
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_types.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_types.h
deleted file mode 100644 (file)
index e18f1b9..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
- /* Revision History:
-  *             11/07/07 02.30 Voice HSO -- qhu
-  *                  -- change FALSE to -1 -- a bug reported by rmaeder
-  *                     socket may be a 0
-  */
-
-/*
- * wfa_types.h:
- *   Defines general types and enum 
- */
-#ifndef _WFA_TYPES_H
-#define _WFA_TYPES_H 
-
-#define WFA_IF_NAME_LEN 16
-#define WFA_VERSION_LEN 16
-#define WFA_SSID_NAME_LEN 64
-#define WFA_IP_ADDR_STR_LEN  16
-#define WFA_IP_MASK_STR_LEN  16
-#define WFA_MAX_DNS_NUM      2
-#define WFA_MAC_ADDR_STR_LEN 20
-
-
-#define WFA_P2P_DEVID_LEN 18
-#define WFA_P2P_GRP_ID_LEN 128
-#define WFA_WPS_PIN_LEN 256
-#define WFA_PSK_PP_LEN 256
-
-
-#define IF_80211   1
-#define IF_ETH     2
-
-/* WMM-AC APSD defines*/
-#ifdef WFA_WMM_AC
-#define DIR_NONE  0
-#define DIR_UP    1
-#define DIR_DOWN  2
-#define DIR_BIDIR 3
-#endif
-
-typedef unsigned short WORD;
-typedef unsigned char BYTE;
-
-enum _response_staus
-{
-       STATUS_RUNNING = 0x0001,
-       STATUS_INVALID = 0x0002,
-       STATUS_ERROR = 0x0003,
-       STATUS_COMPLETE = 0x0004,
-};
-
-typedef int BOOL;
-
-#ifndef    TRUE
-    #define    FALSE       -1
-    #define    TRUE        0
-    #define    DONE        1
-#endif
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_utils.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_utils.h
deleted file mode 100644 (file)
index 9a6e129..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-#ifndef _WFA_UTILS_H
-#define _WFA_UTILS_H
-
-
-#define WFA_RET_ENV       "WFA_UTIL_RET"
-
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_ver.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_ver.h
deleted file mode 100644 (file)
index 28628c8..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-#ifndef WFA_VER_H
-#define WFA_VER_H
-
-#define WFA_VERNAM_LEN      16
-#define WFA_SYSTEM_VER      "DUT-4.0.0"     /* PC-ENDPOINT 3.1.2.2 */
-                                                 /* Sigma DUT 3.1.2.2   */
-                                                 /* WMM-AC-0010         */
-                                                 /* VoiceEnt-0010       */
-                                                                                               /* P2P 4.0.0*/  
-#endif
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_wmmps.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_wmmps.c
deleted file mode 100644 (file)
index 4a2d140..0000000
+++ /dev/null
@@ -1,896 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved 
- *
- * 
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated 
- *  contractors (“Authorized Licensees”).  Authorized Licensees are granted 
- *  the non-exclusive, worldwide, limited right to use, copy, import, export 
- *  and distribute this software: 
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi 
- *  equipment; and 
- *  (ii) solely for the purpose of embedding the software into Authorized 
- *  Licensee’s proprietary equipment and software products for distribution to 
- *  its customers under a license with at least the same restrictions as 
- *  contained in this License, including, without limitation, the disclaimer of 
- *  warranty and limitation of liability, below.  The distribution rights 
- *  granted in clause 
- *  (ii), above, include distribution to third party companies who will 
- *  redistribute the Authorized Licensee’s product to their customers with or 
- *  without such third party’s private label. Other than expressly granted 
- *  herein, this License is not transferable or sublicensable, and it does not 
- *  extend to and may not be used with non-Wi-Fi applications.  Wi-Fi Alliance 
- *  reserves all rights not expressly granted herein. 
- * 
- *  Except as specifically set forth above, commercial derivative works of 
- *  this software or applications that use the Wi-Fi scripts generated by this 
- *  software are NOT AUTHORIZED without specific prior written permission from 
- *  Wi-Fi Alliance.
- * 
- *  Non-Commercial derivative works of this software for internal use are 
- *  authorized and are limited by the same restrictions; provided, however, 
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of 
- *  such derivative works under a perpetual, payment-free license to use, 
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi 
- *  equipment.
- * 
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse 
- *  or promote products that are derived from or that use this software without 
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR 
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE, 
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT, 
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF 
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- ******************************************************************************
- */
-
-/*    Revision History:
- *    2007/07/25  -- Initial created by qhu
- *    2007/08/15  -- 02.10 WMM-Power Save Released by qhu
- *    2007/10/10 --  02.20 Voice SOHO beta -- qhu
- *    2007/11/07 --  02.30 Voice HSO -- qhu
- *    2007/12/10 --  02.32 no change
- *    2008/02/07 --  02.40 Upgrade the new WMM-PS method.
- *    2008/03/20 --  02.41 Bug #18, the hello counter limit could fails other
- *                         tests. Reset num_hello in wfaRcvProc(). 
- *                         Not Bug, print message too long and frequent. Remove
- *                         trace messages for L1.
- *
- */
-
-#ifdef WFA_WMM_PS_EXT
-#if 0
-#include <netdb.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <pthread.h>
-#endif
-
-#include "wfa_portall.h"
-#include "wfa_stdincs.h"
-#include "wfa_sock.h"
-#include "wfa_types.h"
-#include "wfa_tg.h"
-#include "wfa_ca.h"
-#include "wfa_wmmps.h"
-#include "wfa_main.h"
-#include "wfa_debug.h"
-
-extern int psSockfd;
-extern int num_stops;
-extern int num_hello;
-extern tgWMM_t wmm_thr[];
-
-extern unsigned int psTxMsg[512];
-extern unsigned int psRxMsg[512];
-extern int msgsize;
-
-char gCmdStr[WFA_CMD_STR_SZ];
-int resetsnd=0;
-int reset_recd=0;
-int resetrcv=0;
-int num_retry=0;
-int gtgPsPktRecvd = 0;                    // need to reset
-struct timeval time_ap;
-struct timeval time_ul;
-
-extern wfaWmmPS_t wmmps_info;
-extern int gtgWmmPS;
-
-extern int wfaTGSetPrio(int sockfd, int tgClass);
-
-void wmmps_wait_state_proc();
-/* APTS messages*/
-struct apts_msg apts_msgs[] ={
-       {0, -1},
-       {"B.D", B_D},   
-       {"B.H", B_H},
-        {"B.B", B_B},
-       {"B.M", B_M},   
-       {"M.D", M_D},   
-       {"B.Z", B_Z},   
-       {"M.Y", M_Y},   
-       {"L.1", L_1},   
-       {"A.Y", A_Y},   
-       {"B.W", B_W},   
-       {"A.J", A_J},   
-       {"M.V", M_V},   
-       {"M.U", M_U},   
-        {"A.U", A_U},  
-       {"M.L", M_L},   
-       {"B.K", B_K},   
-       {"M.B", M_B},   
-       {"M.K", M_K},   
-       {"M.W", M_W},
-#ifdef WFA_WMM_AC
-        {"422.T02B", WMMAC_422_T02B},
-        {"422.T03A", WMMAC_422_T03A},
-        {"422.T04A", WMMAC_422_T04B},
-        {"422.T05B", WMMAC_422_T05B},
-        {"422.T06B", WMMAC_422_T06B},
-        {"422.T07B", WMMAC_422_T07B},
-        {"422.T08B", WMMAC_422_T08B},
-        {"423.T04",  WMMAC_423_T04},
-        {"424.T07",  WMMAC_424_T07t14},
-        {"425.T04",  WMMAC_425_T04t06},
-        {"521.T03", WMMAC_521_T03},
-        {"521.T05", WMMAC_521_T05},
-        {"522.T04", WMMAC_522_T04},
-        {"522.T06", WMMAC_522_T06},
-        {"522.T06o", WMMAC_522_T06o},
-        {"524.T03", WMMAC_524_T03},
-        {"524.T03i", WMMAC_524_T03i},
-        {"525.T07", WMMAC_525_T07t10},
-#endif
-       {"APTS TX         ", APTS_DEFAULT },
-       {"APTS Hello      ", APTS_HELLO },
-       {"APTS Broadcast  ", APTS_BCST },
-       {"APTS Confirm    ", APTS_CONFIRM},
-       {"APTS STOP       ", APTS_STOP},
-       {"APTS CK BE      ", APTS_CK_BE },
-       {"APTS CK BK      ", APTS_CK_BK },
-       {"APTS CK VI      ", APTS_CK_VI },
-       {"APTS CK VO      ", APTS_CK_VO },
-       {"APTS RESET      ", APTS_RESET },
-       {"APTS RESET RESP ", APTS_RESET_RESP },
-       {"APTS RESET STOP ", APTS_RESET_STOP },
-       {0, 0 }         // APTS_LAST
-};
-
-#if 0 /* Since Passing criteria is handled by Sniffer check, checking order of receiving packets not important */
-/* The DUT recv table for each of the test cases*/
-StationRecvProcStatetbl_t stationRecvProcStatetbl[LAST_TEST+10][6] = {
-         {{WfaRcvStop},{0},{0},{0},{0},{0}},
- /*B.D*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvStop},{0},{0},{0}},
- /*B.H*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvVO},{WfaRcvStop},{0},{0}},
- /*B.B*/ {{WfaRcvProc},{WfaRcvStop},{0},{0},{0},{0}},
- /*B.M*/ {{WfaRcvProc},{WfaRcvStop},{0},{0},{0},{0}},
- /*M.D*/ {{WfaRcvProc},{WfaRcvBE},{WfaRcvBK},{WfaRcvVI},{WfaRcvVO},{WfaRcvStop}},
- /*B.Z*/ {{WfaRcvProc},{WfaRcvVI},{WfaRcvBE},{WfaRcvStop},{0},{0}},
- /*M.Y*/ {{WfaRcvProc},{WfaRcvVI},{WfaRcvBE},{WfaRcvBE},{WfaRcvStop},{0}},
- /*L.1*/ {{WfaRcvProc},{WfaRcvVOCyclic},{0},{0},{0},{0}},
- /*A.Y*/ {{WfaRcvProc},{WfaRcvVI},{WfaRcvBE},{WfaRcvBE},{WfaRcvStop},{0}},
- /*B.W*/ {{WfaRcvProc},{WfaRcvBE},{WfaRcvVI},{WfaRcvBE},{WfaRcvVI},{WfaRcvStop}},
- /*A.J*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvVI},{WfaRcvBE},{WfaRcvBK},{WfaRcvStop}},
- /*M.V*/ {{WfaRcvProc},{WfaRcvBE},{WfaRcvVI},{WfaRcvStop},{0},{0}},
- /*M.U*/ {{WfaRcvProc},{WfaRcvVI},{WfaRcvBE},{WfaRcvVO},{WfaRcvVO},{WfaRcvStop}},
- /*A.U*/ {{WfaRcvProc},{WfaRcvVI},{WfaRcvBE},{WfaRcvVO},{WfaRcvStop},{0}},
- /*M.L*/ {{WfaRcvProc},{WfaRcvBE},{WfaRcvStop},{0},{0},{0}},
- /*B.K*/ {{WfaRcvProc},{WfaRcvVI},{WfaRcvBE},{WfaRcvStop},{0},{0}},
- /*M.B*/ {{WfaRcvProc},{WfaRcvStop},{0},{0},{0},{0}},
- /*M.K*/ {{WfaRcvProc},{WfaRcvBE},{WfaRcvVI},{WfaRcvStop},{0},{0}},
- /*M.W*/ {{WfaRcvProc},{WfaRcvBE},{WfaRcvBE},{WfaRcvBE},{WfaRcvVI},{WfaRcvStop}}
-#ifdef WFA_WMM_AC
- /*422_T02B*/ ,{{WfaRcvProc},{WfaRcvVI},{WfaRcvVO},{WfaRcvVO},{WfaRcvBE},{WfaRcvStop}},
- /*422_T03B*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvVI},{WfaRcvVI},{WfaRcvStop}},
- /*422_T04B*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvVI},{WfaRcvBE},{WfaRcvBK},{WfaRcvStop}},
- /*422_T05B*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvVI},{WfaRcvVI},{WfaRcvStop}},
- /*422_T06B*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvVI},{WfaRcvBE},{WfaRcvBK},{WfaRcvStop}},
- /*422_T07B*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvVI},{WfaRcvBE},{WfaRcvBK},{WfaRcvStop}},
- /*422_T08B*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvVO},{WfaRcvVI},{WfaRcvVO},{WfaRcvStop}},
- /*423_T04*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvStop}},
- /*424_T07t14*/ {{WfaRcvProc},{WfaRcvVI},{WfaRcvVO},{WfaRcvStop}},
- /*425_T04t06*/{{WfaRcvProc},{WfaRcvStop}},
- /*521_T03*/{{WfaRcvProc},{WfaRcvVI},{WfaRcvBE},{WfaRcvStop}},
- /*521_T05*/{{WfaRcvProc},{WfaRcvBE},{WfaRcvVI},{WfaRcvStop}},
- /*522_T04*/ {{WfaRcvProc},{WfaRcvBE},{WfaRcvVI},{WfaRcvStop},{0},{0}},
- /*522_T06*/ {{WfaRcvProc},{WfaRcvBE},{WfaRcvBK},{WfaRcvVI},{WfaRcvVO},{WfaRcvStop}},
- /*522_T06o*/ {{WfaRcvProc},{WfaRcvBE},{WfaRcvBK},{WfaRcvVI},{WfaRcvVO},{WfaRcvStop}},
- /*524_T03*/ {{WfaRcvProc},{WfaRcvVO},{WfaRcvVO},{WfaRcvStop}},
- /*524_T03i*/ {{WfaRcvProc},{WfaRcvVI},{WfaRcvVI},{WfaRcvStop},{0},{0}},
- /*525_T07t10*/ {{WfaRcvProc},{WfaRcvVI},{WfaRcvStop}},
-#endif
-};
-
-#endif
-
-StationRecvProcStatetbl_t stationRecvProcStatetbl[LAST_TEST+10][6] = {
-         {{WfaRcvStop},{0},{0},{0},{0},{0}},
- /*B.D*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvStop},{0},{0},{0}},
- /*B.H*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0},{0}},
- /*B.B*/ {{WfaRcvProc},{WfaRcvStop},{0},{0},{0},{0}},
- /*B.M*/ {{WfaRcvProc},{WfaRcvStop},{0},{0},{0},{0}},
- /*M.D*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*B.Z*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0},{0}},
- /*M.Y*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0}},
- /*L.1*/ {{WfaRcvProc},{WfaRcvVOCyclic},{0},{0},{0},{0}},
- /*A.Y*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0}},
- /*B.W*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*A.J*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*M.V*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0},{0}},
- /*M.U*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*A.U*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0}},
- /*M.L*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvStop},{0},{0},{0}},
- /*B.K*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0},{0}},
- /*M.B*/ {{WfaRcvProc},{WfaRcvStop},{0},{0},{0},{0}},
- /*M.K*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0},{0}},
- /*M.W*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}}
-#ifdef WFA_WMM_AC
- /*422_T02B*/ ,{{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*422_T03B*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*422_T04B*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*422_T05B*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*422_T06B*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*422_T07B*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*422_T08B*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*423_T04*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvStop}},
- /*424_T07t14*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*425_T04t06*/{{WfaRcvProc},{WfaRcvStop}},
- /*521_T03*/{{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*521_T05*/{{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*522_T04*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0},{0}},
- /*522_T06*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*522_T06o*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*524_T03*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop}},
- /*524_T03i*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvNotCare},{WfaRcvStop},{0},{0}},
- /*525_T07t10*/ {{WfaRcvProc},{WfaRcvNotCare},{WfaRcvStop}},
-#endif
-};
-
-
-
-
-/* The DUT send table for each of the test cases*/
-StationProcStatetbl_t stationProcStatetbl[LAST_TEST+1][11] = {
-/* Dummy*/{{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},
-/* B.D*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-  {WfaStaSndVO,P_ON,LII / 2}   ,{WfaStaSndVO,P_ON,LII / 2}        ,{WfaStaWaitStop,P_ON,LII / 2},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* B.H*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVO,P_ON,LII / 2}   ,{WfaStaSndVO,P_ON,LII / 2}        ,{WfaStaWaitStop,P_ON,LII / 2},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* B.B*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVO,P_ON,LII / 2}   ,{WfaStaSndVI,P_ON,LII / 2}        ,{WfaStaSndBE,P_ON,LII / 2}     ,{WfaStaSndBK,P_ON,LII / 2}    ,{WfaStaWaitStop,P_ON,LII / 2},{0,0,0},{0,0,0},{0,0,0}},
-
-/* B.M*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVI,P_ON,30000000},{WfaStaWaitStop,P_ON,LII / 2}     ,{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},       
-
-/* M.D*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVI,P_ON,LII / 2}   ,{WfaStaSndVI,P_ON,LII / 2}        ,{WfaStaSndVI,P_ON,LII / 2}     ,{WfaStaSndVI,P_ON,LII / 2}    ,{WfaStaWaitStop,P_ON,LII / 2},{0,0,0},{0,0,0},{0,0,0}},
-
-/* B.Z*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-  {WfaStaSndVO,P_ON,LII / 2 }  ,{WfaStaWaitStop,P_ON,LII / 2}     ,{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* M.Y*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-  {WfaStaSndVI,P_ON,LII / 2}   ,{WfaStaSndVO,P_ON,LII / 2}        ,{WfaStaSndBE,P_ON,LII / 2}     ,{WfaStaSndBE,P_ON,LII / 2}    ,{WfaStaWaitStop,P_ON,LII / 2},{0,0,0},{0,0,0},{0,0,0}},
-
-/* L.1*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-  {WfaStaSndVOCyclic,P_ON,20000},{WfaStaWaitStop,P_ON,LII / 2 }},
-
-/* A.Y*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-  {WfaStaSndVI,P_ON,LII / 2}   ,{WfaStaSndVO,P_ON,LII / 2}        ,{WfaStaSndBE,P_ON,LII / 2}     ,{WfaStaSndBE,P_OFF,LII / 2}    ,{WfaStaSndBE,P_ON,LII / 2}   ,{WfaStaWaitStop,P_ON,LII / 2},{0,0,0},{0,0,0}}, 
-
-/* B.W*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVI,P_ON,LII / 2}   ,{WfaStaSndVI,P_ON,LII / 2}        ,{WfaStaSndVI,P_ON,LII / 2}    ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* A.J*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVO,P_ON,LII / 2}   ,{WfaStaSndVO,P_OFF,LII / 2},{WfaStaWaitStop      ,P_ON,LII / 2},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* M.V*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVI,P_ON,LII / 2}   ,{WfaStaSndBE,P_ON,LII / 2}        ,{WfaStaSndVI,P_ON,LII / 2}    ,{WfaStaWaitStop        ,P_ON,LII / 2} ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* M.U*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-  {WfaStaSndVI,P_ON,LII / 2}   ,{WfaStaSndBE,P_ON,LII / 2}        ,{WfaStaSnd2VO,P_ON,LII / 2}   ,{WfaStaWaitStop      ,P_ON,LII / 2} ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* A.U*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVI,P_ON,LII / 2}  ,{WfaStaSndBE,P_OFF,LII / 2}      ,{WfaStaSndBE,P_ON,LII / 2}    ,{WfaStaSndBE,P_OFF,LII / 2}   ,{WfaStaSndVO,P_ON,LII / 2}   ,{WfaStaSndVO,P_OFF,LII / 2} ,{WfaStaWaitStop ,P_ON,LII / 2},{0,0,0}},
-
-/* M.L*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndBE,P_ON,LII / 2}   ,{WfaStaWaitStop,P_ON,LII / 2}     ,{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* B.K*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVI,P_ON,LII / 2}   ,{WfaStaSndBE,P_ON,LII / 2}        ,{WfaStaSndVI,P_ON,LII / 2}    ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* M.B*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVO,P_ON,LII / 2}   ,{WfaStaSndVI,P_ON,LII / 2}        ,{WfaStaSndBE,P_ON,LII / 2}     ,{WfaStaSndBK,P_ON,LII / 2}    ,{WfaStaWaitStop,P_ON,LII / 2} ,{0,0,0},{0,0,0},{0,0,0}},
-
-/* M.K*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVI,P_ON,LII / 2}   ,{WfaStaSndBE,P_ON,LII / 2}        ,{WfaStaSndVI,P_ON,LII / 2}    ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* M.W*/  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2},
-{WfaStaSndVI,P_ON,LII / 2}   ,{WfaStaSndBE,P_ON,LII / 2}        ,{WfaStaSndVI,P_ON,LII / 2}    ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}}
-#ifdef WFA_WMM_AC
-/* WMMAC_422_T02B */  ,{{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,1000000}, {WfaStaSndVO,P_ON,1000000}, {WfaStaSndVO,P_ON,1000000}, {WfaStaWaitStop,P_ON,LII / 2}, {0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* WMMAC_422_T03B */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaSndVO,P_ON,lis_int}        ,{WfaStaSndVI,P_ON,becon_int}  ,{WfaStaSndVO,P_ON,becon_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0}},
-
-/* 422_T04B/ATC7 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaSndVO,P_ON,lis_int}        ,{WfaStaSndVI,P_ON,becon_int}  ,{WfaStaSndVO,P_ON,becon_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0}},
-
-/* 422_T05B/ATC8 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVO,P_ON,lis_int}   ,{WfaStaSndVI,P_ON,lis_int+2*becon_int} ,{WfaStaSndVI,P_ON,becon_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* 422_T06B/ATC9 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndBE,P_ON,becon_int}   ,{WfaStaSndVO,P_ON,lis_int}        ,{WfaStaSndBE,P_ON,becon_int}  ,{WfaStaSndVI,P_ON,becon_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0}},
-
-/* 422_T07B/ATC10 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaSndBE,P_ON,lis_int}        ,{WfaStaSndVI,P_ON,becon_int}  ,{WfaStaSndBK,P_ON,becon_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0}},
-
-/* 422_T08B/ATC11 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndBE,P_ON,becon_int}   ,{WfaStaSndVI,P_ON,lis_int}        ,{WfaStaSndBE,P_ON,becon_int}  ,{WfaStaSndVO,P_ON,lis_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0}},
-
-/* 423_T04 */  {{WfaStaSndHello,P_OFF, 1000000}, {WfaStaSndConfirm,P_ON, 1}
- ,{WfaStaSndVO,P_ON,1000000}    ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* 424_T07t14 */ {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaSndVO,P_ON,lis_int}        ,{WfaStaSndVO,P_ON,becon_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* 425_T04t06 */ {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndBE,P_ON,becon_int}   ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* 521_T03 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaSndBE,P_ON,lis_int}        ,{WfaStaSndVI,P_ON,becon_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* 521_T05 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaSndBE,P_ON,lis_int}        ,{WfaStaSndVO,P_ON,becon_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* 522_T04 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaSndBE,P_ON,lis_int}        ,{WfaStaSndVO,P_ON,becon_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* 522_T06 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaSndVI,P_ON,lis_int}        ,{WfaStaSndVI,P_ON,becon_int}  ,{WfaStaSndVI,P_ON,lis_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0}},
-/* 522_T06o */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVO,P_ON,becon_int}   ,{WfaStaSndVO,P_ON,lis_int}        ,{WfaStaSndVO,P_ON,becon_int}  ,{WfaStaSndVO,P_ON,lis_int}  ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0}},
-
-/* 524_T03 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVO,P_ON,becon_int}   ,{WfaStaSndVO,P_ON,lis_int}        ,{WfaStaSndVO,P_ON,lis_int} ,{WfaStaWaitStop,P_ON,LII / 2},  {0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-/* 524_T03i */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaSndVI,P_ON,lis_int}  ,{WfaStaSndVI,P_ON,lis_int}       ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-/* 525_T07t10 */  {{WfaStaSndHello,P_OFF, 1000000},{WfaStaSndConfirm,P_ON, LII / 2}, {WfaStaSndVI,P_ON,becon_int}   ,{WfaStaWaitStop,P_ON,LII / 2}  ,{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
-
-#endif
-
-};
-
-int ac_seq[APTS_LAST][6] ={
-   {0,      0,      0,      0,      0},
-   {0},
-   {0},
-   {0},
-   {0},
-   {0},
-   {0},
-   {0},
-   {0},
-   {0},
-   {0}, // APTS_TESTS
-   {0}, // B.D
-   {0}, // B.2
-   {0}, // B.H
-   {0}, // B.4
-   {0}, // B_5
-   {0, 0, 0, 0, 0}, // B_6
-   {TG_WMM_AC_VO, TG_WMM_AC_VI, TG_WMM_AC_BE, TG_WMM_AC_BK, 0}, // B.B B_B - 4 exchanges: 1 uplink, 0 downlink
-   {0}, // B.E
-   {0}, // B.G
-   {0}, // B.I
-   {0}, // M.D
-   {0}, // M.G
-   {0}, // M.I
-   {0}, // B.Z  1, 1, 1, 0},   // 1 special exchange for Broadcast testing
-   {TG_WMM_AC_VI, TG_WMM_AC_VO, TG_WMM_AC_BE, TG_WMM_AC_BE, 0}, //  M.Y  M_Y 2 special exchange for Broadcast testing
-   {0}, // L.1
-   {0}, // DLOAD
-   {0}, // ULOAD
-   {0}, // "APTS PASS"
-   {0}, // "APTS FAIL"
-   //{TOS_VI, TOS_VO, TOS_BE, TOS_BE, 0}, //  A.Y A_Y special exchange for Broadcast testing
-   {TG_WMM_AC_VI, TG_WMM_AC_VO, TG_WMM_AC_BE, TG_WMM_AC_BE, TG_WMM_AC_BE}, //  A.Y A_Y special exchange for Broadcast testing
-   {0}, //  B.W  2 special exchange for Broadcast testing
-   {0}, //  A.J
-   {TG_WMM_AC_VI, TG_WMM_AC_BE, TG_WMM_AC_VI, TG_WMM_AC_VI, TG_WMM_AC_VI}, //  M.V M_V
-   {TG_WMM_AC_VI, TG_WMM_AC_BE, TG_WMM_AC_VO, TG_WMM_AC_VO, TG_WMM_AC_VO}, //  M.U M_U
-   {TG_WMM_AC_VI, TG_WMM_AC_BE, TG_WMM_AC_BE, TG_WMM_AC_BE, TG_WMM_AC_VO, TG_WMM_AC_VO},  //  A.U A_U
-   {0}, //  M.L M_L
-   {TG_WMM_AC_VI, TG_WMM_AC_BE, TG_WMM_AC_VI, TG_WMM_AC_VI, 0}, // B.K B_K
-   {TG_WMM_AC_VO, TG_WMM_AC_VI, TG_WMM_AC_BE, TG_WMM_AC_BK, 0}, // M.B M_B - 4 exchanges: 1 uplink, 0 downlink
-   {TG_WMM_AC_VI, TG_WMM_AC_BE, TG_WMM_AC_VI, TG_WMM_AC_VI, 0}, // M.K M_K
-   {TG_WMM_AC_VI, TG_WMM_AC_BE, TG_WMM_AC_VI, TG_WMM_AC_VI, 0} //  M.W M_W   special exchange for Broadcast testing
-};
-/* Generic function to create a meassage, it also fills in the AC as part of
-** the payload
-** */
-void create_apts_msg(int msg, unsigned int txbuf[],int id)
-{
-   struct apts_msg *t;
-
-   t = &apts_msgs[msg];
-   txbuf[ 0] = wmmps_info.my_cookie;
-   txbuf[ 1] = wmmps_info.dscp;
-   txbuf[ 2] = 0;
-   txbuf[ 3] = 0;
-   txbuf[ 4] = 0;
-   txbuf[ 5] = 0; 
-   //txbuf[ 6] = t->param0; 
-   //txbuf[ 7] = t->param1; 
-   //txbuf[ 8] = t->param2; 
-   txbuf[ 9] = id;
-   txbuf[ 10] = t->cmd; 
-   wSTRCPY((char *)&txbuf[11], t->name);
-   PRINTF("create_apts_msg (%s) %d\n", t->name,t->cmd);
-}
-
-void print_hex_string(char* buf, int len)
-{
-   int i;
-
-   if (len==0) 
-   { 
-      printf("<empty string>"); return; 
-   }
-
-   for (i = 0; i < len; i++) 
-   {
-      printf("%02x ", *((unsigned char *)buf + i));
-      if ((i&0xf)==15) 
-         printf("\n   ");
-   }
-
-   if ((i&0xf))
-      printf("\n");
-}
-
-/* trace print*/
-void mpx(char *m, void *buf_v, int len)
-{
-   char *buf = buf_v;
-
-   printf("%s   MSG: %s\n   ", m, &buf[44] );
-   print_hex_string(buf, len);
-}
-
-/* function to validate the AC of the payload recd to ensure the correct
-** message sequence*/
-int receiver(unsigned int *rmsg,int length,int tos,unsigned int type)
-{
-   int r=1;
-#ifndef WFA_WMM_AC
-   int new_dscp=rmsg[1];
-
-   if((new_dscp != tos)||(rmsg[10] != type))
-   {
-      PRINTF("\r\n dscp recd is %d msg type is %d\n",new_dscp,rmsg[10]);
-      r=-6;
-   }
-#else
-   if(rmsg[10] != type)
-   {
-      PRINTF("\r\n dscp recd is %d msg type is %d\n",new_dscp,rmsg[10]);
-      r=-6;
-   }
-#endif
-
-   return r;
-}
-/* WfaRcvProc: This function receives the test case name
-** after sending the initial hello packet, on receiving a
-** valid test case it advances onto the next receive state
-*/
-int WfaRcvProc(unsigned int *rmsg,int length,int *state)
-{
-
-    int sta_test;
-    int usedThread = wmmps_info.ps_thread;
-    num_hello=0;
-    sta_test = rmsg[10];
-    mpx("STA recv\n", rmsg, 64);
-// For debugging
-#if 0
-    switch(rmsg[10])
-    {
-       case APTS_DEFAULT:
-          printf("Recvd: APTS_DEFAULT\n");
-       break;
-       case APTS_HELLO:
-          printf("Recvd: APTS_HELLO\n");
-       break;
-       case APTS_BCST:
-          printf("Recvd: APTS_BCST\n");
-       break;
-       case APTS_CONFIRM:
-          printf("Recvd: APTS_CONFIRM\n");
-       break;
-       case APTS_STOP:
-          printf("Recvd: APTS_STOP\n");
-       break;
-       case APTS_CK_BE:
-          printf("Recvd: APTS_CK_BE\n");
-       break;
-       case APTS_CK_BK:
-          printf("Recvd: APTS_CK_BK\n");
-       break;
-       case APTS_CK_VI:
-          printf("Recvd: APTS_CK_VI\n");
-       break;
-       case APTS_CK_VO:
-          printf("Recvd: APTS_CK_VO\n");
-       break;
-       case APTS_RESET:
-          printf("Recvd: APTS_RESET\n");
-       break;
-       case APTS_RESET_RESP:
-          printf("Recvd: APTS_RESET_RESP\n");
-       break;
-       case APTS_RESET_STOP:
-          printf("Recvd: APTS_RESET_STOP\n");
-       break;
-     }
-#endif
-    if(!((sta_test >=B_D)&&(sta_test <= LAST_TEST)))
-    {
-         return -1;
-    }
-
-    wmmps_info.sta_test = rmsg[10];
-    wmmps_info.my_sta_id = rmsg[9];
-    wPT_MUTEX_LOCK(&wmm_thr[usedThread].thr_flag_mutex);
-    wmm_thr[usedThread].thr_flag = wmmps_info.streamid;
-    wPT_MUTEX_UNLOCK(&wmm_thr[usedThread].thr_flag_mutex);
-    (*state)++;
-
-    return 0;
-}
-/* WfaStaResetAll: This function resets the whole communication with
-** the console (in the event of a wrong message received for the test case)
-** resulting into resending of all the packets from the scratch, there is an
-** upper bound for the resets a max of three*/
-void WfaStaResetAll()
-{
-    int r;
-    PRINTF("Entering Reset\n");
-    num_retry++;
-    if(num_retry > MAXRETRY)
-    {
-        create_apts_msg(APTS_RESET_STOP, psTxMsg,wmmps_info.my_sta_id);
-        wfaTGSetPrio(psSockfd, TG_WMM_AC_BE);
-        r = wSENDTO(psSockfd, psTxMsg, msgsize, 0, (struct sockaddr *)&wmmps_info.psToAddr, sizeof(struct sockaddr));
-        mpx("STA msg",psTxMsg,64);
-        printf("Too many retries\n");
-       //exit(-8);
-    }
-    if(!reset_recd)
-    {
-        create_apts_msg(APTS_RESET, psTxMsg,wmmps_info.my_sta_id);
-        wfaTGSetPrio(psSockfd, TG_WMM_AC_BE);
-        psTxMsg[1] = TOS_BE;
-        r = wSENDTO(psSockfd, psTxMsg, msgsize, 0, (struct sockaddr *)&wmmps_info.psToAddr, sizeof(struct sockaddr));
-        mpx("STA msg",psTxMsg,64);
-    }
-    else
-    {
-        create_apts_msg(APTS_RESET_RESP, psTxMsg,wmmps_info.my_sta_id);
-        wfaTGSetPrio(psSockfd, TG_WMM_AC_BE);
-        r = wSENDTO(psSockfd, psTxMsg, msgsize, 0, (struct sockaddr *)&wmmps_info.psToAddr, sizeof(struct sockaddr));
-        mpx("STA msg",psTxMsg,64);
-        reset_recd=0;
-    }
-
-    resetsnd=1;
-    resetrcv=1;
-}
-/* WfaRcvVO: A function expected to receive a AC_VO packet from
-** the console, if does not reeive a valid VO resets the communication wit
-** h the console*/
-
-int WfaRcvVO(unsigned int *rmsg,int length,int *state)
-{
-
-    int r;
-
-    if ((r=receiver(rmsg,length,TOS_VO,APTS_DEFAULT))>=0)
-        (*state)++;
-    else
-    {
-        PRINTF("\nBAD REC in VO%d\n",r);
-        WfaStaResetAll();
-    }
-
-    return 0;
-}
-/* WfaRcvVI: A function expected to receive a AC_VI packet from
-** the console, if does not reeive a valid VI resets the communication wit
-** h the console*/
-
-int WfaRcvVI(unsigned int *rmsg,int length,int *state)
-{
-    int r;
-
-    if ((r=receiver(rmsg,length,TOS_VI,APTS_DEFAULT))>=0)
-        (*state)++;
-    else
-        PRINTF("\nBAD REC in VI%d\n",r);
-
-    return 0;
-}
-
-/* WfaRcvBE: A function expected to receive a AC_BE packet from
-** the console, if does not reeive a valid BE resets the communication wit
-** h the console*/
-
-int WfaRcvBE(unsigned int *rmsg,int length,int *state)
-{
-
-    int r;
-    if ((r=receiver(rmsg,length,TOS_BE,APTS_DEFAULT))>=0)
-        (*state)++;
-    else
-    {
-        PRINTF("\nBAD REC in BE%d\n",r);
-    }
-
-    return 0;
-}
-
-/* WfaRcvBK: A function expected to receive a AC_BK packet from
-** the console, if does not reeive a valid BK resets the communication wit
-** h the console*/
-
-int WfaRcvBK(unsigned int *rmsg,int length,int *state)
-{
-
-    int r;
-
-    if ((r=receiver(rmsg,length,TOS_BK,APTS_DEFAULT))>=0)
-        (*state)++;
-    else
-        PRINTF("\nBAD REC in BK%d\n",r);
-
-    return 0;
-}
-/* WfaRcvVOCyclic: This is meant for the L1 test case. The function
-** receives the VO packets from the console */
-int WfaRcvVOCyclic(unsigned int *rmsg,int length,int *state)
-{
-
-    int r;
-    tgWMM_t *my_wmm = &wmm_thr[wmmps_info.ps_thread];
-
-    if(rmsg[10] != APTS_STOP)
-    {
-        if ((r=receiver(rmsg,length,TOS_VO,APTS_DEFAULT))>=0)
-            ;
-        else
-            PRINTF("\nBAD REC in VO%d\n",r);
-    }
-    else
-    {
-        wPT_MUTEX_LOCK(&my_wmm->thr_stop_mutex);
-        while(!my_wmm->stop_flag)
-        {
-            wPT_COND_WAIT(&my_wmm->thr_stop_cond, &my_wmm->thr_stop_mutex);
-        }
-        wPT_MUTEX_UNLOCK(&my_wmm->thr_stop_mutex);
-        my_wmm->stop_flag = 0;
-        gtgWmmPS = 0;
-        wCLOSE(psSockfd);
-        psSockfd = -1;
-        wSIGNAL(SIGALRM, SIG_IGN);
-        //wfaSetDUTPwrMgmt(PS_OFF);
-        wSLEEP(1);
-    }
-
-    return 0;
-}
-/* WfaRcvStop: This function receives the stop message from the
-** console, it waits for the sending thread to have sent the stop before
-** quitting*/
-int WfaRcvStop(unsigned int *rmsg,int length,int *state)
-{
-
-   tgWMM_t *my_wmm = &wmm_thr[wmmps_info.ps_thread];
-
-   my_wmm->stop_flag = 0;
-   PRINTF("\r\nEnterring Wfarcvstop\n");
-
-   if(rmsg[10] != APTS_STOP)
-   {
-      PRINTF("\nBAD REC in rcvstop%d\n",r);
-      //WfaStaResetAll();
-   }
-   else
-   {
-      pthread_mutex_lock(&my_wmm->thr_stop_mutex);
-      while(!my_wmm->stop_flag)
-      {
-         pthread_cond_wait(&my_wmm->thr_stop_cond, &my_wmm->thr_stop_mutex);
-      }
-      num_stops=0;
-      pthread_mutex_unlock(&my_wmm->thr_stop_mutex);
-      my_wmm->stop_flag = 0;
-      gtgWmmPS = 0;
-      close(psSockfd);
-      psSockfd = -1;
-      signal(SIGALRM, SIG_IGN);
-      //wfaSetDUTPwrMgmt(PS_OFF);
-      sleep(1);
-   }
-   return 0;
-}
-
-int WfaRcvNotCare(unsigned int *rmsg,int length,int *state)
-{
-    int r;
-
-    if ((r=receiver(rmsg,length,TOS_VO,APTS_DEFAULT))>=0 || 
-          (r=receiver(rmsg,length,TOS_VI,APTS_DEFAULT))>=0 ||
-         (r=receiver(rmsg,length,TOS_BE,APTS_DEFAULT))>=0 ||
-         (r=receiver(rmsg,length,TOS_BK,APTS_DEFAULT))>=0 )
-    {
-        (*state)++;
-    }
-    else
-    {
-        PRINTF("\nBAD REC in BE%d\n",r);
-        WfaStaResetAll();
-    }
-
-    return 0;
-}
-
-
-
-void BUILD_APTS_MSG(int msg, unsigned long *txbuf)
-{   
-   struct apts_msg *t;
-
-   t = &apts_msgs[msg];
-   txbuf[0] = wmmps_info.msgno++;
-   txbuf[1] = 0;
-   txbuf[2] = 0;
-   txbuf[3] = 0;
-   txbuf[4] = 0;
-   txbuf[5] = 0;
-   txbuf[6] = t->param0;
-   txbuf[7] = t->param1;
-   txbuf[8] = t->param2;
-   txbuf[9] = t->param3;
-   txbuf[10] = t->cmd;
-   wSTRCPY((char *)&txbuf[11], t->name); 
-}
-
-void send_txmsg(int new_prio_class)
-{
-   int r;
-   int new_dscp = 0;
-
-   if(new_prio_class > -1)
-      new_dscp = wfaTGSetPrio(psSockfd, new_prio_class);
-
-   psTxMsg[0] = wmmps_info.msgno++;
-   psTxMsg[1] = new_dscp;
-   psTxMsg[2] = wmmps_info.my_group_cookie;
-   psTxMsg[3] = wmmps_info.my_cookie;
-   psTxMsg[4] = wmmps_info.my_sta_id;
-
-   if(psTxMsg[10] == APTS_DEFAULT)
-   {
-      psTxMsg[13] = (wmmps_info.msgno%10) + 0x20202030; 
-   }
-
-   r = wfaTrafficSendTo(psSockfd, (char *)psTxMsg, 200+(wmmps_info.msgno%200), (struct sockaddr *) &wmmps_info.psToAddr);
-
-   wmmps_info.nsent++;
-}
-
-/*
- * This needs to adopt to the specific platform you port to.
- */
-void wfaSetDUTPwrMgmt(int mode)
-{
-   static int curr_mode = -1;
-   char iface[32];
-
-   wSTRNCPY(iface,WFA_STAUT_IF,31);
-
-   if(curr_mode == mode)
-   {
-      return;
-   }
-
-   if(mode == PS_OFF)
-   {
-      //sprintf(gCmdStr, "iwpriv %s set PSMode=CAM", iface);
-      sprintf(gCmdStr, "iwconfig %s power off", iface);
-      if( system(gCmdStr) < 0)
-      {
-         DPRINT_ERR(WFA_ERR, "Cant Set PS OFF\n");
-      }
-      else
-         printf("\r\n STA PS OFF \n");
-   }
-   else
-   {
-      //sprintf(gCmdStr, "iwpriv %s set PSMode=MAX_PSP", iface);
-      sprintf(gCmdStr, "iwconfig %s power on", iface);
-      if( system(gCmdStr) < 0)
-      {
-         DPRINT_ERR(WFA_ERR, "Cant Set PS ON\n");
-      }
-      else
-      {
-         printf("\r\n STA PS ON \n");
-      }
-   }
-
-   curr_mode = mode;
-}
-
-int wfaWmmPowerSaveProcess(int sockfd)
-{
-   int rbytes = 0;
-   int sta_test;
-   struct sockaddr from;
-   int len;
-   StationRecvProcStatetbl_t  *rcvstatarray;
-   StationRecvProcStatetbl_t  func;
-   int *rcv_state;
-   len=sizeof(from);
-
-   rbytes = recvfrom(sockfd, (char *)psRxMsg, MAX_UDP_LEN, 0, &from, (socklen_t *)&len);
-   if(rbytes < 0)
-   {
-      perror("receive error");
-      return rbytes;
-   }
-
-   sta_test = wmmps_info.sta_test;
-   if(sta_test != L_1)
-   mpx("RX msg",psRxMsg,64);
-   if(psRxMsg[10] == APTS_STOP)
-      PRINTF("\r\n stop recd\n");
-
-   if(psRxMsg[10] == APTS_RESET)
-   {
-      reset_recd=1;
-      WfaStaResetAll();
-      return 0;
-   }
-   //If reset signal is there for the receiving thread and station has sent the
-   //reset message (i.e. !reset_recd) then ignore all the messages till an
-   //APTS_RESET_RESP has been received.
-
-   if(resetrcv)
-   {
-      wmmps_info.rcv_state = 0;
-      if((!reset_recd)&&(psRxMsg[10] != APTS_RESET_RESP))
-         return 0;
-      else
-      {
-         resetrcv = 0;
-         reset_recd = 0;
-      }
-   }
-
-   if(sta_test > LAST_TEST)
-   {
-      // unknown case
-      return 0;
-   }
-
-   sta_test = wmmps_info.sta_test;
-   wmmps_info.my_cookie = psRxMsg[0];
-   rcv_state = &(wmmps_info.rcv_state);
-   rcvstatarray = stationRecvProcStatetbl[sta_test];
-   func = rcvstatarray[*(rcv_state)];
-   func.statefunc(psRxMsg,rbytes,rcv_state);
-
-   return TRUE;
-}
-
-#endif /* WFA_WMM_PS_EXT */
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_wmmps.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wfa_wmmps.h
deleted file mode 100644 (file)
index 95b6b63..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/****************************************************************************
- *  (c) Copyright 2007 Wi-Fi Alliance.  All Rights Reserved
- *
- *
- *  LICENSE
- *
- *  License is granted only to Wi-Fi Alliance members and designated
- *  contractors (\e$B!H\e(BAuthorized Licensees\e$B!I\e(B).\e.A\eN  Authorized Licensees are granted
- *  the non-exclusive, worldwide, limited right to use, copy, import, export
- *  and distribute this software:
- *  (i) solely for noncommercial applications and solely for testing Wi-Fi
- *  equipment; and
- *  (ii) solely for the purpose of embedding the software into Authorized
- *  Licensee\e$B!G\e(Bs proprietary equipment and software products for distribution to
- *  its customers under a license with at least the same restrictions as
- *  contained in this License, including, without limitation, the disclaimer of
- *  warranty and limitation of liability, below.\e.A\eN  The distribution rights
- *  granted in clause
- *  (ii), above, include distribution to third party companies who will
- *  redistribute the Authorized Licensee\e$B!G\e(Bs product to their customers with or
- *  without such third party\e$B!G\e(Bs private label. Other than expressly granted
- *  herein, this License is not transferable or sublicensable, and it does not
- *  extend to and may not be used with non-Wi-Fi applications.\e.A\eN  Wi-Fi Alliance
- *  reserves all rights not expressly granted herein.\e.A\e
- *\e.A\e
- *  Except as specifically set forth above, commercial derivative works of
- *  this software or applications that use the Wi-Fi scripts generated by this
- *  software are NOT AUTHORIZED without specific prior written permission from
- *  Wi-Fi Alliance.
- *\e.A\e
- *  Non-Commercial derivative works of this software for internal use are
- *  authorized and are limited by the same restrictions; provided, however,
- *  that the Authorized Licensee shall provide Wi-Fi Alliance with a copy of
- *  such derivative works under a perpetual, payment-free license to use,
- *  modify, and distribute such derivative works for purposes of testing Wi-Fi
- *  equipment.
- *\e.A\e
- *  Neither the name of the author nor "Wi-Fi Alliance" may be used to endorse
- *  or promote products that are derived from or that use this software without
- *  specific prior written permission from Wi-Fi Alliance.
- *
- *  THIS SOFTWARE IS PROVIDED BY WI-FI ALLIANCE "AS IS" AND ANY EXPRESS OR
- *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- *  OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A\e.A\eN PARTICULAR PURPOSE,
- *  ARE DISCLAIMED. IN NO EVENT SHALL WI-FI ALLIANCE BE LIABLE FOR ANY DIRECT,
- *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *  (INCLUDING, BUT NOT LIMITED TO, THE COST OF 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) ARISING IN ANY WAY OUT OF
- *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************
- */
-
-/*
- * * APTS messages/tests
- * */
-#define B_D            1
-#define        B_H             2       
-#define B_B             3
-#define B_M             4
-#define M_D             5
-#define B_Z             6
-#define M_Y             7
-#define        L_1             8
-#define        A_Y             9               // active mode version of M_Y
-#define        B_W             10              // 
-#define        A_J             11              // Active test of sending 4 down
-#define M_V             12
-#define M_U             13
-#define A_U             14
-#define M_L             15
-#define B_K             16
-#define M_B             17
-#define M_K             18
-#define M_W             19
-#ifdef WFA_WMM_AC
-#define WMMAC_422_T02B            20
-#define WMMAC_422_T03A            21
-#define WMMAC_422_T04B            22
-#define WMMAC_422_T05B            23
-#define WMMAC_422_T06B            24
-#define WMMAC_422_T07B            25
-#define WMMAC_422_T08B            26
-
-#define WMMAC_423_T04             27
-#define WMMAC_424_T07t14          28
-#define WMMAC_425_T04t06          29
-
-#define WMMAC_521_T03             30
-#define WMMAC_521_T05             31
-
-#define WMMAC_522_T04             32
-#define WMMAC_522_T06             33
-#define WMMAC_522_T06o            34
-#define WMMAC_524_T03             35
-#define WMMAC_524_T03i            36
-#define WMMAC_525_T07t10          37
-
-#define LAST_TEST       WMMAC_525_T07t10 
-#else
-#define LAST_TEST       M_W
-#endif
-#define        APTS_DEFAULT    (LAST_TEST + 0x01)              // message codes
-#define        APTS_HELLO      (APTS_DEFAULT + 0x01)
-#define        APTS_BCST       (APTS_HELLO + 0x01)
-#define        APTS_CONFIRM    (APTS_BCST + 0x01)
-#define        APTS_STOP       (APTS_CONFIRM + 0x01)
-#define APTS_CK_BE      (APTS_STOP + 0x01)
-#define APTS_CK_BK      (APTS_CK_BE + 0x01)
-#define APTS_CK_VI      (APTS_CK_BK + 0x01)
-#define APTS_CK_VO      (APTS_CK_VI + 0x01)
-#define APTS_RESET      (APTS_CK_VO + 0x01)
-#define APTS_RESET_RESP (APTS_RESET + 0x01)
-#define APTS_RESET_STOP (APTS_RESET_RESP + 0x01)
-#define APTS_LAST       99
-#define        MAXRETRY        3
-#define        MAXHELLO        20
-#define MAX_STOPS 10
-#define        NTARG   32                  // number of target names
-#define EQ(a,b)     (strcmp(a,b)==0)
-
-#define PORT            12345          // use a common port for sending/receiving
-#define   LII  2000000
-#ifdef WFA_WMM_AC
-/*Listen Inteval for station,to be changed to the actual value*/
-#define   lis_int  500000
-#define   becon_int  100000
-#endif
-#define NTARG           32
-
-#define WFA_DEFAULT_CODEC_SEC         0
-#define WFA_DEFAULT_CODEC_USEC        10000
-
-#define WFA_WMMPS_UDP_PORT            12345        // it must sync with console
-
-/* wmm defs */
-#define TOS_VO7     0xE0                // 111 0  0000 (7)  AC_VO tos/dscp values
-#define TOS_VO      0xD0                // 110 0  0000 (6)  AC_VO tos/dscp values
-//Atheros Madwifi use 0x88 for UPSD/Voice
-//#define TOS_VO      0x88               // 110 0  0000 (6)  AC_VO tos/dscp values
-
-#define TOS_VI      0xA0                // 101 0  0000 (5)  AC_VI
-#define TOS_VI4     0x80                // 100 0  0000 (4)  AC_VI
-
-#define TOS_BE      0x00                // 000 0  0000 (0)  AC_BE
-#define TOS_EE      0x60                // 011 0  0000 (3)  AC_BE
-
-#define TOS_BK      0x20                // 001 0  0000 (1)  AC_BK
-#define TOS_LE      0x40                // 010 0  0000 (2)  AC_BK
-
-
-/*
- * * power management
- * */
-#define PS_ON    1
-#define PS_OFF   0
-#define P_ON    1
-#define P_OFF   0
-
-#if WFA_DEBUG
-#define PRINTF(s,args...) printf(s,## args)
-#else
-#define PRINTF(s,args...) ;
-#endif
-
-/*
- * * internal table
- * */
-struct apts_msg {                       //
-    char *name;                     // name of test
-    int cmd;                        // msg num
-    int param0;                     // number of packet exchanges
-    int param1;                     // number of uplink frames
-    int param2;                     // number of downlink frames
-    int param3;
-};
-
-/*
- * * Wait/Timer states
- * */
-typedef enum {
-    WFA_WAIT_NEXT_CODEC,
-    WFA_WAIT_FOR_AP_RESPONSE,
-    WFA_WAIT_STAUT_00,
-    WFA_WAIT_STAUT_01,
-    WFA_WAIT_STAUT_02,
-    WFA_WAIT_STAUT_03,
-    WFA_WAIT_STAUT_04,
-    WFA_WAIT_STAUT_0E,
-    WFA_WAIT_STAUT_VOLOAD,
-    WFA_WAIT_STAUT_SEQ,
-} WAIT_MODE;
-
-typedef struct wfa_wmmps
-{
-    int my_sta_id;
-    int my_group_cookie;
-    int my_cookie;
-    int thr_flag;
-    int sta_state;
-    int sta_test;
-    int wait_state;
-    int nextsleep;
-    int nsent;
-    int msgno;
-    int ps_thread;
-    int rcv_state;
-    int dscp;
-    int reset;
-    int streamid;
-    tgThrData_t *tdata;
-    struct sockaddr_in psToAddr;
-    pthread_t thr;
-    pthread_cond_t thr_flag_cond;
-    pthread_mutex_t thr_flag_mutex;
-
-}wfaWmmPS_t;
-
-
-
-int WfaStaSndHello(char,int,int *state);
-int WfaStaSndConfirm(char,int,int *state);
-int WfaStaSndVO(char,int,int *state);
-int WfaStaSndVOCyclic(char,int,int *state);
-int WfaStaSnd2VO(char,int,int *state);
-int WfaStaWaitStop(char,int,int *state);
-int WfaStaSndVI(char,int,int *state);
-int WfaStaSndBE(char,int,int *state);
-int WfaStaSndBK(char,int,int *state);
-int WfaStaSndVIE(char,int,int *state);
-//int WfaStaSndVO(char,int,int *state);
-int WfaStaSndBEE(char,int,int *state);
-int WfaStaSnd2VOE(char,int,int *state);
-void create_apts_msg(int msg, unsigned int txbuf[],int id);
-int WfaRcvStop(unsigned int *,int ,int *);
-int WfaRcvVO(unsigned int *,int ,int *);
-int WfaRcvProc(unsigned int *,int ,int *);
-int WfaRcvVOCyclic(unsigned int *,int ,int *);
-int WfaRcvVI(unsigned int *,int ,int *);
-int WfaRcvBE(unsigned int *,int ,int *);
-int WfaRcvBK(unsigned int *,int ,int *);
-int WfaRcvNotCare(unsigned int *,int ,int *);
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wlantest.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wlantest.c
deleted file mode 100644 (file)
index 051e60d..0000000
+++ /dev/null
@@ -1,1118 +0,0 @@
-/*
- * Sigma Control API DUT (wlantest)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-#include <sys/un.h>
-#include "wlantest_ctrl.h"
-
-
-typedef unsigned int u32;
-typedef unsigned char u8;
-
-#define WPA_GET_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \
-                        (((u32) (a)[2]) << 8) | ((u32) (a)[3]))
-#define WPA_PUT_BE32(a, val)                                   \
-       do {                                                    \
-               (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff);   \
-               (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff);   \
-               (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff);    \
-               (a)[3] = (u8) (((u32) (val)) & 0xff);           \
-       } while (0)
-
-#ifndef ETH_ALEN
-#define ETH_ALEN 6
-#endif
-
-int hwaddr_aton(const char *txt, unsigned char *addr);
-
-
-static u8 * attr_get(u8 *buf, size_t buflen, enum wlantest_ctrl_attr attr,
-                    size_t *len)
-{
-       u8 *pos = buf;
-
-       while (pos + 8 <= buf + buflen) {
-               enum wlantest_ctrl_attr a;
-               size_t alen;
-               a = WPA_GET_BE32(pos);
-               pos += 4;
-               alen = WPA_GET_BE32(pos);
-               pos += 4;
-               if (pos + alen > buf + buflen)
-                       return NULL;
-               if (a == attr) {
-                       *len = alen;
-                       return pos;
-               }
-               pos += alen;
-       }
-
-       return NULL;
-}
-
-
-static u8 * attr_hdr_add(u8 *pos, u8 *end, enum wlantest_ctrl_attr attr,
-                        size_t len)
-{
-       if (pos == NULL || end - pos < 8 + len)
-               return NULL;
-       WPA_PUT_BE32(pos, attr);
-       pos += 4;
-       WPA_PUT_BE32(pos, len);
-       pos += 4;
-       return pos;
-}
-
-
-static u8 * attr_add_str(u8 *pos, u8 *end, enum wlantest_ctrl_attr attr,
-                        const char *str)
-{
-       size_t len = strlen(str);
-
-       if (pos == NULL || end - pos < 8 + len)
-               return NULL;
-       WPA_PUT_BE32(pos, attr);
-       pos += 4;
-       WPA_PUT_BE32(pos, len);
-       pos += 4;
-       memcpy(pos, str, len);
-       pos += len;
-       return pos;
-}
-
-
-static u8 * attr_add_be32(u8 *pos, u8 *end, enum wlantest_ctrl_attr attr,
-                         u32 val)
-{
-       if (pos == NULL || end - pos < 12)
-               return NULL;
-       WPA_PUT_BE32(pos, attr);
-       pos += 4;
-       WPA_PUT_BE32(pos, 4);
-       pos += 4;
-       WPA_PUT_BE32(pos, val);
-       pos += 4;
-       return pos;
-}
-
-
-static int open_wlantest(void)
-{
-       int s;
-       struct sockaddr_un addr;
-
-       s = socket(AF_UNIX, SOCK_SEQPACKET, 0);
-       if (s < 0) {
-               perror("socket");
-               return -1;
-       }
-
-       memset(&addr, 0, sizeof(addr));
-       addr.sun_family = AF_UNIX;
-       strncpy(addr.sun_path + 1, WLANTEST_SOCK_NAME,
-               sizeof(addr.sun_path) - 1);
-       if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
-               perror("connect");
-               close(s);
-               return -1;
-       }
-
-       return s;
-}
-
-
-static int cmd_send_and_recv(int s, const u8 *cmd, size_t cmd_len,
-                            u8 *resp, size_t max_resp_len)
-{
-       int res;
-       enum wlantest_ctrl_cmd cmd_resp;
-
-       if (send(s, cmd, cmd_len, 0) < 0)
-               return -1;
-       res = recv(s, resp, max_resp_len, 0);
-       if (res < 4)
-               return -1;
-
-       cmd_resp = WPA_GET_BE32(resp);
-       if (cmd_resp == WLANTEST_CTRL_SUCCESS)
-               return res;
-
-       return -1;
-}
-
-
-static int cmd_simple(int s, enum wlantest_ctrl_cmd cmd)
-{
-       u8 buf[4];
-       int res;
-       WPA_PUT_BE32(buf, cmd);
-       res = cmd_send_and_recv(s, buf, sizeof(buf), buf, sizeof(buf));
-       return res < 0 ? -1 : 0;
-}
-
-
-static int run_wlantest_simple(struct sigma_dut *dut, struct sigma_conn *conn,
-                              enum wlantest_ctrl_cmd cmd)
-{
-       int s, ret;
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-
-       ret = cmd_simple(s, cmd);
-       close(s);
-
-       return ret < 0 ? -2 : 1;
-}
-
-
-static int cmd_wlantest_version(struct sigma_dut *dut, struct sigma_conn *conn,
-                               struct sigma_cmd *cmd)
-{
-       int s;
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[4];
-       char *version;
-       size_t len;
-       int rlen;
-       char *rbuf;
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-
-       WPA_PUT_BE32(buf, WLANTEST_CTRL_VERSION);
-       rlen = cmd_send_and_recv(s, buf, sizeof(buf), resp, sizeof(resp));
-       close(s);
-       if (rlen < 0)
-               return -2;
-
-       version = (char *) attr_get(resp + 4, rlen - 4, WLANTEST_ATTR_VERSION,
-                                   &len);
-       if (version == NULL)
-               return -2;
-
-       rbuf = malloc(9 + len);
-       if (rbuf == NULL)
-               return -2;
-       memcpy(rbuf, "version,", 8);
-       memcpy(rbuf + 8, version, len);
-       rbuf[8 + len] = '\0';
-       send_resp(dut, conn, SIGMA_COMPLETE, rbuf);
-       free(rbuf);
-       return 0;
-}
-
-
-static int cmd_wlantest_set_channel(struct sigma_dut *dut,
-                                   struct sigma_conn *conn,
-                                   struct sigma_cmd *cmd)
-{
-       char buf[100];
-       const char *chan;
-
-       if (dut->sniffer_ifname == NULL) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Sniffer "
-                         "interface not available");
-               return 0;
-       }
-
-       chan = get_param(cmd, "channel");
-       if (chan == NULL)
-               return -1;
-
-       snprintf(buf, sizeof(buf), "iw dev %s set type monitor",
-                dut->sniffer_ifname);
-       if (system(buf) != 0) {
-               snprintf(buf, sizeof(buf), "ifconfig %s down",
-                        dut->sniffer_ifname);
-               if (system(buf) != 0) {
-                       sigma_dut_print( DUT_MSG_INFO,
-                                       "Failed to run '%s'", buf);
-                       return -2;
-               }
-
-               snprintf(buf, sizeof(buf), "iw dev %s set type monitor",
-                        dut->sniffer_ifname);
-               if (system(buf) != 0) {
-                       sigma_dut_print( DUT_MSG_INFO,
-                                       "Failed to run '%s'", buf);
-                       return -2;
-               }
-       }
-
-       snprintf(buf, sizeof(buf), "iw %s set channel %d HT20",
-                dut->sniffer_ifname, atoi(chan));
-       if (system(buf) != 0) {
-               sigma_dut_print( DUT_MSG_INFO, "Failed to run '%s'", buf);
-               return -2;
-       }
-
-       snprintf(buf, sizeof(buf), "ifconfig %s up", dut->sniffer_ifname);
-       if (system(buf) != 0) {
-               sigma_dut_print( DUT_MSG_INFO, "Failed to run '%s'", buf);
-               return -2;
-       }
-
-       return 1;
-}
-
-
-static int cmd_wlantest_flush(struct sigma_dut *dut, struct sigma_conn *conn,
-                             struct sigma_cmd *cmd)
-{
-       return run_wlantest_simple(dut, conn, WLANTEST_CTRL_FLUSH);
-}
-
-
-static int cmd_wlantest_send_frame(struct sigma_dut *dut,
-                                  struct sigma_conn *conn,
-                                  struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       enum wlantest_inject_frame frame;
-       enum wlantest_inject_protection prot;
-       const char *val;
-       int s;
-
-       /* wlantest_send_frame,PMFFrameType,disassoc,PMFProtected,Unprotected,sender,AP,bssid,00:11:22:33:44:55,stationID,00:66:77:88:99:aa */
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_INJECT);
-       pos += 4;
-
-       val = get_param(cmd, "Type");
-       if (val == NULL)
-               val = get_param(cmd, "PMFFrameType");
-       if (val == NULL)
-               return -1;
-       if (strcasecmp(val, "disassoc") == 0)
-               frame = WLANTEST_FRAME_DISASSOC;
-       else if (strcasecmp(val, "deauth") == 0)
-               frame = WLANTEST_FRAME_DEAUTH;
-       else if (strcasecmp(val, "saquery") == 0)
-               frame = WLANTEST_FRAME_SAQUERYREQ;
-       else if (strcasecmp(val, "auth") == 0)
-               frame = WLANTEST_FRAME_AUTH;
-       else if (strcasecmp(val, "assocreq") == 0)
-               frame = WLANTEST_FRAME_ASSOCREQ;
-       else if (strcasecmp(val, "reassocreq") == 0)
-               frame = WLANTEST_FRAME_REASSOCREQ;
-       else {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Unsupported "
-                         "PMFFrameType");
-               return 0;
-       }
-       pos = attr_add_be32(pos, end, WLANTEST_ATTR_INJECT_FRAME, frame);
-
-       val = get_param(cmd, "Protected");
-       if (val == NULL)
-               val = get_param(cmd, "PMFProtected");
-       if (val == NULL)
-               return -1;
-       if (strcasecmp(val, "CorrectKey") == 0)
-               prot = WLANTEST_INJECT_PROTECTED;
-       else if (strcasecmp(val, "IncorrectKey") == 0)
-               prot = WLANTEST_INJECT_INCORRECT_KEY;
-       else if (strcasecmp(val, "Unprotected") == 0)
-               prot = WLANTEST_INJECT_UNPROTECTED;
-       else {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Unsupported "
-                         "PMFProtected");
-               return 0;
-       }
-       pos = attr_add_be32(pos, end, WLANTEST_ATTR_INJECT_PROTECTION, prot);
-
-       val = get_param(cmd, "sender");
-       if (val == NULL)
-               return -1;
-       if (strcasecmp(val, "ap") == 0) {
-               pos = attr_add_be32(pos, end, WLANTEST_ATTR_INJECT_SENDER_AP,
-                                   1);
-       } else if (strcasecmp(val, "sta") == 0) {
-               pos = attr_add_be32(pos, end, WLANTEST_ATTR_INJECT_SENDER_AP,
-                                   0);
-       } else {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,Unsupported "
-                         "sender");
-               return 0;
-       }
-
-       val = get_param(cmd, "bssid");
-       if (val == NULL)
-               return -1;
-       pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-       if (hwaddr_aton(val, pos) < 0) {
-               send_resp(dut, conn, SIGMA_INVALID, "errorCode,Invalid bssid");
-               return 0;
-       }
-       pos += ETH_ALEN;
-
-       val = get_param(cmd, "stationID");
-       if (val == NULL)
-               return -1;
-       pos = attr_hdr_add(pos, end, WLANTEST_ATTR_STA_ADDR, ETH_ALEN);
-       if (hwaddr_aton(val, pos) < 0) {
-               send_resp(dut, conn, SIGMA_INVALID,
-                         "errorCode,Invalid stationID");
-               return 0;
-       }
-       pos += ETH_ALEN;
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-       if (rlen < 0)
-               return -2;
-       return 1;
-}
-
-
-static int cmd_wlantest_add_passphrase(struct sigma_dut *dut,
-                                      struct sigma_conn *conn,
-                                      struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       const char *val;
-       int s;
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_ADD_PASSPHRASE);
-       pos += 4;
-
-       val = get_param(cmd, "passphrase");
-       if (val) {
-               if (strlen(val) < 8 || strlen(val) > 63)
-                       return -1;
-               pos = attr_add_str(pos, end, WLANTEST_ATTR_PASSPHRASE, val);
-       } else {
-               val = get_param(cmd, "wepkey");
-               if (!val)
-                       return -1;
-               pos = attr_add_str(pos, end, WLANTEST_ATTR_WEPKEY, val);
-       }
-       val = get_param(cmd, "bssid");
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid bssid");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-       if (rlen < 0)
-               return -2;
-       return 1;
-}
-
-
-static int cmd_wlantest_clear_sta_counters(struct sigma_dut *dut,
-                                          struct sigma_conn *conn,
-                                          struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       const char *val;
-       int s;
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_CLEAR_STA_COUNTERS);
-       pos += 4;
-
-       val = get_param(cmd, "bssid");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid bssid");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "stationID");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_STA_ADDR, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid stationID");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-       if (rlen < 0)
-               return -2;
-       return 1;
-}
-
-
-static int cmd_wlantest_clear_bss_counters(struct sigma_dut *dut,
-                                          struct sigma_conn *conn,
-                                          struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       const char *val;
-       int s;
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_CLEAR_BSS_COUNTERS);
-       pos += 4;
-
-       val = get_param(cmd, "bssid");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid bssid");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-       if (rlen < 0)
-               return -2;
-       return 1;
-}
-
-
-static int cmd_wlantest_clear_tdls_counters(struct sigma_dut *dut,
-                                           struct sigma_conn *conn,
-                                           struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       const char *val;
-       int s;
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_CLEAR_TDLS_COUNTERS);
-       pos += 4;
-
-       val = get_param(cmd, "bssid");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid bssid");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "stationID");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_STA_ADDR, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid stationID");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "stationID2");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_STA2_ADDR,
-                                  ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid stationID2");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-       if (rlen < 0)
-               return -2;
-       return 1;
-}
-
-
-struct sta_counters {
-       const char *name;
-       enum wlantest_sta_counter num;
-};
-
-static const struct sta_counters sta_counters[] = {
-       { "auth_tx", WLANTEST_STA_COUNTER_AUTH_TX },
-       { "auth_rx", WLANTEST_STA_COUNTER_AUTH_RX },
-       { "assocreq_tx", WLANTEST_STA_COUNTER_ASSOCREQ_TX },
-       { "reassocreq_tx", WLANTEST_STA_COUNTER_REASSOCREQ_TX },
-       { "ptk_learned", WLANTEST_STA_COUNTER_PTK_LEARNED },
-       { "valid_deauth_tx", WLANTEST_STA_COUNTER_VALID_DEAUTH_TX },
-       { "valid_deauth_rx", WLANTEST_STA_COUNTER_VALID_DEAUTH_RX },
-       { "invalid_deauth_tx", WLANTEST_STA_COUNTER_INVALID_DEAUTH_TX },
-       { "invalid_deauth_rx", WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX },
-       { "valid_disassoc_tx", WLANTEST_STA_COUNTER_VALID_DISASSOC_TX },
-       { "valid_disassoc_rx", WLANTEST_STA_COUNTER_VALID_DISASSOC_RX },
-       { "invalid_disassoc_tx", WLANTEST_STA_COUNTER_INVALID_DISASSOC_TX },
-       { "invalid_disassoc_rx", WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX },
-       { "valid_saqueryreq_tx", WLANTEST_STA_COUNTER_VALID_SAQUERYREQ_TX },
-       { "valid_saqueryreq_rx", WLANTEST_STA_COUNTER_VALID_SAQUERYREQ_RX },
-       { "invalid_saqueryreq_tx",
-         WLANTEST_STA_COUNTER_INVALID_SAQUERYREQ_TX },
-       { "invalid_saqueryreq_rx",
-         WLANTEST_STA_COUNTER_INVALID_SAQUERYREQ_RX },
-       { "valid_saqueryresp_tx", WLANTEST_STA_COUNTER_VALID_SAQUERYRESP_TX },
-       { "valid_saqueryresp_rx", WLANTEST_STA_COUNTER_VALID_SAQUERYRESP_RX },
-       { "invalid_saqueryresp_tx",
-         WLANTEST_STA_COUNTER_INVALID_SAQUERYRESP_TX },
-       { "invalid_saqueryresp_rx",
-         WLANTEST_STA_COUNTER_INVALID_SAQUERYRESP_RX },
-       { "ping_ok", WLANTEST_STA_COUNTER_PING_OK },
-       { "assocresp_comeback", WLANTEST_STA_COUNTER_ASSOCRESP_COMEBACK },
-       { "reassocresp_comeback", WLANTEST_STA_COUNTER_REASSOCRESP_COMEBACK },
-       { "ping_ok_first_assoc", WLANTEST_STA_COUNTER_PING_OK_FIRST_ASSOC },
-       { "valid_deauth_rx_ack", WLANTEST_STA_COUNTER_VALID_DEAUTH_RX_ACK },
-       { "valid_disassoc_rx_ack",
-         WLANTEST_STA_COUNTER_VALID_DISASSOC_RX_ACK },
-       { "invalid_deauth_rx_ack",
-         WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX_ACK },
-       { "invalid_disassoc_rx_ack",
-         WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX_ACK },
-       { "deauth_rx_asleep", WLANTEST_STA_COUNTER_DEAUTH_RX_ASLEEP },
-       { "deauth_rx_awake", WLANTEST_STA_COUNTER_DEAUTH_RX_AWAKE },
-       { "disassoc_rx_asleep", WLANTEST_STA_COUNTER_DISASSOC_RX_ASLEEP },
-       { "disassoc_rx_awake", WLANTEST_STA_COUNTER_DISASSOC_RX_AWAKE },
-       { "prot_data_tx", WLANTEST_STA_COUNTER_PROT_DATA_TX },
-       { NULL, 0 }
-};
-
-static int cmd_wlantest_get_sta_counter(struct sigma_dut *dut,
-                                       struct sigma_conn *conn,
-                                       struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       const char *val;
-       int s, i;
-       char ret[100];
-       size_t len;
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_GET_STA_COUNTER);
-       pos += 4;
-
-       val = get_param(cmd, "bssid");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid bssid");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "stationID");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_STA_ADDR, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid stationID");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "field");
-       if (val == NULL)
-               return -1;
-       for (i = 0; sta_counters[i].name; i++) {
-               if (strcasecmp(sta_counters[i].name, val) == 0)
-                       break;
-       }
-       if (sta_counters[i].name == NULL) {
-               send_resp(dut, conn, SIGMA_INVALID, "errorCode,Invalid field");
-               return 0;
-       }
-       pos = attr_add_be32(pos, end, WLANTEST_ATTR_STA_COUNTER,
-                           sta_counters[i].num);
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-
-
-       pos = attr_get(resp + 4, rlen - 4, WLANTEST_ATTR_COUNTER, &len);
-       if (pos == NULL || len != 4)
-               return -2;
-       snprintf(ret, sizeof(ret), "counter,%u", WPA_GET_BE32(pos));
-       send_resp(dut, conn, SIGMA_COMPLETE, ret);
-       return 0;
-}
-
-
-struct bss_counters {
-       const char *name;
-       enum wlantest_bss_counter num;
-};
-
-static const struct bss_counters bss_counters[] = {
-       { "valid_bip_mmie", WLANTEST_BSS_COUNTER_VALID_BIP_MMIE },
-       { "invalid_bip_mmie", WLANTEST_BSS_COUNTER_INVALID_BIP_MMIE },
-       { "missing_bip_mmie", WLANTEST_BSS_COUNTER_MISSING_BIP_MMIE },
-       { "bip_deauth", WLANTEST_BSS_COUNTER_BIP_DEAUTH },
-       { "bip_disassoc", WLANTEST_BSS_COUNTER_BIP_DISASSOC },
-       { NULL, 0 }
-};
-
-static int cmd_wlantest_get_bss_counter(struct sigma_dut *dut,
-                                       struct sigma_conn *conn,
-                                       struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       const char *val;
-       int s, i;
-       char ret[100];
-       size_t len;
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_GET_BSS_COUNTER);
-       pos += 4;
-
-       val = get_param(cmd, "bssid");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid bssid");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "field");
-       if (val == NULL)
-               return -1;
-       for (i = 0; bss_counters[i].name; i++) {
-               if (strcasecmp(bss_counters[i].name, val) == 0)
-                       break;
-       }
-       if (bss_counters[i].name == NULL) {
-               send_resp(dut, conn, SIGMA_INVALID, "errorCode,Invalid field");
-               return 0;
-       }
-       pos = attr_add_be32(pos, end, WLANTEST_ATTR_BSS_COUNTER,
-                           bss_counters[i].num);
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-
-       pos = attr_get(resp + 4, rlen - 4, WLANTEST_ATTR_COUNTER, &len);
-       if (pos == NULL || len != 4)
-               return -2;
-       snprintf(ret, sizeof(ret), "counter,%u", WPA_GET_BE32(pos));
-       send_resp(dut, conn, SIGMA_COMPLETE, ret);
-       return 0;
-}
-
-
-struct tdls_counters {
-       const char *name;
-       enum wlantest_tdls_counter num;
-};
-
-static const struct tdls_counters tdls_counters[] = {
-       { "valid_direct_link", WLANTEST_TDLS_COUNTER_VALID_DIRECT_LINK },
-       { "invalid_direct_link", WLANTEST_TDLS_COUNTER_INVALID_DIRECT_LINK },
-       { "valid_ap_path", WLANTEST_TDLS_COUNTER_VALID_AP_PATH },
-       { "invalid_ap_path", WLANTEST_TDLS_COUNTER_INVALID_AP_PATH },
-       { "setup_req", WLANTEST_TDLS_COUNTER_SETUP_REQ },
-       { "setup_resp_ok", WLANTEST_TDLS_COUNTER_SETUP_RESP_OK },
-       { "setup_resp_fail", WLANTEST_TDLS_COUNTER_SETUP_RESP_FAIL },
-       { "setup_conf_ok", WLANTEST_TDLS_COUNTER_SETUP_CONF_OK },
-       { "setup_conf_fail", WLANTEST_TDLS_COUNTER_SETUP_CONF_FAIL },
-       { "teardown", WLANTEST_TDLS_COUNTER_TEARDOWN },
-       { NULL, 0 }
-};
-
-static int cmd_wlantest_get_tdls_counter(struct sigma_dut *dut,
-                                        struct sigma_conn *conn,
-                                        struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       const char *val;
-       int s, i;
-       char ret[100];
-       size_t len;
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_GET_TDLS_COUNTER);
-       pos += 4;
-
-       val = get_param(cmd, "bssid");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid bssid");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "stationID");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_STA_ADDR, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid stationID");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "stationID2");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_STA2_ADDR,
-                                  ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid stationID");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "field");
-       if (val == NULL)
-               return -1;
-       for (i = 0; tdls_counters[i].name; i++) {
-               if (strcasecmp(tdls_counters[i].name, val) == 0)
-                       break;
-       }
-       if (tdls_counters[i].name == NULL) {
-               send_resp(dut, conn, SIGMA_INVALID, "errorCode,Invalid field");
-               return 0;
-       }
-       pos = attr_add_be32(pos, end, WLANTEST_ATTR_TDLS_COUNTER,
-                           tdls_counters[i].num);
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-
-
-       pos = attr_get(resp + 4, rlen - 4, WLANTEST_ATTR_COUNTER, &len);
-       if (pos == NULL || len != 4)
-               return -2;
-       snprintf(ret, sizeof(ret), "counter,%u", WPA_GET_BE32(pos));
-       send_resp(dut, conn, SIGMA_COMPLETE, ret);
-       return 0;
-}
-
-
-struct sta_infos {
-       const char *name;
-       enum wlantest_sta_info num;
-};
-
-static const struct sta_infos sta_infos[] = {
-       { "proto", WLANTEST_STA_INFO_PROTO },
-       { "pairwise", WLANTEST_STA_INFO_PAIRWISE },
-       { "key_mgmt", WLANTEST_STA_INFO_KEY_MGMT },
-       { "rsn_capab", WLANTEST_STA_INFO_RSN_CAPAB },
-       { "state", WLANTEST_STA_INFO_STATE },
-       { NULL, 0 }
-};
-
-static int cmd_wlantest_info_sta(struct sigma_dut *dut,
-                                struct sigma_conn *conn,
-                                struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       const char *val;
-       int s, i;
-       char ret[120];
-       size_t len;
-       char info[100];
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_INFO_STA);
-       pos += 4;
-
-       val = get_param(cmd, "bssid");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid bssid");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "stationID");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_STA_ADDR, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid stationID");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "field");
-       if (val == NULL)
-               return -1;
-       for (i = 0; sta_infos[i].name; i++) {
-               if (strcasecmp(sta_infos[i].name, val) == 0)
-                       break;
-       }
-       if (sta_infos[i].name == NULL) {
-               send_resp(dut, conn, SIGMA_INVALID, "errorCode,Invalid field");
-               return 0;
-       }
-       pos = attr_add_be32(pos, end, WLANTEST_ATTR_STA_INFO,
-                           sta_infos[i].num);
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-
-
-       pos = attr_get(resp + 4, rlen - 4, WLANTEST_ATTR_INFO, &len);
-       if (pos == NULL)
-               return -2;
-       if (len >= sizeof(info))
-               len = sizeof(info) - 1;
-       memcpy(info, pos, len);
-       info[len] = '\0';
-       snprintf(ret, sizeof(ret), "info,%s", info);
-       send_resp(dut, conn, SIGMA_COMPLETE, ret);
-       return 0;
-}
-
-
-struct bss_infos {
-       const char *name;
-       enum wlantest_bss_info num;
-};
-
-static const struct bss_infos bss_infos[] = {
-       { "proto", WLANTEST_BSS_INFO_PROTO },
-       { "pairwise", WLANTEST_BSS_INFO_PAIRWISE },
-       { "group", WLANTEST_BSS_INFO_GROUP },
-       { "group_mgmt", WLANTEST_BSS_INFO_GROUP_MGMT },
-       { "key_mgmt", WLANTEST_BSS_INFO_KEY_MGMT },
-       { "rsn_capab", WLANTEST_BSS_INFO_RSN_CAPAB },
-       { NULL, 0 }
-};
-
-static int cmd_wlantest_info_bss(struct sigma_dut *dut,
-                                struct sigma_conn *conn,
-                                struct sigma_cmd *cmd)
-{
-       u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
-       u8 buf[100], *end, *pos;
-       int rlen;
-       const char *val;
-       int s, i;
-       char ret[120];
-       size_t len;
-       char info[100];
-
-       pos = buf;
-       end = buf + sizeof(buf);
-       WPA_PUT_BE32(pos, WLANTEST_CTRL_INFO_BSS);
-       pos += 4;
-
-       val = get_param(cmd, "bssid");
-       if (val == NULL)
-               return -1;
-       if (val) {
-               pos = attr_hdr_add(pos, end, WLANTEST_ATTR_BSSID, ETH_ALEN);
-               if (hwaddr_aton(val, pos) < 0) {
-                       send_resp(dut, conn, SIGMA_INVALID,
-                                 "errorCode,Invalid bssid");
-                       return 0;
-               }
-               pos += ETH_ALEN;
-       }
-
-       val = get_param(cmd, "field");
-       if (val == NULL)
-               return -1;
-       for (i = 0; bss_infos[i].name; i++) {
-               if (strcasecmp(bss_infos[i].name, val) == 0)
-                       break;
-       }
-       if (bss_infos[i].name == NULL) {
-               send_resp(dut, conn, SIGMA_INVALID, "errorCode,Invalid field");
-               return 0;
-       }
-       pos = attr_add_be32(pos, end, WLANTEST_ATTR_BSS_INFO,
-                           bss_infos[i].num);
-
-       s = open_wlantest();
-       if (s < 0) {
-               send_resp(dut, conn, SIGMA_ERROR, "errorCode,wlantest not "
-                         "available");
-               return 0;
-       }
-       rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
-       close(s);
-
-
-       pos = attr_get(resp + 4, rlen - 4, WLANTEST_ATTR_INFO, &len);
-       if (pos == NULL)
-               return -2;
-       if (len >= sizeof(info))
-               len = sizeof(info) - 1;
-       memcpy(info, pos, len);
-       info[len] = '\0';
-       snprintf(ret, sizeof(ret), "info,%s", info);
-       send_resp(dut, conn, SIGMA_COMPLETE, ret);
-       return 0;
-}
-
-
-void wlantest_register_cmds(void)
-{
-       sigma_dut_reg_cmd("wlantest_version", NULL, cmd_wlantest_version);
-       sigma_dut_reg_cmd("wlantest_set_channel", NULL,
-                         cmd_wlantest_set_channel);
-       sigma_dut_reg_cmd("wlantest_flush", NULL, cmd_wlantest_flush);
-       sigma_dut_reg_cmd("wlantest_send_frame", NULL,
-                         cmd_wlantest_send_frame);
-       sigma_dut_reg_cmd("wlantest_add_passphrase", NULL,
-                         cmd_wlantest_add_passphrase);
-       sigma_dut_reg_cmd("wlantest_clear_sta_counters", NULL,
-                         cmd_wlantest_clear_sta_counters);
-       sigma_dut_reg_cmd("wlantest_clear_bss_counters", NULL,
-                         cmd_wlantest_clear_bss_counters);
-       sigma_dut_reg_cmd("wlantest_clear_tdls_counters", NULL,
-                         cmd_wlantest_clear_tdls_counters);
-       sigma_dut_reg_cmd("wlantest_get_sta_counter", NULL,
-                         cmd_wlantest_get_sta_counter);
-       sigma_dut_reg_cmd("wlantest_get_bss_counter", NULL,
-                         cmd_wlantest_get_bss_counter);
-       sigma_dut_reg_cmd("wlantest_get_tdls_counter", NULL,
-                         cmd_wlantest_get_tdls_counter);
-       sigma_dut_reg_cmd("wlantest_info_sta", NULL, cmd_wlantest_info_sta);
-       sigma_dut_reg_cmd("wlantest_info_bss", NULL, cmd_wlantest_info_bss);
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wlantest_ctrl.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wlantest_ctrl.h
deleted file mode 100644 (file)
index 91f5af6..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * wlantest control interface
- * Copyright (c) 2010, Jouni Malinen <j@w1.fi>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
- */
-
-#ifndef WLANTEST_CTRL_H
-#define WLANTEST_CTRL_H
-
-#define WLANTEST_SOCK_NAME "w1.fi.wlantest"
-#define WLANTEST_CTRL_MAX_CMD_LEN 1000
-#define WLANTEST_CTRL_MAX_RESP_LEN 1000
-
-enum wlantest_ctrl_cmd {
-       WLANTEST_CTRL_SUCCESS,
-       WLANTEST_CTRL_FAILURE,
-       WLANTEST_CTRL_INVALID_CMD,
-       WLANTEST_CTRL_UNKNOWN_CMD,
-       WLANTEST_CTRL_PING,
-       WLANTEST_CTRL_TERMINATE,
-       WLANTEST_CTRL_LIST_BSS,
-       WLANTEST_CTRL_LIST_STA,
-       WLANTEST_CTRL_FLUSH,
-       WLANTEST_CTRL_CLEAR_STA_COUNTERS,
-       WLANTEST_CTRL_CLEAR_BSS_COUNTERS,
-       WLANTEST_CTRL_GET_STA_COUNTER,
-       WLANTEST_CTRL_GET_BSS_COUNTER,
-       WLANTEST_CTRL_INJECT,
-       WLANTEST_CTRL_VERSION,
-       WLANTEST_CTRL_ADD_PASSPHRASE,
-       WLANTEST_CTRL_INFO_STA,
-       WLANTEST_CTRL_INFO_BSS,
-       WLANTEST_CTRL_SEND,
-       WLANTEST_CTRL_CLEAR_TDLS_COUNTERS,
-       WLANTEST_CTRL_GET_TDLS_COUNTER,
-};
-
-enum wlantest_ctrl_attr {
-       WLANTEST_ATTR_BSSID,
-       WLANTEST_ATTR_STA_ADDR,
-       WLANTEST_ATTR_STA_COUNTER,
-       WLANTEST_ATTR_BSS_COUNTER,
-       WLANTEST_ATTR_COUNTER,
-       WLANTEST_ATTR_INJECT_FRAME,
-       WLANTEST_ATTR_INJECT_SENDER_AP,
-       WLANTEST_ATTR_INJECT_PROTECTION,
-       WLANTEST_ATTR_VERSION,
-       WLANTEST_ATTR_PASSPHRASE,
-       WLANTEST_ATTR_STA_INFO,
-       WLANTEST_ATTR_BSS_INFO,
-       WLANTEST_ATTR_INFO,
-       WLANTEST_ATTR_FRAME,
-       WLANTEST_ATTR_TDLS_COUNTER,
-       WLANTEST_ATTR_STA2_ADDR,
-       WLANTEST_ATTR_WEPKEY,
-};
-
-enum wlantest_bss_counter {
-       WLANTEST_BSS_COUNTER_VALID_BIP_MMIE,
-       WLANTEST_BSS_COUNTER_INVALID_BIP_MMIE,
-       WLANTEST_BSS_COUNTER_MISSING_BIP_MMIE,
-       WLANTEST_BSS_COUNTER_BIP_DEAUTH,
-       WLANTEST_BSS_COUNTER_BIP_DISASSOC,
-       NUM_WLANTEST_BSS_COUNTER
-};
-
-enum wlantest_sta_counter {
-       WLANTEST_STA_COUNTER_AUTH_TX,
-       WLANTEST_STA_COUNTER_AUTH_RX,
-       WLANTEST_STA_COUNTER_ASSOCREQ_TX,
-       WLANTEST_STA_COUNTER_REASSOCREQ_TX,
-       WLANTEST_STA_COUNTER_PTK_LEARNED,
-       WLANTEST_STA_COUNTER_VALID_DEAUTH_TX,
-       WLANTEST_STA_COUNTER_VALID_DEAUTH_RX,
-       WLANTEST_STA_COUNTER_INVALID_DEAUTH_TX,
-       WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX,
-       WLANTEST_STA_COUNTER_VALID_DISASSOC_TX,
-       WLANTEST_STA_COUNTER_VALID_DISASSOC_RX,
-       WLANTEST_STA_COUNTER_INVALID_DISASSOC_TX,
-       WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX,
-       WLANTEST_STA_COUNTER_VALID_SAQUERYREQ_TX,
-       WLANTEST_STA_COUNTER_VALID_SAQUERYREQ_RX,
-       WLANTEST_STA_COUNTER_INVALID_SAQUERYREQ_TX,
-       WLANTEST_STA_COUNTER_INVALID_SAQUERYREQ_RX,
-       WLANTEST_STA_COUNTER_VALID_SAQUERYRESP_TX,
-       WLANTEST_STA_COUNTER_VALID_SAQUERYRESP_RX,
-       WLANTEST_STA_COUNTER_INVALID_SAQUERYRESP_TX,
-       WLANTEST_STA_COUNTER_INVALID_SAQUERYRESP_RX,
-       WLANTEST_STA_COUNTER_PING_OK,
-       WLANTEST_STA_COUNTER_ASSOCRESP_COMEBACK,
-       WLANTEST_STA_COUNTER_REASSOCRESP_COMEBACK,
-       WLANTEST_STA_COUNTER_PING_OK_FIRST_ASSOC,
-       WLANTEST_STA_COUNTER_VALID_DEAUTH_RX_ACK,
-       WLANTEST_STA_COUNTER_VALID_DISASSOC_RX_ACK,
-       WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX_ACK,
-       WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX_ACK,
-       WLANTEST_STA_COUNTER_DEAUTH_RX_ASLEEP,
-       WLANTEST_STA_COUNTER_DEAUTH_RX_AWAKE,
-       WLANTEST_STA_COUNTER_DISASSOC_RX_ASLEEP,
-       WLANTEST_STA_COUNTER_DISASSOC_RX_AWAKE,
-       WLANTEST_STA_COUNTER_PROT_DATA_TX,
-       NUM_WLANTEST_STA_COUNTER
-};
-
-enum wlantest_tdls_counter {
-       WLANTEST_TDLS_COUNTER_VALID_DIRECT_LINK,
-       WLANTEST_TDLS_COUNTER_INVALID_DIRECT_LINK,
-       WLANTEST_TDLS_COUNTER_VALID_AP_PATH,
-       WLANTEST_TDLS_COUNTER_INVALID_AP_PATH,
-       WLANTEST_TDLS_COUNTER_SETUP_REQ,
-       WLANTEST_TDLS_COUNTER_SETUP_RESP_OK,
-       WLANTEST_TDLS_COUNTER_SETUP_RESP_FAIL,
-       WLANTEST_TDLS_COUNTER_SETUP_CONF_OK,
-       WLANTEST_TDLS_COUNTER_SETUP_CONF_FAIL,
-       WLANTEST_TDLS_COUNTER_TEARDOWN,
-       NUM_WLANTEST_TDLS_COUNTER
-};
-
-enum wlantest_inject_frame {
-       WLANTEST_FRAME_AUTH,
-       WLANTEST_FRAME_ASSOCREQ,
-       WLANTEST_FRAME_REASSOCREQ,
-       WLANTEST_FRAME_DEAUTH,
-       WLANTEST_FRAME_DISASSOC,
-       WLANTEST_FRAME_SAQUERYREQ,
-};
-
-/**
- * enum wlantest_inject_protection - WLANTEST_CTRL_INJECT protection
- * @WLANTEST_INJECT_NORMAL: Use normal rules (protect if key is set)
- * @WLANTEST_INJECT_PROTECTED: Force protection (fail if not possible)
- * @WLANTEST_INJECT_UNPROTECTED: Force unprotected
- * @WLANTEST_INJECT_INCORRECT_KEY: Force protection with incorrect key
- */
-enum wlantest_inject_protection {
-       WLANTEST_INJECT_NORMAL,
-       WLANTEST_INJECT_PROTECTED,
-       WLANTEST_INJECT_UNPROTECTED,
-       WLANTEST_INJECT_INCORRECT_KEY,
-};
-
-enum wlantest_sta_info {
-       WLANTEST_STA_INFO_PROTO,
-       WLANTEST_STA_INFO_PAIRWISE,
-       WLANTEST_STA_INFO_KEY_MGMT,
-       WLANTEST_STA_INFO_RSN_CAPAB,
-       WLANTEST_STA_INFO_STATE,
-};
-
-enum wlantest_bss_info {
-       WLANTEST_BSS_INFO_PROTO,
-       WLANTEST_BSS_INFO_PAIRWISE,
-       WLANTEST_BSS_INFO_GROUP,
-       WLANTEST_BSS_INFO_GROUP_MGMT,
-       WLANTEST_BSS_INFO_KEY_MGMT,
-       WLANTEST_BSS_INFO_RSN_CAPAB,
-};
-
-#endif /* WLANTEST_CTRL_H */
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_ctrl.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_ctrl.c
deleted file mode 100644 (file)
index a743bac..0000000
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * wpa_supplicant/hostapd control interface library
- * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
- */
-
-#include "includes.h"
-
-#if 1   // by bbelief
-#define os_strlcpy strlcpy
-#endif
-
-#ifdef CONFIG_CTRL_IFACE
-
-#ifdef CONFIG_CTRL_IFACE_UNIX
-#include <sys/un.h>
-#endif /* CONFIG_CTRL_IFACE_UNIX */
-
-#ifdef ANDROID
-#include <dirent.h>
-#include <linux/limits.h>
-#include <cutils/sockets.h>
-#include <cutils/memory.h>
-#include "private/android_filesystem_config.h"
-#endif /* ANDROID */
-
-#include "wpa_ctrl.h"
-#include "common.h"
-
-#if defined(CONFIG_CTRL_IFACE_UNIX) || defined(CONFIG_CTRL_IFACE_UDP)
-#define CTRL_IFACE_SOCKET
-#ifdef ANDROID
-static const char *local_socket_dir = "/data/misc/wifi/sockets";
-static const char *local_socket_prefix = "hostapd_ctrl_";
-#endif /* ANDROID */
-#endif /* CONFIG_CTRL_IFACE_UNIX || CONFIG_CTRL_IFACE_UDP */
-
-
-/**
- * struct wpa_ctrl - Internal structure for control interface library
- *
- * This structure is used by the wpa_supplicant/hostapd control interface
- * library to store internal data. Programs using the library should not touch
- * this data directly. They can only use the pointer to the data structure as
- * an identifier for the control interface connection and use this as one of
- * the arguments for most of the control interface library functions.
- */
-struct wpa_ctrl {
-#ifdef CONFIG_CTRL_IFACE_UDP
-       int s;
-       struct sockaddr_in local;
-       struct sockaddr_in dest;
-       char *cookie;
-#endif /* CONFIG_CTRL_IFACE_UDP */
-#ifdef CONFIG_CTRL_IFACE_UNIX
-       int s;
-       struct sockaddr_un local;
-       struct sockaddr_un dest;
-#endif /* CONFIG_CTRL_IFACE_UNIX */
-#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE
-       HANDLE pipe;
-#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
-};
-
-
-#ifdef CONFIG_CTRL_IFACE_UNIX
-
-#ifndef CONFIG_CTRL_IFACE_CLIENT_DIR
-#define CONFIG_CTRL_IFACE_CLIENT_DIR "/tmp"
-#endif /* CONFIG_CTRL_IFACE_CLIENT_DIR */
-#ifndef CONFIG_CTRL_IFACE_CLIENT_PREFIX
-#define CONFIG_CTRL_IFACE_CLIENT_PREFIX "wpa_ctrl_"
-#endif /* CONFIG_CTRL_IFACE_CLIENT_PREFIX */
-
-
-struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
-{
-       struct wpa_ctrl *ctrl;
-       static int counter = 0;
-       int ret;
-       size_t res;
-       int tries = 0;
-
-       ctrl = os_malloc(sizeof(*ctrl));
-       if (ctrl == NULL)
-               return NULL;
-       os_memset(ctrl, 0, sizeof(*ctrl));
-
-       ctrl->s = socket(PF_UNIX, SOCK_DGRAM, 0);
-       if (ctrl->s < 0) {
-               os_free(ctrl);
-               return NULL;
-       }
-
-       ctrl->local.sun_family = AF_UNIX;
-       counter++;
-try_again:
-       ret = os_snprintf(ctrl->local.sun_path, sizeof(ctrl->local.sun_path),
-#ifdef ANDROID
-                   "%s/%s%d-%d", local_socket_dir, local_socket_prefix,
-             getpid(), counter);
-#else /* ANDROID */
-                         "/tmp/wpa_ctrl_%d-%d", (int) getpid(), counter);
-#endif /* ANDROID */
-       if (ret < 0 || (size_t) ret >= sizeof(ctrl->local.sun_path)) {
-               close(ctrl->s);
-               os_free(ctrl);
-               return NULL;
-       }
-       tries++;
-       if (bind(ctrl->s, (struct sockaddr *) &ctrl->local,
-                   sizeof(ctrl->local)) < 0) {
-               if (errno == EADDRINUSE && tries < 2) {
-                       /*
-                        * getpid() returns unique identifier for this instance
-                        * of wpa_ctrl, so the existing socket file must have
-                        * been left by unclean termination of an earlier run.
-                        * Remove the file and try again.
-                        */
-                       unlink(ctrl->local.sun_path);
-                       goto try_again;
-               }
-               close(ctrl->s);
-               os_free(ctrl);
-               return NULL;
-       }
-
-#ifdef ANDROID
-       chmod(ctrl->local.sun_path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
-       chown(ctrl->local.sun_path, AID_SYSTEM, AID_WIFI);
-       /*
-        * If the ctrl_path isn't an absolute pathname, assume that
-        * it's the name of a socket in the Android reserved namespace.
-        * Otherwise, it's a normal UNIX domain socket appearing in the
-        * filesystem.
-        */
-       if (ctrl_path != NULL && *ctrl_path != '/') {
-               os_snprintf(ctrl->dest.sun_path, sizeof(ctrl->dest.sun_path), "hostapd_%s",
-                           ctrl_path);
-               if (socket_local_client_connect(ctrl->s,
-                                               ctrl->dest.sun_path,
-                                               ANDROID_SOCKET_NAMESPACE_RESERVED,
-                                               SOCK_DGRAM) < 0) {
-                       close(ctrl->s);
-                       unlink(ctrl->local.sun_path);
-                       os_free(ctrl);
-                       return NULL;
-               }
-               return ctrl;
-       }
-#endif /* ANDROID */
-
-       ctrl->dest.sun_family = AF_UNIX;
-       res = os_strlcpy(ctrl->dest.sun_path, ctrl_path,
-                        sizeof(ctrl->dest.sun_path));
-       if (res >= sizeof(ctrl->dest.sun_path)) {
-               close(ctrl->s);
-               os_free(ctrl);
-               return NULL;
-       }
-       if (connect(ctrl->s, (struct sockaddr *) &ctrl->dest,
-                   sizeof(ctrl->dest)) < 0) {
-               close(ctrl->s);
-               unlink(ctrl->local.sun_path);
-               os_free(ctrl);
-               return NULL;
-       }
-
-       return ctrl;
-}
-
-
-void wpa_ctrl_close(struct wpa_ctrl *ctrl)
-{
-       if (ctrl == NULL)
-               return;
-       unlink(ctrl->local.sun_path);
-       if (ctrl->s >= 0)
-               close(ctrl->s);
-       os_free(ctrl);
-}
-#ifdef ANDROID
-/**
- * wpa_ctrl_cleanup() - Delete any local UNIX domain socket files that
- * may be left over from clients that were previously connected to
- * wpa_supplicant. This keeps these files from being orphaned in the
- * event of crashes that prevented them from being removed as part
- * of the normal orderly shutdown.
- */
-void wpa_ctrl_cleanup()
-{
-    DIR *dir;
-    struct dirent entry;
-    struct dirent *result;
-    size_t dirnamelen;
-    int prefixlen = strlen(local_socket_prefix);
-    size_t maxcopy;
-    char pathname[PATH_MAX];
-    char *namep;
-
-    if ((dir = opendir(local_socket_dir)) == NULL)
-        return;
-
-    dirnamelen = (size_t)snprintf(pathname, sizeof(pathname), "%s/", local_socket_dir);
-    if (dirnamelen >= sizeof(pathname)) {
-        closedir(dir);
-        return;
-    }
-    namep = pathname + dirnamelen;
-    maxcopy = PATH_MAX-dirnamelen;
-    while (readdir_r(dir, &entry, &result) == 0 && result != NULL) {
-        if (strncmp(entry.d_name, local_socket_prefix, prefixlen) == 0) {
-            if (strlcpy(namep, entry.d_name, maxcopy) < maxcopy) {
-                unlink(pathname);
-            }
-        }
-    }
-    closedir(dir);
-}
-#endif /* ANDROID */
-#else /* CONFIG_CTRL_IFACE_UNIX */
-#ifdef ANDROID
-void wpa_ctrl_cleanup()
-{
-}
-#endif /* ANDROID */
-#endif /* CONFIG_CTRL_IFACE_UNIX */
-
-#ifdef CONFIG_CTRL_IFACE_UDP
-
-struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
-{
-       struct wpa_ctrl *ctrl;
-       char buf[128];
-       size_t len;
-
-       ctrl = os_malloc(sizeof(*ctrl));
-       if (ctrl == NULL)
-               return NULL;
-       os_memset(ctrl, 0, sizeof(*ctrl));
-
-       ctrl->s = socket(PF_INET, SOCK_DGRAM, 0);
-       if (ctrl->s < 0) {
-               perror("socket");
-               os_free(ctrl);
-               return NULL;
-       }
-
-       ctrl->local.sin_family = AF_INET;
-       ctrl->local.sin_addr.s_addr = htonl((127 << 24) | 1);
-       if (bind(ctrl->s, (struct sockaddr *) &ctrl->local,
-                sizeof(ctrl->local)) < 0) {
-               close(ctrl->s);
-               os_free(ctrl);
-               return NULL;
-       }
-
-       ctrl->dest.sin_family = AF_INET;
-       ctrl->dest.sin_addr.s_addr = htonl((127 << 24) | 1);
-       ctrl->dest.sin_port = htons(WPA_CTRL_IFACE_PORT);
-       if (connect(ctrl->s, (struct sockaddr *) &ctrl->dest,
-                   sizeof(ctrl->dest)) < 0) {
-               perror("connect");
-               close(ctrl->s);
-               os_free(ctrl);
-               return NULL;
-       }
-
-       len = sizeof(buf) - 1;
-       if (wpa_ctrl_request(ctrl, "GET_COOKIE", 10, buf, &len, NULL) == 0) {
-               buf[len] = '\0';
-               ctrl->cookie = os_strdup(buf);
-       }
-
-       return ctrl;
-}
-
-
-void wpa_ctrl_close(struct wpa_ctrl *ctrl)
-{
-       close(ctrl->s);
-       os_free(ctrl->cookie);
-       os_free(ctrl);
-}
-
-#endif /* CONFIG_CTRL_IFACE_UDP */
-
-
-#ifdef CTRL_IFACE_SOCKET
-int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
-                    char *reply, size_t *reply_len,
-                    void (*msg_cb)(char *msg, size_t len))
-{
-       struct timeval tv;
-       int res;
-       fd_set rfds;
-       const char *_cmd;
-       char *cmd_buf = NULL;
-       size_t _cmd_len;
-
-#ifdef CONFIG_CTRL_IFACE_UDP
-       if (ctrl->cookie) {
-               char *pos;
-               _cmd_len = os_strlen(ctrl->cookie) + 1 + cmd_len;
-               cmd_buf = os_malloc(_cmd_len);
-               if (cmd_buf == NULL)
-                       return -1;
-               _cmd = cmd_buf;
-               pos = cmd_buf;
-               os_strlcpy(pos, ctrl->cookie, _cmd_len);
-               pos += os_strlen(ctrl->cookie);
-               *pos++ = ' ';
-               os_memcpy(pos, cmd, cmd_len);
-       } else
-#endif /* CONFIG_CTRL_IFACE_UDP */
-       {
-               _cmd = cmd;
-               _cmd_len = cmd_len;
-       }
-
-       if (send(ctrl->s, _cmd, _cmd_len, 0) < 0) {
-               os_free(cmd_buf);
-               return -1;
-       }
-       os_free(cmd_buf);
-
-       for (;;) {
-#ifdef ANDROID
-               tv.tv_sec = 5;
-#else /* ANDROID */
-               tv.tv_sec = 2;
-#endif /* ANDROID */
-               tv.tv_usec = 0;
-               FD_ZERO(&rfds);
-               FD_SET(ctrl->s, &rfds);
-               res = select(ctrl->s + 1, &rfds, NULL, NULL, &tv);
-               if (FD_ISSET(ctrl->s, &rfds)) {
-                       res = recv(ctrl->s, reply, *reply_len, 0);
-                       if (res < 0)
-                               return res;
-                       if (res > 0 && reply[0] == '<') {
-                               /* This is an unsolicited message from
-                                * wpa_supplicant, not the reply to the
-                                * request. Use msg_cb to report this to the
-                                * caller. */
-                               if (msg_cb) {
-                                       /* Make sure the message is nul
-                                        * terminated. */
-                                       if ((size_t) res == *reply_len)
-                                               res = (*reply_len) - 1;
-                                       reply[res] = '\0';
-                                       msg_cb(reply, res);
-                               }
-                               continue;
-                       }
-                       *reply_len = res;
-                       break;
-               } else {
-                       return -2;
-               }
-       }
-       return 0;
-}
-#endif /* CTRL_IFACE_SOCKET */
-
-
-static int wpa_ctrl_attach_helper(struct wpa_ctrl *ctrl, int attach)
-{
-       char buf[10];
-       int ret;
-       size_t len = 10;
-
-       ret = wpa_ctrl_request(ctrl, attach ? "ATTACH" : "DETACH", 6,
-                              buf, &len, NULL);
-       if (ret < 0)
-               return ret;
-       if (len == 3 && os_memcmp(buf, "OK\n", 3) == 0)
-               return 0;
-       return -1;
-}
-
-
-int wpa_ctrl_attach(struct wpa_ctrl *ctrl)
-{
-       return wpa_ctrl_attach_helper(ctrl, 1);
-}
-
-
-int wpa_ctrl_detach(struct wpa_ctrl *ctrl)
-{
-       return wpa_ctrl_attach_helper(ctrl, 0);
-}
-
-
-#ifdef CTRL_IFACE_SOCKET
-
-int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len)
-{
-       int res;
-
-       res = recv(ctrl->s, reply, *reply_len, 0);
-       if (res < 0)
-               return res;
-       *reply_len = res;
-       return 0;
-}
-
-
-int wpa_ctrl_pending(struct wpa_ctrl *ctrl)
-{
-       struct timeval tv;
-       fd_set rfds;
-       tv.tv_sec = 0;
-       tv.tv_usec = 0;
-       FD_ZERO(&rfds);
-       FD_SET(ctrl->s, &rfds);
-       select(ctrl->s + 1, &rfds, NULL, NULL, &tv);
-       return FD_ISSET(ctrl->s, &rfds);
-}
-
-
-int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl)
-{
-       return ctrl->s;
-}
-
-#endif /* CTRL_IFACE_SOCKET */
-
-
-#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE
-
-#ifndef WPA_SUPPLICANT_NAMED_PIPE
-#define WPA_SUPPLICANT_NAMED_PIPE "WpaSupplicant"
-#endif
-#define NAMED_PIPE_PREFIX TEXT("\\\\.\\pipe\\") TEXT(WPA_SUPPLICANT_NAMED_PIPE)
-
-struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
-{
-       struct wpa_ctrl *ctrl;
-       DWORD mode;
-       TCHAR name[256];
-       int i, ret;
-
-       ctrl = os_malloc(sizeof(*ctrl));
-       if (ctrl == NULL)
-               return NULL;
-       os_memset(ctrl, 0, sizeof(*ctrl));
-
-#ifdef UNICODE
-       if (ctrl_path == NULL)
-               ret = _snwprintf(name, 256, NAMED_PIPE_PREFIX);
-       else
-               ret = _snwprintf(name, 256, NAMED_PIPE_PREFIX TEXT("-%S"),
-                                ctrl_path);
-#else /* UNICODE */
-       if (ctrl_path == NULL)
-               ret = os_snprintf(name, 256, NAMED_PIPE_PREFIX);
-       else
-               ret = os_snprintf(name, 256, NAMED_PIPE_PREFIX "-%s",
-                                 ctrl_path);
-#endif /* UNICODE */
-       if (ret < 0 || ret >= 256) {
-               os_free(ctrl);
-               return NULL;
-       }
-
-       for (i = 0; i < 10; i++) {
-               ctrl->pipe = CreateFile(name, GENERIC_READ | GENERIC_WRITE, 0,
-                                       NULL, OPEN_EXISTING, 0, NULL);
-               /*
-                * Current named pipe server side in wpa_supplicant is
-                * re-opening the pipe for new clients only after the previous
-                * one is taken into use. This leaves a small window for race
-                * conditions when two connections are being opened at almost
-                * the same time. Retry if that was the case.
-                */
-               if (ctrl->pipe != INVALID_HANDLE_VALUE ||
-                   GetLastError() != ERROR_PIPE_BUSY)
-                       break;
-               WaitNamedPipe(name, 1000);
-       }
-       if (ctrl->pipe == INVALID_HANDLE_VALUE) {
-               os_free(ctrl);
-               return NULL;
-       }
-
-       mode = PIPE_READMODE_MESSAGE;
-       if (!SetNamedPipeHandleState(ctrl->pipe, &mode, NULL, NULL)) {
-               CloseHandle(ctrl->pipe);
-               os_free(ctrl);
-               return NULL;
-       }
-
-       return ctrl;
-}
-
-
-void wpa_ctrl_close(struct wpa_ctrl *ctrl)
-{
-       CloseHandle(ctrl->pipe);
-       os_free(ctrl);
-}
-
-
-int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
-                    char *reply, size_t *reply_len,
-                    void (*msg_cb)(char *msg, size_t len))
-{
-       DWORD written;
-       DWORD readlen = *reply_len;
-
-       if (!WriteFile(ctrl->pipe, cmd, cmd_len, &written, NULL))
-               return -1;
-
-       if (!ReadFile(ctrl->pipe, reply, *reply_len, &readlen, NULL))
-               return -1;
-       *reply_len = readlen;
-
-       return 0;
-}
-
-
-int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len)
-{
-       DWORD len = *reply_len;
-       if (!ReadFile(ctrl->pipe, reply, *reply_len, &len, NULL))
-               return -1;
-       *reply_len = len;
-       return 0;
-}
-
-
-int wpa_ctrl_pending(struct wpa_ctrl *ctrl)
-{
-       DWORD left;
-
-       if (!PeekNamedPipe(ctrl->pipe, NULL, 0, NULL, &left, NULL))
-               return -1;
-       return left ? 1 : 0;
-}
-
-
-int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl)
-{
-       return -1;
-}
-
-#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
-
-#endif /* CONFIG_CTRL_IFACE */
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_ctrl.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_ctrl.h
deleted file mode 100644 (file)
index 387b804..0000000
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * wpa_supplicant/hostapd control interface library
- * Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
- */
-
-#ifndef WPA_CTRL_H
-#define WPA_CTRL_H
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-/* wpa_supplicant control interface - fixed message prefixes */
-
-/** Interactive request for identity/password/pin */
-#define WPA_CTRL_REQ "CTRL-REQ-"
-
-/** Response to identity/password/pin request */
-#define WPA_CTRL_RSP "CTRL-RSP-"
-
-/* Event messages with fixed prefix */
-/** Authentication completed successfully and data connection enabled */
-#define WPA_EVENT_CONNECTED "CTRL-EVENT-CONNECTED "
-
-// by bbelief
-#define P2_PWPA_EVENT_CONNECTED "CTRL-EVENT-P2P-CONNECTED "
-/** Disconnected, data connection is not available */
-#define WPA_EVENT_DISCONNECTED "CTRL-EVENT-DISCONNECTED "
-/** Association rejected during connection attempt */
-#define WPA_EVENT_ASSOC_REJECT "CTRL-EVENT-ASSOC-REJECT "
-/** wpa_supplicant is exiting */
-#define WPA_EVENT_TERMINATING "CTRL-EVENT-TERMINATING "
-/** Password change was completed successfully */
-#define WPA_EVENT_PASSWORD_CHANGED "CTRL-EVENT-PASSWORD-CHANGED "
-/** EAP-Request/Notification received */
-#define WPA_EVENT_EAP_NOTIFICATION "CTRL-EVENT-EAP-NOTIFICATION "
-/** EAP authentication started (EAP-Request/Identity received) */
-#define WPA_EVENT_EAP_STARTED "CTRL-EVENT-EAP-STARTED "
-/** EAP method proposed by the server */
-#define WPA_EVENT_EAP_PROPOSED_METHOD "CTRL-EVENT-EAP-PROPOSED-METHOD "
-/** EAP method selected */
-#define WPA_EVENT_EAP_METHOD "CTRL-EVENT-EAP-METHOD "
-/** EAP peer certificate from TLS */
-#define WPA_EVENT_EAP_PEER_CERT "CTRL-EVENT-EAP-PEER-CERT "
-/** EAP TLS certificate chain validation error */
-#define WPA_EVENT_EAP_TLS_CERT_ERROR "CTRL-EVENT-EAP-TLS-CERT-ERROR "
-/** EAP authentication completed successfully */
-#define WPA_EVENT_EAP_SUCCESS "CTRL-EVENT-EAP-SUCCESS "
-/** EAP authentication failed (EAP-Failure received) */
-#define WPA_EVENT_EAP_FAILURE "CTRL-EVENT-EAP-FAILURE "
-/** New scan results available */
-#define WPA_EVENT_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS "
-/** wpa_supplicant state change */
-#define WPA_EVENT_STATE_CHANGE "CTRL-EVENT-STATE-CHANGE "
-/** A new BSS entry was added (followed by BSS entry id and BSSID) */
-#define WPA_EVENT_BSS_ADDED "CTRL-EVENT-BSS-ADDED "
-/** A BSS entry was removed (followed by BSS entry id and BSSID) */
-#define WPA_EVENT_BSS_REMOVED "CTRL-EVENT-BSS-REMOVED "
-#ifdef ANDROID
-/** wpa_supplicant state change */
-#define WPA_EVENT_STATE_CHANGE "CTRL-EVENT-STATE-CHANGE "
-/** AP to STA speed */
-#define WPA_EVENT_LINK_SPEED "CTRL-EVENT-LINK-SPEED "
-/** Driver state change */
-#define WPA_EVENT_DRIVER_STATE "CTRL-EVENT-DRIVER-STATE "
-#endif /* ANDROID */
-
-/** WPS overlap detected in PBC mode */
-#define WPS_EVENT_OVERLAP "WPS-OVERLAP-DETECTED "
-/** Available WPS AP with active PBC found in scan results */
-#define WPS_EVENT_AP_AVAILABLE_PBC "WPS-AP-AVAILABLE-PBC "
-/** Available WPS AP with our address as authorized in scan results */
-#define WPS_EVENT_AP_AVAILABLE_AUTH "WPS-AP-AVAILABLE-AUTH "
-/** Available WPS AP with recently selected PIN registrar found in scan results
- */
-#define WPS_EVENT_AP_AVAILABLE_PIN "WPS-AP-AVAILABLE-PIN "
-/** Available WPS AP found in scan results */
-#define WPS_EVENT_AP_AVAILABLE "WPS-AP-AVAILABLE "
-/** A new credential received */
-#define WPS_EVENT_CRED_RECEIVED "WPS-CRED-RECEIVED "
-/** M2D received */
-#define WPS_EVENT_M2D "WPS-M2D "
-/** WPS registration failed after M2/M2D */
-#define WPS_EVENT_FAIL "WPS-FAIL "
-/** WPS registration completed successfully */
-#define WPS_EVENT_SUCCESS "WPS-SUCCESS "
-/** WPS enrollment attempt timed out and was terminated */
-#define WPS_EVENT_TIMEOUT "WPS-TIMEOUT "
-
-#define WPS_EVENT_ENROLLEE_SEEN "WPS-ENROLLEE-SEEN "
-
-#define WPS_EVENT_OPEN_NETWORK "WPS-OPEN-NETWORK "
-
-/* WPS ER events */
-#define WPS_EVENT_ER_AP_ADD "WPS-ER-AP-ADD "
-#define WPS_EVENT_ER_AP_REMOVE "WPS-ER-AP-REMOVE "
-#define WPS_EVENT_ER_ENROLLEE_ADD "WPS-ER-ENROLLEE-ADD "
-#define WPS_EVENT_ER_ENROLLEE_REMOVE "WPS-ER-ENROLLEE-REMOVE "
-#define WPS_EVENT_ER_AP_SETTINGS "WPS-ER-AP-SETTINGS "
-#define WPS_EVENT_ER_SET_SEL_REG "WPS-ER-AP-SET-SEL-REG "
-
-/** P2P device found */
-#define P2P_EVENT_DEVICE_FOUND "P2P-DEVICE-FOUND "
-/** A P2P device requested GO negotiation, but we were not ready to start the
- * negotiation */
-#define P2P_EVENT_GO_NEG_REQUEST "P2P-GO-NEG-REQUEST "
-#define P2P_EVENT_GO_NEG_SUCCESS "P2P-GO-NEG-SUCCESS "
-#define P2P_EVENT_GO_NEG_FAILURE "P2P-GO-NEG-FAILURE "
-#define P2P_EVENT_GROUP_FORMATION_SUCCESS "P2P-GROUP-FORMATION-SUCCESS "
-#define P2P_EVENT_GROUP_FORMATION_FAILURE "P2P-GROUP-FORMATION-FAILURE "
-#define P2P_EVENT_GROUP_STARTED "P2P-GROUP-STARTED "
-#define P2P_EVENT_GROUP_REMOVED "P2P-GROUP-REMOVED "
-#define P2P_EVENT_CROSS_CONNECT_ENABLE "P2P-CROSS-CONNECT-ENABLE "
-#define P2P_EVENT_CROSS_CONNECT_DISABLE "P2P-CROSS-CONNECT-DISABLE "
-/* parameters: <peer address> <PIN> */
-#define P2P_EVENT_PROV_DISC_SHOW_PIN "P2P-PROV-DISC-SHOW-PIN "
-/* parameters: <peer address> */
-#define P2P_EVENT_PROV_DISC_ENTER_PIN "P2P-PROV-DISC-ENTER-PIN "
-/* parameters: <peer address> */
-#define P2P_EVENT_PROV_DISC_PBC_REQ "P2P-PROV-DISC-PBC-REQ "
-/* parameters: <peer address> */
-#define P2P_EVENT_PROV_DISC_PBC_RESP "P2P-PROV-DISC-PBC-RESP "
-#define P2P_EVENT_PROV_DISC_NULL_RESP "P2P-PROV-DISC-NULL-RESP "
-/* parameters: <freq> <src addr> <dialog token> <update indicator> <TLVs> */
-#define P2P_EVENT_SERV_DISC_REQ "P2P-SERV-DISC-REQ "
-/* parameters: <src addr> <update indicator> <TLVs> */
-#define P2P_EVENT_SERV_DISC_RESP "P2P-SERV-DISC-RESP "
-#define P2P_EVENT_INVITATION_RECEIVED "P2P-INVITATION-RECEIVED "
-#define P2P_EVENT_INVITATION_RESULT "P2P-INVITATION-RESULT "
-
-/* hostapd control interface - fixed message prefixes */
-#define WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED "
-#define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS "
-#define WPS_EVENT_REG_SUCCESS "WPS-REG-SUCCESS "
-#define WPS_EVENT_AP_SETUP_LOCKED "WPS-AP-SETUP-LOCKED "
-#define WPS_EVENT_AP_SETUP_UNLOCKED "WPS-AP-SETUP-UNLOCKED "
-#define WPS_EVENT_AP_PIN_ENABLED "WPS-AP-PIN-ENABLED "
-#define WPS_EVENT_AP_PIN_DISABLED "WPS-AP-PIN-DISABLED "
-#define AP_STA_CONNECTED "AP-STA-CONNECTED "
-#define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
-
-
-/* wpa_supplicant/hostapd control interface access */
-
-/**
- * wpa_ctrl_open - Open a control interface to wpa_supplicant/hostapd
- * @ctrl_path: Path for UNIX domain sockets; ignored if UDP sockets are used.
- * Returns: Pointer to abstract control interface data or %NULL on failure
- *
- * This function is used to open a control interface to wpa_supplicant/hostapd.
- * ctrl_path is usually /var/run/wpa_supplicant or /var/run/hostapd. This path
- * is configured in wpa_supplicant/hostapd and other programs using the control
- * interface need to use matching path configuration.
- */
-struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path);
-
-
-/**
- * wpa_ctrl_close - Close a control interface to wpa_supplicant/hostapd
- * @ctrl: Control interface data from wpa_ctrl_open()
- *
- * This function is used to close a control interface.
- */
-void wpa_ctrl_close(struct wpa_ctrl *ctrl);
-
-
-/**
- * wpa_ctrl_request - Send a command to wpa_supplicant/hostapd
- * @ctrl: Control interface data from wpa_ctrl_open()
- * @cmd: Command; usually, ASCII text, e.g., "PING"
- * @cmd_len: Length of the cmd in bytes
- * @reply: Buffer for the response
- * @reply_len: Reply buffer length
- * @msg_cb: Callback function for unsolicited messages or %NULL if not used
- * Returns: 0 on success, -1 on error (send or receive failed), -2 on timeout
- *
- * This function is used to send commands to wpa_supplicant/hostapd. Received
- * response will be written to reply and reply_len is set to the actual length
- * of the reply. This function will block for up to two seconds while waiting
- * for the reply. If unsolicited messages are received, the blocking time may
- * be longer.
- *
- * msg_cb can be used to register a callback function that will be called for
- * unsolicited messages received while waiting for the command response. These
- * messages may be received if wpa_ctrl_request() is called at the same time as
- * wpa_supplicant/hostapd is sending such a message. This can happen only if
- * the program has used wpa_ctrl_attach() to register itself as a monitor for
- * event messages. Alternatively to msg_cb, programs can register two control
- * interface connections and use one of them for commands and the other one for
- * receiving event messages, in other words, call wpa_ctrl_attach() only for
- * the control interface connection that will be used for event messages.
- */
-int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
-                    char *reply, size_t *reply_len,
-                    void (*msg_cb)(char *msg, size_t len));
-
-
-/**
- * wpa_ctrl_attach - Register as an event monitor for the control interface
- * @ctrl: Control interface data from wpa_ctrl_open()
- * Returns: 0 on success, -1 on failure, -2 on timeout
- *
- * This function registers the control interface connection as a monitor for
- * wpa_supplicant/hostapd events. After a success wpa_ctrl_attach() call, the
- * control interface connection starts receiving event messages that can be
- * read with wpa_ctrl_recv().
- */
-int wpa_ctrl_attach(struct wpa_ctrl *ctrl);
-
-
-/**
- * wpa_ctrl_detach - Unregister event monitor from the control interface
- * @ctrl: Control interface data from wpa_ctrl_open()
- * Returns: 0 on success, -1 on failure, -2 on timeout
- *
- * This function unregisters the control interface connection as a monitor for
- * wpa_supplicant/hostapd events, i.e., cancels the registration done with
- * wpa_ctrl_attach().
- */
-int wpa_ctrl_detach(struct wpa_ctrl *ctrl);
-
-
-/**
- * wpa_ctrl_recv - Receive a pending control interface message
- * @ctrl: Control interface data from wpa_ctrl_open()
- * @reply: Buffer for the message data
- * @reply_len: Length of the reply buffer
- * Returns: 0 on success, -1 on failure
- *
- * This function will receive a pending control interface message. This
- * function will block if no messages are available. The received response will
- * be written to reply and reply_len is set to the actual length of the reply.
- * wpa_ctrl_recv() is only used for event messages, i.e., wpa_ctrl_attach()
- * must have been used to register the control interface as an event monitor.
- */
-int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len);
-
-
-/**
- * wpa_ctrl_pending - Check whether there are pending event messages
- * @ctrl: Control interface data from wpa_ctrl_open()
- * Returns: 1 if there are pending messages, 0 if no, or -1 on error
- *
- * This function will check whether there are any pending control interface
- * message available to be received with wpa_ctrl_recv(). wpa_ctrl_pending() is
- * only used for event messages, i.e., wpa_ctrl_attach() must have been used to
- * register the control interface as an event monitor.
- */
-int wpa_ctrl_pending(struct wpa_ctrl *ctrl);
-
-
-/**
- * wpa_ctrl_get_fd - Get file descriptor used by the control interface
- * @ctrl: Control interface data from wpa_ctrl_open()
- * Returns: File descriptor used for the connection
- *
- * This function can be used to get the file descriptor that is used for the
- * control interface connection. The returned value can be used, e.g., with
- * select() while waiting for multiple events.
- *
- * The returned file descriptor must not be used directly for sending or
- * receiving packets; instead, the library functions wpa_ctrl_request() and
- * wpa_ctrl_recv() must be used for this.
- */
-int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl);
-#ifdef ANDROID
-/**
- * wpa_ctrl_cleanup() - Delete any local UNIX domain socket files that
- * may be left over from clients that were previously connected to
- * wpa_supplicant. This keeps these files from being orphaned in the
- * event of crashes that prevented them from being removed as part
- * of the normal orderly shutdown.
- */
-void wpa_ctrl_cleanup();
-#endif  /* ANDROID */
-#ifdef CONFIG_CTRL_IFACE_UDP
-#define WPA_CTRL_IFACE_PORT 9877
-#define WPA_GLOBAL_CTRL_IFACE_PORT 9878
-#endif /* CONFIG_CTRL_IFACE_UDP */
-
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* WPA_CTRL_H */
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_helpers.c b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_helpers.c
deleted file mode 100644 (file)
index d92ef3d..0000000
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#include "sigma_dut.h"
-#include <sys/stat.h>
-#include "wpa_ctrl.h"
-#include "wpa_helpers.h"
-
-#ifdef ANDROID
-static const char *local_cli_dir = "/data/misc/wifi/";
-#endif
-
-char * get_main_ifname(void)
-{
-      if (if_nametoindex("eth2") > 0)
-             return "eth2";
-      if (if_nametoindex("eth1") > 0)
-             return "eth1";
-      if (if_nametoindex("p2p0") > 0)
-             return "p2p0";
-      if (if_nametoindex("wlan1") > 0) {
-             struct stat s;
-
-sigma_dut_print(DUT_MSG_INFO, "%s -1", __func__);
-    
-             //if (stat("/sys/module/mac80211", &s) == 0 &&
-             if (stat("/sys/module/ar6000", &s) == 0 &&
-                 if_nametoindex("wlan0")) {
-sigma_dut_print(DUT_MSG_INFO, "%s -2", __func__);                
-                     /*
-                      * Likely a dual-radio AP device; use wlan0 for STA/P2P
-                      * operations.
-                      */
-                     return "wlan0";
-             }
-sigma_dut_print(DUT_MSG_INFO, "%s -3", __func__);          
-             return "wlan1";
-      }
-      if (if_nametoindex("wlan0") > 0){
-sigma_dut_print(DUT_MSG_INFO, "%s -4", __func__);        
-             return "wlan0";
-      }
-      return "unknown";
-}
-
-
-char * get_station_ifname(void)
-{
-#ifdef __APPLE__
-       return "en1";
-#else /* __APPLE__ */
-        /* AR6003 eth1 STA  Interface */
-        if (if_nametoindex("eth1") > 0)
-             return "eth1";
-       /*
-        * If we have both wlan0 and wlan1, assume the first one is the station
-        * interface.
-        */
-       if (if_nametoindex("wlan1") > 0 && if_nametoindex("wlan0") > 0)
-               return "wlan0";
-
-       /* If nothing else matches, hope for best and guess.. */
-       return "wlan0";
-#endif /* __APPLE__ */
-}
-
-
-int wpa_command(const char *ifname, const char *cmd)
-{
-       struct wpa_ctrl *ctrl;
-       char buf[128];
-       size_t len;
-
-       sigma_dut_print(DUT_MSG_INFO, "wpa_command(ifname='%s', cmd='%s')\n", ifname, cmd);
-       //snprintf(buf, sizeof(buf), "/var/run/wpa_supplicant/%s", ifname);
-       snprintf(buf, sizeof(buf), "%s%s", local_cli_dir, ifname);        
-       ctrl = wpa_ctrl_open(buf);
-       if (ctrl == NULL) {
-               sigma_dut_print(DUT_MSG_INFO, "wpa_command: wpa_ctrl_open(%s) failed\n", buf);
-               return -1;
-       }
-       len = sizeof(buf);
-       if (wpa_ctrl_request(ctrl, cmd, strlen(cmd), buf, &len, NULL) < 0) {
-               sigma_dut_print(DUT_MSG_INFO, "wpa_command: wpa_ctrl_request failed\n");
-               wpa_ctrl_close(ctrl);
-               return -1;
-       }
-       wpa_ctrl_close(ctrl);
-       buf[len] = '\0';
-       if (strncmp(buf, "FAIL", 4) == 0) {
-               sigma_dut_print(DUT_MSG_INFO, "wpa_command: Command failed (FAIL received)\n");
-               return -1;
-       }
-
-       sigma_dut_print(DUT_MSG_INFO, "%s\n", buf);
-       return 0;
-}
-
-
-int wpa_command_resp(const char *ifname, const char *cmd,
-                    char *resp, size_t resp_size)
-{
-       struct wpa_ctrl *ctrl;
-       char buf[128];
-       size_t len;
-
-       sigma_dut_print(DUT_MSG_INFO, "wpa_command(ifname='%s', cmd='%s')\n", ifname, cmd);
-       snprintf(buf, sizeof(buf), "%s%s", local_cli_dir, ifname);
-       ctrl = wpa_ctrl_open(buf);
-       if (ctrl == NULL) {
-               sigma_dut_print(DUT_MSG_INFO, "wpa_command: wpa_ctrl_open(%s) failed\n", buf);
-               return -1;
-       }
-       len = resp_size;
-       if (wpa_ctrl_request(ctrl, cmd, strlen(cmd), resp, &len, NULL) < 0) {
-               sigma_dut_print(DUT_MSG_INFO, "wpa_command: wpa_ctrl_request failed\n");
-               wpa_ctrl_close(ctrl);
-               return -1;
-       }
-       wpa_ctrl_close(ctrl);
-       resp[len] = '\0';
-       return 0;
-}
-
-
-struct wpa_ctrl * open_wpa_mon(const char *ifname)
-{
-       struct wpa_ctrl *ctrl;
-       char path[256];
-
-       snprintf(path, sizeof(path), "%s%s", local_cli_dir, ifname);
-       ctrl = wpa_ctrl_open(path);
-       if (ctrl == NULL)
-               return NULL;
-       if (wpa_ctrl_attach(ctrl) < 0) {
-               wpa_ctrl_close(ctrl);
-               return NULL;
-       }
-
-       return ctrl;
-}
-
-
-int get_wpa_cli_event2(struct sigma_dut *dut, struct wpa_ctrl *mon,
-                      const char *event, const char *event2,
-                      char *buf, size_t buf_size)
-{
-       int fd, ret;
-       fd_set rfd;
-       char *pos;
-       struct timeval tv;
-       time_t start, now;
-
-       sigma_dut_print( DUT_MSG_DEBUG, "Waiting for wpa_cli event %s",
-                       event);
-       fd = wpa_ctrl_get_fd(mon);
-       if (fd < 0)
-               return -1;
-
-       time(&start);
-       while (1) {
-               size_t len;
-
-               FD_ZERO(&rfd);
-               FD_SET(fd, &rfd);
-               tv.tv_sec = dut->default_timeout;
-               tv.tv_usec = 0;
-               ret = select(fd + 1, &rfd, NULL, NULL, &tv);
-               if (ret == 0) {
-                       sigma_dut_print( DUT_MSG_INFO, "Timeout on "
-                                       "waiting for event %s", event);
-                       return -2;
-               }
-               if (ret < 0) {
-                       sigma_dut_print( DUT_MSG_INFO, "select: %s",
-                                       strerror(errno));
-                       return -1;
-               }
-               len = buf_size;
-               if (wpa_ctrl_recv(mon, buf, &len) < 0) {
-                       sigma_dut_print( DUT_MSG_ERROR, "Failure while "
-                                       "waiting for event %s", event);
-                       return -1;
-               }
-               if (len == buf_size)
-                       len--;
-               buf[len] = '\0';
-
-               pos = strchr(buf, '>');
-               if (pos &&
-                   (strncmp(pos + 1, event, strlen(event)) == 0 ||
-                    (event2 &&
-                     strncmp(pos + 1, event2, strlen(event2)) == 0)))
-                       return 0; /* Event found */
-
-               time(&now);
-               if (now - start > dut->default_timeout) {
-                       sigma_dut_print( DUT_MSG_INFO, "Timeout on "
-                                       "waiting for event %s", event);
-                       return -1;
-               }
-       }
-}
-
-
-int get_wpa_cli_event(struct sigma_dut *dut, struct wpa_ctrl *mon,
-                     const char *event, char *buf, size_t buf_size)
-{
-       return get_wpa_cli_event2(dut, mon, event, NULL, buf, buf_size);
-}
-
-
-int get_wpa_status(const char *ifname, const char *field, char *obuf,
-                  size_t obuf_size)
-{
-       struct wpa_ctrl *ctrl;
-       char buf[4096];
-       char *pos, *end;
-       size_t len, flen;
-
-       snprintf(buf, sizeof(buf), "%s%s", local_cli_dir, ifname);
-       ctrl = wpa_ctrl_open(buf);
-       if (ctrl == NULL)
-               return -1;
-
-       len = sizeof(buf);
-       if (wpa_ctrl_request(ctrl, "STATUS", 6, buf, &len, NULL) < 0) {
-               wpa_ctrl_close(ctrl);
-               return -1;
-       }
-    
-       wpa_ctrl_close(ctrl);
-       buf[len] = '\0';
-
-       flen = strlen(field);
-       pos = buf;
-       while (pos + flen < buf + len) {
-               if (pos > buf) {
-                       if (*pos != '\n') {
-                               pos++;
-                               continue;
-                       }
-                       pos++;
-               }
-
-               if (strncmp(pos, field, flen) != 0 || pos[flen] != '=') {
-                       pos++;
-                       continue;
-               }
-        
-               pos += flen + 1;
-               end = strchr(pos, '\n');
-               if (end == NULL)
-                       return -1;
-        
-               *end++ = '\0';
-               if (end - pos > obuf_size)
-                       return -1;
-        
-               memcpy(obuf, pos, end - pos);
-               return 0;
-       }
-
-       return -1;
-}
-
-
-int wait_ip_addr(struct sigma_dut *dut, const char *ifname)
-{
-       char ip[30];
-       int count = dut->default_timeout;
-
-       while (count > 0) {
-               sigma_dut_print( DUT_MSG_DEBUG, "%s: ifname='%s' - %d "
-                               "seconds remaining",
-                               __func__, ifname, count);
-               count--;
-               if (get_wpa_status(ifname, "ip_address", ip, sizeof(ip)) == 0
-                   && strlen(ip) > 0) {
-                       sigma_dut_print( DUT_MSG_INFO, "IP address "
-                                       "found: '%s'", ip);
-                       return 0;
-               }
-               sleep(1);
-       }
-       sigma_dut_print( DUT_MSG_INFO, "%s: Could not get IP address for "
-                       "ifname='%s'", __func__, ifname);
-       return -1;
-}
-
-
-void remove_wpa_networks(const char *ifname)
-{
-       char buf[4096];
-       char cmd[256];
-       char *pos;
-
-       if (wpa_command_resp(ifname, "LIST_NETWORKS", buf, sizeof(buf)) < 0)
-               return;
-
-       /* Skip the first line (header) */
-       pos = strchr(buf, '\n');
-       if (pos == NULL)
-               return;
-       pos++;
-       while (pos && pos[0]) {
-               int id = atoi(pos);
-               snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", id);
-               wpa_command(ifname, cmd);
-               pos = strchr(pos, '\n');
-               if (pos)
-                       pos++;
-       }
-}
-
-
-int add_network(const char *ifname)
-{
-       char res[30];
-
-       if (wpa_command_resp(ifname, "ADD_NETWORK", res, sizeof(res)) < 0)
-               return -1;
-       return atoi(res);
-}
-
-
-int set_network(const char *ifname, int id, const char *field,
-               const char *value)
-{
-       char buf[200];
-       snprintf(buf, sizeof(buf), "SET_NETWORK %d %s %s", id, field, value);
-       return wpa_command(ifname, buf);
-}
-
-
-int set_network_quoted(const char *ifname, int id, const char *field,
-                      const char *value)
-{
-       char buf[200];
-       snprintf(buf, sizeof(buf), "SET_NETWORK %d %s \"%s\"",
-                id, field, value);
-       return wpa_command(ifname, buf);
-}
-
-
-int start_sta_mode(struct sigma_dut *dut)
-{
-       FILE *f;
-       char buf[100];
-       char *ifname;
-
-       if (dut->mode == SIGMA_MODE_STATION)
-               return 0;
-
-       if (dut->mode == SIGMA_MODE_AP) {
-               if (system("killall hostapd") == 0) {
-                       int i;
-
-                       /* Wait some time to allow hostapd to complete cleanup
-                        * before starting a new process */
-                       for (i = 0; i < 10; i++) {
-                               usleep(500000);
-                               if (system("pidof hostapd") != 0)
-                                       break;
-                       }
-               }
-       }
-
-       if (dut->mode == SIGMA_MODE_SNIFFER && dut->sniffer_ifname) {
-               snprintf(buf, sizeof(buf), "ifconfig %s down",
-                        dut->sniffer_ifname);
-               if (system(buf) != 0) {
-                       sigma_dut_print( DUT_MSG_INFO,
-                                       "Failed to run '%s'", buf);
-               }
-               snprintf(buf, sizeof(buf), "iw dev %s set type station",
-                        dut->sniffer_ifname);
-               if (system(buf) != 0) {
-                       sigma_dut_print( DUT_MSG_INFO,
-                                       "Failed to run '%s'", buf);
-               }
-       }
-
-       dut->mode = SIGMA_MODE_STATION;
-
-       ifname = get_main_ifname();
-       if (wpa_command(ifname, "PING") == 0)
-               return 0; /* wpa_supplicant is already running */
-
-       /* Start wpa_supplicant */
-       f = fopen("/tmp/sigma_dut-sta.conf", "w");
-       if (f == NULL)
-               return -1;
-
-       fprintf(f, "ctrl_interface=%s\n", local_cli_dir);
-       fprintf(f, "device_name=Test client\n");
-       fprintf(f, "device_type=1-0050F204-1\n");
-       fclose(f);
-
-       snprintf(buf, sizeof(buf), "wpa_supplicant -Dnl80211 -i%s -B "
-                "-c/tmp/sigma_dut-sta.conf", ifname);
-       if (system(buf) != 0) {
-               sigma_dut_print( DUT_MSG_INFO, "Failed to run '%s'", buf);
-               return -1;
-       }
-
-       sleep(1);
-
-       if (wpa_command(ifname, "PING")) {
-               sigma_dut_print( DUT_MSG_INFO, "Failed to communicate "
-                               "with wpa_supplicant");
-               return -1;
-       }
-
-       return 0;
-}
-
-
-void stop_sta_mode(struct sigma_dut *dut)
-{
-        if (if_nametoindex("eth1") > 0) {
-          wpa_command("eth1", "TERMINATE");
-          return ;
-        }
-       wpa_command("wlan0", "TERMINATE");
-       wpa_command("wlan1", "TERMINATE");
-       wpa_command("ath0", "TERMINATE");
-       wpa_command("ath1", "TERMINATE");
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_helpers.h b/drivers/net/wireless/ar6003/host/tools/sigma-dut/wpa_helpers.h
deleted file mode 100644 (file)
index 4cac740..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Sigma Control API DUT (station/AP)
- * Copyright (c) 2010, Atheros Communications, Inc.
- */
-
-#ifndef WPA_HELPERS_H
-#define WPA_HELPERS_H
-
-char * get_main_ifname(void);
-char * get_station_ifname(void);
-int wpa_command(const char *ifname, const char *cmd);
-int wpa_command_resp(const char *ifname, const char *cmd,
-                    char *resp, size_t resp_size);
-int get_wpa_status(const char *ifname, const char *field, char *obuf,
-                  size_t obuf_size);
-void remove_wpa_networks(const char *ifname);
-
-struct wpa_ctrl * open_wpa_mon(const char *ifname);
-int wait_ip_addr(struct sigma_dut *dut, const char *ifname);
-int get_wpa_cli_event(struct sigma_dut *dut, struct wpa_ctrl *mon,
-                     const char *event, char *buf, size_t buf_size);
-int get_wpa_cli_event2(struct sigma_dut *dut, struct wpa_ctrl *mon,
-                      const char *event, const char *event2,
-                      char *buf, size_t buf_size);
-
-int add_network(const char *ifname);
-int set_network(const char *ifname, int id, const char *field,
-               const char *value);
-int set_network_quoted(const char *ifname, int id, const char *field,
-                      const char *value);
-
-int start_sta_mode(struct sigma_dut *dut);
-void stop_sta_mode(struct sigma_dut *dut);
-
-#endif /* WPA_HELPERS_H */
diff --git a/drivers/net/wireless/ar6003/host/tools/wlan_tool/Android.mk b/drivers/net/wireless/ar6003/host/tools/wlan_tool/Android.mk
deleted file mode 100644 (file)
index 7ed8e79..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2010 Atheros Corporation.  All rights reserved.
-# 
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-
-ifneq ($(TARGET_SIMULATOR),true)
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := wlan_tool
-LOCAL_MODULE_TAGS := debug eng optional
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH :=  $(TARGET_OUT)/bin
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-include $(BUILD_PREBUILT)
-
-
-endif
diff --git a/drivers/net/wireless/ar6003/host/tools/wlan_tool/wlan_tool b/drivers/net/wireless/ar6003/host/tools/wlan_tool/wlan_tool
deleted file mode 100644 (file)
index 84e6fcd..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-#!/system/bin/sh
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2010 Atheros Corporation.  All rights reserved.
-# $ATH_LICENSE_HOSTSDK0_C$
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-CLK_HELPER=0
-#WMODE="bg"
-IFNAME=`getprop wifi.interface wlan0`
-ARGS=`getprop wlan.driver.args "\"ifname=$IFNAME\""`
-# for HotSpot +
-AP_IF=`getprop wifi.ap.interface softap0`
-AP_ARGS=`getprop wlan.driver.args "ifname=$AP_IF devmode=ap"`
-AP_WLAN_ENABLE_CHECK="wmiconfig -i $AP_IF --getRTS"
-# for HotSpot -
-MODE_TCMD="insmod_tcmd"
-MODE_WLAN="insmod"
-TAGS="wlan_tool"
-MODULE_CHECK="ls /sys/bus/sdio/drivers/ar6k_wlan"
-WLAN_ENABLE_CHECK="wmiconfig -i $IFNAME --getRTS"
-DRIVER_PROP_NAME="wlan.driver.status"
-APMODE_PROP_NAME="wlan.driver.apmode"
-WIFI_STATUS="`getprop $DRIVER_PROP_NAME failed`"
-BT_ENABLED="" # To be define
-#SYSLOG="echo "
-SYSLOG="log -p i -t $TAGS "
-
-strcmp() {
-    case $1 in
-        $2)
-        return 0;
-        ;;
-        *)
-        return 1;
-        ;;
-    esac
-}
-
-wmode() {
-    case $WMODE in
-        bg)
-        $SYSLOG "Running in 11bg mode"
-        wmiconfig -i $IFNAME --wmode g
-        wmiconfig -i $IFNAME --set_ht_cap g 0 0 1 1 0 1
-        ;;
-        ag)
-        $SYSLOG "Running in 11ag mode"
-        wmiconfig -i $IFNAME --wmode ag
-        wmiconfig -i $IFNAME --set_ht_cap g 0 0 1 1 0 1
-        wmiconfig -i $IFNAME --set_ht_cap a 0 1 1 1 0 1
-        ;;
-        *)
-        $SYSLOG "Running in 11bgn mode"
-        ;;
-    esac
-}
-
-do_setprop() {
-    setprop $1 $2
-    for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
-        if strcmp `getprop $1` $2; then
-            break
-        fi
-        setprop $1 $2
-    done
-}
-
-do_rmmod() {
-    if ! rmmod ar6000; then
-        $SYSLOG "Fallback to use on property:wlan.driver.status=rmmod which will exec /system/bin/rmmod"
-        do_setprop $DRIVER_PROP_NAME rmmod
-        for i in 1 2 3 4 5 6 7 8 9 10; do
-            if ! $MODULE_CHECK; then
-                break;
-            fi
-            sleep 1
-        done
-    fi
-}
-
-do_insmod() {
-    case $1 in
-    $MODE_TCMD)
-    MOD_ARGS="testmode=1"
-    ;;
-    *)
-    MOD_ARGS=$ARGS
-    ;;
-    esac      
-    if ! insmod /system/wifi/ar6000.ko $MOD_ARGS; then
-        $SYSLOG "Fallback to use on property:wlan.driver.status=insmod which will insmod"
-        do_setprop $DRIVER_PROP_NAME $1
-        for i in 1 2 3 4 5 6 7 8 9 10; do
-            if $MODULE_CHECK; then
-                break;
-            fi
-            sleep 1
-        done
-    fi
-}
-
-reload() {
-    if $MODULE_CHECK; then
-        do_rmmod
-    fi
-    $SYSLOG "Try to load driver with $@"
-    do_insmod $@
-    
-    for i in 1 2 3 4 5 6 7 8 9 10; do
-        if $WLAN_ENABLE_CHECK; then
-            break;
-        fi
-        sleep 1
-    done
-#    wmode
-    if exp $CLK_HELPER == 1; then
-        if exp $BT_ENABLED == 1; then
-            $SYSLOG "Setup bt on"
-            wmiconfig -i $IFNAME --bt on
-        else
-            $SYSLOG "Setup bt off"
-            wmiconfig -i $IFNAME --bt off
-        fi
-    fi
-}
-
-# for HotSpot +
-ap_reload() {
-    if $MODULE_CHECK; then
-        rmmod ar6000
-    fi
-    $SYSLOG "Try to load AP driver with $@"
-    insmod /system/wifi/ar6000.ko $@
-
-    for i in 1 2 3 4 5 6 7 8 9 10; do
-        if $AP_WLAN_ENABLE_CHECK; then
-            break;
-        fi
-        sleep 1
-    done
-}
-# for HotSpot -
-init() {
-    setprop wifi.interface wlan0
-    do_setprop $APMODE_PROP_NAME "unloaded"
-    mkdir /data/misc/wifi/wpa_supplicant
-    mkdir /data/misc/wifi/hostapd
-    mkdir /data/system/wpa_supplicant /data/system/hostapd  
-    chmod 770 /data/misc/wifi/wpa_supplicant /data/misc/wifi/hostapd
-    chown wifi.wifi /data/misc/wifi/wpa_supplicant /data/misc/wifi/hostapd
-    chown wifi.wifi /data/system/wpa_supplicant /data/system/hostapd
-    chown system.system /sys/devices/platform/msm_sdcc.1/detect_change
-    chown system.system /sys/devices/platform/msm_sdcc.2/detect_change
-    if exp $CLK_HELPER == 1; then
-        reload $MODE_WLAN
-        wmiconfig -i $IFNAME --wlan disable
-    fi
-}
-
-checkapmode() {
-    if strcmp `getprop $APMODE_PROP_NAME unloaded` "ok"; then
-        return 0
-    else 
-        return 1
-    fi
-}
-
-# for HotSpot +
-loadAPdriver() {
-    $SYSLOG "AP wifi loading"
-    setprop $DRIVER_PROP_NAME ""
-    if $MODULE_CHECK; then
-        $SYSLOG "AP Driver is initialized. load it"
-        wmiconfig -i $AP_IF --wlan disable
-        sleep 1
-        wmiconfig -i $AP_IF --wlan enable
-    else
-        ap_reload $AP_ARGS
-    fi
-    if $AP_WLAN_ENABLE_CHECK; then
-        $SYSLOG "ar6000 AP driver loaded"
-        setprop $DRIVER_PROP_NAME "ok"
-    else
-        $SYSLOG "ar6000 AP driver fails to load"
-        setprop $DRIVER_PROP_NAME "failed"
-    fi
-}
-# for HotSpot -
-
-loaddriver() {
-    $SYSLOG "wifi loading"
-    if checkapmode; then
-        $SYSLOG "Ap mode is running!"
-        do_setprop $DRIVER_PROP_NAME "failed"
-        return
-    fi
-    do_setprop $DRIVER_PROP_NAME "x"
-    if $MODULE_CHECK; then
-        $SYSLOG "Driver is initialized. load it"
-        wmiconfig -i $IFNAME --wlan enable
-    else
-        reload $MODE_WLAN
-    fi   
-    if $WLAN_ENABLE_CHECK; then
-        ifconfig $IFNAME up
-        $SYSLOG "ar6000 driver loaded"
-        do_setprop $DRIVER_PROP_NAME "ok"
-    else
-        $SYSLOG "ar6000 driver fails to load"
-        do_setprop $DRIVER_PROP_NAME "failed"
-    fi
-}
-
-unloaddriver() {
-    $SYSLOG "wifi unloading"
-    if checkapmode; then
-        $SYSLOG "Ap mode is running!"
-        do_setprop $DRIVER_PROP_NAME "failed"
-        return
-    fi
-    if exp $CLK_HELPER == 1; then
-        wmiconfig -i $IFNAME --wlan disable        
-    else
-        do_rmmod
-    fi
-    for i in 1 2 3 4 5 6 7 8 9 10; do
-        if ! $WLAN_ENABLE_CHECK; then
-            break;
-        fi
-        sleep 1
-    done
-    do_setprop $DRIVER_PROP_NAME "unloaded"
-}
-
-testmodeup() {
-    do_setprop $DRIVER_PROP_NAME "x"
-    reload $MODE_TCMD
-    if $WLAN_ENABLE_CHECK; then
-        $SYSLOG "ar6000 driver loaded"
-        do_setprop $DRIVER_PROP_NAME "ok"
-    else
-        $SYSLOG "ar6000 driver fails to load"
-        do_setprop $DRIVER_PROP_NAME "failed"
-    fi
-}
-
-testmodedown() {
-    if $MODULE_CHECK; then
-        do_rmmod
-    fi
-    if exp $CLK_HELPER == 1; then
-        reload $MODE_WLAN
-        wmiconfig -i $IFNAME --wlan disable
-    fi
-    do_setprop $DRIVER_PROP_NAME "unloaded"
-}
-
-apmodedown() {
-    $SYSLOG "Shutting down Ap mode"
-    iwconfig $IFNAME mode managed
-    iwconfig $IFNAME essid off
-    do_setprop $APMODE_PROP_NAME "unloaded"
-    unloaddriver
-}
-
-apmodeup() {
-    $SYSLOG "Running for AP mode"
-    if strcmp $WIFI_STATUS "ok"; then
-        $SYSLOG "Station mode is running. exit"
-        return
-    fi
-    if checkapmode; then
-        apmodedown
-    fi
-    if $MODULE_CHECK; then
-        wmiconfig -i $IFNAME --wlan enable
-    else
-        reload $MODE_WLAN
-        wmiconfig -i $IFNAME --connect dummy
-    fi 
-}
-
-if ! ls /system/bin/wmiconfig; then
-    $SYSLOG "Cannot find wmiconfig!!!!"
-fi 
-
-case $1 in 
-    dhcpcd)
-    /system/bin/dhcpcd -B $IFNAME
-    ;;
-    wpa_supplicant)
-    /system/bin/wpa_supplicant -Dwext -i$IFNAME -c/data/misc/wifi/wpa_supplicant.conf
-    ;;
-    hostapd)
-    /system/bin/hostapd /data/misc/wifi/hostapd.conf
-    ;;
-    abtfilt)
-    /system/bin/abtfilt -d -z -n -v -s
-    ;;
-    bton)
-    if ! $MODULE_CHECK && exp $CLK_HELPER == 1; then
-        $SYSLOG "Run BT clock helper"
-        init
-    fi
-    do_setprop wlan.driver.btcoex ok
-    ;;
-    btoff)
-    if ! strcmp $WIFI_STATUS "ok"; then
-        if $MODULE_CHECK && exp $CLK_HELPER == 1; then
-            $SYSLOG "Stop BT clock helper"
-            do_rmmod
-        fi
-    fi
-    do_setprop wlan.driver.btcoex ok
-    ;;
-    unload)    
-    unloaddriver
-    ;;
-    load)
-    loaddriver
-    ;;
-# for HotSpot +
-    load_ap)
-    $SYSLOG "loadAPdriver+"
-    loadAPdriver
-    $SYSLOG "loadAPdriver-"
-    ;;
-# for HotSpot -
-    testmodeup)
-    testmodeup
-    ;;
-    testmodedown)
-    testmodedown
-    ;;
-    apmodeup)
-    apmodeup
-    ;;
-    apmodedown)
-    apmodedown
-    ;;
-    recEvent)
-    mv /data/ar6k.log /data/ar6k.previous.log
-    recEvent --logfile=/data/ar6k.log --binary --reclimit=10000
-    ;;
-    *) 
-    init
-    ;;
-esac
diff --git a/drivers/net/wireless/ar6003/host/tools/wmiconfig/Android.mk b/drivers/net/wireless/ar6003/host/tools/wmiconfig/Android.mk
deleted file mode 100644 (file)
index 5d570bb..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2010 Atheros Corporation.  All rights reserved.
-# 
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES := \
-       $(LOCAL_PATH)/../../include \
-    $(LOCAL_PATH)/../../os/linux/include \
-    $(LOCAL_PATH)/../../../include \
-    $(LOCAL_PATH)/../../wlan/include
-
-LOCAL_CFLAGS+=-DUSER_KEYS
-LOCAL_SRC_FILES:= wmiconfig.c
-LOCAL_MODULE := wmiconfig
-LOCAL_MODULE_TAGS := debug eng optional
-include $(BUILD_EXECUTABLE)
-
-
diff --git a/drivers/net/wireless/ar6003/host/tools/wmiconfig/Makefile b/drivers/net/wireless/ar6003/host/tools/wmiconfig/Makefile
deleted file mode 100644 (file)
index 9cb2773..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#------------------------------------------------------------------------------
-# <copyright file="makefile" company="Atheros">
-#    Copyright (c) 2005-2008 Atheros Corporation.  All rights reserved.
-# 
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-#
-#------------------------------------------------------------------------------
-#==============================================================================
-# Author(s): ="Atheros"
-#==============================================================================
-CC :=$(ATH_CROSS_COMPILE_TYPE)gcc
-ifeq ($(ATH_BUILD_PAL_APP),yes)
-AR :=$(ATH_CROSS_COMPILE_TYPE)ar
-RM :=$(ATH_CROSS_COMPILE_TYPE)rm
-
-USERF_FLAGS=-DATH_INCLUDE_PAL
-KERNEL_SRC :=$(ATH_LINUXPATH)
-PAL_SRC=../pal_host_intf/pal_api.c ../pal_host_intf/pal_intf.c ../pal_host_intf/pal_util.c ../palEventRecv/hciParser.c
-PAL_OBJ=pal_api.o pal_intf.o pal_util.o hciParser.o
-PAL_INTF_LIB=libpal_intf.a
-INCLUDE_THREAD=-lpthread
-else
-USERF_FLAGS=
-PAL_OBJ=
-PAL_INTF_LIB=
-INCLUDE_THREAD=
-endif
-APP=wmiconfig
-
-all:
-ifeq ($(ATH_BUILD_PAL_APP),yes)
-       $(CC) -Wall $(USERF_FLAGS) -c -I./ -I$(KERNEL_SRC)/include -I../../include -I../../../include -I../../wlan/include -I../../os/linux/include  $(PAL_SRC)
-       $(AR) -crs $(PAL_INTF_LIB) $(PAL_OBJ)
-endif
-       $(CC) -Wall $(USERF_FLAGS) -DUSER_KEYS -g -I$(KERNEL_SRC)/include -I../../include -I../../../include -I../../wlan/include -I../../os/linux/include wmiconfig.c $(PAL_INTF_LIB)  -o $(APP) $(INCLUDE_THREAD)
-
-clean:
-ifeq ($(ATH_BUILD_PAL_APP),yes)
-       $(RM) $(PAL_OBJ) $(PAL_INTF_LIB)
-endif
-       $(RM) $(APP)
diff --git a/drivers/net/wireless/ar6003/host/tools/wmiconfig/wmiconfig.c b/drivers/net/wireless/ar6003/host/tools/wmiconfig/wmiconfig.c
deleted file mode 100644 (file)
index c6fed41..0000000
+++ /dev/null
@@ -1,5108 +0,0 @@
-/*
- * Copyright (c) 2004-2009 Atheros Communications Inc.
- * All rights reserved.
- * 
- * 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
- *
- *
- */
-#define SUPPORT_11N
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <linux/types.h>
-#include <linux/if.h>
-#include <linux/wireless.h>
-#include <arpa/inet.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <getopt.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <a_config.h>
-#include <a_osapi.h>
-#include <athdefs.h>
-#include <a_types.h>
-#include <wmi.h>
-#include <ar6kap_common.h>
-#include "athdrv_linux.h"
-#include "ieee80211.h"
-#include "ieee80211_ioctl.h"
-#include "wmiconfig.h"
-#include "targaddrs.h"
-#include "pkt_log.h"
-
-#if WIRELESS_EXT >= 18
-/* only allow WPA config commands if this is compiled against distribution
- * with a newer version of the wireless extensions */
-#define WPA_SUPPORT
-#endif
-
-#define TO_LOWER(c) ((((c) >= 'A') && ((c) <= 'Z')) ? ((c)+ 0x20) : (c))
-
-#define ISDIGIT(c)  ( (((c) >= '0') && ((c) <= '9')) ? (1) : (0) )
-
-static int send_connect_cmd();
-
-static int send_scan_probedssid_cmd();
-
-static int _from_hex(char c);
-static A_INT8 getPhyMode(char *pArg);
-
-static A_UINT16 wmic_ieee2freq(int chan);
-static A_STATUS wmic_ether_aton(const char *orig, A_UINT8 *eth);
-void            printTargetStats(TARGET_STATS *pStats);
-A_STATUS
-wmic_validate_roam_ctrl(WMI_SET_ROAM_CTRL_CMD *pRoamCtrl, A_UINT8 numArgs,
-                        char **argv);
-A_STATUS
-wmic_validate_appie(struct ieee80211req_getset_appiebuf *appIEInfo, char **argv);
-
-A_STATUS
-wmic_validate_mgmtfilter(A_UINT32 *pMgmtFilter, char **argv);
-void convert_hexstring_bytearray(char *hexStr, A_UINT8 *byteArray,
-                                    A_UINT8 numBytes);
-static int is_mac_null(A_UINT8 *mac);
-void print_wild_mac(unsigned char *mac, char wildcard);
-A_STATUS wmic_ether_aton_wild(const char *orig, A_UINT8 *eth, A_UINT8 *wild);
-void printBtcoexConfig(WMI_BTCOEX_CONFIG_EVENT * pConfig);
-void printBtcoexStats(WMI_BTCOEX_STATS_EVENT * pStats);
-#ifdef ATH_INCLUDE_PAL
-void *phy_attach(char *if_name);
-int pal_send_hci_cmd(void *dev, char *buf, short sz);
-int pal_send_acl_data_pkt(void *dev, char *buf, short sz);
-void cmdParser(A_UINT8 *cmd,A_UINT16 len);
-void palData(A_UINT8 *data,A_UINT32 len);
-extern int eventLogLevel; //To enable/disable Debug messages. defined in pal parser library
-const char palcommands[]=
-"--sendpalcmd <filename> <on/off> ; on - enable debug; off - disable debug \n\
---sendpaldata <filename> <on/off>; on - enable debug; off - disable debug \n";
-#endif
-const char *progname;
-const char commands[] =
-"commands:\n\
---version\n\
---power <mode> where <mode> is rec or maxperf\n\
---getpower is used to get the power mode(rec or maxperf)\n\
---pmparams --it=<msec> --np=<number of PS POLL> --dp=<DTIM policy: ignore/normal/stick> --twp=<Tx wakeup policy: wakeup/sleep> --nt=<number of tx to wakeup>\n\
---psparams --psPollTimer=<psPollTimeout> --triggerTimer=<triggerTimeout> --apsdTimPolicy=<ignore/adhere> --simulatedAPSDTimPolicy=<ignore/adhere>\n\
---forceAssert \n\
---ibsspmcaps --ps=<disable/atheros/ieee> --aw=<ATIM Windows in millisecond> --to=<TIMEOUT in millisecond> --ttl=<Time to live in number of beacon periods>\n\
---appsparams --pstype=<disable/atheros> --psit=<millisecond> --psperiod=<in microsecond> --sleepperiod=<in psperiods>\n\
---scan --fgstart=<sec> --fgend=<sec> --bg=<sec> --minact=<msec> maxact=<msec> --pas=<msec> --sr=<short scan ratio> --maxact2pas=<msec> --scanctrlflags <connScan> <scanConnected> <activeScan> <roamScan> <reportBSSINFO> <EnableAutoScan> --maxactscan_ssid=<Max no of active scan per probed ssid>\n\
-  where: \n\\n\
-  <connScan>           is 0 to not scan when Connect and Reconnect command, \n\
-                          1 to scan when Connect and Reconnect command, \n\
-  <scanConnected>      is 0 to skip the ssid it is already connected to, \n\
-                          1 to scan the ssid it is already connected to, \n\
-  <activeScan>         is 0 to disable active scan, \n\
-                          1 to enable active scan, \n\
-  <roamScan>           is 0 to disable roam scan when beacom miss and low rssi.(It's only valible when connScan is 0.\n\
-                          1 to enable roam scan.\n\
-  <reportBSSINFO>      is 0 to disable specified BSSINFO reporting rule.\n\
-                          1 to enable specified BSSINFO reporting rule.\n\
- <EnableAutoScan>      is 0 to disable autonomous scan. No scan after a disconnect event\n\
-                          1 Enable autonomous scan.\n\
---listen=<#of TUs, can  range from 15 to 5000>\n\
---listenbeacons=<#of beacons, can  range from 1 to 50>\n\
---setbmisstime <#of TUs, can range from 1000 to 5000>\n\
---setbmissbeacons <#of beacons, can range from 5 to 50>\n\
---filter=<filter> --ieMask 0x<mask> where <filter> is none, all, profile, not_profile, bss, not_bss, or ssid and <mask> is a combination of the following\n\
-{\n\
-    BSS_ELEMID_CHANSWITCH = 0x01 \n\
-    BSS_ELEMID_ATHEROS = 0x02\n\
-}\n\
---wmode <mode> <list> sc <scan> where \n\
-        <mode> is a, g, b,ag, gonly (use mode alone in AP mode) \n\
-        <list> is a list of channels (frequencies in mhz or ieee channel numbers)\n\
-        <scan> is 0 to disable scan after setting channel list.\n\
-                  1 to enable scan after setting channel list.\n\
---getwmode \n\
---ssid=<ssid> [--num=<index>] where <ssid> is the wireless network string and <index> is 0 or 1 (set to 0 if not specified). Set ssid to 'off' to clear the entry\n\
---badAP=<macaddr> [--num=<index>] where macaddr is macaddr of AP to be avoided in xx:xx:xx:xx:xx:xx format, and num is index from 0-1.\n\
---clrAP [--num=<index>] is used to clear a badAP entry.  num is index from 0-1\n\
---createqos <user priority> <direction> <traffic class> <trafficType> <voice PS capability> \n\
-    <min service interval> <max service interval> <inactivity interval> <suspension interval> \n\
-    <service start time> <tsid> <nominal MSDU> <max MSDU> <min data rate> <mean data rate> \n\
-    <peak data rate> <max burst size> <delay bound> <min phy rate> <sba> <medium time>where:\n\
-        <user priority>         802.1D user priority range : 0-7        \n\
-        <direction>             is 0 for Tx(uplink) traffic,            \n\
-                                   1 for Rx(downlink) traffic,          \n\
-                                   2 for bi-directional traffic;        \n\
-        <traffic class>         is 0 for BE,                            \n\
-                                   1 for BK,                            \n\
-                                   2 for VI,                            \n\
-                                   3 for VO;                            \n\
-        <trafficType>           1-periodic, 0-aperiodic                 \n\
-        <voice PS capability>   specifies whether the voice power save mechanism \n\
-                                (APSD if AP supports it or legacy/simulated APSD \n\
-                                    [using PS-Poll] ) should be used             \n\
-                                = 0 to disable voice power save for this traffic class,\n\
-                                = 1 to enable APSD voice power save for this traffic class,\n\
-                                = 2 to enable voice power save for ALL traffic classes,\n\
-        <min service interval>  in milliseconds                     \n\
-        <max service interval>  in milliseconds                     \n\
-        <inactivity interval>   in milliseconds;=0 means infinite inactivity interval\n\
-        <suspension interval>   in milliseconds \n\
-        <service start time>    service start time \n\
-        <tsid>                  TSID range: 0-15                    \n\
-        <nominal MSDU>          nominal MAC SDU size                \n\
-        <max MSDU>              maximum MAC SDU size                \n\
-        <min data rate>         min data rate in bps                \n\
-        <mean data rate>        mean data rate in bps               \n\
-        <peak data rate>        peak data rate in bps               \n\
-        <max burst size>        max burst size in bps               \n\
-        <delay bound>           delay bound                         \n\
-        <min phy rate>          min phy rate in bps                 \n\
-        <sba>                   surplus bandwidth allowance         \n\
-        <medium time>           medium time in TU of 32-us periods per sec    \n\
---deleteqos <trafficClass> <tsid> where:\n\
-  <traffic class>         is 0 for BE,                            \n\
-                             1 for BK,                            \n\
-                             2 for VI,                            \n\
-                             3 for VO;                            \n\
-  <tsid> is the TspecID, use --qosqueue option to get the active tsids\n\
---qosqueue <traffic class>, where:\n\
-  <traffic class>         is 0 for BE,                            \n\
-                             1 for BK,                            \n\
-                             2 for VI,                            \n\
-                             3 for VO;                            \n\
---getTargetStats --clearStats\n\
-   tx_unicast_rate, rx_unicast_rate values will be 0Kbps when no tx/rx \n\
-   unicast data frame is received.\n\
---setErrorReportingBitmask\n\
---acparams --acval <0-3> --txop <limit> --cwmin <0-15> --cwmax <0-15> --aifsn<0-15>\n\
---disc=<timeout> to set the disconnect timeout in seconds\n\
---mode <mode> set the optional mode, where mode is special or off \n\
---sendframe <frmType> <dstaddr> <bssid> <optIEDatalen> <optIEData> where:\n\
-  <frmType>   is 1 for probe request frame,\n\
-                 2 for probe response frame,\n\
-                 3 for CPPP start,\n\
-                 4 for CPPP stop, \n\
-  <dstaddr>   is the destination mac address, in xx:xx:xx:xx:xx:xx format, \n\
-  <bssid>     is the bssid, in xx:xx:xx:xx:xx:xx format, \n\
-  <optIEDatalen> optional IE data length,\n\
-  <optIEData> is the pointer to optional IE data arrary \n\
---adhocbssid <macaddr> where macaddr is the BSSID for IBSS to be created in xx:xx:xx:xx:xx:xx format\n\
---beaconintvl   <beacon_interval in milliseonds> \n\
---getbeaconintvl \n\
---setretrylimits  <frameType> <trafficClass> <maxRetries> <enableNotify>\n\
-  <frameType>      is 0 for management frame, \n\
-                      1 for control frame,\n\
-                      2,for data frame;\n\
-  <trafficClass>   is 0 for BE, 1 for BK, 2 for VI, 3 for VO, only applies to data frame type\n\
-  <maxRetries>     is # in [2 - 13];      \n\
-  <enableNotify>   is \"on\" to enable the notification of max retries exceed \n\
-                      \"off\" to disable the notification of max retries excedd \n\
---rssiThreshold <weight> <pollTimer> <above_threshold_tag_1> <above_threshold_val_1> ... \n\
-                <above_threshold_tag_6> <above_threshold_val_6> \n\
-                <below_threshold_tag_1> <below_threshold_val_1> ... \n\
-                <below_threshold_tag_6> <below_threshold_val_6> \n\
-  <weight>        share with snrThreshold\n\
-  <threshold_x>   will be converted to negatvie value automatically, \n\
-                   i.e. input 90, actually -90 will be set into HW\n\
-  <pollTimer>     is timer to poll rssi value(factor of LI), set to 0 will disable all thresholds\n\
-                 \n\
---snrThreshold <weight> <upper_threshold_1> ... <upper_threshold_4> \n\
-               <lower_threshold_1> ... <lower_threshold_4> <pollTimer>\n\
-  <weight>        share with rssiThreshold\n\
-  <threshold_x>  is positive value, in ascending order\n\
-  <pollTimer>     is timer to poll snr value(factor of LI), set to 0 will disable all thresholds\n\
-                 \n\
---cleanRssiSnr \n\
---lqThreshold <enable> <upper_threshold_1>  ... <upper_threshold_4>\n\
-              <lower_threshold_1> ... <lower_threshold_4>\n\
-   <enable>       is 0 for disable,\n\
-                     1 for enable lqThreshold\n\
-   <threshold_x>  is in ascending order            \n\
---setlongpreamble <enable>\n\
-    <enable>      is 0 for diable,\n\
-                     1 for enable.\n\
---setRTS  <pkt length threshold>\n\
---getRTS \n\
---startscan   --homeDwellTime=<msec> --forceScanInt<ms> --forceScanFlags <scan type> <forcefgscan> <isLegacyCisco> --scanlist <list> where:\n\
-  <homeDwellTime>     Maximum duration in the home channel(milliseconds),\n\
-  <forceScanInt>      Time interval between scans (milliseconds),\n\
-    <scan type>     is 0 for long scan,\n\
-                     1 for short scan,\n\
-  <forcefgscan>   is 0 for disable force fgscan,\n\
-                     1 for enable force fgscan,\n\
-  <isLegacyCisco> is 0 for disable legacy Cisco AP compatible,\n\
-                     1 for enable legacy Cisco AP compatible,\n\
-  <list> is a list of channels (frequencies in mhz or ieee channel numbers)\n\
---setfixrates <rate index> where: \n\
-  <rate index> is {0 1M},{1 2M},{2 5.5M},{3 11M},{4 6M},{5 9M},{6 12M},{7 18M},{8 24M},{9 36M},{10 48M},{11 54M},\n\
-  if want to config more rare index, can use blank to space out, such as: --setfixrates 0 1 2 \n\
---getfixrates : Get the fix rate index from target\n\
---setauthmode <mode> where:\n\
-  <mode>        is 0 to do authentication when reconnect, \n\
-                   1 to not do authentication when reconnect.(not clean key). \n\
---setreassocmode <mode> where:\n\
-  <mode>        is 0 do send disassoc when reassociation, \n\
-                   1 do not send disassoc when reassociation. \n\
---setVoicePktSize  is maximum size of voice packet \n\
---setMaxSPLength   is the maximum service period in packets, as applicable in APSD \n\
-                   0 - deliver all packets \n\
-                   1 - deliver up to 2 packets \n\
-                   2 - deliver up to 4 packets \n\
-                   3 - deliver up to 6 packets \n\
---setAssocIe <IE String>\n\
---roam <roamctrl> <info>\n\
-       where <roamctrl> is   1  force a roam to specified bssid\n\
-                             2  set the roam mode \n\
-                             3  set the host bias of the specified BSSID\n\
-                             4 set the lowrssi scan parameters \n\
-      where <info> is BSSID<aa:bb:cc:dd:ee:ff> for roamctrl of 1\n\
-                      DEFAULT ,BSSBIAS or LOCK for roamctrl of 2\n\
-                      BSSID<aa:bb:cc:dd:ee:ff> <bias> for  roamctrl of 3\n\
-                             where <bias> is  a value between -256 and 255\n\
-                      <scan period> <scan threshold> <roam threshold> \n\
-                      <roam rssi floor> for roamctrl of 4\n\
---getroamtable\n\
---getroamdata\n\
---wlan <enable/disable/query>\n\
---bt <on/off/query>\n\
---setBTstatus <streamType> <status>\n\
-      where <streamType> is    1 - Bluetooth SCO stream\n\
-                               2 - Bluetooth A2DP stream\n\
-                               3 - Bluetooth Inquiry/low priority stream\n\
-                               4 - Bluetooth E-SCO stream\n\
-      \n\
-      where <status> is        1 - stream started\n\
-                               2 - stream stopped\n\
-                               3 - stream resumed\n\
-                               4 - stream suspended\n\
---setBTparams <paramType> <params>\n\
-      where <paramType> is     1 - Bluetooth SCO stream parameters\n\
-                               2 - Bluetooth A2DP stream parameters \n\
-                               3 - Front end antenna configuration \n\
-                               4 - Co-located Bluetooth configuration\n\
-                               5 - Bluetooth ACL coex (non-a2dp) parameters\n\
-                               6 - 11a is using a separate antenna\n\
-      \n\
-      where <params> for Bluetooth SCO are:\n\
-              <numScoCyclesForceTrigger> - number of Sco cyles, to force a trigger\n\
-               <dataResponseTimeout> - timeout for receiving downlink packet per PS-poll\n\
-               <stompScoRules> - Applicable for dual/splitter front end\n\
-                           1, Never stomp BT to receive downlink pkt\n\
-                           2, Always stomp BT to receive downlink pkt\n\
-                           3, Stomp BT only during low rssi conditions\n\
-               <stompDutyCyleVal> If Sco is stomped while waiting for downlink pkt, number sco cyles to not queue ps-poll-(Applicable only for switch FE)\n\
-              <psPollLatencyFraction> Fraction of idle SCO idle time.\n\
-                           1, if more than 3/4 idle duration is left, retrieve downlink pkt\n\
-                           2, if more than 1/2 idle duration is left, retrieve downlink pkt\n\
-                           3, if more 1/4 idle duration is left, retrieve dwnlink pkt\n\
-               <SCO slots> - number of Tx+Rx SCO slots : 2 for single-slot SCO, 6 for 3-slot SCO\n\
-          <Idle SCO slots> - number of idle slots between two SCO Tx+Rx instances\n\
-      \n\
-      where <params> for A2DP configuration are\n\
-      <a2dpWlanUsageLimit> Max duration wlan can use the medium ,whenever firmware detects medium for wlan (in msecs) \n\
-     <a2dpBurstCntMin> Mininum number of bluetooth data frames to replenish wlan usage time\n\
-     <a2dpDataRespTimeout> Time to wait for downlink data, after queuing pspoll\n\
-      where <params> for front end antenna configuration are\n\
-      1 - Dual antenna configuration (BT and wlan have seperate antenna) \n\
-      2 - Single antenna splitter configuration \n\
-      3 - Single antenna switch  configuration \n\
-      \n\
-      where <params> for co-located Bluetooth configuration are\n\
-      0 - Qualcomm BTS402x (default)\n\
-      1 - CSR Bluetooth\n\
-      2 - Atheros Bluetooth\n\
-      \n\
-      where <params> for Bluetooth ACL coex(bt ftp or bt OPP or other data based ACL profile (non a2dp)  parameter are \n\
-      <aclWlanMediumUsageTime> Usage time for Wlan.(default 30 msecs)\n\
-      <aclBtMediumUsageTime> Usage time for bluetooth (default 30 msecs)\n\
-      <aclDataRespTimeout> - timeout for receiving downlink packet per PS-poll\n\
---setbtcoexfeant <antType> \n\
-       <antType> - Front end antenna type\n\
-       1 - Single antenna\n\
-       2 - Dual antenna\n\
-       3 - Dual antenna high isolation\n\
-       4 - bypass mode\n\
-       5 - combine mode\n\
---setbtcoexcolocatedbt <btdevType >\n\
-        <btdevType> Co-located bluetooth device\n\
-        1 - Qualcomm BTS402X \n\
-        2 - CSR BC06 bluetooth \n\
-        3 - Atheros 3001 bluetooth\n\
-        4 - ST-ericssion CG2900 \n\
-        5 - Atheros 3002/MCI \n\
---setbtcoexscoconfig <noscoSlots> <noidleslots> <scoflags> <linkid> <scoCyclesForceTrigger> <scoDataResponseTimeout> <scoStompDutyCyleVal> <scoStompDutyCyleMaxVal> <scoPsPollLatencyFraction> <scoStompCntIn100ms> <scoContStompMax> <scoMinlowRateMbps> <scoLowRateCnt> <scoHighPktRatio> <scoMaxAggrSize>\n\
---setbtcoexa2dpconfig <a2dpFlags> <linkid> <a2dpWlanMaxDur> <a2dpMinBurstCnt> <a2dpDataRespTimeout> <a2dpMinlowRateMbps> <a2dpLowRateCnt> <a2dpHighPktRatio> <a2dpMaxAggrSize> <a2dpPktStompCnt>\n\
---setbtcoexaclcoexconfig <aclWlanMediumDur> <aclBtMediumDur> <aclDetectTimeout> <aclPktCntLowerLimit> <aclIterForEnDis> <aclPktCntUpperLimit> <aclCoexFlags> <linkId> <aclDataRespTimeout> <aclCoexMinlowRateMbps> <aclCoexLowRateCnt> <aclCoexHighPktRatio> <aclCoexMaxAggrSize> <aclPktStompCnt>  \n\
---setbtcoexbtinquirypageconfig <btInquiryDataFetchFrequency> <protectBmissDurPostBtInquiry> <btInquiryPageFlag>\n\
---setbtcoexbtoperatingstatus <btprofiletype> <btoperatingstatus> <btlinkid>\n\
-        <btprofiletype> - Bluetooth profile\n\
-        1 - Bluetooth SCO profile \n\
-        2 - Bluetooth A2DP profile \n\
-        3 - Bluetooth Inquiry Page profile \n\
-        4 - Bluetooth ACL (non-a2dp) profile \n\
-        \n\
-        <btoperatingstatus>  profile operating status \n\
-        1 - start \n\
-        2 - stop \n\
-        \n\
-        <btlinkid> bluetooth link id -Applicable only for STE Bluetooth\n\
-        \n\
---setbtcoexdebug <params1> <params2> <params3> <params4> <params5> \n\
---getbtcoexconfig <btprofile> <linkid>\n\
-        <btprofile> - bluetooth profile \n\
-        1 - Bluetooth SCO profile \n\
-        2 - Bluetooth A2DP profile \n\
-        3 - Bluetooth Inquiry Page profile \n\
-        4 - Bluetooth ACL (non-a2dp) profile \n\
-        \n\
-    <btlinkid> bluetooth link id -Applicable only for STE Bluetooth\n\
-    \n\
-\n\
---getbtcoexstats\n\
---detecterror --frequency=<sec> --threshold=<count> where:\n\
-  <frequency>   is the periodicity of the challenge messages in seconds, \n\
-  <threshold>   is the number of challenge misses after which the error detection module in the driver will report an error, \n\
---getheartbeat --cookie=<cookie>\n\
-  <cookie>  is used to identify the response corresponding to a challenge sent\n\
---usersetkeys --initrsc=<on/off>\n\
-  initrsc=on(off> initialises(doesnot initialise) the RSC in the firmware\n\
---getRD\n\
---setcountry <countryCode> (Use --countrycodes for list of codes)\n\
---countrycodes (Lists all the valid country codes)\n\
---getcountry \n\
---disableregulatory\n\
---txopbursting <burstEnable>\n\
-        where <burstEnable> is  0 disallow TxOp bursting\n\
-                                1 allow TxOp bursting\n\
---diagread\n\
---diagwrite\n\
---setkeepalive <keepalive interval>\n\
-  <keepalive interval> is the time within which if there is no transmission/reception activity, the station sends a null packet to AP.\n\
---getkeepalive\n\
---setappie <frame> <IE>\n\
-         where frame is one of beacon, probe, respon, assoc\n\
-               IE is a hex string starting with dd\n\
-               if IE is 0 then no IE is sent in the management frame\n\
---setmgmtfilter <op> <frametype>\n\
-                op is one of set, clear\n\
-                frametype is one of beacon proberesp\n\
---setdbglogconfig --mmask=<mask> --rep=<0/1> --tsr=<tsr codes> --size=<num>\n\
-         where <mask> is a 16 bit wide mask to selectively enable logging for different modules. Example: 0xFFFD enables logging for all modules except WMI. The mask is derived from the module ids defined in etna/include/dbglog.h header file.\n\
-               <rep> is whether the target should generate log events to the host whenever the log buffer is full.\n\
-               <tsr> resolution of the debug timestamp (less than 16)\n\
-                     0: 31.25 us\n\
-                     1: 62.50 us\n\
-                     2: 125.0 us\n\
-                     3: 250.0 us\n\
-                     4: 500.0 us\n\
-                     5: 1.0 ms and so on.\n\
-               <size> size of the report in number of debug logs.\n\
---getdbglogs\n\
---sethostmode <mode>\n\
-  where <mode> is awake\n\
-                  asleep\n\
---setwowmode <mode> --wowfilter <filter> --hostreqdelay <hostreqdelay> \n\
-  where <mode> is enable \n\
-                  disable\n\
-  where <filter> is ssid -to enable ssid filtering when asleep\n\
-                    none \n\
---getwowlist <listid> \n\
---addwowpattern <list-id> <pattern-size> <pattern-offset> <pattern> <pattern-mask \n\
---delwowpattern <list-id> <pattern-id>\n\
---dumpchipmem \n\
---dumpchipmem_venus \n\
---setconnectctrl <ctrl flags bitmask> \n\
-  where <flags> could take the following values:\n\
-      0x0001(CONNECT_ASSOC_POLICY_USER): Assoc frames are sent using the policy specified by the flag below.\n\
-      0x0002(CONNECT_SEND_REASSOC): Send Reassoc frame while connecting otherwise send assoc frames.\n\
-      0x0004(CONNECT_IGNORE_WPAx_GROUP_CIPHER): Ignore WPAx group cipher for WPA/WPA2.\n\
-      0x0008(CONNECT_PROFILE_MATCH_DONE): Ignore any profile check.\n\
-      0x0010(CONNECT_IGNORE_AAC_BEACON): Ignore the admission control beacon.\n\
-      0x0020(CONNECT_CSA_FOLLOW_BSS):Set to Follow BSS to the new channel and connect \n\
-                                 and reset to disconnect from BSS and change channel \n\
---dumpcreditstates \n\
-      Triggers the HTC layer to dump credit state information to the debugger \n\
---setakmp --multipmkid=<on/off>\n\
-  multipmkid=on(off> enables(doesnot enable) Multi PMKID Caching in firmware\n\
---setpmkidlist --numpmkid=<n> --pmkid=<pmkid_1> ... --pmkid=<pmkid_n>\n\
-   where n is the number of pmkids (max 8)\n\
-   and pmkid_i is the ith pmkid (16 bytes in hex format)\n\
---setbsspmkid --bssid=<aabbccddeeff> --bsspmkid=<pmkid>\n\
-   bssid is 6 bytes in hex format\n\
-   bsspmkid is 16 bytes in hex format\n\
---getpmkidlist \n\
---abortscan \n\
---settgtevt <event value>\n\
-      where <event value> is  0 send WMI_DISCONNECT_EVENT with disconnectReason = BSS_DISCONNECTED\n\
-                                after re-connection with AP\n\
-                              1 NOT send WMI_DISCONNECT_EVENT with disconnectReason = BSS_DISCONNECTED\n\
-                                after re-connection with AP\n\
---getsta \n\
---hiddenssid <value> \n\
-    where value 1-Enable, 0-Disable. \n\
---gethiddenssid \n\
---numsta <num> \n\
---gnumsta <num> \n\
---getnumsta \n\
---getgnumsta \n\
---conninact <period> \n\
-    where period is time in min (default 5min). \n\
-    0 will disable STA inactivity check. \n\
---protectionscan <period> <dwell> \n\
-    where period is in min (default 5min). 0 will disable. \n\
-    dwell is in ms. (default 200ms). \n\
---addacl <mac> \n\
-    where mac is of the format xx:xx:xx:xx:xx:xx \n\
---delacl <index> \n\
-    use --getacl to get index \n\
---getacl \n\
---aclpolicy <policy> <retain list> \n\
-    where <policy> \n\
-        0 - Disable ACL \n\
-        1 - Allow MAC \n\
-        2 - Deny MAC \n\
-          <retain list> \n\
-        0 - Clear the current ACL list \n\
-        1 - Retain the current ACL list \n\
---removesta <action> <reason> <mac> \n\
-    where <action>  \n\
-            2 - Disassoc    \n\
-            3 - Deauth      \n\
-          <reason> protocol reason code, use 1 when in doubt \n\
-          <mac> mac addr of a connected STA            \n\
---dtim <period> \n\
---getdtim \n\
---intrabss <ctrl> \n\
-    where <ctrl> 0 - Disable, 1 - Enable (default) \n\
---interbss <ctrl> \n\
-    where <ctrl> 0 - Disable, 1 - Enable (default) \n\
---apgetstats \n\
---apclearstats \n\
---acsdisablehichannels <0/1> \n\
-    where 0 - ACS will choose 1, 6 or 11 \n\
-          1 - ACS will choose 1, 6 or 11 \n\
---commit \n\
---ip arg, arg may be \n\
-   none  - resets ip \n\
-   x.x.x.x - ip addr is dotted form\n\
---set_ht_cap <band> <enable> <supported channel width set> <short GI 20MHz> <short GI 40MHz> <40MHz intolerant> <max AMPDU len exponent> \n\
-    where <band> : 'g' for 2.4 GHZ or 'a' for 5GHZ \n\
-    <enable> : 0 to disable 11n in band, 1 to enable 11n in band \n\
-    <supported channel width set> : 0 if only 20MHz operation supported \n\
-                                          1 if 20MHz and 40MHz operation supported \n\
-    <short GI 20MHz> : 0 if not supported, 1 if supported \n\
-    <short GI 40MHz> : 0 if not supported, 1 if supported \n\
-    <40MHz intolerant> : 1 if prohibit a receing AP from operating as a 20/40 MHz BSS \n\
-                         0 otherwise \n\
-    <max AMPDU len exponent> : valid values from 0 to 3 \n\
---dump_recv_aggr_stats \n\
---setup_aggr <tid> <aid> \n\
-        where <aid> = aid of a connected STA. Ignored in STA mode \n\
---allow_aggr <tx_tid_mask>  <rx_tid_mask> \n\
---dele_aggr <tid>  <direction> <aid> \n\
-        where <direction> =1 uplink; \n\
-                          =0 dnlink  \n\
-              <aid> = aid of a connected STA. Ignored in STA mode \n\
---set_ht_op <STA channel width> : 0 if only allow 20MHz channel width\n\
-                                  1 if allow any channel width in the supported channel width set \n\
---wlan_conn_prec <prec_val> \n\
-        where 0: WLAN connection will have precedence;\n\
-              1: PAL connection will have precedence;\n\
---settxselrates <11A ratemask> <11G ratemask> <11B ratemask> <11GOnly ratemask> <11A_HT20 ratemask> <11G_HT20 ratemask> \
-<11A_HT40 ratemask> <11G_HT40 ratemask> where all rate masks are hex integers. \n\
---aprateset <val> \n\
-        where 1: RateSet#1 - 1,2,5.5,11 basic rates (default)\n\
-              2: RateSet#2 - 1,2,5.5,11,6,12,24 basic rates\n\
---connect <ssid> \n\
---connect <ssid> --wpa <ver> <ucipher> <mcipher> <psk> \n\
---connect <ssid> --wep <mode> <def_keyix> <key1> <key2*> <key3*> <key4*> \n\
-        where   <ssid>     : SSID of network \n\
-                <ver>      : 1 - WPA, 2 - RSN   \n\
-                <ucipher>  : TKIP or CCMP for unicast \n\
-                <mcipher>  : TKIP or CCMP for multicast \n\
-                <psk>      : passphrase for WPA    \n\
-                <mode>     : open or shared    \n\
-                <def_keyix>: Default TX wep key index  [1-4] \n\
-                <key>      : wep key   \n\
-                *          : optional parameters  \n\
---set_tx_sgi --masksgi <mask> --persgi <value> \n\
-         where <mask> is a 32 bit hexadecimal value (eg: 0x0808000 or 08080000) to select desired MCS and ht20/ht40 SGI implementation (refer spec for bit location of each MCS)\n\
-             For disabling SGI enter 0x00000000 or 0.\n\
-             If mask is not entered, the default mask is 0x08080000 which enables MCS 7 to use SGI for both ht20 and ht40, when set_tx_sgi command is issued \n\
-         where  <value> is the acceptable loss percentage for Packet Error Rate (PER) for SGI (default : 10)\n\
---set_dfs <enable> \n\
-        where  <enable> : 1 to allow DFS \n\
-                        : 0 to disable DFS \n\
---setdivparam <idleTime> <RSSIThresh> <Enable> <Threshold Rate> \n\
-        where <idleTime> : time in ms where the idle timer would start checking the other antenna (default: 10000) \n\
-                  <RSSIThresh> : in db, where the firmware will check the other antenna if the RSSI drops below this delta (default: 10) \n\
-                  <Enable> : 1 to enable diversity \n\
-                  <Threshold Rate> : in Mbps, where the firmware will block the idleTimer if the throughput is above this rate (default 48) \n\
---scanprobedssid <ssid> where <ssid> is the wireless network string to scan. Broadcast probe will not be sent .  Set ssid to 'off' or 'any' to send broadcast probe requests \n\
---ap_apsd <value> \n\
-    where value 1-Enable, 0-Disable \n\
---get_ht_cap <band> \n\
-    where <band> : 'g' for 2.4 GHZ or 'a' for 5GHZ \n\
-";
-
-A_UINT32 mercuryAdd[5][2] = {
-            {0x20000, 0x200fc},
-            {0x28000, 0x28800},
-            {0x20800, 0x20a40},
-            {0x21000, 0x212f0},
-            {0x500000, 0x500000+184*1024},
-        };
-
-typedef struct chip_internal_t{
-    A_UINT32 addr_st;
-    A_UINT32 addr_end;
-    A_UINT8 *info;
-}CHIP_INTERNAL;
-
-CHIP_INTERNAL venus_internal[8] = {
-            {0x20000, 0x200fc, (A_UINT8 *)"General DMA and recv related registers"},
-            {0x28000, 0x28900, (A_UINT8 *)"MAC PCU register & keycache"},
-            {0x20800, 0x20a40, (A_UINT8 *)"QCU"},
-            {0x21000, 0x212f0, (A_UINT8 *)"DCU"},
-            {0x4000,  0x42e4,  (A_UINT8 *)"RTC"},
-            {0x540000, 0x540000+256*1024, (A_UINT8 *)"RAM"},
-            {0x29800, 0x2B210, (A_UINT8 *)"BB"},
-            {0x1C000, 0x1C748, (A_UINT8 *)"Analog"},
-        };
-
-
-
-static void
-usage(void)
-{
-    fprintf(stderr, "usage:\n%s [-i device] commands\n", progname);
-    fprintf(stderr, "%s\n", commands);
-#ifdef ATH_INCLUDE_PAL
-    fprintf(stderr, "%s\n", palcommands);
-#endif
-    fprintf(stderr, "The options can be given in any order\n");
-    exit(-1);
-}
-
-/* List of Country codes */
-char    *my_ctr[] = {
-    "DB", "NA", "AL", "DZ", "AR", "AM", "AU", "AT", "AZ", "BH", "BY", "BE", "BZ", "BO", "BR", "BN",
-    "BG", "CA", "CL", "CN", "CO", "CR", "HR", "CY", "CZ", "DK", "DO", "EC", "EG", "SV", "EE", "FI",
-    "FR", "GE", "DE", "GR", "GT", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IE", "IL", "IT", "JP",
-    "JO", "KZ", "KP", "KR", "K2", "KW", "LV", "LB", "LI", "LT", "LU",
-    "MO", "MK", "MY", "MX", "MC", "MA", "NL", "NZ", "NO", "OM", "PK", "PA", "PE", "PH", "PL", "PT",
-    "PR", "QA", "RO", "RU", "SA", "SG", "SK", "SI", "ZA", "ES", "SE", "CH", "SY", "TW", "TH", "TT",
-    "TN", "TR", "UA", "AE", "GB", "US", "UY", "UZ", "VE", "VN", "YE", "ZW"
-    };
-
-const char *targ_reg_name[] = {
-"zero", "pc", "lbeg", "lend", "lcount", "sar", "litbaddr", "ps",
-"brtarg", "epc1", "epc2", "epc3", "epc4", "windowbase", "windowstart", "zero",
-"zero", "zero", "zero", "zero", "zero", "zero", "zero", "zero",
-"zero", "zero", "zero", "zero", "zero", "zero", "zero", "zero",
-"ar0", "ar1", "ar2", "ar3", "ar4", "ar5", "ar6", "ar7",
-"ar8", "ar9", "ar10", "ar11", "ar12", "ar13", "ar14", "ar15",
-"ar16", "ar17", "ar18", "ar19", "ar20", "ar21", "ar22", "ar23",
-"ar24", "ar25", "ar26", "ar27", "ar28", "ar29", "ar30", "ar31",
-};
-
-#ifdef ATH_INCLUDE_PAL
-
-A_INT32
-get_input_choice(char *fname,A_UINT8 *pdu, A_UINT16 *sz)
-{
-    int fhdl;
-    A_INT32 ret = -1;
-    fhdl = open(fname, O_RDONLY);
-    if(fhdl != -1)
-    {
-        *sz  = read(fhdl, pdu,MAX_BUFFER_SIZE);
-        close(fhdl);
-        ret = 0;
-    }
-    return ret;
-}
-
-#endif
-int
-main (int argc, char **argv)
-{
-    int c, s;
-    char ifname[IFNAMSIZ];
-    unsigned int cmd = 0;
-    progname = argv[0];
-    struct ifreq ifr;
-    struct iwreq iwr;
-    char *buf = malloc(sizeof(PACKET_LOG));
-    int clearstat = 0;
-
-    WMI_LISTEN_INT_CMD *listenCmd         = (WMI_LISTEN_INT_CMD*)buf;
-    WMI_BMISS_TIME_CMD *bmissCmd         = (WMI_BMISS_TIME_CMD*)buf;
-
-    WMI_POWER_MODE_CMD *pwrCmd         = (WMI_POWER_MODE_CMD *)buf;
-    WMI_SET_MCAST_FILTER_CMD *sMcastFilterCmd       = (WMI_SET_MCAST_FILTER_CMD *)(buf + 4);
-    WMI_MCAST_FILTER_CMD *mcastFilterCmd       = (WMI_MCAST_FILTER_CMD *)(buf + 4);
-    WMI_IBSS_PM_CAPS_CMD *adhocPmCmd   = (WMI_IBSS_PM_CAPS_CMD *)buf;
-    WMI_AP_PS_CMD *apPsCmd             = (WMI_AP_PS_CMD *)(buf + 4);
-    WMI_SCAN_PARAMS_CMD *sParamCmd     = (WMI_SCAN_PARAMS_CMD *)buf;
-    WMI_BSS_FILTER_CMD *filterCmd      = (WMI_BSS_FILTER_CMD *)buf;
-    WMI_CHANNEL_PARAMS_CMD *chParamCmd = (WMI_CHANNEL_PARAMS_CMD *)buf;
-    WMI_PROBED_SSID_CMD *ssidCmd       = (WMI_PROBED_SSID_CMD *)buf;
-    WMI_POWER_PARAMS_CMD *pmParamCmd   = (WMI_POWER_PARAMS_CMD *)buf;
-    WMI_ADD_BAD_AP_CMD *badApCmd       = (WMI_ADD_BAD_AP_CMD *)buf;
-    WMI_CREATE_PSTREAM_CMD *crePStreamCmd = (WMI_CREATE_PSTREAM_CMD *)buf;
-    WMI_DELETE_PSTREAM_CMD *delPStreamCmd = (WMI_DELETE_PSTREAM_CMD *)buf;
-    USER_RSSI_PARAMS *rssiThresholdParam = (USER_RSSI_PARAMS *)(buf + 4);
-    WMI_SNR_THRESHOLD_PARAMS_CMD *snrThresholdParam = (WMI_SNR_THRESHOLD_PARAMS_CMD *)buf;
-    WMI_LQ_THRESHOLD_PARAMS_CMD *lqThresholdParam = (WMI_LQ_THRESHOLD_PARAMS_CMD *)(buf + 4);
-    WMI_TARGET_ERROR_REPORT_BITMASK *pBitMask =
-                                    (WMI_TARGET_ERROR_REPORT_BITMASK *)buf;
-    TARGET_STATS_CMD tgtStatsCmd;
-    WMI_SET_ASSOC_INFO_CMD *ieInfo = (WMI_SET_ASSOC_INFO_CMD *)buf;
-    WMI_SET_ACCESS_PARAMS_CMD *acParamsCmd = (WMI_SET_ACCESS_PARAMS_CMD *)buf;
-    WMI_DISC_TIMEOUT_CMD *discCmd = (WMI_DISC_TIMEOUT_CMD *)buf;
-    WMI_SET_ADHOC_BSSID_CMD *adhocBssidCmd = (WMI_SET_ADHOC_BSSID_CMD *)(buf + 4);
-    WMI_BEACON_INT_CMD *bconIntvl     = (WMI_BEACON_INT_CMD *)(buf + 4);
-    WMI_SET_RETRY_LIMITS_CMD *setRetryCmd  = (WMI_SET_RETRY_LIMITS_CMD *)(buf + 4);
-    WMI_START_SCAN_CMD *startScanCmd  = (WMI_START_SCAN_CMD *)(buf + 4);
-    WMI_FIX_RATES_CMD *setFixRatesCmd  = (WMI_FIX_RATES_CMD *)(buf + 4);
-    WMI_FIX_RATES_CMD *getFixRatesCmd  = (WMI_FIX_RATES_CMD *)(buf + 4);
-    WMI_SET_AUTH_MODE_CMD *setAuthMode = (WMI_SET_AUTH_MODE_CMD *)(buf + 4);
-    WMI_SET_REASSOC_MODE_CMD *setReassocMode = (WMI_SET_REASSOC_MODE_CMD *)(buf + 4);
-    WMI_SET_LPREAMBLE_CMD *setLpreambleCmd = (WMI_SET_LPREAMBLE_CMD *)(buf + 4);
-    WMI_SET_RTS_CMD *setRtsCmd = (WMI_SET_RTS_CMD *)(buf + 4);
-    struct ar6000_queuereq *getQosQueueCmd = (struct ar6000_queuereq *)buf;
-    WMI_SET_VOICE_PKT_SIZE_CMD *pSizeThresh = (WMI_SET_VOICE_PKT_SIZE_CMD *)(buf + sizeof(int));
-    WMI_SET_MAX_SP_LEN_CMD *pMaxSP          = (WMI_SET_MAX_SP_LEN_CMD *)(buf + sizeof(int));
-    WMI_SET_ROAM_CTRL_CMD *pRoamCtrl        = (WMI_SET_ROAM_CTRL_CMD *)(buf +
-                                                sizeof(int));
-    WMI_POWERSAVE_TIMERS_POLICY_CMD *pPowerSave    = (WMI_POWERSAVE_TIMERS_POLICY_CMD *)(buf + sizeof(int));
-    WMI_POWER_MODE_CMD *getPowerMode = (WMI_POWER_MODE_CMD *)buf;
-    WMI_SET_BT_STATUS_CMD *pBtStatCmd = (WMI_SET_BT_STATUS_CMD *) (buf + sizeof(int));
-    WMI_SET_BT_PARAMS_CMD *pBtParmCmd = (WMI_SET_BT_PARAMS_CMD *) (buf + sizeof(int));
-    WMI_SET_BTCOEX_FE_ANT_CMD *pBtcoexFeAntCmd = (WMI_SET_BTCOEX_FE_ANT_CMD *) (buf + sizeof(int));
-    WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD *pBtcoexCoLocatedBtCmd = (WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD *) (buf + sizeof(int));
-    WMI_SET_BTCOEX_SCO_CONFIG_CMD *pBtcoexScoConfigCmd = (WMI_SET_BTCOEX_SCO_CONFIG_CMD *) (buf + sizeof(int));
-    WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD *pBtcoexbtinquiryPageConfigCmd = (WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD *) (buf + sizeof(int));
-    WMI_BTCOEX_CONFIG_EVENT btcoexConfigEvent;
-    WMI_BTCOEX_STATS_EVENT btcoexStatsEvent;
-    AR6000_BTCOEX_CONFIG *pBtcoexConfig = (AR6000_BTCOEX_CONFIG *) (buf + sizeof(int));
-    AR6000_BTCOEX_STATS *pBtcoexStatsEvent = (AR6000_BTCOEX_STATS *) (buf + sizeof(int));
-    WMI_SET_BTCOEX_A2DP_CONFIG_CMD *pBtcoexA2dpConfigCmd = (WMI_SET_BTCOEX_A2DP_CONFIG_CMD *) (buf + sizeof(int));
-    WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD *pBtcoexAclCoexConfigCmd = (WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD *) (buf + sizeof(int));
-//    WMI_SET_BTCOEX_DEBUG_CMD *pBtcoexDebugCmd = (WMI_SET_BTCOEX_DEBUG_CMD *) (buf + sizeof(int));
-    WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD *pBtcoexBtOperatingStatusCmd = (WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD *) (buf + sizeof(int));
-    WMI_SET_WMM_CMD *setWmmCmd = (WMI_SET_WMM_CMD *)(buf + 4);
-    WMI_SET_QOS_SUPP_CMD *qosSupp = (WMI_SET_QOS_SUPP_CMD *)(buf +4);
-    WMI_SET_HB_CHALLENGE_RESP_PARAMS_CMD *hbparam = (WMI_SET_HB_CHALLENGE_RESP_PARAMS_CMD *)(buf + 4);
-    A_UINT32 *cookie = (A_UINT32 *)(buf + 4);
-    A_UINT32 *diagaddr = (A_UINT32 *)(buf + 4);
-    A_UINT32 *diagdata = (A_UINT32 *)(buf + 8);
-    WMI_SET_WMM_TXOP_CMD *pTxOp = (WMI_SET_WMM_TXOP_CMD *)(buf + sizeof(int));
-    WMI_AP_SET_COUNTRY_CMD *pCountry = (WMI_AP_SET_COUNTRY_CMD *)(buf + sizeof(int));
-    A_UINT32 *rd = (A_UINT32 *)(buf + 4);
-    WMI_SET_KEEPALIVE_CMD *setKeepAlive = (WMI_SET_KEEPALIVE_CMD *)(buf + 4);
-    WMI_GET_KEEPALIVE_CMD *getKeepAlive = (WMI_GET_KEEPALIVE_CMD *)(buf + 4);
-    //WMI_SET_APPIE_CMD     *appIEInfo     = (WMI_SET_APPIE_CMD *)(buf + 4);
-    struct ieee80211req_getset_appiebuf     *appIEInfo     = (struct ieee80211req_getset_appiebuf *)(buf + 4);
-    A_UINT32              *pMgmtFilter  = (A_UINT32 *)(buf + 4);
-    DBGLOG_MODULE_CONFIG *dbglogCfg = (DBGLOG_MODULE_CONFIG *)(buf + 4);
-
-    WMI_SET_HOST_SLEEP_MODE_CMD *hostSleepModeCmd = (WMI_SET_HOST_SLEEP_MODE_CMD*)(buf + sizeof(int));
-    WMI_SET_WOW_MODE_CMD *wowModeCmd = (WMI_SET_WOW_MODE_CMD*)(buf + sizeof(int));
-    WMI_ADD_WOW_PATTERN_CMD *addWowCmd = (WMI_ADD_WOW_PATTERN_CMD*)(buf + sizeof(int));
-    WMI_DEL_WOW_PATTERN_CMD *delWowCmd = (WMI_DEL_WOW_PATTERN_CMD*)(buf + sizeof(int));
-    WMI_GET_WOW_LIST_CMD *getWowListCmd = (WMI_GET_WOW_LIST_CMD*)(buf + sizeof(int));
-    A_UINT32 *connectCtrlFlags = (A_UINT32 *)(buf + 4);
-    AR6000_USER_SETKEYS_INFO *user_setkeys_info =
-                                (AR6000_USER_SETKEYS_INFO *)(buf + sizeof(int));
-    WMI_SET_AKMP_PARAMS_CMD *akmpCtrlCmd =
-                                (WMI_SET_AKMP_PARAMS_CMD *)(buf + sizeof(int));
-    WMI_SET_TARGET_EVENT_REPORT_CMD *evtCfgCmd = (WMI_SET_TARGET_EVENT_REPORT_CMD *) (buf + sizeof(int));
-    WMI_SET_DFS_CMD *setDfsCmd = (WMI_SET_DFS_CMD *)(buf + 4);
-    pmkidUserInfo_t         pmkidUserInfo;
-    A_UINT8                 bssid[ATH_MAC_LEN];
-    struct ieee80211req_addpmkid *pi_cmd = (struct ieee80211req_addpmkid *)buf;
-
-    int i, index = 0, channel, chindex, cnt;
-    A_INT8 phyMode;
-    A_INT16 threshold[26];  /* user can set rssi tags */
-    A_UINT16 *clist;
-    A_UCHAR *ssid;
-    char *ethIf;
-
-    WMI_AP_HIDDEN_SSID_CMD *pHidden = (WMI_AP_HIDDEN_SSID_CMD *)(buf + 4);
-    ap_get_sta_t *pGetSta = (ap_get_sta_t *)(buf + 4);
-    WMI_AP_ACL_MAC_CMD *pACL = (WMI_AP_ACL_MAC_CMD *)(buf + 4);
-    WMI_AP_NUM_STA_CMD *pNumSta = (WMI_AP_NUM_STA_CMD *)(buf + 4);
-    WMI_AP_ACL *pGetAcl = (WMI_AP_ACL *)(buf + 4);
-    WMI_AP_CONN_INACT_CMD *pInact = (WMI_AP_CONN_INACT_CMD *)(buf + 4);
-    WMI_AP_PROT_SCAN_TIME_CMD *pProt = (WMI_AP_PROT_SCAN_TIME_CMD *)(buf + 4);
-    struct ieee80211req_mlme *pMlme = (struct ieee80211req_mlme *)buf;
-    WMI_AP_SET_DTIM_CMD *pDtim = (WMI_AP_SET_DTIM_CMD *)(buf + 4);
-    WMI_SET_IP_CMD *pIP = (WMI_SET_IP_CMD*)(buf + 4);
-    WMI_AP_ACL_POLICY_CMD *pACLpolicy = (WMI_AP_ACL_POLICY_CMD *)(buf + 4);
-    WMI_SET_HT_CAP_CMD *pHtCap = (WMI_SET_HT_CAP_CMD *)(buf + 4);
-    WMI_SET_HT_OP_CMD *pHtOp = (WMI_SET_HT_OP_CMD *)(buf + 4);
-    A_UINT8 *intra = (A_UINT8 *)(buf + 4);
-    WMI_AP_MODE_STAT *apStat = (WMI_AP_MODE_STAT *)(buf + 4);
-    WMI_SET_TX_SELECT_RATES_CMD *pTxSelectRate = (WMI_SET_TX_SELECT_RATES_CMD *)(buf + 4);
-    WMI_ADDBA_REQ_CMD *pAddbaReq = (WMI_ADDBA_REQ_CMD *)(buf + 4);
-    WMI_ALLOW_AGGR_CMD *pAllowAggr = (WMI_ALLOW_AGGR_CMD *)(buf + 4);
-    WMI_DELBA_REQ_CMD *pDeleteAggr = (WMI_DELBA_REQ_CMD *)(buf + 4);
-    WMI_SET_BT_WLAN_CONN_PRECEDENCE *prec = (WMI_SET_BT_WLAN_CONN_PRECEDENCE *) (buf + 4);
-    WMI_AP_SET_11BG_RATESET_CMD *pAPrs = (WMI_AP_SET_11BG_RATESET_CMD *) (buf + 4);
-    WMI_SET_TX_SGI_PARAM_CMD *set_txsgiparam = (WMI_SET_TX_SGI_PARAM_CMD *) (buf + 4);
-    WMI_DIV_PARAMS_CMD *pDiversity = (WMI_DIV_PARAMS_CMD *)(buf + 4);
-    WMI_AP_SET_APSD_CMD *pApApsd = (WMI_AP_SET_APSD_CMD *)(buf + 4);
-    PACKET_LOG *log;
-    profile_t   cp;
-    CHIP_INTERNAL *p;
-    A_UINT8 *pWpaOffloadState = (A_UINT8 *) (buf + 4);
-    A_UINT32 *pExcessTxRetryThres = (A_UINT32 *)(buf + 4);
-
-    if (argc == 1) {
-        usage();
-    }
-
-    memset(buf, 0, sizeof(buf));
-    memset(ifname, '\0', IFNAMSIZ);
-    if ((ethIf = getenv("NETIF")) == NULL) {
-        ethIf = "eth1";
-    }
-    strcpy(ifname, ethIf);
-    s = socket(AF_INET, SOCK_DGRAM, 0);
-    if (s < 0) {
-        err(1, "socket");
-    }
-
-    while (1) {
-        int option_index = 0;
-        static struct option long_options[] = {
-            {"it", 1, NULL, 'a'},
-            {"bg", 1, NULL, 'b'},
-            {"np", 1, NULL, 'c'},
-            {"dp", 1, NULL, 'd'},
-            {"fgend", 1, NULL, 'e'},
-            {"filter", 1, NULL, 'f'},
-            {"fgstart", 1, NULL, 'g'},
-            {"maxact", 1, NULL, 'h'},
-            {"interface", 1, NULL, 'i'},
-            {"createqos", 1, NULL, 'j'},
-            {"deleteqos", 1, NULL, 'k'},
-            {"listen", 1, NULL, 'l'},
-            {"listenbeacons", 1, NULL, 'N'},
-            {"pmparams", 0, NULL, 'm'},
-            {"num", 1, NULL, 'n'},
-            {"qosqueue", 1, NULL, 'o'},
-            {"power", 1, NULL, 'p'},
-            {"pas", 1, NULL, 'q'},
-            {"scan", 0, NULL, 's'},
-            {"sr", 1, NULL, 'r'},
-            {"ssid", 1, NULL, 't'},
-            {"rssiThreshold", 1, NULL, 'u'},
-            {"snrThreshold", 1, NULL, WMI_SET_SNR_THRESHOLDS},
-            {"cleanRssiSnr", 0, NULL, WMI_CLR_RSSISNR},
-            {"lqThreshold", 1, NULL, WMI_SET_LQ_THRESHOLDS},
-            {"version", 0, NULL, 'v'},
-            {"wmode", 1, NULL, 'w'},
-            {"badAP", 1, NULL, 'x'},
-            {"clrAP", 0, NULL, 'y'},
-            {"minact", 1, NULL, 'z'},
-            {"getTargetStats", 0, NULL, WMI_GET_TARGET_STATS},
-            {"setErrorReportingBitmask", 1, NULL,
-                        WMI_SET_TARGET_ERROR_REPORTING_BITMASK},
-            {"acparams", 0, NULL, WMI_SET_AC_PARAMS},
-            {"acval", 1, NULL, WMI_SET_AC_VAL},
-            {"txop", 1, NULL, 'A'},
-            {"cwmin", 1, NULL, 'B'},
-            {"cwmax", 1, NULL, 'C'},
-            {"aifsn", 1, NULL, 'D'},
-            {"ps", 1, NULL, 'E'},
-            {"aw", 1, NULL, 'F'},
-            {"adhocbssid", 1, NULL, 'G'},
-            {"mode", 1, NULL, 'H'},
-            {"sendframe", 1, NULL, 'I'},
-            {"wlan", 1, NULL, 'J'},
-            {"to", 1, NULL, 'K'},
-            {"ttl", 1, NULL, 'L'},
-            {"scanctrlflags", 1, NULL, 'O'},
-            {"homeDwellTime", 1, NULL, 'P'},
-            {"forceScanInt", 1, NULL, 'Q'},
-            {"forceScanFlags",1, NULL, 'R'},
-            {"threshold", 1, NULL, 'S'},
-            {"frequency", 1, NULL, 'T'},
-            {"cookie", 1, NULL, 'U'},
-            {"mmask", 1, NULL, 'V'},
-            {"rep", 1, NULL, 'W'},
-            {"tsr", 1, NULL, 'X'},
-            {"size", 1, NULL, 'Y'},
-            {"bssid",1, NULL, WMI_BSSID},
-            {"initrsc", 1, NULL, USER_SETKEYS_INITRSC},
-            {"multipmkid", 1, NULL, WMI_AKMP_MULTI_PMKID},
-            {"numpmkid", 1, NULL, WMI_NUM_PMKID},
-            {"pmkid", 1, NULL, WMI_PMKID_ENTRY},
-            {"clearStats", 0, NULL, 'Z'},
-            {"maxact2pas", 1, NULL, WMI_SCAN_DFSCH_ACT_TIME},
-            {"maxactscan_ssid", 1, NULL, WMI_SCAN_MAXACT_PER_SSID},
-            {"ibsspmcaps", 0, NULL, WMI_SET_IBSS_PM_CAPS},
-            {"appsparams", 0, NULL, WMI_SET_AP_PS},
-            {"setAssocIe", 1, NULL, WMI_SET_ASSOC_IE},
-            {"setbmisstime", 1, NULL, WMI_SET_BMISS_TIME},
-            {"setbmissbeacons", 1, NULL, 'M'},
-            {"disc", 1, NULL, WMI_SET_DISC_TIMEOUT},
-            {"beaconintvl", 1, NULL, WMI_SET_BEACON_INT},
-            {"setVoicePktSize", 1, NULL, WMI_SET_VOICE_PKT_SIZE},
-            {"setMaxSPLength", 1, NULL, WMI_SET_MAX_SP},
-            {"getroamtable", 0, NULL, WMI_GET_ROAM_TBL},
-            {"roam", 1, NULL, WMI_SET_ROAM_CTRL},
-            {"psparams", 0, NULL, WMI_SET_POWERSAVE_TIMERS},
-            {"psPollTimer", 1, NULL, WMI_SET_POWERSAVE_TIMERS_PSPOLLTIMEOUT},
-            {"triggerTimer", 1, NULL, WMI_SET_POWERSAVE_TIMERS_TRIGGERTIMEOUT},
-            {"getpower", 0, NULL, WMI_GET_POWER_MODE},
-            {"getroamdata", 0, NULL, WMI_GET_ROAM_DATA},
-            {"setBTstatus", 1, NULL, WMI_SET_BT_STATUS},
-            {"setBTparams", 1, NULL, WMI_SET_BT_PARAMS},
-            {"setbtcoexfeant", 1, NULL, WMI_SET_BTCOEX_FE_ANT},
-            {"setbtcoexcolocatedbt", 1, NULL, WMI_SET_BTCOEX_COLOCATED_BT_DEV},
-            {"setbtcoexscoconfig", 1, NULL, WMI_SET_BTCOEX_SCO_CONFIG},
-            {"setbtcoexa2dpconfig", 1, NULL, WMI_SET_BTCOEX_A2DP_CONFIG},
-            {"setbtcoexaclcoexconfig", 1, NULL, WMI_SET_BTCOEX_ACLCOEX_CONFIG},
-            {"setbtcoexbtinquirypageconfig", 1, NULL, WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG},
-            {"setbtcoexbtoperatingstatus", 1, NULL, WMI_SET_BTCOEX_BT_OPERATING_STATUS},
-            {"getbtcoexconfig",1,NULL, WMI_GET_BTCOEX_CONFIG},
-            {"getbtcoexstats", 0, NULL, WMI_GET_BTCOEX_STATS},
-            {"setretrylimits", 1, NULL, WMI_SET_RETRYLIMITS},
-            {"startscan", 0, NULL, WMI_START_SCAN},
-            {"setfixrates", 1, NULL, WMI_SET_FIX_RATES},
-            {"getfixrates", 0, NULL, WMI_GET_FIX_RATES},
-            {"setauthmode", 1, NULL, WMI_SET_AUTH_MODE},
-            {"setreassocmode", 1, NULL, WMI_SET_REASSOC_MODE},
-            {"setlongpreamble", 1, NULL, WMI_SET_LPREAMBLE},
-            {"setRTS", 1, NULL, WMI_SET_RTS},
-            {"setwmm", 1, NULL, WMI_SET_WMM},
-            {"setqos", 1, NULL, WMI_SET_QOS_SUPP},
-            {"apsdTimPolicy", 1, NULL, WMI_APSD_TIM_POLICY},
-            {"simulatedAPSDTimPolicy", 1, NULL, WMI_SIMULATED_APSD_TIM_POLICY},
-            {"detecterror", 0, NULL, WMI_SET_ERROR_DETECTION},
-            {"getheartbeat", 0, NULL, WMI_GET_HB_CHALLENGE_RESP},
-#ifdef USER_KEYS
-            {"usersetkeys", 0, NULL, USER_SETKEYS},
-#endif
-            {"getRD", 0, NULL, WMI_GET_RD},
-            {"setcountry", 1, NULL, WMI_AP_SET_COUNTRY},
-            {"countrycodes", 0, NULL, WMI_AP_GET_COUNTRY_LIST},
-            {"disableregulatory", 0, NULL, WMI_AP_DISABLE_REGULATORY},
-            {"txopbursting", 1, NULL, WMI_SET_TXOP},
-            {"diagaddr", 1, NULL, DIAG_ADDR},
-            {"diagdata", 1, NULL, DIAG_DATA},
-            {"diagread", 0, NULL, DIAG_READ},
-            {"diagwrite", 0, NULL, DIAG_WRITE},
-            {"setkeepalive", 1, NULL, WMI_SET_KEEPALIVE},
-            {"getkeepalive", 0, NULL, WMI_GET_KEEPALIVE},
-            {"setappie", 1, NULL, WMI_SET_APPIE},
-            {"setmgmtfilter", 1, NULL, WMI_SET_MGMT_FRM_RX_FILTER},
-            {"setdbglogconfig", 0, NULL, WMI_DBGLOG_CFG_MODULE},
-            {"getdbglogs", 0, NULL, WMI_DBGLOG_GET_DEBUG_LOGS},
-            {"sethostmode", 1, NULL, WMI_SET_HOST_SLEEP_MODE},
-            {"setwowmode", 1, NULL, WMI_SET_WOW_MODE},
-            {"wowfilter",1,NULL,WMI_SET_WOW_FILTER},
-            {"hostreqdelay",1,NULL,WMI_SET_WOW_HOST_REQ_DELAY},
-            {"getwowlist", 1, NULL, WMI_GET_WOW_LIST},
-            {"addwowpattern", 1, NULL, WMI_ADD_WOW_PATTERN},
-            {"delwowpattern", 1, NULL, WMI_DEL_WOW_PATTERN},
-            {"dumpchipmem", 0, NULL, DIAG_DUMP_CHIP_MEM},
-            {"dumpchipmem_venus", 0, NULL, DIAG_DUMP_CHIP_MEM_VENUS},
-            {"setconnectctrl", 1, NULL, WMI_SET_CONNECT_CTRL_FLAGS},
-            {"dumpcreditstates",0, NULL, DUMP_HTC_CREDITS},
-            {"setakmp", 0, NULL, WMI_SET_AKMP_INFO},
-            {"setpmkidlist", 0, NULL, WMI_SET_PMKID_LIST},
-            {"getpmkidlist", 0, NULL, WMI_GET_PMKID_LIST},
-            {"ieMask", 1, NULL, WMI_SET_IEMASK},
-            {"scanlist", 1, NULL, WMI_SCAN_CHANNEL_LIST},
-            {"setbsspmkid", 0, NULL, WMI_SET_BSS_PMKID_INFO},
-            {"bsspmkid", 1, NULL, WMI_BSS_PMKID_ENTRY},
-            {"abortscan", 0, NULL, WMI_ABORT_SCAN},
-            {"settgtevt", 1, NULL, WMI_TARGET_EVENT_REPORT},
-            {"getsta", 0, NULL, WMI_AP_GET_STA_LIST},       /* AP mode */
-            {"hiddenssid", 0, NULL, WMI_AP_HIDDEN_SSID},    /* AP mode */
-            {"numsta", 0, NULL, WMI_AP_SET_NUM_STA},        /* AP mode */
-            {"aclpolicy", 0, NULL, WMI_AP_ACL_POLICY},      /* AP mode */
-            {"addacl", 0, NULL, WMI_AP_ACL_MAC_LIST1},      /* AP mode */
-            {"delacl", 0, NULL, WMI_AP_ACL_MAC_LIST2},      /* AP mode */
-            {"getacl", 0, NULL, WMI_AP_GET_ACL_LIST},       /* AP mode */
-            {"commit", 0, NULL, WMI_AP_COMMIT_CONFIG},      /* AP mode */
-            {"conninact", 0, NULL, WMI_AP_INACT_TIME},      /* AP mode */
-            {"protectionscan", 0, NULL, WMI_AP_PROT_TIME},  /* AP mode */
-            {"removesta", 0, NULL, WMI_AP_SET_MLME},        /* AP mode */
-            {"dtim", 0, NULL, WMI_AP_SET_DTIM},             /* AP mode */
-            {"intrabss", 0, NULL, WMI_AP_INTRA_BSS},        /* AP mode */
-            {"interbss", 0, NULL, WMI_AP_INTER_BSS},        /* AP mode */            
-            {"ip", 1, NULL, WMI_GET_IP},
-            {"setMcastFilter", 1, NULL, WMI_SET_MCAST_FILTER},
-            {"delMcastFilter", 1, NULL, WMI_DEL_MCAST_FILTER},
-            {"mcastFilter", 1, NULL, WMI_MCAST_FILTER},
-            {"dump_recv_aggr_stats",0, NULL, WMI_DUMP_RCV_AGGR_STATS},
-            {"setup_aggr", 2, NULL, WMI_SETUP_AGGR},
-            {"allow_aggr", 2, NULL, WMI_CFG_ALLOW_AGGR},
-            {"dele_aggr", 2, NULL, WMI_CFG_DELE_AGGR},
-            {"set_ht_cap",1, NULL, WMI_SET_HT_CAP},
-            {"set_ht_op",1, NULL, WMI_SET_HT_OP},
-            {"apgetstats", 0, NULL, WMI_AP_GET_STAT},       /* AP mode */
-            {"apclearstats", 0, NULL, WMI_AP_CLR_STAT},     /* AP mode */
-            {"settxselrates", 1, NULL, WMI_SET_TX_SELECT_RATES},
-            {"gethiddenssid", 0, NULL, WMI_AP_GET_HIDDEN_SSID},   /* AP mode */
-            {"getcountry", 0, NULL, WMI_AP_GET_COUNTRY},    /* AP mode */
-            {"getwmode", 0, NULL, WMI_AP_GET_WMODE},
-            {"getdtim", 0, NULL, WMI_AP_GET_DTIM},          /* AP mode */
-            {"getbeaconintvl", 0, NULL, WMI_AP_GET_BINTVL}, /* AP mode */
-            {"getRTS", 0, NULL, WMI_GET_RTS},
-            {"targregs", 0, NULL, DIAG_FETCH_TARGET_REGS},
-#ifdef ATH_INCLUDE_PAL
-            {"sendpalcmd", 2, NULL, WMI_SEND_PAL_CMD},
-            {"sendpaldata", 2, NULL, WMI_SEND_PAL_DATA},
-            {"wlan_conn_prec", 1, NULL, WMI_SET_WLAN_CONN_PRECDNCE},
-#endif
-            {"aprateset", 0, NULL, WMI_SET_AP_RATESET},
-            {"twp", 1, NULL, WMI_SET_TX_WAKEUP_POLICY},
-            {"nt", 1, NULL, WMI_SET_TX_NUM_FRAMES_TO_WAKEUP},
-            {"pstype", 1, NULL, WMI_SET_AP_PS_PSTYPE},
-            {"psit", 1, NULL, WMI_SET_AP_PS_IDLE_TIME},
-            {"psperiod", 1, NULL, WMI_SET_AP_PS_PS_PERIOD},
-            {"sleepperiod", 1, NULL, WMI_SET_AP_PS_SLEEP_PERIOD},
-            {"connect", 1, NULL, WMI_SEND_CONNECT_CMD},
-            {"wpa", 1, NULL, WMI_SEND_CONNECT_CMD1},
-            {"wep", 1, NULL, WMI_SEND_CONNECT_CMD2},
-            {"set_dfs", 1, NULL, WMI_AP_SET_DFS},
-            {"bt",1,NULL,BT_HW_POWER_STATE},
-            {"set_tx_sgi", 0, NULL, WMI_SET_TX_SGI_PARAM},
-            {"masksgi", 1, NULL, WMI_SGI_MASK},
-            {"persgi", 1, NULL, WMI_PER_SGI},
-            {"wac", 1, NULL, WMI_WAC_ENABLE},
-            {"setwpaoffload", 1, NULL, WMI_SET_WPA_OFFLOAD_STATE},
-            {"acsdisablehichannels", 0, NULL, WMI_AP_ACS_DISABLE_HI_CHANNELS},
-            {"setdivparam", 1, NULL, WMI_SET_DIVERSITY_PARAM},
-            {"setexcesstxretrythres", 1, NULL, WMI_SET_EXCESS_TX_RETRY_THRES},
-            {"forceAssert", 0, NULL, WMI_FORCE_ASSERT},            
-            {"gnumsta", 0, NULL, WMI_AP_SET_GNUM_STA},        /* AP mode */
-            {"getgnumsta", 0, NULL, WMI_AP_GET_GNUM_STA},     /* AP mode */
-            {"getnumsta", 0, NULL, WMI_AP_GET_NUM_STA},       /* AP mode */            
-            {"suspend", 0, NULL, WMI_SUSPEND_DRIVER},                
-            {"resume", 0, NULL, WMI_RESUME_DRIVER},                 
-            {"scanprobedssid", 1, NULL, WMI_SCAN_PROBED_SSID},  
-            {"ap_apsd", 0, NULL, WMI_AP_SET_APSD},    /* AP mode */
-            {"get_ht_cap", 0, NULL, WMI_GET_HT_CAP},
-            {0, 0, 0, 0}
-        };
-
-        c = getopt_long(argc, argv, "rsvda:b:c:e:h:f:g:h:i:l:p:q:r:w:n:t:u:x:y:z:A:B:C:D:E:F:G:H:I:J:K:L:M:N:O:P:Q:R:S:T:U:V:W:X:Y:Z:", long_options, &option_index);
-        if (c == -1)
-        break;
-        switch (c) {
-        case 'a':
-            pmParamCmd->idle_period = atoi(optarg);
-            break;
-        case 'b':
-            if (!strcasecmp(optarg,"default")) {
-                sParamCmd->bg_period = 0;
-            } else {
-                sParamCmd->bg_period = atoi(optarg);
-                /* Setting the background scan to 0 or 65535 has the same effect
-                 - it disables background scanning */
-                if(!sParamCmd->bg_period)
-                    sParamCmd->bg_period = 65535;
-            }
-            break;
-        case 'c':
-            pmParamCmd->pspoll_number = atoi(optarg);
-            break;
-        case 'd':
-            if (!strcmp(optarg, "ignore")) {
-                pmParamCmd->dtim_policy = IGNORE_DTIM;
-            } else if (!strcmp(optarg, "normal")) {
-                pmParamCmd->dtim_policy = NORMAL_DTIM;
-            } else if (!strcmp(optarg, "stick")) {
-                pmParamCmd->dtim_policy = STICK_DTIM;
-            } else {
-                cmd = 0;
-            }
-            break;
-        case 'f':
-            cmd = WMI_SET_BSS_FILTER;
-            if (!strcmp(optarg, "none")) {
-                filterCmd->bssFilter = NONE_BSS_FILTER;
-            } else if (!strcmp(optarg, "all")) {
-                filterCmd->bssFilter = ALL_BSS_FILTER;
-            } else if (!strcmp(optarg, "profile")) {
-                filterCmd->bssFilter = PROFILE_FILTER;
-            } else if (!strcmp(optarg, "not_profile")) {
-                filterCmd->bssFilter = ALL_BUT_PROFILE_FILTER;
-            } else if (!strcmp(optarg, "bss")) {
-                filterCmd->bssFilter = CURRENT_BSS_FILTER;
-            } else if (!strcmp(optarg, "not_bss")) {
-                filterCmd->bssFilter = ALL_BUT_BSS_FILTER;
-            } else if (!strcmp(optarg, "ssid")) {
-                filterCmd->bssFilter = PROBED_SSID_FILTER;
-            } else {
-                cmd = 0;
-            }
-            break;
-        case 'e':
-            sParamCmd->fg_end_period = atoi(optarg);
-            break;
-        case 'g':
-            sParamCmd->fg_start_period = atoi(optarg);
-            break;
-        case 'h':
-            sParamCmd->maxact_chdwell_time = atoi(optarg);
-            break;
-        case 'q':
-            sParamCmd->pas_chdwell_time = atoi(optarg);
-            break;
-        case 'j':
-            cmd = WMI_CREATE_QOS;
-            crePStreamCmd->userPriority = atoi(optarg);
-            break;
-        case 'k':
-            cmd = WMI_DELETE_QOS;
-            delPStreamCmd->trafficClass = atoi(optarg);
-            break;
-        case 'l':
-            cmd = WMI_SET_LISTEN_INTERVAL;
-            listenCmd->listenInterval = atoi(optarg);
-            if ((listenCmd->listenInterval < MIN_LISTEN_INTERVAL) ||
-                (listenCmd->listenInterval > MAX_LISTEN_INTERVAL))
-            {
-                printf("Listen Interval out of range\n");
-                cmd = 0;
-            }
-            break;
-        case 'N':
-            cmd =  WMI_SET_LISTEN_INTERVAL;
-            listenCmd->numBeacons = atoi(optarg);
-            if ((listenCmd->numBeacons < MIN_LISTEN_BEACONS) ||
-                (listenCmd->numBeacons > MAX_LISTEN_BEACONS))
-            {
-                printf("Listen beacons out of range\n");
-                cmd = 0;
-            }
-            break;
-        case 'm':
-            cmd = WMI_SET_PM_PARAMS;
-            break;
-        case 'n':
-            index = atoi(optarg);
-            break;
-        case 'v':
-            cmd = WMI_GET_VERSION;
-            break;
-        case 'o':
-            cmd = WMI_GET_QOS_QUEUE;
-            getQosQueueCmd->trafficClass = atoi(optarg);
-            break;
-        case 'p':
-            cmd = WMI_SET_POWER_MODE;
-            if (!strcmp(optarg, "rec")) {
-                pwrCmd->powerMode = REC_POWER;
-            } else if (!strcmp(optarg, "maxperf")) {
-                pwrCmd->powerMode = MAX_PERF_POWER;
-            } else {
-                cmd = 0;
-            }
-            break;
-        case WMI_FORCE_ASSERT:
-            cmd = WMI_FORCE_ASSERT;
-            break;
-        case WMI_SET_MCAST_FILTER:
-            cmd = WMI_SET_MCAST_FILTER;
-            sMcastFilterCmd->multicast_mac[0] = (unsigned int) atoi(argv[2]);
-            sMcastFilterCmd->multicast_mac[1] = (unsigned int) atoi(argv[3]);
-            sMcastFilterCmd->multicast_mac[2] = (unsigned int) atoi(argv[4]);
-            sMcastFilterCmd->multicast_mac[3] = (unsigned int) atoi(argv[5]);
-            sMcastFilterCmd->multicast_mac[4] = (unsigned int) atoi(argv[6]);
-            sMcastFilterCmd->multicast_mac[5] = (unsigned int) atoi(argv[7]);
-
-            printf("sMcastFilterCmd->multicast_mac[0]  %d\n",sMcastFilterCmd->multicast_mac[0] );
-            printf("sMcastFilterCmd->multicast_mac[1]  %d\n",sMcastFilterCmd->multicast_mac[1] );
-            printf("sMcastFilterCmd->multicast_mac[2]  %d\n",sMcastFilterCmd->multicast_mac[2] );
-            printf("sMcastFilterCmd->multicast_mac[3]  %d\n",sMcastFilterCmd->multicast_mac[3] );
-            printf("sMcastFilterCmd->multicast_mac[4]  %d\n",sMcastFilterCmd->multicast_mac[4] );
-            printf("sMcastFilterCmd->multicast_mac[5]  %d\n",sMcastFilterCmd->multicast_mac[5] );
-            break;
-        case WMI_DEL_MCAST_FILTER:
-            cmd = WMI_DEL_MCAST_FILTER;
-            sMcastFilterCmd->multicast_mac[0] = (unsigned int) atoi(argv[2]);
-            sMcastFilterCmd->multicast_mac[1] = (unsigned int) atoi(argv[3]);
-            sMcastFilterCmd->multicast_mac[2] = (unsigned int) atoi(argv[4]);
-            sMcastFilterCmd->multicast_mac[3] = (unsigned int) atoi(argv[5]);
-            sMcastFilterCmd->multicast_mac[4] = (unsigned int) atoi(argv[6]);
-            sMcastFilterCmd->multicast_mac[5] = (unsigned int) atoi(argv[7]);
-
-            printf("sMcastFilterCmd->multicast_mac[0]  %d\n",sMcastFilterCmd->multicast_mac[0] );
-            printf("sMcastFilterCmd->multicast_mac[1]  %d\n",sMcastFilterCmd->multicast_mac[1] );
-            printf("sMcastFilterCmd->multicast_mac[2]  %d\n",sMcastFilterCmd->multicast_mac[2] );
-            printf("sMcastFilterCmd->multicast_mac[3]  %d\n",sMcastFilterCmd->multicast_mac[3] );
-            printf("sMcastFilterCmd->multicast_mac[4]  %d\n",sMcastFilterCmd->multicast_mac[4] );
-            printf("sMcastFilterCmd->multicast_mac[5]  %d\n",sMcastFilterCmd->multicast_mac[5] );
-            break;
-        case WMI_MCAST_FILTER:
-            cmd = WMI_MCAST_FILTER;
-
-            mcastFilterCmd->enable = (unsigned int) atoi(argv[2]);
-            printf("Multicast Filter State: %s\n", mcastFilterCmd->enable ? "enable" : "disable");
-            break;
-        case 'r':
-            sParamCmd->shortScanRatio = atoi(optarg);
-            break;
-        case 's':
-            cmd = WMI_SET_SCAN_PARAMS;
-            sParamCmd->scanCtrlFlags = DEFAULT_SCAN_CTRL_FLAGS;
-            sParamCmd->shortScanRatio = WMI_SHORTSCANRATIO_DEFAULT;
-            sParamCmd->max_dfsch_act_time = 0 ;
-            break;
-        case WMI_SCAN_DFSCH_ACT_TIME:
-            sParamCmd->max_dfsch_act_time = atoi(optarg);
-            break;
-        case WMI_SCAN_MAXACT_PER_SSID:
-            sParamCmd->maxact_scan_per_ssid = atoi(optarg);
-            break;
-        case 't':
-            cmd = WMI_SET_SSID;
-            ssid = (A_UCHAR *)optarg;
-            break;
-        case 'u':
-            cmd = WMI_SET_RSSI_THRESHOLDS;
-            memset(threshold, 0, sizeof(threshold));
-            for (index = optind; index <= argc; index++)
-                threshold[index-optind] = atoi(argv[index-1]);
-
-            rssiThresholdParam->weight                  = threshold[0];
-            rssiThresholdParam->pollTime                = threshold[1];
-            rssiThresholdParam->tholds[0].tag           = threshold[2];
-            rssiThresholdParam->tholds[0].rssi          = 0 - threshold[3];
-            rssiThresholdParam->tholds[1].tag           = threshold[4];
-            rssiThresholdParam->tholds[1].rssi          = 0 - threshold[5];
-            rssiThresholdParam->tholds[2].tag           = threshold[6];
-            rssiThresholdParam->tholds[2].rssi          = 0 - threshold[7];
-            rssiThresholdParam->tholds[3].tag           = threshold[8];
-            rssiThresholdParam->tholds[3].rssi          = 0 - threshold[9];
-            rssiThresholdParam->tholds[4].tag           = threshold[10];
-            rssiThresholdParam->tholds[4].rssi          = 0 - threshold[11];
-            rssiThresholdParam->tholds[5].tag           = threshold[12];
-            rssiThresholdParam->tholds[5].rssi          = 0 - threshold[13];
-            rssiThresholdParam->tholds[6].tag           = threshold[14];
-            rssiThresholdParam->tholds[6].rssi          = 0 - threshold[15];
-            rssiThresholdParam->tholds[7].tag           = threshold[16];
-            rssiThresholdParam->tholds[7].rssi          = 0 - threshold[17];
-            rssiThresholdParam->tholds[8].tag           = threshold[18];
-            rssiThresholdParam->tholds[8].rssi          = 0 - threshold[19];
-            rssiThresholdParam->tholds[9].tag           = threshold[20];
-            rssiThresholdParam->tholds[9].rssi          = 0 - threshold[21];
-            rssiThresholdParam->tholds[10].tag           = threshold[22];
-            rssiThresholdParam->tholds[10].rssi          = 0 - threshold[23];
-            rssiThresholdParam->tholds[11].tag           = threshold[24];
-            rssiThresholdParam->tholds[11].rssi          = 0 - threshold[25];
-
-            break;
-        case WMI_SET_SNR_THRESHOLDS:
-            cmd = WMI_SET_SNR_THRESHOLDS;
-            memset(threshold, 0, sizeof(threshold));
-            for (index = optind; index <= argc; index++)
-                threshold[index-optind] = atoi(argv[index-1]);
-
-            snrThresholdParam->weight                  = threshold[0];
-            snrThresholdParam->thresholdAbove1_Val     = threshold[1];
-            snrThresholdParam->thresholdAbove2_Val     = threshold[2];
-            snrThresholdParam->thresholdAbove3_Val     = threshold[3];
-            snrThresholdParam->thresholdAbove4_Val     = threshold[4];
-            snrThresholdParam->thresholdBelow1_Val    = threshold[5];
-            snrThresholdParam->thresholdBelow2_Val    = threshold[6];
-            snrThresholdParam->thresholdBelow3_Val    = threshold[7];
-            snrThresholdParam->thresholdBelow4_Val    = threshold[8];
-            snrThresholdParam->pollTime                = threshold[9];
-            break;
-        case WMI_CLR_RSSISNR:
-            cmd = WMI_CLR_RSSISNR;
-            break;
-        case WMI_SET_LQ_THRESHOLDS:
-            cmd = WMI_SET_LQ_THRESHOLDS;
-            memset(threshold, 0, sizeof(threshold));
-            for (index = optind; index <= argc; index++)
-                threshold[index-optind] = atoi(argv[index-1]);
-
-            lqThresholdParam->enable                       = threshold[0];
-            lqThresholdParam->thresholdAbove1_Val          = threshold[1];
-            lqThresholdParam->thresholdAbove2_Val          = threshold[2];
-            lqThresholdParam->thresholdAbove3_Val          = threshold[3];
-            lqThresholdParam->thresholdAbove4_Val          = threshold[4];
-            lqThresholdParam->thresholdBelow1_Val          = threshold[5];
-            lqThresholdParam->thresholdBelow2_Val          = threshold[6];
-            lqThresholdParam->thresholdBelow3_Val          = threshold[7];
-            lqThresholdParam->thresholdBelow4_Val          = threshold[8];
-
-            break;
-        case 'i':
-            memset(ifname, '\0', 8);
-            strcpy(ifname, optarg);
-            break;
-        case 'w':
-            cmd = WMI_SET_CHANNEL;
-            chParamCmd->numChannels = 0;
-            chParamCmd->scanParam = 0;
-            break;
-        case 'x':
-            if (wmic_ether_aton(optarg, badApCmd->bssid) != A_OK) {
-                printf("bad mac address\n");
-                break;
-            }
-            cmd = WMI_SET_BADAP;
-            break;
-        case 'y':
-            /*
-             * we are clearing a bad AP. We pass a null mac address
-             */
-            cmd = WMI_DELETE_BADAP;
-            break;
-        case 'z':
-            sParamCmd->minact_chdwell_time = atoi(optarg);
-            break;
-        case WMI_GET_TARGET_STATS:
-            cmd = WMI_GET_TARGET_STATS;
-            break;
-        case WMI_SET_TARGET_ERROR_REPORTING_BITMASK:
-            cmd = WMI_SET_TARGET_ERROR_REPORTING_BITMASK;
-            pBitMask->bitmask = atoi(optarg);
-            printf("Setting the bitmask = 0x%x\n", pBitMask->bitmask);
-            break;
-        case WMI_SET_ASSOC_IE:
-            cmd = WMI_SET_ASSOC_INFO_CMDID;
-            ieInfo->ieType = 1;
-            if (strlen(optarg) > WMI_MAX_ASSOC_INFO_LEN) {
-                printf("IE Size cannot be greater than %d\n",
-                        WMI_MAX_ASSOC_INFO_LEN);
-                cmd = 0;
-            } else {
-                ieInfo->bufferSize = strlen(optarg) + 2;
-                memcpy(&ieInfo->assocInfo[2], optarg,
-                       ieInfo->bufferSize - 2);
-               ieInfo->assocInfo[0] = 0xdd;
-               ieInfo->assocInfo[1] = ieInfo->bufferSize - 2;
-            }
-            break;
-        case WMI_SET_BMISS_TIME:
-            cmd = WMI_SET_BMISS_TIME;
-            bmissCmd->bmissTime = atoi(optarg);
-            if ((bmissCmd->bmissTime < MIN_BMISS_TIME) ||
-                (bmissCmd->bmissTime > MAX_BMISS_TIME))
-            {
-                printf("BMISS time out of range\n");
-                cmd = 0;
-            } 
-            break;
-        case 'M':
-            cmd = WMI_SET_BMISS_TIME;
-            bmissCmd->numBeacons =  atoi(optarg);
-            if ((bmissCmd->numBeacons < MIN_BMISS_BEACONS) ||
-                (bmissCmd->numBeacons > MAX_BMISS_BEACONS))
-            {
-                printf("BMISS beacons out of range\n");
-                cmd = 0;
-            }
-            break;
-
-        case WMI_SET_AC_PARAMS:
-            cmd = WMI_SET_AC_PARAMS;
-            break;
-        case WMI_SET_AC_VAL:
-            acParamsCmd->ac = atoi(optarg);
-            break;
-        case 'A':
-            acParamsCmd->txop = atoi(optarg);
-            break;
-        case 'B':
-            acParamsCmd->eCWmin = atoi(optarg);
-            break;
-        case 'C':
-            acParamsCmd->eCWmax = atoi(optarg);
-            break;
-        case 'D':
-            acParamsCmd->aifsn = atoi(optarg);
-            break;
-        case 'E':
-            if (!strcmp(optarg, "disable")) {
-                adhocPmCmd->power_saving = ADHOC_PS_DISABLE;
-            } else if (!strcmp(optarg, "atheros")) {
-                adhocPmCmd->power_saving = ADHOC_PS_ATH;
-            } else if (!strcmp(optarg, "ieee")) {
-                adhocPmCmd->power_saving = ADHOC_PS_IEEE;
-            } else {
-                cmd = 0;
-            }
-
-            break;
-        case 'F':
-            adhocPmCmd->atim_windows = atoi(optarg);
-            break;
-        case 'G':
-            if (wmic_ether_aton(optarg, adhocBssidCmd->bssid) != A_OK) {
-                printf("bad mac address\n");
-                break;
-            }
-            printf("adhoc bssid address, %x\n", adhocBssidCmd->bssid[0]);
-            cmd = WMI_SET_ADHOC_BSSID;
-            break;
-
-       case 'J':
-            cmd = WMI_SET_WLAN_STATE;
-            if (!strcmp(optarg, "enable")) {
-                ((int *)buf)[1] = WLAN_ENABLED;
-            } else if (!strcmp(optarg, "disable")) {
-                ((int *)buf)[1] = WLAN_DISABLED;
-            } else if (!strcmp(optarg, "query")) {
-                cmd = WMI_GET_WLAN_STATE;
-            } else {
-                usage();
-            }
-            break;
-        case 'K':
-            adhocPmCmd->timeout_value = atoi(optarg);
-            break;
-       case 'O':
-            index = optind;
-            index--;
-            if((index + 6) > argc) {  /*6 is the number of  flags
-                                       scanctrlflags takes  */
-                printf("Incorrect number of scanctrlflags\n");
-                cmd = 0;
-                break;
-           }
-            sParamCmd->scanCtrlFlags = 0;
-            if (atoi(argv[index]) == 1)
-                sParamCmd->scanCtrlFlags |= CONNECT_SCAN_CTRL_FLAGS;
-            index++;
-            if (atoi(argv[index]) == 1)
-                sParamCmd->scanCtrlFlags |= SCAN_CONNECTED_CTRL_FLAGS;
-            index++;
-            if (atoi(argv[index]) == 1)
-                sParamCmd->scanCtrlFlags |= ACTIVE_SCAN_CTRL_FLAGS;
-            index++;
-            if (atoi(argv[index]) == 1)
-                sParamCmd->scanCtrlFlags |= ROAM_SCAN_CTRL_FLAGS;
-            index++;
-            if (atoi(argv[index]) == 1)
-                sParamCmd->scanCtrlFlags |= REPORT_BSSINFO_CTRL_FLAGS;
-            index++;
-            if(atoi(argv[index]) == 1)
-               sParamCmd->scanCtrlFlags |= ENABLE_AUTO_CTRL_FLAGS;
-            index++;
-            if (argc - index) {
-                if(atoi(argv[index]) == 1)
-                   sParamCmd->scanCtrlFlags |= ENABLE_SCAN_ABORT_EVENT;
-                index++;
-            }
-            if(!sParamCmd->scanCtrlFlags) {
-               sParamCmd->scanCtrlFlags = 255; /* all flags have being disabled by the user */
-            }
-            break;
-       case 'L':
-            adhocPmCmd->ttl = atoi(optarg);
-            break;
-       case  'P':
-            startScanCmd->homeDwellTime =atoi(optarg);
-            break;
-       case 'Q':
-            startScanCmd->forceScanInterval =atoi(optarg);
-            break;
-       case 'R':
-            index = optind;
-            index--;
-            if((index + 3) > argc) {
-                printf("Incorrect number of forceScanCtrlFlags\n");
-                cmd = 0;
-                break;
-            }
-            startScanCmd->scanType = atoi(argv[index]);
-            index++;
-            startScanCmd->forceFgScan = atoi(argv[index]);
-            index++;
-            startScanCmd->isLegacy = atoi(argv[index]);
-            index++;
-            break;
-       case WMI_SCAN_CHANNEL_LIST:
-            chindex = 0;
-            index = optind - 1;
-            clist = startScanCmd->channelList;
-
-            while (argv[index] != NULL) {
-                channel = atoi(argv[index]);
-                if (channel < 255) {
-                    /*
-                     * assume channel is a ieee channel #
-                     */
-                clist[chindex] = wmic_ieee2freq(channel);
-                } else {
-                    clist[chindex] = channel;
-                }
-                chindex++;
-                index++;
-            }
-            startScanCmd->numChannels = chindex;
-            break;
-       case WMI_SET_IBSS_PM_CAPS:
-            cmd = WMI_SET_IBSS_PM_CAPS;
-            break;
-       case WMI_SET_AP_PS:
-            cmd = WMI_SET_AP_PS;
-            break;
-        case WMI_SET_DISC_TIMEOUT:
-            cmd = WMI_SET_DISC_TIMEOUT;
-            discCmd->disconnectTimeout = atoi(optarg);
-            break;
-        case WMI_SET_BEACON_INT:
-            cmd = WMI_SET_BEACON_INT;
-            bconIntvl->beaconInterval = atoi(optarg);
-            break;
-        case WMI_SET_VOICE_PKT_SIZE:
-            cmd = WMI_SET_VOICE_PKT_SIZE;
-            pSizeThresh->voicePktSize = atoi(optarg);
-            break;
-        case WMI_SET_MAX_SP:
-            cmd = WMI_SET_MAX_SP;
-            pMaxSP->maxSPLen = atoi(optarg);
-            break;
-        case WMI_GET_ROAM_TBL:
-            cmd = WMI_GET_ROAM_TBL;
-            break;
-        case WMI_SET_ROAM_CTRL:
-            pRoamCtrl->roamCtrlType = atoi(optarg);
-            if (A_OK != wmic_validate_roam_ctrl(pRoamCtrl, argc-optind, argv)) {
-                break;
-            }
-            cmd = WMI_SET_ROAM_CTRL;
-            break;
-        case WMI_SET_POWERSAVE_TIMERS:
-            cmd = WMI_SET_POWERSAVE_TIMERS;
-            break;
-        case WMI_SET_POWERSAVE_TIMERS_PSPOLLTIMEOUT:
-            pPowerSave->psPollTimeout = atoi(optarg);
-            break;
-        case WMI_SET_POWERSAVE_TIMERS_TRIGGERTIMEOUT:
-            pPowerSave->triggerTimeout = atoi(optarg);
-            break;
-        case WMI_GET_POWER_MODE:
-            cmd = WMI_GET_POWER_MODE;
-            break;
-        case WMI_GET_ROAM_DATA:
-            cmd = WMI_GET_ROAM_DATA;
-            break;
-        case WMI_SET_BT_STATUS:
-            cmd = WMI_SET_BT_STATUS;
-            pBtStatCmd->streamType = atoi(optarg);
-            pBtStatCmd->status = atoi(argv[optind]);
-            if (pBtStatCmd->streamType >= BT_STREAM_MAX ||
-                pBtStatCmd->status >= BT_STATUS_MAX)
-            {
-                fprintf(stderr, "Invalid parameters.\n");
-                exit(0);
-            }
-            break;
-        case WMI_SET_BT_PARAMS:
-            cmd = WMI_SET_BT_PARAMS;
-            pBtParmCmd->paramType = atoi(optarg);
-            if (pBtParmCmd->paramType >= BT_PARAM_MAX)
-            {
-                fprintf(stderr, "Invalid parameters.\n");
-                exit(0);
-            }
-            if (BT_PARAM_SCO == pBtParmCmd->paramType) {
-                pBtParmCmd->info.scoParams.numScoCyclesForceTrigger =
-                                    strtoul(argv[optind], NULL, 0);
-                pBtParmCmd->info.scoParams.dataResponseTimeout =
-                    strtoul(argv[optind+1], NULL, 0);
-                pBtParmCmd->info.scoParams.stompScoRules =
-                    strtoul(argv[optind+2], NULL, 0);
-                pBtParmCmd->info.scoParams.scoOptFlags =
-                    strtoul(argv[optind+3], NULL, 0);
-                pBtParmCmd->info.scoParams.stompDutyCyleVal =
-                    strtoul(argv[optind+4], NULL, 0);
-                pBtParmCmd->info.scoParams.stompDutyCyleMaxVal =
-                    strtoul(argv[optind+5], NULL, 0);
-                pBtParmCmd->info.scoParams. psPollLatencyFraction =
-                    strtoul(argv[optind+6], NULL, 0);
-                pBtParmCmd->info.scoParams.noSCOSlots =
-                    strtoul(argv[optind+7], NULL, 0);
-                pBtParmCmd->info.scoParams.noIdleSlots =
-                    strtoul(argv[optind+8], NULL, 0);
-                pBtParmCmd->info.scoParams.scoOptOffRssi =
-                    strtoul(argv[optind+9], NULL, 0);
-                pBtParmCmd->info.scoParams.scoOptOnRssi =
-                    strtoul(argv[optind+10], NULL, 0);
-                pBtParmCmd->info.scoParams.scoOptRtsCount =
-                    strtoul(argv[optind+11], NULL, 0);
-            }else if (BT_PARAM_A2DP == pBtParmCmd->paramType) {
-                pBtParmCmd->info.a2dpParams.a2dpWlanUsageLimit =
-                    strtoul(argv[optind], NULL, 0);
-                pBtParmCmd->info.a2dpParams.a2dpBurstCntMin =
-                    strtoul(argv[optind+1 ], NULL, 0);
-                pBtParmCmd->info.a2dpParams.a2dpDataRespTimeout =
-                    strtoul(argv[optind+2 ], NULL, 0);
-                pBtParmCmd->info.a2dpParams.a2dpOptFlags =
-                    strtoul(argv[optind+3 ], NULL, 0);
-                pBtParmCmd->info.a2dpParams.isCoLocatedBtRoleMaster =
-                    strtoul(argv[optind+4 ], NULL, 0);
-                pBtParmCmd->info.a2dpParams.a2dpOptOffRssi =
-                    strtoul(argv[optind+5], NULL, 0);
-                pBtParmCmd->info.a2dpParams.a2dpOptOnRssi =
-                    strtoul(argv[optind+6], NULL, 0);
-                pBtParmCmd->info.a2dpParams.a2dpOptRtsCount =
-                    strtoul(argv[optind+7 ], NULL, 0);
-
-            }else if (BT_PARAM_ANTENNA_CONFIG == pBtParmCmd->paramType) {
-                pBtParmCmd->info.antType = strtoul(argv[optind], NULL, 0);
-            } else if (BT_PARAM_COLOCATED_BT_DEVICE == pBtParmCmd->paramType) {
-                pBtParmCmd->info.coLocatedBtDev =
-                                         strtoul(argv[optind], NULL, 0);
-            }else if(BT_PARAM_ACLCOEX == pBtParmCmd->paramType) {
-                pBtParmCmd->info.aclCoexParams.aclWlanMediumUsageTime =
-                                            strtoul(argv[optind], NULL, 0);
-                pBtParmCmd->info.aclCoexParams.aclBtMediumUsageTime =
-                                            strtoul(argv[optind+1], NULL, 0);
-                pBtParmCmd->info.aclCoexParams.aclDataRespTimeout =
-                                            strtoul(argv[optind+2], NULL, 0);
-                pBtParmCmd->info.aclCoexParams.aclDetectTimeout =
-                                            strtoul(argv[optind+3], NULL, 0);
-                pBtParmCmd->info.aclCoexParams.aclmaxPktCnt =
-                                            strtoul(argv[optind + 4], NULL, 0);
-            } else if (BT_PARAM_11A_SEPARATE_ANT == pBtParmCmd->paramType) {
-                printf("BT_PARAM_11A_SEPARATE_ANT \n");
-            }
-            else
-            {
-                fprintf(stderr, "Invalid parameters.\n");
-                exit(0);
-            }
-            break;
-        case WMI_SET_BTCOEX_FE_ANT:
-            cmd = WMI_SET_BTCOEX_FE_ANT;
-            pBtcoexFeAntCmd->btcoexFeAntType = atoi(optarg);
-            if (pBtcoexFeAntCmd->btcoexFeAntType >= WMI_BTCOEX_FE_ANT_TYPE_MAX) {
-                printf("Invalid configuration [1-Single Antenna,  2- dual antenna low isolation, 3 - dual antenna high isolation\n");
-                printf("4 - bypass mode, 5 - combine mode]\n");
-                exit(-1);
-            }
-            break;
-    case WMI_SET_BTCOEX_COLOCATED_BT_DEV:
-        cmd = WMI_SET_BTCOEX_COLOCATED_BT_DEV;
-        pBtcoexCoLocatedBtCmd->btcoexCoLocatedBTdev = atoi(optarg);
-            if (pBtcoexCoLocatedBtCmd->btcoexCoLocatedBTdev > 4) {
-                printf("Invalid configuration %d\n",
-                        pBtcoexCoLocatedBtCmd->btcoexCoLocatedBTdev);
-                exit(-1);
-            }
-        printf("btcoex colocated antType = %d\n",
-                   pBtcoexCoLocatedBtCmd->btcoexCoLocatedBTdev);
-        break;
-    case WMI_SET_BTCOEX_SCO_CONFIG:
-        cmd = WMI_SET_BTCOEX_SCO_CONFIG;
-        index = optind - 1;
-        if((index + 17) > argc) {
-            printf("Incorrect number of sco Config\n");
-            exit(-1);
-        }
-        pBtcoexScoConfigCmd->scoConfig.scoSlots =  atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoConfig.scoIdleSlots = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoConfig.scoFlags = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoConfig.linkId = atoi(argv[index++]);
-
-        pBtcoexScoConfigCmd->scoPspollConfig.scoCyclesForceTrigger = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoPspollConfig.scoDataResponseTimeout = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoPspollConfig.scoStompDutyCyleVal = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoPspollConfig.scoStompDutyCyleMaxVal = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoPspollConfig.scoPsPollLatencyFraction = atoi(argv[index++]);
-
-
-        pBtcoexScoConfigCmd->scoOptModeConfig.scoStompCntIn100ms = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoOptModeConfig.scoContStompMax = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoOptModeConfig.scoMinlowRateMbps = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoOptModeConfig.scoLowRateCnt = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoOptModeConfig.scoHighPktRatio = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoOptModeConfig.scoMaxAggrSize = atoi(argv[index++]);
-
-        pBtcoexScoConfigCmd->scoWlanScanConfig.scanInterval = atoi(argv[index++]);
-        pBtcoexScoConfigCmd->scoWlanScanConfig.maxScanStompCnt = atoi(argv[index++]);
-        break;
-    case WMI_SET_BTCOEX_A2DP_CONFIG:
-        cmd = WMI_SET_BTCOEX_A2DP_CONFIG;
-        index = optind - 1;
-        if((index + 10) > argc ) {
-            printf("Incorrect number of A2DP Config\n");
-            exit(-1);
-        }
-        pBtcoexA2dpConfigCmd->a2dpConfig.a2dpFlags =  atoi(argv[index++]);
-        pBtcoexA2dpConfigCmd->a2dpConfig.linkId = atoi(argv[index++]);
-        pBtcoexA2dpConfigCmd->a2dppspollConfig.a2dpWlanMaxDur = atoi(argv[index++]);
-        pBtcoexA2dpConfigCmd->a2dppspollConfig.a2dpMinBurstCnt = atoi(argv[index++]);
-        pBtcoexA2dpConfigCmd->a2dppspollConfig.a2dpDataRespTimeout = atoi(argv[index++]);
-
-        pBtcoexA2dpConfigCmd->a2dpOptConfig.a2dpMinlowRateMbps = atoi(argv[index++]);
-        pBtcoexA2dpConfigCmd->a2dpOptConfig.a2dpLowRateCnt = atoi(argv[index++]);
-        pBtcoexA2dpConfigCmd->a2dpOptConfig.a2dpHighPktRatio = atoi(argv[index++]);
-        pBtcoexA2dpConfigCmd->a2dpOptConfig.a2dpMaxAggrSize = atoi(argv[index++]);
-        pBtcoexA2dpConfigCmd->a2dpOptConfig.a2dpPktStompCnt = atoi(argv[index++]);
-
-        printf("a2dp Config, flags=%x\n", pBtcoexA2dpConfigCmd->a2dpConfig.a2dpFlags);
-        break;
-    case WMI_SET_BTCOEX_ACLCOEX_CONFIG:
-        cmd = WMI_SET_BTCOEX_ACLCOEX_CONFIG;
-        index = optind - 1;
-        if((index + 14) > argc ) {
-            printf("Incorrect number of ACL COEX Config\n");
-            exit(-1);
-        }
-        pBtcoexAclCoexConfigCmd->aclCoexConfig.aclWlanMediumDur     =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexConfig.aclBtMediumDur       =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexConfig.aclDetectTimeout     =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexConfig.aclPktCntLowerLimit  =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexConfig.aclIterForEnDis      =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexConfig.aclPktCntUpperLimit  =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexConfig.aclCoexFlags         =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexConfig.linkId               =  atoi(argv[index++]);
-
-        pBtcoexAclCoexConfigCmd->aclCoexPspollConfig.aclDataRespTimeout =  atoi(argv[index++]);
-
-        pBtcoexAclCoexConfigCmd->aclCoexOptConfig.aclCoexMinlowRateMbps  =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexOptConfig.aclCoexLowRateCnt  =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexOptConfig.aclCoexHighPktRatio  =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexOptConfig.aclCoexMaxAggrSize  =  atoi(argv[index++]);
-        pBtcoexAclCoexConfigCmd->aclCoexOptConfig.aclPktStompCnt  =  atoi(argv[index++]);
-        break;
-
-    case WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG:
-        cmd = WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG;
-        index = optind - 1;
-        if((index + 3) > argc) {
-            printf("Incorrect number of inquiry_page Config\n");
-            exit(-1);
-        }
-        pBtcoexbtinquiryPageConfigCmd->btInquiryDataFetchFrequency = atoi(argv[index++]);
-        pBtcoexbtinquiryPageConfigCmd->protectBmissDurPostBtInquiry = atoi(argv[index++]);
-        pBtcoexbtinquiryPageConfigCmd->btInquiryPageFlag = atoi(argv[index++]);
-        break;
-
-    case WMI_SET_BTCOEX_BT_OPERATING_STATUS:
-        cmd = WMI_SET_BTCOEX_BT_OPERATING_STATUS;
-        index = optind - 1;
-        if((index + 3) > argc) {
-            printf("Incorrect number of operating status cmdn");
-            exit(-1);
-        }
-
-        pBtcoexBtOperatingStatusCmd->btProfileType =atoi(argv[index++]);
-        pBtcoexBtOperatingStatusCmd->btOperatingStatus =atoi(argv[index++]);
-        pBtcoexBtOperatingStatusCmd->btLinkId =atoi(argv[index++]);
-        break;
-
-    case WMI_GET_BTCOEX_CONFIG:
-        cmd = WMI_GET_BTCOEX_CONFIG;
-        index = optind - 1;
-        if((index + 2) > argc) {
-            printf("Incorrect number of get Config\n");
-            exit(-1);
-        }
-        pBtcoexConfig->configCmd.btProfileType = atoi(argv[index++]);
-        pBtcoexConfig->configCmd.linkId = atoi(argv[index++]);
-        break;
-    case WMI_GET_BTCOEX_STATS:
-        cmd = WMI_GET_BTCOEX_STATS;
-        break;
-        case WMI_SET_RETRYLIMITS:
-            index = optind - 1;
-            setRetryCmd->frameType = atoi(argv[index++]);
-            if (setRetryCmd->frameType > 2) {
-                printf("Invalid frame type! [0 - 2]\n");
-                exit(-1);
-            }
-            setRetryCmd->trafficClass = atoi(argv[index++]);
-            if (setRetryCmd->trafficClass > 3) {
-                printf("Invalid traffic class! [0 - 3]\n");
-                exit(-1);
-            }
-            setRetryCmd->maxRetries = atoi(argv[index++]);
-            if (setRetryCmd->maxRetries > WMI_MAX_RETRIES) {
-                printf("Invalid max retries! [0 - 13] \n");
-                exit(-1);
-            }
-            if (!strcmp(argv[index], "on")) {
-                setRetryCmd->enableNotify = 1;
-            } else if (!strcmp(argv[index], "off")) {
-                setRetryCmd->enableNotify = 0;
-            } else {
-                usage();
-            }
-            cmd = WMI_SET_RETRYLIMITS;
-            break;
-        case WMI_START_SCAN:
-            cmd = WMI_START_SCAN;
-            startScanCmd->homeDwellTime = 0;
-            startScanCmd->forceScanInterval = 0;
-            startScanCmd->numChannels = 0;
-            break;
-        case WMI_SET_FIX_RATES:
-            cmd = WMI_SET_FIX_RATES;
-            break;
-        case WMI_GET_FIX_RATES:
-            cmd = WMI_GET_FIX_RATES;
-            break;
-        case WMI_SET_AUTH_MODE:
-            cmd = WMI_SET_AUTH_MODE;
-            break;
-        case WMI_SET_REASSOC_MODE:
-            cmd = WMI_SET_REASSOC_MODE;
-            break;
-        case WMI_SET_LPREAMBLE:
-            cmd = WMI_SET_LPREAMBLE;
-            setLpreambleCmd->status = atoi(optarg);
-            break;
-        case WMI_SET_RTS:
-            cmd = WMI_SET_RTS;
-            setRtsCmd->threshold = atoi(optarg);
-            break;
-        case WMI_SET_WMM:
-            cmd = WMI_SET_WMM;
-            setWmmCmd->status = atoi(optarg);
-            break;
-        case WMI_SET_QOS_SUPP:
-            cmd = WMI_SET_QOS_SUPP;
-            qosSupp->status = atoi(optarg);
-            break;
-        case WMI_APSD_TIM_POLICY:
-            if (!strcmp(optarg, "ignore")) {
-                pPowerSave->apsdTimPolicy = IGNORE_TIM_ALL_QUEUES_APSD;
-            } else {
-                pPowerSave->apsdTimPolicy = PROCESS_TIM_ALL_QUEUES_APSD;
-            }
-            break;
-        case WMI_SIMULATED_APSD_TIM_POLICY:
-            if (!strcmp(optarg, "ignore")) {
-                pPowerSave->simulatedAPSDTimPolicy = IGNORE_TIM_SIMULATED_APSD;
-            } else {
-                pPowerSave->simulatedAPSDTimPolicy = PROCESS_TIM_SIMULATED_APSD;
-            }
-            break;
-        case WMI_SET_ERROR_DETECTION:
-            cmd = WMI_SET_ERROR_DETECTION;
-            break;
-        case 'S':
-            hbparam->threshold = atoi(optarg);
-            break;
-        case 'T':
-            hbparam->frequency = atoi(optarg);
-            break;
-        case WMI_GET_HB_CHALLENGE_RESP:
-            cmd = WMI_GET_HB_CHALLENGE_RESP;
-            break;
-        case 'U':
-            *cookie = strtoul(optarg, (char **)NULL, 0);
-            break;
-        case USER_SETKEYS:
-            if (argc == 5) {
-                user_setkeys_info->keyOpCtrl = 0;
-                cmd = USER_SETKEYS;
-            } else {
-              printf("Invalid arg %s:Usage --usersetkeys --initrsc=<on/off>",
-                     optarg);
-            }
-            break;
-        case WMI_GET_RD:
-            cmd = WMI_GET_RD;
-            break;
-        case WMI_SET_TXOP:
-            cmd = WMI_SET_TXOP;
-            pTxOp->txopEnable = atoi(optarg);
-            break;
-        case DIAG_ADDR:
-            *diagaddr = strtoul(optarg, (char **)NULL, 0);
-            printf("addr: 0x%x\n", *diagaddr);
-            break;
-        case DIAG_DATA:
-            *diagdata = strtoul(optarg, (char **)NULL, 0);
-            printf("data: 0x%x\n", *diagdata);
-            break;
-        case DIAG_READ:
-            cmd = DIAG_READ;
-            break;
-        case DIAG_WRITE:
-            cmd = DIAG_WRITE;
-            break;
-        case WMI_SET_KEEPALIVE:
-             cmd = WMI_SET_KEEPALIVE;
-             break;
-        case WMI_GET_KEEPALIVE:
-             cmd = WMI_GET_KEEPALIVE;
-             break;
-        case WMI_SET_APPIE:
-             cmd = WMI_SET_APPIE;
-
-            if (argc - optind != 1) {
-                printf("Usage is --setappie <beacon/probe/respon/assoc> <IE>\n");
-                cmd = 0;
-                break;
-            }
-
-            if (A_OK != wmic_validate_appie(appIEInfo, argv)) {
-                cmd = 0;
-                break;
-            }
-            break;
-        case WMI_SET_MGMT_FRM_RX_FILTER:
-             cmd = WMI_SET_MGMT_FRM_RX_FILTER;
-            if (argc - optind != 1) {
-                printf("Usage is --setmgmtfilter <set/clear> <frmtype> \n");
-                cmd = 0;
-                break;
-            }
-
-            if (A_OK != wmic_validate_mgmtfilter(pMgmtFilter, argv)) {
-                cmd = 0;
-                break;
-            }
-            break;
-        case 'V':
-            dbglogCfg->mmask = strtoul(optarg, (char **)NULL, 0);
-            dbglogCfg->valid |= DBGLOG_MODULE_LOG_ENABLE_MASK;
-            break;
-        case 'W':
-            dbglogCfg->rep = strtoul(optarg, (char **)NULL, 0);
-            dbglogCfg->valid |= DBGLOG_REPORTING_ENABLED_MASK;
-            break;
-        case 'X':
-            dbglogCfg->tsr = strtoul(optarg, (char **)NULL, 0);
-            dbglogCfg->valid |= DBGLOG_TIMESTAMP_RESOLUTION_MASK;
-            break;
-        case 'Y':
-            dbglogCfg->size = strtoul(optarg, (char **)NULL, 0);
-            dbglogCfg->valid |= DBGLOG_REPORT_SIZE_MASK;
-            break;
-        case 'Z':
-            clearstat = 1;
-            break;
-        case WMI_BSSID:
-             convert_hexstring_bytearray(optarg, bssid, sizeof(bssid));
-            break;
-        case USER_SETKEYS_INITRSC:
-            if (strcmp(optarg, "on") == 0) {
-                user_setkeys_info->keyOpCtrl &=
-                                    ~AR6000_USER_SETKEYS_RSC_UNCHANGED;
-            } else if (strcmp(optarg, "off") == 0) {
-                user_setkeys_info->keyOpCtrl |=
-                                    AR6000_USER_SETKEYS_RSC_UNCHANGED;
-            } else {
-              printf("Invalid arg %s:Usage --usersetkeys --initrsc=<on/off>",
-                     optarg);
-            }
-            break;
-        case WMI_DBGLOG_CFG_MODULE:
-            dbglogCfg->valid = 0;
-            cmd = WMI_DBGLOG_CFG_MODULE;
-            break;
-        case WMI_DBGLOG_GET_DEBUG_LOGS:
-            cmd = WMI_DBGLOG_GET_DEBUG_LOGS;
-            break;
-        case WMI_SET_HOST_SLEEP_MODE:
-            cmd = WMI_SET_HOST_SLEEP_MODE;
-            if (!strcmp(optarg, "asleep")) {
-                hostSleepModeCmd->asleep = TRUE;
-                hostSleepModeCmd->awake = FALSE;
-            } else if (!strcmp(optarg, "awake")) {
-                hostSleepModeCmd->asleep = FALSE;
-                hostSleepModeCmd->awake = TRUE;
-            }
-            break;
-        case WMI_GET_IP:
-            cmd = WMI_GET_IP;
-            if (strcmp(optarg, "none") == 0) {
-               break;
-            }
-            pIP->ips[0] = inet_addr(optarg);
-            if (!pIP->ips[0] || ((pIP->ips[0] & 0xf0) >= 0xe0)) {
-                printf("Invalid IP\n");
-                cmd = 0;
-                break;
-            }
-            if (optind < argc) {
-                pIP->ips[1] = inet_addr(argv[optind]);
-                if (!pIP->ips[1] || ((pIP->ips[1] & 0xf0) >= 0xe0)) {
-                    printf("Invalid IP\n");
-                    cmd =0;
-                    break;
-                }
-            }
-            break;
-        case WMI_SET_WOW_MODE:
-            cmd = WMI_SET_WOW_MODE;
-            if (!strcmp(optarg, "enable")) {
-                wowModeCmd->enable_wow = TRUE;
-            } else if (!strcmp(optarg, "disable")) {
-                wowModeCmd->enable_wow = FALSE;
-            }
-            break;
-        case WMI_SET_WOW_FILTER:
-            if (!strcmp(optarg, "none")) {
-               wowModeCmd->filter = 0;
-            } else if (!strcmp(optarg, "ssid")) {
-                wowModeCmd->filter |= (1<<WOW_FILTER_SSID);
-            }
-            break;
-        case WMI_SET_WOW_HOST_REQ_DELAY:
-             wowModeCmd->hostReqDelay=atoi(optarg);
-             break;
-        case WMI_ADD_WOW_PATTERN:
-            cmd = WMI_ADD_WOW_PATTERN;
-            index = (optind - 1);
-            A_UINT8* filter_mask = NULL;
-            A_UINT8 temp1[64]={0};
-            A_UINT8 temp2[64]={0};
-
-            if((index + 4) > argc) {
-                printf("Incorrect number of add wow pattern parameters\n");
-                cmd = 0;
-                break;
-            }
-            memset((char*)addWowCmd, 0, sizeof(WMI_ADD_WOW_PATTERN_CMD));
-            i = addWowCmd->filter_list_id = 0;
-            addWowCmd->filter_list_id = atoi(argv[index++]);
-            addWowCmd->filter_size = atoi(argv[index++]);
-            addWowCmd->filter_offset = atoi(argv[index++]);
-            printf("optind=%d, size=%d offset=%d id=%d\n", optind,
-                    addWowCmd->filter_size, addWowCmd->filter_offset,
-                    addWowCmd->filter_list_id);
-            convert_hexstring_bytearray(argv[index], temp1,addWowCmd->filter_size );
-            memcpy(&addWowCmd->filter[0], temp1, addWowCmd->filter_size);
-            index++;
-            filter_mask = (A_UINT8*)(addWowCmd->filter + addWowCmd->filter_size);
-            convert_hexstring_bytearray(argv[index], temp2,addWowCmd->filter_size );
-            memcpy(filter_mask, temp2, addWowCmd->filter_size);
-
-            for (i=0; i< addWowCmd->filter_size; i++) {
-
-                printf ("mask[%d]=%x pattern[%d]=%x temp=%x\n", i, filter_mask[i], i, addWowCmd->filter[i], temp1[i]);
-            }
-            break;
-        case WMI_DEL_WOW_PATTERN:
-            cmd = WMI_DEL_WOW_PATTERN;
-            index = (optind - 1);
-            if ((index  + 1) > argc) {
-                printf("Incorrect number of del wow pattern parameters\n");
-                cmd = 0;
-                break;
-            }
-            delWowCmd->filter_list_id = 0;
-            index++;
-            delWowCmd->filter_id = atoi(argv[index]);
-            break;
-        case WMI_GET_WOW_LIST:
-            cmd = WMI_GET_WOW_LIST;
-            index = (optind - 1);
-            if ((index  + 1) > argc) {
-                printf("Incorrect number of get wow list parameters\n");
-                cmd = 0;
-                break;
-            }
-            getWowListCmd->filter_list_id = atoi(argv[index]);
-            printf("Get wow filters in list %d\n", getWowListCmd->filter_list_id);
-            break;
-        case DIAG_DUMP_CHIP_MEM:
-            cmd = DIAG_DUMP_CHIP_MEM;
-            break;
-        case DIAG_DUMP_CHIP_MEM_VENUS:
-            cmd = DIAG_DUMP_CHIP_MEM_VENUS;
-            break;
-        case WMI_SET_CONNECT_CTRL_FLAGS:
-            cmd = WMI_SET_CONNECT_CTRL_FLAGS;
-            break;
-        case DUMP_HTC_CREDITS:
-            cmd = DUMP_HTC_CREDITS;
-            break;
-        case WMI_AKMP_MULTI_PMKID:
-            if (strcmp(optarg, "on") == 0) {
-                akmpCtrlCmd->akmpInfo |= WMI_AKMP_MULTI_PMKID_EN;
-            } else if (strcmp(optarg, "off") == 0) {
-                akmpCtrlCmd->akmpInfo &= ~WMI_AKMP_MULTI_PMKID_EN;
-            } else {
-              printf("Invalid arg %s:Usage --setakmctrl --multipmkid=<on/off>",
-                     optarg);
-            }
-            break;
-        case WMI_SET_AKMP_INFO:
-            cmd = WMI_SET_AKMP_INFO;
-            break;
-        case WMI_NUM_PMKID:
-            if ((pmkidUserInfo.numPMKIDUser = atoi(optarg))
-                                                > WMI_MAX_PMKID_CACHE)
-            {
-                printf("Number of PMKIDs %d is out of range [1-%d]\n",
-                       pmkidUserInfo.numPMKIDUser,
-                       WMI_MAX_PMKID_CACHE);
-                pmkidUserInfo.numPMKIDUser = 0;
-            }
-            break;
-        case WMI_PMKID_ENTRY:
-            if (pmkidUserInfo.pmkidInfo->numPMKID <
-                    pmkidUserInfo.numPMKIDUser)
-            {
-                A_UINT8 nextEntry = pmkidUserInfo.pmkidInfo->numPMKID;
-
-                convert_hexstring_bytearray(optarg,
-                                            pmkidUserInfo.pmkidInfo->
-                                            pmkidList[nextEntry].pmkid,
-                                            WMI_PMKID_LEN);
-                pmkidUserInfo.pmkidInfo->numPMKID++;
-            }
-            break;
-        case WMI_SET_PMKID_LIST:
-            cmd = WMI_SET_PMKID_LIST;
-            pmkidUserInfo.pmkidInfo =
-                                 (WMI_SET_PMKID_LIST_CMD *)(buf + sizeof(int));
-            pmkidUserInfo.pmkidInfo->numPMKID = 0;
-            pmkidUserInfo.numPMKIDUser = 0;
-            break;
-        case WMI_GET_PMKID_LIST:
-            cmd = WMI_GET_PMKID_LIST;
-            break;
-        case WMI_SET_IEMASK:
-            filterCmd->ieMask = strtoul(argv[optind-1], NULL, 0);
-            break;
-        case WMI_SET_BSS_PMKID_INFO:
-            cmd = WMI_SET_BSS_PMKID_INFO;
-            memset(bssid, 0, sizeof(bssid));
-            pi_cmd->pi_enable = FALSE;
-            break;
-        case WMI_BSS_PMKID_ENTRY:
-            convert_hexstring_bytearray(optarg, pi_cmd->pi_pmkid,
-                                        sizeof(pi_cmd->pi_pmkid));
-            memcpy(pi_cmd->pi_bssid, bssid, sizeof(bssid));
-            pi_cmd->pi_enable = TRUE;
-            break;
-        case WMI_ABORT_SCAN:
-             cmd = WMI_ABORT_SCAN;
-             break;
-        case WMI_TARGET_EVENT_REPORT:
-             cmd = WMI_TARGET_EVENT_REPORT;
-             evtCfgCmd->evtConfig = atoi(optarg);
-             break;
-        /* AP mode commands */
-        case WMI_AP_GET_STA_LIST:
-            cmd = WMI_AP_GET_STA_LIST;
-            break;
-        case WMI_AP_HIDDEN_SSID:
-            cmd = WMI_AP_HIDDEN_SSID;
-            pHidden->hidden_ssid = atoi(argv[optind]);
-            break;
-        case WMI_AP_SET_NUM_STA:
-            cmd = WMI_AP_SET_NUM_STA;
-            pNumSta->num_sta = atoi(argv[optind]);
-            break;
-        case WMI_AP_SET_GNUM_STA:
-            cmd = WMI_AP_SET_GNUM_STA;
-            pNumSta->num_sta = atoi(argv[optind]);
-            pNumSta->num_sta |= 0x80;
-            break;
-        case WMI_AP_GET_NUM_STA:
-            cmd = WMI_AP_GET_NUM_STA;
-            pNumSta->num_sta = 0;
-            break;
-        case WMI_AP_GET_GNUM_STA:
-            cmd = WMI_AP_GET_GNUM_STA;
-            pNumSta->num_sta = 0x80;
-            break;
-        case WMI_AP_SET_DFS:
-            cmd = WMI_AP_SET_DFS;
-            setDfsCmd->enable = atoi(optarg);
-            break;
-        case WMI_AP_ACL_POLICY:
-        {
-            A_UINT8 policy, retain;
-            cmd = WMI_AP_ACL_POLICY;
-            index = optind;
-            policy = atoi(argv[index++]);
-            retain = atoi(argv[index++]);
-            pACLpolicy->policy = policy |
-                (retain?AP_ACL_RETAIN_LIST_MASK:0);
-            break;
-        }
-        case WMI_AP_ACL_MAC_LIST1:
-            cmd = WMI_AP_ACL_MAC_LIST1;
-            pACL->action = ADD_MAC_ADDR;
-            if(wmic_ether_aton_wild(argv[optind], pACL->mac, &pACL->wildcard) != A_OK) {
-                printf("bad mac address\n");
-                exit (0);
-            }
-            break;
-        case WMI_AP_ACL_MAC_LIST2:
-            cmd = WMI_AP_ACL_MAC_LIST2;
-            pACL->action = DEL_MAC_ADDR;
-            if( (strlen(argv[optind]) == 2) && ISDIGIT(argv[optind][0]) && ISDIGIT(argv[optind][1]) ) {
-                pACL->index = atoi(argv[optind]);
-            } else if( (strlen(argv[optind]) == 1) && ISDIGIT(argv[optind][0]) ) {
-                pACL->index = atoi(argv[optind]);
-            } else {
-                printf("bad ACL index\n");
-                exit(0);
-            }
-            break;
-        case WMI_AP_GET_ACL_LIST:
-            cmd = WMI_AP_GET_ACL_LIST;
-            break;
-        case WMI_AP_COMMIT_CONFIG:
-            cmd = WMI_AP_COMMIT_CONFIG;
-            break;
-        case WMI_AP_INACT_TIME:
-            cmd = WMI_AP_INACT_TIME;
-            pInact->period = atoi(argv[optind]);
-            break;
-        case WMI_AP_PROT_TIME:
-            cmd = WMI_AP_PROT_TIME;
-            index = optind;
-            pProt->period_min = atoi(argv[index++]);
-            pProt->dwell_ms = atoi(argv[index++]);
-            break;
-        case WMI_AP_SET_MLME:
-            cmd = WMI_AP_SET_MLME;
-            index = optind;
-            if((index + 3) > argc) {
-                printf("Incorrect number of arguments\n");
-                exit(0);
-            }
-            pMlme->im_op = atoi(argv[index++]);
-            pMlme->im_reason = atoi(argv[index++]);
-            if(wmic_ether_aton(argv[index++], pMlme->im_macaddr) != A_OK) {
-                printf("bad mac address\n");
-                exit (0);
-            }
-            break;
-        case WMI_AP_SET_DTIM:
-            cmd = WMI_AP_SET_DTIM;
-            pDtim->dtim = atoi(argv[optind]);
-            break;
-        case WMI_AP_SET_COUNTRY:
-            cmd = WMI_AP_SET_COUNTRY;
-            A_BOOL match=FALSE;
-
-            for(i = 0; i < sizeof(my_ctr)/sizeof(my_ctr[0]); i++) {
-                if(!strcasecmp(optarg, my_ctr[i])) {
-                    match = 1;
-                    break;
-                }
-            }
-
-            if (!match) {
-                cmd = 0;
-            } else {
-                memcpy(pCountry->countryCode,my_ctr[i], 2);
-                *(pCountry->countryCode + 2)=0x20;
-            }
-
-            break;
-        case WMI_AP_GET_COUNTRY_LIST:
-            cmd = WMI_AP_GET_COUNTRY_LIST;
-            break;
-        case WMI_AP_DISABLE_REGULATORY:
-            cmd = WMI_AP_DISABLE_REGULATORY;
-            break;
-        case WMI_AP_INTRA_BSS:
-            cmd = WMI_AP_INTRA_BSS;
-            *intra = atoi(argv[optind]);
-            *intra &= 0xF;
-            break;
-        case WMI_AP_INTER_BSS:
-            cmd = WMI_AP_INTER_BSS;
-            *intra = atoi(argv[optind]);
-            *intra |= 0x80;
-            break;
-        case WMI_DUMP_RCV_AGGR_STATS:
-            cmd = WMI_DUMP_RCV_AGGR_STATS;
-            break;
-        case WMI_SUSPEND_DRIVER:
-            cmd = WMI_SUSPEND_DRIVER;
-            break;
-        case WMI_RESUME_DRIVER:
-            cmd = WMI_RESUME_DRIVER;
-            break;                             
-        case WMI_SETUP_AGGR:
-        {
-            A_UINT8 aid;
-            cmd = WMI_SETUP_AGGR;
-            if(argc-optind < 2) {
-                printf("--setup_aggr <tid> <aid>\n");
-                return 0;
-            }
-            pAddbaReq->tid = strtoul(argv[optind++], NULL, 0);
-            if(argv[optind]) aid = strtoul(argv[optind], NULL, 0);
-            pAddbaReq->tid = (pAddbaReq->tid & 0xF) | (aid << 4);
-            break;
-        }
-        case WMI_CFG_ALLOW_AGGR:
-            cmd = WMI_CFG_ALLOW_AGGR;
-            pAllowAggr->tx_allow_aggr = strtoul(argv[argc-2], NULL, 0);
-            pAllowAggr->rx_allow_aggr = strtoul(argv[argc-1], NULL, 0);
-            break;
-        case WMI_CFG_DELE_AGGR:
-        {
-            A_UINT8 aid;
-            cmd = WMI_CFG_DELE_AGGR;
-            if(argc-optind < 2) {
-                printf("--dele_aggr <tid> <direction> <aid>\n");
-                return 0;
-            }
-            pDeleteAggr->tid = strtoul(argv[optind++], NULL, 0);
-            pDeleteAggr->is_sender_initiator = strtoul(argv[optind++], NULL, 0);
-            if(argv[optind]) aid = strtoul(argv[optind], NULL, 0);
-            pDeleteAggr->tid = (pDeleteAggr->tid & 0xF) | (aid << 4);
-            break;
-        }
-        case WMI_SET_HT_CAP:
-            cmd = WMI_SET_HT_CAP;
-            break;
-        case WMI_SET_HT_OP:
-            cmd = WMI_SET_HT_OP;
-            break;
-        case WMI_AP_GET_STAT:
-            cmd = WMI_AP_GET_STAT;
-            break;
-        case WMI_AP_CLR_STAT:
-            cmd = WMI_AP_CLR_STAT;
-            break;
-        case WMI_SET_TX_SELECT_RATES:
-            cmd = WMI_SET_TX_SELECT_RATES;
-            break;
-        case WMI_AP_GET_HIDDEN_SSID:
-            cmd = WMI_AP_GET_HIDDEN_SSID;
-            break;
-        case WMI_AP_GET_COUNTRY:
-            cmd = WMI_AP_GET_COUNTRY;
-            break;
-        case WMI_AP_GET_WMODE:
-            cmd = WMI_AP_GET_WMODE;
-            break;
-        case WMI_AP_GET_DTIM:
-            cmd = WMI_AP_GET_DTIM;
-            break;
-        case WMI_AP_GET_BINTVL:
-            cmd = WMI_AP_GET_BINTVL;
-            break;
-        case WMI_GET_RTS:
-            cmd = WMI_GET_RTS;
-            break;
-        case DIAG_FETCH_TARGET_REGS:
-            cmd = DIAG_FETCH_TARGET_REGS;
-            break;
-#ifdef ATH_INCLUDE_PAL
-        case WMI_SEND_PAL_CMD:
-            cmd = WMI_SEND_PAL_CMD;
-            break;
-        case WMI_SEND_PAL_DATA:
-            cmd = WMI_SEND_PAL_DATA;
-            break;
-#endif
-        case WMI_SET_WLAN_CONN_PRECDNCE:
-            cmd = WMI_SET_WLAN_CONN_PRECDNCE;
-            prec->precedence = atoi(argv[argc-1]);
-            break;
-        case WMI_SET_AP_RATESET:
-            cmd = WMI_SET_AP_RATESET;
-            pAPrs->rateset = atoi(argv[optind]);
-            break;
-        case WMI_SET_TX_WAKEUP_POLICY:
-            if (!strcmp(optarg, "sleep")) {
-                pmParamCmd->tx_wakeup_policy = TX_DONT_WAKEUP_UPON_SLEEP;
-            } else if (!strcmp(optarg, "wakeup")) {
-                pmParamCmd->tx_wakeup_policy = TX_WAKEUP_UPON_SLEEP;
-            } else {
-                cmd = 0;
-            }
-            break;
-        case WMI_SET_TX_NUM_FRAMES_TO_WAKEUP:
-            pmParamCmd->num_tx_to_wakeup = atoi(optarg);
-            break;
-        case WMI_SET_AP_PS_PSTYPE:
-            if (!strcmp(optarg, "disable")) {
-                apPsCmd->psType = AP_PS_DISABLE;
-            } else if (!strcmp(optarg, "atheros")) {
-                apPsCmd->psType = AP_PS_ATH;
-            } else {
-                cmd = 0;
-            }
-            break;
-        case WMI_SET_AP_PS_IDLE_TIME:
-            apPsCmd->idle_time = atoi(optarg);
-            break;
-        case WMI_SET_AP_PS_PS_PERIOD:
-            apPsCmd->ps_period = atoi(optarg);
-            break;
-        case WMI_SET_AP_PS_SLEEP_PERIOD:
-            apPsCmd->sleep_period = atoi(optarg);
-            break;
-        case WMI_SEND_CONNECT_CMD:
-            cmd = WMI_SEND_CONNECT_CMD;
-            memset(&cp,0,sizeof(cp));
-            if(strlen(optarg) > 32) {
-                printf("Error: Wrong SSID\n");
-            } else {
-                cp.ssid_len = strlen(optarg);
-                memcpy(cp.ssid, optarg, cp.ssid_len);
-            }
-            break;
-        case WMI_SEND_CONNECT_CMD1:
-#ifdef WPA_SUPPORT
-        {
-            unsigned long val;
-            index = optind-1;
-
-            if(argc-index != 4) {
-                printf("Error: wpa needs 4 args but only %d given\n", argc-index);
-                break;
-            }
-
-            val = strtol(argv[index++], NULL, 0);
-            if(val == 1) {
-                cp.wpa = IW_AUTH_WPA_VERSION_WPA;
-            } else if(val == 2) {
-                cp.wpa = IW_AUTH_WPA_VERSION_WPA2;
-            } else {
-                cp.wpa = 0;
-                printf("Error: Wrong WPA version\n");
-            }
-
-            if (!strcasecmp(argv[index], "tkip")) {
-                cp.ucipher = IW_AUTH_CIPHER_TKIP;
-            } else if (!strcasecmp(argv[index], "ccmp")) {
-                cp.ucipher = IW_AUTH_CIPHER_CCMP;
-            } else {
-                cp.ucipher = IW_AUTH_CIPHER_NONE;
-                printf("Error: Wrong unicast cipher\n");
-            }
-            index++;
-
-            if (!strcasecmp(argv[index], "tkip")) {
-                cp.mcipher = IW_AUTH_CIPHER_TKIP;
-            } else if (!strcasecmp(argv[index], "ccmp")) {
-                cp.mcipher = IW_AUTH_CIPHER_CCMP;
-            } else {
-                cp.mcipher = IW_AUTH_CIPHER_NONE;
-                printf("Error: Wrong multicast cipher\n");
-            }
-            index++;
-
-            val = strlen(argv[index]);
-            if(val >= 8 && val <= 63) {
-                memcpy(cp.psk, argv[index], val);
-                cp.psk_type = KEYTYPE_PHRASE;
-            } else if (val == 64) {
-                memcpy(cp.psk, argv[index], val);
-                cp.psk_type = KEYTYPE_PSK;
-            } else {
-                printf("Error: Wrong PSK\n");
-            }
-            break;
-        }
-#else
-            printf("Command not supported in wireless ext version: %d \n",WIRELESS_EXT);
-            return -1;
-#endif
-       case WMI_SEND_CONNECT_CMD2:
-            printf("Error: WEP not yet implemented\n");
-            return 0;
-
-       case WMI_SET_WPA_OFFLOAD_STATE:
-       {
-           index = optind-1;
-
-           if(argc-index != 1) {
-               printf("Error: setwpaoffload needs 1 arg but only %d given\n", argc-index);
-               break;
-           }
-
-           *pWpaOffloadState = strtol(argv[index++], NULL, 0);
-
-           cmd = WMI_SET_WPA_OFFLOAD_STATE;
-
-           break;
-       }
-       case WMI_SET_EXCESS_TX_RETRY_THRES:
-       {
-           index = optind-1;
-
-           if(argc-index != 1) {
-               printf("Error: setexcesstxretrythres needs 1 arg but only %d given\n", argc-index);
-               break;
-           }
-
-           *pExcessTxRetryThres = strtol(argv[index++], NULL, 0);
-
-           cmd = WMI_SET_EXCESS_TX_RETRY_THRES;
-
-           break;
-       }
-       case BT_HW_POWER_STATE:
-            if (!strcmp(optarg, "on")) {
-                cmd = SET_BT_HW_POWER_STATE;
-                ((int *)buf)[0] = AR6000_XIOCTL_SET_BT_HW_POWER_STATE;
-                ((int *)buf)[1] = 1;
-            } else if (!strcmp(optarg, "off")) {
-                cmd = SET_BT_HW_POWER_STATE;
-                ((int *)buf)[0] = AR6000_XIOCTL_SET_BT_HW_POWER_STATE;
-                ((int *)buf)[1] = 0;
-            } else if (!strcmp(optarg, "query")) {
-                cmd = GET_BT_HW_POWER_STATE;
-                ((int *)buf)[0] = AR6000_XIOCTL_GET_BT_HW_POWER_STATE;
-            } else {
-                usage();
-            }
-            break;
-
-
-       case WMI_SET_TX_SGI_PARAM:
-             cmd = WMI_SET_TX_SGI_PARAM;
-             set_txsgiparam->sgiMask[0] = DEFAULT_SGI_MASK_L32;
-             set_txsgiparam->sgiMask[1] = DEFAULT_SGI_MASK_U32;
-             set_txsgiparam->sgiPERThreshold = DEFAULT_SGI_PER;
-             break;
-
-       case WMI_SGI_MASK:
-            {
-                unsigned long long val;
-
-                val = strtoll(optarg, NULL, 16);
-                set_txsgiparam->sgiMask[0] = (unsigned long) val;
-                set_txsgiparam->sgiMask[1] = (unsigned long) (val>>32);
-            }
-            break;
-       
-
-       case WMI_PER_SGI:
-            {set_txsgiparam->sgiPERThreshold = atoi(optarg);
-             break;
-            }
-
-       case WMI_WAC_ENABLE:
-            cmd = WMI_WAC_ENABLE;
-            break;
-
-       case WMI_AP_ACS_DISABLE_HI_CHANNELS:
-            cmd = WMI_AP_ACS_DISABLE_HI_CHANNELS;
-            ((int *)buf)[1] = atoi(argv[optind]);
-            break;
-
-       case WMI_SET_DIVERSITY_PARAM:
-            cmd = WMI_SET_DIVERSITY_PARAM;
-            index = optind-1;
-            
-            pDiversity->divIdleTime = atoi(argv[index++]);
-            pDiversity->antRssiThresh = atoi(argv[index++]);
-            pDiversity->divEnable = atoi(argv[index++]);
-            pDiversity->active_treshold_rate = atoi(argv[index++]);
-            break;
-       
-       case WMI_SCAN_PROBED_SSID:
-            cmd = WMI_SCAN_PROBED_SSID;
-            ssid = (A_UCHAR *)optarg;
-            break;
-
-        case WMI_AP_SET_APSD:
-            cmd = WMI_AP_SET_APSD;
-            pApApsd->enable = atoi(argv[optind]);
-            break;
-
-        case WMI_GET_HT_CAP:
-            cmd = WMI_GET_HT_CAP;
-            break;
-
-       default:
-            usage();
-            break;
-        }
-    }
-
-    strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-    memset(&iwr, 0, sizeof(iwr));
-    strncpy(iwr.ifr_name, ifname, sizeof(iwr.ifr_name));
-
-    switch (cmd) {
-    case WMI_SET_BSS_FILTER:
-        ifr.ifr_data = (void *)filterCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SETBSSFILTER, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_POWER_MODE:
-        ifr.ifr_data = (void *)pwrCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SETPWR, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_PM_PARAMS:
-        ifr.ifr_data = (void *)pmParamCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_PMPARAMS, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_IBSS_PM_CAPS:
-        ifr.ifr_data = (void *)adhocPmCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_IBSS_PM_CAPS, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_AP_PS:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_AP_PS;
-        ifr.ifr_data = (void *)buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_ERROR_DETECTION:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_HB_CHALLENGE_RESP_PARAMS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_HB_CHALLENGE_RESP:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_GET_HB_CHALLENGE_RESP;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-#ifdef USER_KEYS
-    case USER_SETKEYS:
-        {
-            ((int *)buf)[0] = AR6000_XIOCTL_USER_SETKEYS;
-            ifr.ifr_data = buf;
-
-            if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-            {
-                err(1, "%s", ifr.ifr_name);
-            }
-
-            break;
-        }
-#endif /* USER_KEYS */
-    case WMI_SET_SCAN_PARAMS:
-        if (sParamCmd->maxact_chdwell_time) {
-           if (sParamCmd->maxact_chdwell_time < 5) {
-              printf("Max active channel dwell time should be between 5-65535 msec\n");
-              break;
-           }
-           if (sParamCmd->minact_chdwell_time &&
-              (sParamCmd->maxact_chdwell_time < sParamCmd->minact_chdwell_time)) {
-               printf("Max active channel dwell time should be greater than minimum\n");
-               break;
-           }
-        }
-        ifr.ifr_data = (void *)sParamCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SETSCAN, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_VERSION:
-        {
-        struct ar6000_version *revinfo;
-
-        revinfo = malloc(sizeof(*revinfo));
-        ifr.ifr_data = (void *)revinfo;
-        if (ioctl(s, AR6000_IOCTL_WMI_GETREV, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printf("Driver Rev = 0x%x(%u.%u.%u.%u), ROM Rev = 0x%x(%u.%u.%u.%u), "
-               "Firmware Rev = 0x%x(%u.%u.%u.%u)\n",
-              revinfo->host_ver,
-              ((revinfo->host_ver)&0xf0000000)>>28,
-              ((revinfo->host_ver)&0x0f000000)>>24,
-              ((revinfo->host_ver)&0x00ff0000)>>16,
-              ((revinfo->host_ver)&0x0000ffff),
-              revinfo->target_ver,
-              ((revinfo->target_ver)&0xf0000000)>>28,
-              ((revinfo->target_ver)&0x0f000000)>>24,
-              ((revinfo->target_ver)&0x00ff0000)>>16,
-              ((revinfo->target_ver)&0x0000ffff),
-              revinfo->wlan_ver,
-              ((revinfo->wlan_ver)&0xf0000000)>>28,
-              ((revinfo->wlan_ver)&0x0f000000)>>24,
-              ((revinfo->wlan_ver)&0x00ff0000)>>16,
-              ((revinfo->wlan_ver)&0x0000ffff)
-              );
-        }
-        break;
-    case WMI_SET_LISTEN_INTERVAL:
-        ifr.ifr_data = (void *)listenCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SETLISTENINT, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_BMISS_TIME:
-        ifr.ifr_data = (void *)bmissCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_BMISS_TIME, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_RSSI_THRESHOLDS:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_RSSITHRESHOLD;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_SNR_THRESHOLDS:
-        ifr.ifr_data = (void *)snrThresholdParam;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_SNRTHRESHOLD, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_CLR_RSSISNR:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_CLR_RSSISNR;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_LQ_THRESHOLDS:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_LQTHRESHOLD;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_CHANNEL:
-        index = optind - 1;
-
-        phyMode = getPhyMode(argv[index]);
-
-        if(phyMode == -1)
-        {
-            printf("Incorrect Phy mode \n");
-            break;
-        }
-        else
-        {
-            chParamCmd->phyMode = (WMI_PHY_MODE) phyMode;
-            //printf("Phy mode %d \n",phyMode);
-        }
-
-        clist = chParamCmd->channelList;
-        chindex = 0;
-        index++;
-
-        for (; index < argc; index++) {
-            if (strcmp(argv[index],"sc") == 0) {
-                chParamCmd->scanParam = atoi(argv[++index]);
-                break;
-            } else {
-                channel = atoi(argv[index]);
-                if (!channel) {
-                    break;
-                }
-                if (channel < 255) {
-                    /*
-                     * assume channel is a ieee channel #
-                     */
-                clist[chindex] = wmic_ieee2freq(channel);
-                } else {
-                    clist[chindex] = channel;
-                }
-                chindex++;
-            }
-        }
-
-        chParamCmd->numChannels = chindex;
-        ifr.ifr_data = (void *)chParamCmd;
-
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_CHANNELPARAMS, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_SSID:
-        if (index > MAX_PROBED_SSID_INDEX) {
-            printf("num option for ssid command too large\n");
-            err(1, "%s", ifr.ifr_name);
-            break;
-        }
-        if (strlen((char *)ssid) > sizeof (ssidCmd->ssid)) {
-            printf("ssid name too large\n");
-            err(1, "%s", ifr.ifr_name);
-            break;
-        }
-        ssidCmd->entryIndex = index;
-        if (strcmp((char *)ssid, "off") == 0) {
-            ssidCmd->ssidLength = 0;
-            ssidCmd->flag = DISABLE_SSID_FLAG;
-        } else if (strcmp((char *)ssid, "any") == 0) {
-            ssidCmd->ssidLength = 0;
-            ssidCmd->flag = ANY_SSID_FLAG;
-        } else {
-            ssidCmd->flag = SPECIFIC_SSID_FLAG;
-            ssidCmd->ssidLength = strlen((char *)ssid);
-            strcpy((char *)(ssidCmd->ssid), (char *)ssid);
-        }
-        ifr.ifr_data = (void *)ssidCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_PROBEDSSID, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_BADAP:
-    case WMI_DELETE_BADAP:
-        if (index > WMI_MAX_BAD_AP_INDEX) {
-            printf("bad index\n");
-            break;
-        }
-        badApCmd->badApIndex = index;
-        ifr.ifr_data = (void *)badApCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_BADAP, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_CREATE_QOS:
-        index = optind;
-        crePStreamCmd->trafficDirection = atoi(argv[index]);
-        index++;
-        crePStreamCmd->trafficClass = atoi(argv[index]);
-        index++;
-        crePStreamCmd->trafficType = atoi(argv[index]);
-        index++;
-        crePStreamCmd->voicePSCapability = atoi(argv[index]);
-        index++;
-        crePStreamCmd->minServiceInt = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->maxServiceInt = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->inactivityInt = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->suspensionInt = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->serviceStartTime = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->tsid = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->nominalMSDU =  strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->maxMSDU =  strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->minDataRate = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->meanDataRate = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->peakDataRate = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->maxBurstSize = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->delayBound = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->minPhyRate = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->sba = strtoll(argv[index], (char **)NULL, 0);
-        index++;
-        crePStreamCmd->mediumTime = strtoll(argv[index],(char **)NULL, 0);
-        crePStreamCmd->nominalPHY = 0;
-        index++;
-
-        if (argc == (index + 1)){
-            crePStreamCmd->nominalPHY = strtoll(argv[index],(char **)NULL, 0);
-        }
-
-        if (crePStreamCmd->trafficClass > 3) {
-            printf("bad traffic class (%d)\n", crePStreamCmd->trafficClass);
-            printf("Traffic class should be 1(BK), 2(VI) or 3(VO)\n");
-            break;
-        } else if (crePStreamCmd->trafficDirection > BIDIR_TRAFFIC) {
-            printf("bad traffic direction (%d)\n", crePStreamCmd->trafficDirection);
-            printf("Traffic class should be 0(uplink), 1(dnlink) or 2(bi-dir)\n");
-            break;
-        }
-
-        ifr.ifr_data = (void *)crePStreamCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_CREATE_QOS, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_TARGET_STATS:
-        if (clearstat == 1) {
-           tgtStatsCmd.clearStats = 1;
-        } else {
-           tgtStatsCmd.clearStats = 0;
-        }
-
-        ifr.ifr_data = (void *)&tgtStatsCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_GET_TARGET_STATS, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printTargetStats(&(tgtStatsCmd.targetStats));
-        break;
-    case WMI_SET_TARGET_ERROR_REPORTING_BITMASK:
-        ifr.ifr_data = (void *)pBitMask;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_ERROR_REPORT_BITMASK, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_DELETE_QOS:
-        index = optind;
-        delPStreamCmd->tsid = atoi(argv[index]);
-        ifr.ifr_data = (void *)delPStreamCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_DELETE_QOS, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_QOS_QUEUE:
-        {
-        int i;
-        printf("getQosQueue: %d\n", getQosQueueCmd->trafficClass);
-
-        if (getQosQueueCmd->trafficClass > 3) {
-            printf("bad traffic class (%d)\n", getQosQueueCmd->trafficClass);
-            printf("Traffic class should be 0(BE), 1(BK), 2(VI) or 3(VO)\n");
-            break;
-        }
-        ifr.ifr_data = (void *)getQosQueueCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_GET_QOS_QUEUE, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-
-        printf("Active TSIDs \n");
-        for (i=0; i <=15; i++) {
-            if ((getQosQueueCmd->activeTsids & (1<<i))) {
-                printf("tsID: %d\n",i);
-            }
-        }
-        }
-        break;
-    case WMI_SET_ASSOC_INFO_CMDID:
-        ifr.ifr_data = (void *)ieInfo;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_ASSOC_INFO, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_AC_PARAMS:
-        if ((acParamsCmd->eCWmin > WMI_MAX_CW_ACPARAM) ||
-            (acParamsCmd->eCWmax > WMI_MAX_CW_ACPARAM) ||
-            (acParamsCmd->aifsn > WMI_MAX_AIFSN_ACPARAM) ||
-            (acParamsCmd->ac >= WMM_NUM_AC) )
-        {
-            printf("incorrect value for access parameters\n");
-            usage();
-            break;
-        }
-
-        ifr.ifr_data = (void *)acParamsCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_ACCESS_PARAMS, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_DISC_TIMEOUT:
-        ifr.ifr_data = (void *)discCmd;
-        if (ioctl(s, AR6000_IOCTL_WMI_SET_DISC_TIMEOUT, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-     case WMI_SET_ADHOC_BSSID:
-        ((int *)buf)[0] = AR6000_XIOCTL_SET_ADHOC_BSSID;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            printf("fail to set adhoc bssid \n");
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_BEACON_INT:
-        ((int *)buf)[0] = AR6000_XIOCTL_SET_BEACON_INTVAL;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_VOICE_PKT_SIZE:
-        ((int *)buf)[0] = AR6000_XIOCTL_SET_VOICE_PKT_SIZE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_MAX_SP:
-        ((int *)buf)[0] = AR6000_XIOCTL_SET_MAX_SP;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_ROAM_TBL:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_GET_ROAM_TBL;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_ROAM_CTRL:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_ROAM_CTRL;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_POWERSAVE_TIMERS:
-        ((int *)buf)[0] = AR6000_XIOCTRL_WMI_SET_POWERSAVE_TIMERS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_POWER_MODE:
-        ((int *)buf)[0] = AR6000_XIOCTRL_WMI_GET_POWER_MODE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printf("Power mode is %s\n",
-               (getPowerMode->powerMode == MAX_PERF_POWER) ? "maxperf" : "rec");
-        break;
-     case WMI_SET_WLAN_STATE:
-        ((int *)buf)[0] = AR6000_XIOCTRL_WMI_SET_WLAN_STATE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_WLAN_STATE:
-        ((int *)buf)[0] = AR6000_XIOCTL_GET_WLAN_SLEEP_STATE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }    
-        printf("WLAN state is %s\n", (ifr.ifr_ifru.ifru_ivalue == WLAN_ENABLED) ? "enabled" : "disabled");
-        break;
-    case WMI_GET_ROAM_DATA:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_GET_ROAM_DATA;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_BT_STATUS:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BT_STATUS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_BT_PARAMS:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BT_PARAMS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_BTCOEX_FE_ANT:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BTCOEX_FE_ANT;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_BTCOEX_COLOCATED_BT_DEV:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BTCOEX_COLOCATED_BT_DEV;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_BTCOEX_SCO_CONFIG:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BTCOEX_SCO_CONFIG;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-    break;
-    case WMI_SET_BTCOEX_A2DP_CONFIG:
-       ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BTCOEX_A2DP_CONFIG;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-    break;
-    case WMI_SET_BTCOEX_ACLCOEX_CONFIG:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BTCOEX_ACLCOEX_CONFIG;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-    break;
-    case WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-    break;
-    case WMI_SET_BTCOEX_DEBUG:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BTCOEX_DEBUG;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printf("issue ioctl AR6000_XIOCTL_WMI_SET_BTCOEX_DEBUG\n");
-    break;
-
-    case WMI_SET_BTCOEX_BT_OPERATING_STATUS:
-       ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_BT_OPERATING_STATUS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printf("issue ioctl AR6000_XIOCTL_WMI_SET_BT_OPERATING_STATUS\n");
-    break;
-
-    case WMI_GET_BTCOEX_CONFIG:
-       ((int *)buf)[0] = AR6000_XIOCTL_WMI_GET_BTCOEX_CONFIG;
-        pBtcoexConfig->configEvent = (A_UINT32 *)&btcoexConfigEvent;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printBtcoexConfig(&btcoexConfigEvent);
-
-        break;
-
-    case WMI_GET_BTCOEX_STATS:
-       ((int *)buf)[0] = AR6000_XIOCTL_WMI_GET_BTCOEX_STATS;
-        pBtcoexStatsEvent->statsEvent = (A_UINT32 *)&btcoexStatsEvent;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printBtcoexStats(&btcoexStatsEvent);
-        break;
-
-    case WMI_SET_RETRYLIMITS:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SETRETRYLIMITS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_START_SCAN:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_STARTSCAN;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_FIX_RATES:
-        {
-        unsigned long long value;
-        index = optind;
-        index--;
-        setFixRatesCmd->fixRateMask[0] = 0;
-        setFixRatesCmd->fixRateMask[1] = 0;
-        printf("argc = %d\n",argc);
-        /* FIXME: need to first submit a request to the device to
-         * learn what rates are supported before we can correctly
-         * conclude the validity of the user input */
-        for(; index<argc; index++)
-        {
-            if (atoi(argv[index])<0 || atoi(argv[index])>= 64)
-            {
-                printf("incorrect value for rates parameters\n");
-                usage();
-                break;
-            }
-            value |= (unsigned long long)1<<(atoi(argv[index]));
-            printf("wmiconfig:fixRateMask=%lld\n", value);
-        }
-        setFixRatesCmd->fixRateMask[0] = (unsigned long) value;
-        setFixRatesCmd->fixRateMask[1] = (unsigned long) (value>>32);
-
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SETFIXRATES;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        }
-        break;
-    case WMI_GET_FIX_RATES:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_GETFIXRATES;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        } else {
-            int i;
-            unsigned long long mask;
-            mask = getFixRatesCmd->fixRateMask[0];
-            mask |= (unsigned long long)getFixRatesCmd->fixRateMask[1]<<32;
-            printf("Fix rate set index:");
-            for (i = 0; i<64; i++) {
-                if (mask&((unsigned long long)1<<i)) {
-                    printf("%d ",i);
-                }
-            }
-            printf("\n");
-        }
-        break;
-    case WMI_SET_AUTH_MODE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_AUTHMODE;
-        ifr.ifr_data = buf;
-        index = optind;
-        index--;
-        setAuthMode->mode = atoi(argv[index]);
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_REASSOC_MODE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_REASSOCMODE;
-        ifr.ifr_data = buf;
-        index = optind;
-        index--;
-        setReassocMode->mode = atoi(argv[index]);
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_LPREAMBLE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_LPREAMBLE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_RTS:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_RTS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_WMM:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_WMM;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_QOS_SUPP:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_QOS_SUPP;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_TXOP:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_TXOP;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case DIAG_READ:
-        ((int *)buf)[0] = AR6000_XIOCTL_DIAG_READ;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printf("diagdata: 0x%x\n", *diagdata);
-        break;
-    case DIAG_WRITE:
-        ((int *)buf)[0] = AR6000_XIOCTL_DIAG_WRITE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_RD:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_GET_RD;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        else
-        {
-            if(REGCODE_IS_CC_BITSET(*rd))
-            {
-                COUNTRY_CODE_MAP *reg;
-                void *endTable = (void *)allCountries + sizeof(allCountries);                          
-                for (reg = &allCountries[0]; (void *)reg < endTable; reg++)
-                {
-                    if (reg->countryCode == REGCODE_GET_CODE(*rd))
-                    {
-                        break;
-                    }
-                }            
-                printf("CountryCode (%s) = ",reg->isoName);
-            }
-            else if(REGCODE_IS_WWR_BITSET(*rd))
-                printf("WWR Roaming code = ");
-            else
-                printf("Regulatory Domain = ");
-
-            printf("0x%x\n", REGCODE_GET_CODE(*rd));
-        }
-        break;
-    case WMI_SET_MCAST_FILTER:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_MCAST_FILTER;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_DEL_MCAST_FILTER:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_DEL_MCAST_FILTER;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_MCAST_FILTER:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_MCAST_FILTER;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_KEEPALIVE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_KEEPALIVE;
-        ifr.ifr_data = buf;
-        index = optind;
-        index--;
-        setKeepAlive->keepaliveInterval = atoi(argv[index]);
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_KEEPALIVE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_GET_KEEPALIVE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printf("Keepalive interval is %d secs and AP is %s\n",
-               getKeepAlive->keepaliveInterval, (getKeepAlive->configured ?
-               "configured" : "not configured"));
-        break;
-    case WMI_SET_APPIE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_APPIE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_MGMT_FRM_RX_FILTER:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_MGMT_FRM_RX_FILTER;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_DBGLOG_CFG_MODULE:
-        ((int *)buf)[0] = AR6000_XIOCTL_DBGLOG_CFG_MODULE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_DBGLOG_GET_DEBUG_LOGS:
-        ((int *)buf)[0] = AR6000_XIOCTL_DBGLOG_GET_DEBUG_LOGS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_IP:
-        ((int *)buf)[0] = AR6000_XIOCTL_SET_IP;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-     case WMI_SET_HOST_SLEEP_MODE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_HOST_SLEEP_MODE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_WOW_MODE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_WOW_MODE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_ADD_WOW_PATTERN:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_ADD_WOW_PATTERN;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_DEL_WOW_PATTERN:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_DEL_WOW_PATTERN;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_WOW_LIST:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_GET_WOW_LIST;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case DIAG_DUMP_CHIP_MEM:
-        for(i = 0; i < 5; i++) {
-            printf("Address range = 0x%x, 0x%x\n",
-                    mercuryAdd[i][0], mercuryAdd[i][1]);
-            for(*diagaddr = mercuryAdd[i][0];
-                *diagaddr < mercuryAdd[i][1];
-                *diagaddr += 4) {
-                ((int *)buf)[0] = AR6000_XIOCTL_DIAG_READ;
-                ifr.ifr_data = buf;
-                if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-                    err(1, "%s", ifr.ifr_name);
-                }
-                printf("0x%04x:0x%04x\n", *diagaddr, *diagdata);
-            }
-        }
-        break;
-    case DIAG_DUMP_CHIP_MEM_VENUS:
-        printf("Venus:Chip state\n");
-        for(i = 0; i < 8; i++) {
-            p = &venus_internal[i];
-            printf("%s\n", p->info);
-            printf("Address range = 0x%x, 0x%x\n",
-                    p->addr_st, p->addr_end);
-            for(*diagaddr = p->addr_st;
-                *diagaddr < p->addr_end;
-                *diagaddr += 4) {
-                ((int *)buf)[0] = AR6000_XIOCTL_DIAG_READ;
-                ifr.ifr_data = buf;
-                if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-                    err(1, "%s", ifr.ifr_name);
-                }
-                printf("0x%04x:0x%04x\n", *diagaddr, *diagdata);
-            }
-            printf("\n");
-        }
-        break;
-    case WMI_SET_CONNECT_CTRL_FLAGS:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_CONNECT_CTRL_FLAGS;
-        ifr.ifr_data = buf;
-        index = optind - 1;
-        *connectCtrlFlags = strtoul(argv[index], NULL, 0);
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case DUMP_HTC_CREDITS:
-        ((int *)buf)[0] = AR6000_XIOCTL_DUMP_HTC_CREDIT_STATE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_AKMP_INFO:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_AKMP_PARAMS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_PMKID_LIST:
-        if (pmkidUserInfo.pmkidInfo->numPMKID) {
-            ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_PMKID_LIST;
-            ifr.ifr_data = buf;
-            if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-                err(1, "%s", ifr.ifr_name);
-            }
-        } else {
-            printf("No PMKIDs entered\n");
-        }
-        break;
-    case WMI_GET_PMKID_LIST:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_GET_PMKID_LIST;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_BSS_PMKID_INFO:
-        iwr.u.data.pointer = buf;
-        iwr.u.data.length = sizeof(*pi_cmd);
-        if (ioctl(s, IEEE80211_IOCTL_ADDPMKID, &iwr) < 0) {
-            printf("ADDPMKID IOCTL Error\n");
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_ABORT_SCAN:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_ABORT_SCAN;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_TARGET_EVENT_REPORT:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_TARGET_EVENT_REPORT;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_GET_STA_LIST:
-    {
-        A_UINT8 flag=0;
-        char *str;
-
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_STA_LIST;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        pGetSta = (ap_get_sta_t *)buf;
-        printf("\n________________ STA List ___________________________________\n");
-        printf(" MAC                  AID   Auth   Keymgmt  Cipher  Wmode  \n");
-        printf("_____________________________________________________________\n");
-        for(i=0;i<AP_MAX_NUM_STA;i++) {
-            if(!is_mac_null(pGetSta->sta[i].mac)) {
-                printf(" %02X:%02X:%02X:%02X:%02X:%02X    %-5d ",
-                pGetSta->sta[i].mac[0], pGetSta->sta[i].mac[1],
-                pGetSta->sta[i].mac[2], pGetSta->sta[i].mac[3],
-                pGetSta->sta[i].mac[4], pGetSta->sta[i].mac[5],
-                pGetSta->sta[i].aid);
-
-                switch (pGetSta->sta[i].auth) {
-                    case OPEN_AUTH:
-                        str = "OPEN";
-                        break;
-                    case SHARED_AUTH:
-                        str = "SHARED";
-                        break;
-                    default:
-                        str = "Unknown";
-                        break;
-                }
-                printf("%-7s ", str);
-                
-                switch (pGetSta->sta[i].keymgmt) {
-                    case WMI_WPA_PSK_AUTH:
-                        str = "WPA-PSK";
-                        break;
-                    case WMI_WPA2_PSK_AUTH:
-                        str = "WPA2-PSK";
-                        break;
-                    default:
-                        str = "NONE";
-                        break;
-                }
-                printf("%-7s ", str);
-
-                switch (pGetSta->sta[i].ucipher) {
-                    case AES_CRYPT:
-                        str = "AES";
-                        break;
-                    case TKIP_CRYPT:
-                        str = "TKIP";
-                        break;
-                    case WEP_CRYPT:
-                        str = "WEP";
-                        break;
-#ifdef WAPI_ENABLE
-                    case WAPI_CRYPT:
-                        str = "WAPI";
-                        break;
-#endif
-                    default:
-                        str = "NONE";
-                        break;
-                }
-                printf("%-7s ", str);
-
-                switch (pGetSta->sta[i].wmode & 0xf) {
-                    case MODE_11A:
-                        str = "11A";
-                        break;
-                    case MODE_11G:
-                        str = "11G";
-                        break;
-                    case MODE_11B:
-                        str = "11B";
-                        break;
-                    case MODE_11GONLY:
-                        str = "11Gonly";
-                        break;
-                    case MODE_11NA_HT20:
-                    case MODE_11NA_HT40:
-                        if(pGetSta->sta[i].wmode & 0x80) {
-                            str = "11Nonly";
-                        } else {
-                            str = "11NA";
-                        }
-                        break;
-                    case MODE_11NG_HT20:
-                    case MODE_11NG_HT40:                    
-                        if(pGetSta->sta[i].wmode & 0x80) {
-                            str = "11Nonly";
-                        } else {
-                            str = "11NG";
-                        }
-                        break;
-                    case MODE_UNKNOWN:
-                    default:
-                        str = "Unknown";
-                        break;
-                }
-                printf("%-5s\n", str);
-
-                flag = 1;
-            }
-        }
-        if(!flag)
-        printf("                    Empty             \n");
-        printf("_____________________________________________________________\n");
-        break;
-    }
-    case WMI_AP_HIDDEN_SSID:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_HIDDEN_SSID;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_SET_NUM_STA:
-    case WMI_AP_SET_GNUM_STA:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_SET_NUM_STA;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-
-    case WMI_AP_GET_NUM_STA:
-    case WMI_AP_GET_GNUM_STA:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_NUM_STA;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        pNumSta = (WMI_AP_NUM_STA_CMD *)buf;
-        if(pNumSta->num_sta == 0xFF)
-            printf("NUM_STA=NA\n");
-        else
-            printf("NUM_STA=%d\n", pNumSta->num_sta);       
-        break;
-
-    case WMI_AP_SET_DFS:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_SET_DFS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_ACL_POLICY:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_SET_ACL_POLICY;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_ACL_MAC_LIST1:
-    case WMI_AP_ACL_MAC_LIST2:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_SET_ACL_MAC;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_GET_ACL_LIST:
-    {
-        A_UINT8 flag=0;
-
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_ACL_LIST;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        pGetAcl = (WMI_AP_ACL *)buf;
-        printf("____________________________\n");
-        printf(" ACL Policy - %d\n", pGetAcl->policy & ~AP_ACL_RETAIN_LIST_MASK);
-        printf("____________________________\n");
-        printf(" Index       MAC\n");
-        for(i=0;i<AP_ACL_SIZE;i++) {
-            if(!is_mac_null(pGetAcl->acl_mac[i]) || pGetAcl->wildcard[i]) {
-                printf("  %d ",i);
-                print_wild_mac(pGetAcl->acl_mac[i], pGetAcl->wildcard[i]);
-                flag = 1;
-            }
-        }
-        if(!flag)
-        printf("       Empty          \n");
-        printf("____________________________\n");
-        break;
-    }
-    case WMI_AP_COMMIT_CONFIG:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_COMMIT_CONFIG;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_INACT_TIME:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_CONN_INACT_TIME;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_PROT_TIME:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_PROT_SCAN_TIME;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_SET_MLME:
-        iwr.u.data.pointer = buf;
-        iwr.u.data.length = sizeof(struct ieee80211req_mlme);
-        if (ioctl(s, IEEE80211_IOCTL_SETMLME, &iwr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_SET_DTIM:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_SET_DTIM;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_GET_COUNTRY_LIST:
-        for(i = 0; i < sizeof(my_ctr)/sizeof(my_ctr[0]); i++) {
-            printf("%s\t",my_ctr[i]);
-            if ((i+1)%5 == 0) {
-                printf("\n");
-            }
-        }
-        printf("\n");
-        break;
-    case WMI_AP_SET_COUNTRY:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_SET_COUNTRY;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_DISABLE_REGULATORY:
-        /* Set the country code to invalid */
-        memcpy(pCountry->countryCode,WMI_DISABLE_REGULATORY_CODE, 2);
-
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_SET_COUNTRY;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_INTRA_BSS:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_CTRL_BSS_COMM;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_INTER_BSS:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_CTRL_BSS_COMM;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_DUMP_RCV_AGGR_STATS:
-        ((int *)buf)[0] = AR6000_XIOCTL_DUMP_RCV_AGGR_STATS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        log = (PACKET_LOG *)buf;
-        cnt = 0x1000;
-        for(i = log->last_idx; cnt; cnt--) {
-            printf("%d %d %d %d\n", i, log->info[i].cur, log->info[i].st, log->info[i].end);
-            i = (i + 1) & 0xFFF;
-        }
-        break;
-    case WMI_SETUP_AGGR:
-        ((int *)buf)[0] = AR6000_XIOCTL_SETUP_AGGR;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_CFG_ALLOW_AGGR:
-        ((int *)buf)[0] = AR6000_XIOCTL_ALLOW_AGGR;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_CFG_DELE_AGGR:
-        ((int *)buf)[0] = AR6000_XIOCTL_DELE_AGGR;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_HT_CAP:
-        index = optind - 1;
-
-        if(argc-index != 7) {
-            printf("incorrect number of params\n");
-            break;
-        }
-        
-        if(strlen(argv[index]) == strlen("g") && 
-            strcmp(argv[index], "g") == 0) {
-            pHtCap->band = 0;
-        }else if(strlen(argv[index]) == strlen("a") && 
-            strcmp(argv[index], "a") == 0) {
-            pHtCap->band = 1;
-        }else{
-            printf("bad band param. Use 'a' OR 'g' NOT %s\n", argv[index]);
-            break;
-        }
-        
-        pHtCap->enable = atoi(argv[++index]);
-        if(pHtCap->enable > 2) {
-            printf("bad enable value. Use '0', '1' OR '2' NOT %s\n", argv[index]);
-            break;
-        }
-        
-        pHtCap->chan_width_40M_supported = (atoi(argv[++index]) == 1);
-        pHtCap->short_GI_20MHz = (atoi(argv[++index]) == 1);
-        pHtCap->short_GI_40MHz = (atoi(argv[++index]) == 1);
-        pHtCap->intolerance_40MHz = (atoi(argv[++index]) == 1);
-        pHtCap->max_ampdu_len_exp = atoi(argv[++index]);
-
-        if (pHtCap->max_ampdu_len_exp > 3) {
-            printf("bad ampdu len exp (%d)\n", pHtCap->max_ampdu_len_exp);
-            printf("AMPDU len exponent should take value from 0 - 3\n");
-            break;
-        }
-
-        ((int *)buf)[0] = AR6000_XIOCTL_SET_HT_CAP;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SET_HT_OP:
-        index = optind - 1;
-        pHtOp->sta_chan_width = (atoi(argv[index]) == 1);
-
-        ((int *)buf)[0] = AR6000_XIOCTL_SET_HT_OP;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_AP_GET_STAT:
-    {
-        A_UINT8 flag=0;
-
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_STAT;
-        apStat->action = AP_GET_STATS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        apStat = (WMI_AP_MODE_STAT *)buf;
-        printf("_______________________________________________________\n");
-        printf(" AID       bytes      pkts       error      discard  \n");
-        printf("_______________________________________________________\n");
-        for(i=0;i<AP_MAX_NUM_STA;i++) {
-            if(apStat->sta[i].aid) {
-                flag = 1;
-                printf(" %-2d    TX  %-10d %-10d %-10d %-10d\n",
-                    apStat->sta[i].aid,
-                    apStat->sta[i].tx_bytes,
-                    apStat->sta[i].tx_pkts,
-                    apStat->sta[i].tx_error,
-                    apStat->sta[i].tx_discard);
-                printf("       RX  %-10d %-10d %-10d %-10d\n\n",
-                    apStat->sta[i].rx_bytes,
-                    apStat->sta[i].rx_pkts,
-                    apStat->sta[i].rx_error,
-                    apStat->sta[i].rx_discard);
-            }
-        }
-        if(!flag)
-        printf("                   Empty          \n");
-        printf("_______________________________________________________\n\n");
-        break;
-    }
-    case WMI_AP_CLR_STAT:
-    {
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_STAT;
-        apStat->action = AP_CLEAR_STATS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    }
-    case WMI_SET_TX_SELECT_RATES:
-    {
-        unsigned long long val;
-        unsigned char count = 0;
-        index = optind;
-        index--;
-        //pTxSelectRate->rateMasks = 0;
-        printf("argc = %d\n",argc);
-
-        for(; index<argc; index++)
-        {
-            val = strtol(argv[index], NULL, 0);
-
-            if (val == 0)
-            {
-                printf("incorrect value for rates parameters\n");
-                usage();
-                break;
-            }
-
-            if(count >= 8) {
-                break;
-            }
-
-            pTxSelectRate->rateMasks[count++] = val;
-        }
-
-        if(count != 8) {
-            printf("incorrect parameter count (%d)\n", count);
-            usage();
-            break;
-        }
-
-        ((int *)buf)[0] = AR6000_XIOCTL_SET_TX_SELECT_RATES;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    }
-    case WMI_AP_GET_HIDDEN_SSID:
-    {
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_HIDDEN_SSID;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        pHidden = (WMI_AP_HIDDEN_SSID_CMD *)buf;
-        printf("Hidden SSID: %d : %s\n", pHidden->hidden_ssid,
-                pHidden->hidden_ssid?"Enabled":"Disabled");
-        break;
-    }
-    case WMI_AP_GET_COUNTRY:
-    {
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_COUNTRY;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        pCountry = (WMI_AP_SET_COUNTRY_CMD *)buf;
-        if(pCountry->countryCode[0] == 'F' &&
-            pCountry->countryCode[1] == 'F')
-        {
-            printf("Country Code: Disabled\n");
-        } else {
-            printf("Country Code: %s\n", pCountry->countryCode);
-        }
-        break;
-    }
-    case WMI_AP_GET_WMODE:
-    {
-        char *wmode[] = {" ","A","G","AG","B","Gonly"};
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_WMODE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printf("Wireless Mode: %s\n", wmode[(int)buf[0]]);
-        break;
-    }
-    case WMI_AP_GET_DTIM:
-    {
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_DTIM;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        pDtim = (WMI_AP_SET_DTIM_CMD *)buf;
-        printf("DTIM Period: %d\n", pDtim->dtim);
-        break;
-    }
-    case WMI_AP_GET_BINTVL:
-    {
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_BINTVL;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        bconIntvl = (WMI_BEACON_INT_CMD *)buf;
-        printf("Beacon Interval: %d ms\n", bconIntvl->beaconInterval);
-        break;
-    }
-    case WMI_GET_RTS:
-    {
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_GET_RTS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        setRtsCmd = (WMI_SET_RTS_CMD *)buf;
-        printf("RTS threshold: %d\n", setRtsCmd->threshold);
-        break;
-    }
-    case DIAG_FETCH_TARGET_REGS:
-    {
-        int regnum;
-        A_UINT32 *targregs;
-
-        ((int *)buf)[0] = AR6000_XIOCTL_FETCH_TARGET_REGS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        targregs = ((A_UINT32 *)buf);
-        for (regnum=0; regnum<AR6003_FETCH_TARG_REGS_COUNT; regnum++) {
-            printf("%s=0x%x ", targ_reg_name[regnum], targregs[regnum]);
-        }
-        printf("\n");
-        break;
-    }
-#ifdef ATH_INCLUDE_PAL
-    case WMI_SEND_PAL_CMD:
-    {
-        A_UINT8 pdu[MAX_BUFFER_SIZE];
-        A_UINT8 offset = 0;
-        void *pdev;
-        A_UINT16  sz,ret;
-        A_BOOL isDebugOn= 0;
-        pdev = phy_attach(ifname);
-
-        memset(pdu, 0, sizeof(pdu));
-        if(!strncmp(argv[1],"-i",2))
-        {
-            offset += 2;
-        }
-        if(get_input_choice(argv[2 + offset],pdu,&sz) != 0)
-        {
-            printf("Invalid command! Failed\n");
-            break;
-        }
-        if(argc > 3 + offset)
-        {
-            if(!memcmp(argv[3 + offset],"on",2))
-            {
-                isDebugOn = 1;
-            }
-        }
-        eventLogLevel = isDebugOn;
-        cmdParser(pdu,sz);
-        ret = pal_send_hci_cmd(pdev, (char *)pdu, (short)sz);
-        if(0 != ret) {
-            printf("CMD IGNORED\n");
-        }
-    }
-    break;
-    case WMI_SEND_PAL_DATA:
-    {
-        A_UINT8 pdu[MAX_BUFFER_SIZE];
-        A_UINT8 offset = 0;
-        void *pdev;
-        A_UINT16  sz,ret;
-        A_BOOL isDebugOn= 0;
-        pdev = phy_attach(ifname);
-        if (!strncmp(argv[1],"-i",2))
-        {
-            offset += 2;
-        }
-        if(get_input_choice(argv[2 + offset],pdu,&sz) != 0)
-        {
-            printf("Invalid command! Failed\n");
-            break;
-        }
-        if(argc > 3 + offset)
-        {
-            if(!memcmp(argv[3 + offset],"on",2))
-            {
-                isDebugOn = 1;
-            }
-        }
-        eventLogLevel = isDebugOn;
-        palData(pdu,sz);
-        ret = pal_send_acl_data_pkt(pdev, (char *)pdu, (short)sz);
-        if(0 != ret) {
-            printf("DATA IGNORED\n");
-        }
-    }
-    break;
-    case WMI_SET_WLAN_CONN_PRECDNCE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WLAN_CONN_PRECEDENCE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-    break;
-#endif
-    case WMI_SET_AP_RATESET:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_SET_11BG_RATESET;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_SEND_CONNECT_CMD:
-        {
-           send_connect_cmd(s, ifname, &cp);
-        }
-        break;
-     case SET_BT_HW_POWER_STATE:
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-     case GET_BT_HW_POWER_STATE:
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        printf("BT HW power state is %s\n", (ifr.ifr_ifru.ifru_ivalue) ? "on" : "off");
-        break;
-
-     case WMI_SET_TX_SGI_PARAM:
-     {
-     
-          ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_TX_SGI_PARAM;
-          ((int *)buf)[1] = set_txsgiparam->sgiMask[0];
-          ((int *)buf)[2] = set_txsgiparam->sgiMask[1];
-          ((int *)buf)[3] = set_txsgiparam->sgiPERThreshold;
-          ifr.ifr_data = buf;
-          if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-          {
-            err(1, "%s", ifr.ifr_name);
-          }
-          break;
-     }
-
-    case WMI_WAC_ENABLE:
-    {
-        WMI_WAC_ENABLE_CMD *cmd = (WMI_WAC_ENABLE_CMD *)(buf + 4);
-        cmd->enable = atoi(argv[argc - 4]);
-        cmd->period = atoi(argv[argc -3]);
-        cmd->threshold = atoi(argv[argc - 2]);
-        cmd->rssi = atoi(argv[argc - 1]);
-        cmd->enable |= 0x80;
-
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_ENABLE_WAC_PARAM;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    }
-
-    case WMI_SET_WPA_OFFLOAD_STATE:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_WPA_OFFLOAD_STATE;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    
-    case WMI_AP_ACS_DISABLE_HI_CHANNELS:
-        ((int *)buf)[0] = AR6000_XIOCTL_AP_ACS_DISABLE_HI_CHANNELS;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-
-    case WMI_SET_EXCESS_TX_RETRY_THRES:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_EXCESS_TX_RETRY_THRES;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-
-
-    case WMI_SET_DIVERSITY_PARAM:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_DIVERSITY_PARAM;
-        ifr.ifr_data = (void *)buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-
-    case WMI_FORCE_ASSERT:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_FORCE_ASSERT;
-        ifr.ifr_data = (void *)buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-        {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-
-    case WMI_SUSPEND_DRIVER:
-        ((int *)buf)[0] = AR6000_XIOCTL_SUSPEND_DRIVER;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_RESUME_DRIVER:
-        ((int *)buf)[0] = AR6000_XIOCTL_RESUME_DRIVER;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break; 
-   
-     case WMI_SCAN_PROBED_SSID:
-        send_scan_probedssid_cmd(s, ifname, ssid);
-        break;
-
-     case WMI_AP_SET_APSD:
-        ((int *)buf)[0] = AR6000_XIOCTL_WMI_AP_SET_APSD;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        break;
-    case WMI_GET_HT_CAP:
-    {
-        index = optind;
-
-        if(argc-index != 1) {
-            printf("incorrect number of params\n");
-            break;
-        }
-        
-        if(strlen(argv[index]) == strlen("g") && 
-            strcmp(argv[index], "g") == 0) {
-            pHtCap->band = 0;
-        }else if(strlen(argv[index]) == strlen("a") && 
-            strcmp(argv[index], "a") == 0) {
-            pHtCap->band = 1;
-        }else{
-            printf("bad band param. Use 'a' OR 'g' NOT %s\n", argv[index]);
-            break;
-        }
-    
-        ((int *)buf)[0] = AR6000_XIOCTL_GET_HT_CAP;
-        ifr.ifr_data = buf;
-        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) {
-            err(1, "%s", ifr.ifr_name);
-        }
-        pHtCap = (WMI_SET_HT_CAP_CMD *)buf;
-        printf("HT mode         : [%d] %s\n", pHtCap->enable, (pHtCap->enable?((pHtCap->enable==2)?"11n only":"Enabled"):"Disabled"));
-        printf("40M support     : [%d] %s\n", pHtCap->chan_width_40M_supported, (pHtCap->chan_width_40M_supported?"Enabled":"Disabled"));
-        printf("SGI 20M         : [%d] %s\n", pHtCap->short_GI_20MHz, (pHtCap->short_GI_20MHz?"Enabled":"Disabled"));
-        printf("SGI 40M         : [%d] %s\n", pHtCap->short_GI_40MHz, (pHtCap->short_GI_40MHz?"Enabled":"Disabled"));
-        printf("Intolerance 40M : [%d] %s\n", pHtCap->intolerance_40MHz, (pHtCap->intolerance_40MHz?"Enabled":"Disabled"));
-        printf("AMPDU Len       : [%d] %s\n", pHtCap->max_ampdu_len_exp, (pHtCap->max_ampdu_len_exp?"Exponent":"Default"));
-        break;
-    }
-    default:
-        usage();
-    }
-
-    exit (0);
-}
-
-/*
- * converts ieee channel number to frequency
- */
-static A_UINT16
-wmic_ieee2freq(int chan)
-{
-    if (chan == 14) {
-        return 2484;
-    }
-    if (chan < 14) {    /* 0-13 */
-        return (2407 + (chan*5));
-    }
-    if (chan < 27) {    /* 15-26 */
-        return (2512 + ((chan-15)*20));
-    }
-    return (5000 + (chan*5));
-}
-
-
-#ifdef NOT_YET
-// Validate a hex character
-static A_BOOL
-_is_hex(char c)
-{
-    return (((c >= '0') && (c <= '9')) ||
-            ((c >= 'A') && (c <= 'F')) ||
-            ((c >= 'a') && (c <= 'f')));
-}
-
-// Validate alpha
-static A_BOOL
-isalpha(int c)
-{
-    return (((c >= 'a') && (c <= 'z')) ||
-            ((c >= 'A') && (c <= 'Z')));
-}
-
-// Validate alphanum
-static A_BOOL
-isalnum(int c)
-{
-    return (isalpha(c) || isdigit(c));
-}
-
-#endif
-
-// Convert a single hex nibble
-static int
-_from_hex(char c)
-{
-    int ret = 0;
-
-    if ((c >= '0') && (c <= '9')) {
-        ret = (c - '0');
-    } else if ((c >= 'a') && (c <= 'f')) {
-        ret = (c - 'a' + 0x0a);
-    } else if ((c >= 'A') && (c <= 'F')) {
-        ret = (c - 'A' + 0x0A);
-    }
-    return ret;
-}
-
-// Validate digit
-static A_BOOL
-isdigit(int c)
-{
-    return ((c >= '0') && (c <= '9'));
-}
-
-void
-convert_hexstring_bytearray(char *hexStr, A_UINT8 *byteArray, A_UINT8 numBytes)
-{
-    A_UINT8 i;
-
-    for (i = 0; i < numBytes; i++) {
-        byteArray[i] = 16*_from_hex(hexStr[2*i + 0]) + _from_hex(hexStr[2*i +1]);
-    }
-}
-
-/*------------------------------------------------------------------*/
-/*
- * Input an Ethernet address and convert to binary.
- */
-static A_STATUS
-wmic_ether_aton(const char *orig, A_UINT8 *eth)
-{
-  const char *bufp;
-  int i;
-
-  i = 0;
-  for(bufp = orig; *bufp != '\0'; ++bufp) {
-    unsigned int val;
-    unsigned char c = *bufp++;
-    if (isdigit(c)) val = c - '0';
-    else if (c >= 'a' && c <= 'f') val = c - 'a' + 10;
-    else if (c >= 'A' && c <= 'F') val = c - 'A' + 10;
-    else break;
-
-    val <<= 4;
-    c = *bufp++;
-    if (isdigit(c)) val |= c - '0';
-    else if (c >= 'a' && c <= 'f') val |= c - 'a' + 10;
-    else if (c >= 'A' && c <= 'F') val |= c - 'A' + 10;
-    else break;
-
-    eth[i] = (unsigned char) (val & 0377);
-    if(++i == ATH_MAC_LEN) {
-        /* That's it.  Any trailing junk? */
-        if (*bufp != '\0') {
-#ifdef DEBUG
-            fprintf(stderr, "iw_ether_aton(%s): trailing junk!\n", orig);
-            return(A_EINVAL);
-#endif
-        }
-        return(A_OK);
-    }
-    if (*bufp != ':')
-        break;
-  }
-
-  return(A_EINVAL);
-}
-
-A_STATUS
-wmic_ether_aton_wild(const char *orig, A_UINT8 *eth, A_UINT8 *wild)
-{
-  const char *bufp;
-  unsigned char val, c;
-  int i=0;
-
-  *wild = 0;
-  for(bufp = orig; *bufp != '\0'; ++bufp) {
-    c = *bufp++;
-    if (isdigit(c)) val = c - '0';
-    else if (c >= 'a' && c <= 'f') val = c - 'a' + 10;
-    else if (c >= 'A' && c <= 'F') val = c - 'A' + 10;
-    else if (c == '*')  { val = 0; *wild |= 1<<i; goto next; }
-    else break;
-
-    val <<= 4;
-    c = *bufp++;
-    if (isdigit(c)) val |= c - '0';
-    else if (c >= 'a' && c <= 'f') val |= c - 'a' + 10;
-    else if (c >= 'A' && c <= 'F') val |= c - 'A' + 10;
-    else break;
-
-next:
-    eth[i] = (unsigned char) (val & 0xFF);
-    if(++i == ATH_MAC_LEN) {
-        /* That's it.  Any trailing junk? */
-        if (*bufp != '\0') {
-        }
-        return(A_OK);
-    }
-    if (*bufp != ':')
-        break;
-  }
-
-  return(A_EINVAL);
-}
-
-A_STATUS
-wmic_validate_roam_ctrl(WMI_SET_ROAM_CTRL_CMD *pRoamCtrl, A_UINT8 numArgs,
-                        char **argv)
-{
-    A_STATUS status = A_OK;
-    WMI_BSS_BIAS *pBssBias;
-    A_INT32 bias;
-    A_UINT8 i = 0;
-
-    switch (pRoamCtrl->roamCtrlType) {
-        case WMI_FORCE_ROAM:
-            if (numArgs != 1) {
-                fprintf(stderr, "BSSID to roam not given\n");
-                status = A_EINVAL;
-            } else if (wmic_ether_aton(argv[optind], pRoamCtrl->info.bssid)
-                                       != A_OK)
-            {
-                fprintf(stderr,"BSSID %s not in correct format\n",
-                         argv[optind]);
-                status = A_EINVAL;
-            }
-            break;
-        case WMI_SET_ROAM_MODE:
-            if (numArgs != 1) {
-                fprintf(stderr, "roam mode(default, bssbias, lock) not "
-                        " given\n");
-                status = A_EINVAL;
-            } else {
-                if (strcasecmp(argv[optind], "default") == 0) {
-                    pRoamCtrl->info.roamMode = WMI_DEFAULT_ROAM_MODE;
-                } else if (strcasecmp(argv[optind], "bssbias") == 0) {
-                    pRoamCtrl->info.roamMode = WMI_HOST_BIAS_ROAM_MODE;
-                } else if (strcasecmp(argv[optind], "lock") == 0) {
-                    pRoamCtrl->info.roamMode = WMI_LOCK_BSS_MODE;
-                } else {
-                    fprintf(stderr, "roam mode(default, bssbias, lock) not "
-                        " given\n");
-                    status = A_EINVAL;
-                }
-            }
-            break;
-        case WMI_SET_HOST_BIAS:
-            if ((numArgs & 0x01) || (numArgs > 25) ) {
-                fprintf(stderr, "roam bias too many entries or bss bias"
-                        "not input for every BSSID\n");
-                status = A_EINVAL;
-            } else {
-                pRoamCtrl->info.bssBiasInfo.numBss = numArgs >> 1;
-                pBssBias = pRoamCtrl->info.bssBiasInfo.bssBias;
-                while (i < pRoamCtrl->info.bssBiasInfo.numBss) {
-                    if (wmic_ether_aton(argv[optind + 2 * i],
-                                        pBssBias[i].bssid)
-                                        != A_OK)
-                    {
-                        fprintf(stderr,"BSSID %s not in correct format\n",
-                                argv[optind + 2 * i]);
-                        status = A_EINVAL;
-                        pRoamCtrl->info.bssBiasInfo.numBss = 0;
-                        break;
-                    }
-                    bias  = atoi(argv[optind + 2 * i + 1]);
-                    if ((bias < -256) || (bias > 255)) {
-                        fprintf(stderr,"bias value %d is  not in range\n",
-                                bias);
-                        status = A_EINVAL;
-                        pRoamCtrl->info.bssBiasInfo.numBss = 0;
-                        break;
-                    }
-                    pBssBias[i].bias = bias;
-                    i++;
-                }
-            }
-            break;
-        case WMI_SET_LOWRSSI_SCAN_PARAMS:
-            if (numArgs != 4) {
-                fprintf(stderr, "not enough arguments\n");
-                status = A_EINVAL;
-            } else {
-                pRoamCtrl->info.lrScanParams.lowrssi_scan_period = atoi(argv[optind]);
-                if (atoi(argv[optind+1]) >= atoi(argv[optind+2])) {
-                    pRoamCtrl->info.lrScanParams.lowrssi_scan_threshold = atoi(argv[optind+1]);
-                    pRoamCtrl->info.lrScanParams.lowrssi_roam_threshold = atoi(argv[optind+2]);
-                } else {
-                    fprintf(stderr, "Scan threshold should be greater than \
-                            equal to roam threshold\n");
-                    status = A_EINVAL;
-                }
-                pRoamCtrl->info.lrScanParams.roam_rssi_floor = atoi(argv[optind+3]);
-            }
-
-            break;
-        default:
-            status = A_EINVAL;
-            fprintf(stderr,"roamctrl type %d out if range should be between"
-                       " %d and %d\n", pRoamCtrl->roamCtrlType,
-                        WMI_MIN_ROAM_CTRL_TYPE, WMI_MAX_ROAM_CTRL_TYPE);
-            break;
-    }
-    return status;
-}
-
-A_STATUS
-wmic_validate_appie(struct ieee80211req_getset_appiebuf *appIEInfo, char **argv)
-{
-    A_STATUS status = A_OK;
-    A_UINT8 index = optind - 1;
-    A_UINT16 ieLen;
-
-    if ((strlen(argv[index]) == strlen("probe")) &&
-        (strcmp(argv[index], "probe") == 0))
-    {
-        appIEInfo->app_frmtype = IEEE80211_APPIE_FRAME_PROBE_REQ;
-    } else if ((strlen(argv[index]) == strlen("assoc")) &&
-               (strcmp(argv[index], "assoc") == 0))
-    {
-        appIEInfo->app_frmtype = IEEE80211_APPIE_FRAME_ASSOC_REQ;
-    } else if((strlen(argv[index]) == strlen("beacon")) &&
-        (strcmp(argv[index], "beacon") == 0)) {
-        appIEInfo->app_frmtype = IEEE80211_APPIE_FRAME_BEACON;
-    } else if((strlen(argv[index]) == strlen("respon")) &&
-        (strcmp(argv[index], "respon") == 0)) {
-        appIEInfo->app_frmtype = IEEE80211_APPIE_FRAME_PROBE_RESP;
-    } else {
-        printf("specify one of beacon/probe/respon/assoc\n");
-        return A_EINVAL;
-    }
-    index++;
-
-    ieLen = strlen(argv[index]);
-    if ((ieLen == 1) && argv[index][0] == '0') {
-        appIEInfo->app_buflen = 0;
-    } else if ((ieLen > 4)  && (ieLen <= 2*IEEE80211_APPIE_FRAME_MAX_LEN) &&
-               _from_hex(argv[index][2])*16 +
-               _from_hex(argv[index][3]) + 2  == ieLen/2)
-    {
-        if ((argv[index][0] != 'd') && (argv[index][1] != 'd')) {
-            status = A_EINVAL;
-        } else {
-            convert_hexstring_bytearray(argv[index], appIEInfo->app_buf, ieLen/2);
-            appIEInfo->app_buflen = ieLen/2;
-        }
-    } else {
-        status = A_EINVAL;
-        printf("Invalid IE format should be of format dd04aabbccdd\n");
-    }
-
-    return status;
-}
-
-A_STATUS
-wmic_validate_mgmtfilter(A_UINT32 *pMgmtFilter, char **argv)
-{
-    A_UINT8 index = optind - 1;
-    A_BOOL  setFilter = FALSE;
-    A_UINT32    filterType;
-
-    if ((strlen(argv[index]) == strlen("set")) &&
-        (strcmp(argv[index], "set") == 0))
-    {
-        setFilter = TRUE;
-    } else if ((strlen(argv[index]) == strlen("clear")) &&
-        (strcmp(argv[index], "clear") == 0))
-    {
-        setFilter = FALSE;
-    } else {
-        printf("specify one of set/clear\n");
-        return A_EINVAL;
-    }
-    index++;
-    if ((strlen(argv[index]) == strlen("beacon")) &&
-        (strcmp(argv[index], "beacon") == 0))
-    {
-        filterType = IEEE80211_FILTER_TYPE_BEACON;
-    } else if ((strlen(argv[index]) == strlen("proberesp")) &&
-        (strcmp(argv[index], "proberesp") == 0))
-    {
-        filterType = IEEE80211_FILTER_TYPE_PROBE_RESP;
-    } else {
-        printf("specify one of beacon/proberesp\n");
-        return A_EINVAL;
-    }
-    *pMgmtFilter = 0;
-
-    if (setFilter) {
-        *pMgmtFilter |= filterType;
-    } else {
-        *pMgmtFilter &= ~filterType;
-    }
-
-    return A_OK;
-}
-
-void
-printTargetStats(TARGET_STATS *pStats)
-{
-    printf("Target stats\n");
-    printf("------------\n");
-    printf("tx_packets = %llu\n"
-           "tx_bytes = %llu\n"
-           "tx_unicast_pkts  = %llu\n"
-           "tx_unicast_bytes = %llu\n"
-           "tx_multicast_pkts = %llu\n"
-           "tx_multicast_bytes = %llu\n"
-           "tx_broadcast_pkts = %llu\n"
-           "tx_broadcast_bytes = %llu\n"
-           "tx_rts_success_cnt = %llu\n"
-           "tx_packet_per_ac[%d] = %llu\n"
-           "tx_packet_per_ac[%d] = %llu\n"
-           "tx_packet_per_ac[%d] = %llu\n"
-           "tx_packet_per_ac[%d] = %llu\n"
-           "tx_errors = %llu\n"
-           "tx_failed_cnt = %llu\n"
-           "tx_retry_cnt = %llu\n"
-           "tx_mult_retry_cnt = %llu\n"
-           "tx_rts_fail_cnt = %llu\n"
-           "tx_unicast_rate = %d Kbps\n"
-           "rx_packets = %llu\n"
-           "rx_bytes = %llu\n"
-           "rx_unicast_pkts = %llu\n"
-           "rx_unicast_bytes = %llu\n"
-           "rx_multicast_pkts = %llu\n"
-           "rx_multicast_bytes = %llu\n"
-           "rx_broadcast_pkts = %llu\n"
-           "rx_broadcast_bytes = %llu\n"
-           "rx_fragment_pkt = %llu\n"
-           "rx_errors = %llu\n"
-           "rx_crcerr = %llu\n"
-           "rx_key_cache_miss = %llu\n"
-           "rx_decrypt_err = %llu\n"
-           "rx_duplicate_frames = %llu\n"
-           "rx_unicast_rate = %d Kbps\n"
-           "tkip_local_mic_failure = %llu\n"
-           "tkip_counter_measures_invoked = %llu\n"
-           "tkip_replays = %llu\n"
-           "tkip_format_errors = %llu\n"
-           "ccmp_format_errors = %llu\n"
-           "ccmp_replays = %llu\n"
-           "power_save_failure_cnt = %llu\n"
-           "noise_floor_calibation = %d\n"
-           "cs_bmiss_cnt = %llu\n"
-           "cs_lowRssi_cnt = %llu\n"
-           "cs_connect_cnt = %llu\n"
-           "cs_disconnect_cnt = %llu\n"
-           "cs_aveBeacon_snr= %d\n"
-           "cs_aveBeacon_rssi = %d\n"
-           "cs_lastRoam_msec = %d\n"
-           "cs_rssi = %d\n"
-           "cs_snr = %d\n"
-           "lqVal = %d\n"
-           "wow_num_pkts_dropped = %d\n"
-           "wow_num_host_pkt_wakeups = %d\n"
-           "wow_num_host_event_wakeups = %d\n"
-           "wow_num_events_discarded = %d\n"
-           "arp_received = %d\n"
-           "arp_matched = %d\n"
-           "arp_replied = %d\n",
-           pStats->tx_packets,
-           pStats->tx_bytes,
-           pStats->tx_unicast_pkts,
-           pStats->tx_unicast_bytes,
-           pStats->tx_multicast_pkts,
-           pStats->tx_multicast_bytes,
-           pStats->tx_broadcast_pkts,
-           pStats->tx_broadcast_bytes,
-           pStats->tx_rts_success_cnt,
-           0, pStats->tx_packet_per_ac[0],
-           1, pStats->tx_packet_per_ac[1],
-           2, pStats->tx_packet_per_ac[2],
-           3, pStats->tx_packet_per_ac[3],
-           pStats->tx_errors,
-           pStats->tx_failed_cnt,
-           pStats->tx_retry_cnt,
-           pStats->tx_mult_retry_cnt,
-           pStats->tx_rts_fail_cnt,
-           pStats->tx_unicast_rate,
-           pStats->rx_packets,
-           pStats->rx_bytes,
-           pStats->rx_unicast_pkts,
-           pStats->rx_unicast_bytes,
-           pStats->rx_multicast_pkts,
-           pStats->rx_multicast_bytes,
-           pStats->rx_broadcast_pkts,
-           pStats->rx_broadcast_bytes,
-           pStats->rx_fragment_pkt,
-           pStats->rx_errors,
-           pStats->rx_crcerr,
-           pStats->rx_key_cache_miss,
-           pStats->rx_decrypt_err,
-           pStats->rx_duplicate_frames,
-           pStats->rx_unicast_rate,
-           pStats->tkip_local_mic_failure,
-           pStats->tkip_counter_measures_invoked,
-           pStats->tkip_replays,
-           pStats->tkip_format_errors,
-           pStats->ccmp_format_errors,
-           pStats->ccmp_replays,
-           pStats->power_save_failure_cnt,
-           pStats->noise_floor_calibation,
-           pStats->cs_bmiss_cnt,
-           pStats->cs_lowRssi_cnt,
-           pStats->cs_connect_cnt,
-           pStats->cs_disconnect_cnt,
-           pStats->cs_aveBeacon_snr,
-           pStats->cs_aveBeacon_rssi,
-           pStats->cs_lastRoam_msec,
-           pStats->cs_rssi,
-           pStats->cs_snr,
-           pStats->lq_val,
-           pStats->wow_num_pkts_dropped,
-           pStats->wow_num_host_pkt_wakeups,
-           pStats->wow_num_host_event_wakeups,
-           pStats->wow_num_events_discarded,
-           pStats->arp_received,
-           pStats->arp_matched,
-           pStats->arp_replied
-);
-
-}
-
-void
-printBtcoexConfig(WMI_BTCOEX_CONFIG_EVENT *pConfig)
-{
-    switch(pConfig->btProfileType) {
-    case WMI_BTCOEX_BT_PROFILE_SCO:
-        {
-            WMI_SET_BTCOEX_SCO_CONFIG_CMD *scoConfigCmd = &pConfig->info.scoConfigCmd;
-            printf("BTCOEX SCO CONFIG\n");
-            printf("GENERIC SCO CONFIG\n");
-            printf("scoSlots =%d\n"
-                    "scoIdleSlots =%d\n"
-                    "scoFlags = %d\n"
-                    "linkId = %d\n",
-                    scoConfigCmd->scoConfig.scoSlots,
-                    scoConfigCmd->scoConfig.scoIdleSlots,
-                    scoConfigCmd->scoConfig.scoFlags,
-                    scoConfigCmd->scoConfig.linkId
-                   );
-            printf("PSPOLL SCO CONFIG \n");
-            printf( "scoCyclesForceTrigger = %d\n"
-                    "scoDataResponseTimeout = %d\n"
-                    "scoStompDutyCyleVal = %d\n"
-                    "scoStompDutyCyleMaxVal = %d\n"
-                    "scoPsPollLatencyFraction = %d\n",
-                    scoConfigCmd->scoPspollConfig.scoCyclesForceTrigger,
-                    scoConfigCmd->scoPspollConfig.scoDataResponseTimeout,
-                    scoConfigCmd->scoPspollConfig.scoStompDutyCyleVal,
-                    scoConfigCmd->scoPspollConfig.scoStompDutyCyleMaxVal,
-                    scoConfigCmd->scoPspollConfig.scoPsPollLatencyFraction
-                    );
-            printf("SCO optmode Config\n");
-            printf( "scoStompCntIn100ms = %d\n"
-                    "scoContStompMax = %d\n"
-                    "scoMinlowRateMbps = %d\n"
-                    "scoLowRateCnt = %d\n"
-                    "scoHighPktRatio = %d\n"
-                    "scoMaxAggrSize = %d\n",
-                    scoConfigCmd->scoOptModeConfig.scoStompCntIn100ms,
-                    scoConfigCmd->scoOptModeConfig.scoContStompMax,
-                    scoConfigCmd->scoOptModeConfig.scoMinlowRateMbps,
-                    scoConfigCmd->scoOptModeConfig.scoLowRateCnt,
-                    scoConfigCmd->scoOptModeConfig.scoHighPktRatio,
-                    scoConfigCmd->scoOptModeConfig.scoMaxAggrSize
-                 );
-            printf("SCO wlan scan config\n");
-            printf("scanInterval = %d\n"
-                   "maxScanStompCnt = %d\n",
-                   scoConfigCmd->scoWlanScanConfig.scanInterval,
-                   scoConfigCmd->scoWlanScanConfig.maxScanStompCnt
-                  );
-
-         }
-         break;
-    }
-}
-
-void
-printBtcoexStats(WMI_BTCOEX_STATS_EVENT *pStats)
-{
-    printf("btcoex Stats\n");
-}
-
-static A_INT8 getPhyMode(char *pArg)
-{
-    typedef struct {
-                        char * pOption;
-                        WMI_PHY_MODE phyMode;
-                    } PHY_MODE_MAP;
-
-    //note : add options in lower case only
-    PHY_MODE_MAP phyModeMap [] =
-                    {
-                     {"ag",WMI_11AG_MODE},
-                     {"a",WMI_11A_MODE},
-                     {"b",WMI_11B_MODE},
-                     {"g",WMI_11G_MODE},
-                     {"gonly",WMI_11GONLY_MODE},                     
-                     {NULL}
-                    };
-    int i, j;
-    const char *c;
-
-   for (i = 0 ;phyModeMap[i].pOption != NULL ;i++)
-   {
-        c = phyModeMap[i].pOption ;
-
-        for(j = 0; pArg[j] != '\0';j++)
-        {
-            if(c[j] != TO_LOWER(pArg[j]))
-            {
-                break;
-            }
-
-            if((c[j+1] == '\0') && (pArg[j+1] == '\0'))
-            {
-                return phyModeMap[i].phyMode;
-            }
-        }
-   }
-   return -1;
-}
-
-static int is_mac_null(A_UINT8 *mac)
-{
-    if(mac[0]==0 && mac[1]==0 && mac[2]==0 &&
-       mac[3]==0 && mac[4]==0 && mac[5]==0) {
-        return 1;
-    }
-    return 0;
-}
-
-void print_wild_mac(unsigned char *mac, char wildcard)
-{
-    int i;
-
-    printf("    ");
-    for(i=0;i<5;i++) {
-        if(wildcard & (1<<i))   printf("*:");
-        else                    printf("%02X:", mac[i]);
-    }
-
-    if(wildcard & (1<<i))   printf("*\n");
-    else                    printf("%02X\n", mac[5]);
-}
-
-
-int wmiconfig_set_auth_param(int sock, char *ifname,
-                   int idx, A_UINT32 value)
-{
-#ifdef WPA_SUPPORT
-    struct iwreq iwr;
-    int ret = 0;
-
-    memset(&iwr, 0, sizeof(iwr));
-    strncpy(iwr.ifr_name, ifname, IFNAMSIZ);
-    iwr.u.param.flags = idx & IW_AUTH_INDEX;
-    iwr.u.param.value = value;
-
-    if (ioctl(sock, SIOCSIWAUTH, &iwr) < 0) {
-        printf("WPA: SIOCSIWAUTH(param %d value 0x%x) failed)",
-                   idx, value);
-        ret = -1;
-    }
-
-    return ret;
-#else
-    return -1;
-#endif
-}
-
-int wmiconfig_set_pmk(int sock, char *ifname, A_UINT8 *pmk)
-{
-#ifdef WPA_SUPPORT
-    struct iwreq iwr;
-    int ret = 0;
-    struct iw_encode_ext *ext;
-
-    ext = malloc(sizeof(*ext) + WMI_PMK_LEN);
-    if (ext == NULL)
-        return -1;
-
-    memset(ext, 0, sizeof(*ext) + WMI_PMK_LEN);
-    memset(&iwr, 0, sizeof(iwr));
-    strncpy(iwr.ifr_name, ifname, IFNAMSIZ);
-    iwr.u.encoding.pointer = (caddr_t) ext;
-    iwr.u.encoding.length = sizeof(*ext) + WMI_PMK_LEN;
-
-    memcpy(ext + 1, pmk, WMI_PMK_LEN);
-    ext->key_len = WMI_PMK_LEN;
-    ext->alg = IW_ENCODE_ALG_PMK;
-
-    if (ioctl(sock, SIOCSIWENCODEEXT, &iwr) < 0) {
-        ret = -1;
-        perror("ioctl[SIOCSIWENCODEEXT]");
-    }
-
-    free(ext);
-
-    return ret;
-#else
-    return -1;
-#endif
-}
-
-int wmiconfig_set_passphrase(int sock, char *ifname, A_CHAR *passphrase,
-                             A_UINT8 passphrase_len, A_CHAR *ssid, A_UINT8 ssid_len)
-{
-#ifdef WPA_SUPPORT
-    struct ifreq ifr;
-    int ret = 0;
-    char *buf;
-    WMI_SET_PASSPHRASE_CMD* cmd;
-
-    buf = malloc(sizeof(WMI_SET_PASSPHRASE_CMD) + sizeof(int));
-    if (buf == NULL)
-        return -1;
-
-    cmd = (WMI_SET_PASSPHRASE_CMD*)(buf + sizeof(int));
-
-    memset(cmd, 0, sizeof(cmd));
-    cmd->passphrase_len = passphrase_len;
-    memcpy(cmd->passphrase, passphrase, passphrase_len);
-    cmd->ssid_len = ssid_len;
-    memcpy(cmd->ssid, ssid, ssid_len);
-
-    memset(&ifr, 0, sizeof(ifr));
-    strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-
-    ((int *)buf)[0] = AR6000_XIOCTL_WMI_SET_PASSPHRASE;
-    ifr.ifr_data = buf;
-    if (ioctl(sock, AR6000_IOCTL_EXTENDED, &ifr) < 0)
-    {
-        ret = -1;
-        perror("ioctl[AR6000_IOCTL_EXTENDED]");
-    }
-
-    free(buf);
-
-    return ret;
-#else
-    return -1;
-#endif
-}
-
-#ifdef WPA_SUPPORT
-static int hex2num(char c)
-{
-    if (c >= '0' && c <= '9')
-        return c - '0';
-    if (c >= 'a' && c <= 'f')
-        return c - 'a' + 10;
-    if (c >= 'A' && c <= 'F')
-        return c - 'A' + 10;
-    return -1;
-}
-#endif
-
-static int send_connect_cmd(int sock, char *ifname, profile_t *cp)
-{
-    struct iwreq iwr;
-    int ret = 0;
-    char buf[WMI_MAX_SSID_LEN+1];
-
-
-    if(cp->wpa) {
-#ifdef WPA_SUPPORT
-        int a, b;
-
-        ret = wmiconfig_set_auth_param(sock, ifname,
-                       IW_AUTH_WPA_VERSION, cp->wpa);
-        ret = wmiconfig_set_auth_param(sock, ifname,
-                       IW_AUTH_CIPHER_PAIRWISE, cp->ucipher);
-        ret = wmiconfig_set_auth_param(sock, ifname,
-                       IW_AUTH_CIPHER_GROUP, cp->mcipher);
-        ret = wmiconfig_set_auth_param(sock, ifname,
-                       IW_AUTH_KEY_MGMT, IW_AUTH_KEY_MGMT_PSK);
-
-        if(cp->psk_type == KEYTYPE_PHRASE) {
-            ret = wmiconfig_set_passphrase(sock, ifname, cp->psk, 
-                                           strlen(cp->psk), cp->ssid,
-                                           cp->ssid_len);
-        } else if(cp->psk_type == KEYTYPE_PSK) {
-            for(ret=0;ret<32;ret++) {
-                a = hex2num(cp->psk[ret*2]);
-                b = hex2num(cp->psk[ret*2+1]);
-                if(a<0 || b<0) printf("WRONG PSK\n");
-                cp->pmk[ret] = ((a << 4) | b);
-            }
-
-            ret = wmiconfig_set_pmk(sock, ifname, cp->pmk);
-        }
-#else
-        ret = -1;
-#endif
-    }
-
-    memset(&iwr, 0, sizeof(iwr));
-    strncpy(iwr.ifr_name, ifname, IFNAMSIZ);
-
-    iwr.u.essid.flags = 1;
-    memset(buf, 0, sizeof(buf));
-    memcpy(buf, cp->ssid, cp->ssid_len);
-    iwr.u.essid.pointer = (caddr_t) buf;
-    iwr.u.essid.length = cp->ssid_len;
-
-    if (ioctl(sock, SIOCSIWESSID, &iwr) < 0) {
-        perror("ioctl[SIOCSIWESSID]");
-        ret = -1;
-    }
-
-    return ret;
-}
-
-static int send_scan_probedssid_cmd(int sock, char *ifname, char *ssid)
-{
-    struct iwreq iwr;
-    struct iw_scan_req scanreq;
-    int ret = 0;
-    memset(&iwr, 0, sizeof(iwr));
-    memset(&scanreq, 0, sizeof(scanreq));
-    strncpy(iwr.ifr_name, ifname, IFNAMSIZ);
-
-    if (strlen(ssid) > WMI_MAX_SSID_LEN ) {
-            printf("SSID name too large\n");
-            return ret;
-        }else if ((strcmp((char *)ssid, "off") == 0) || ((strcmp((char *)ssid, "any") == 0))) {
-              iwr.u.essid.pointer = &scanreq;
-              iwr.u.essid.length = sizeof(struct iw_scan_req); 
-        } else {
-              iwr.u.essid.flags = IW_SCAN_THIS_ESSID;
-              iwr.u.essid.pointer = &scanreq;
-              memcpy(scanreq.essid, ssid, strlen(ssid));
-              iwr.u.essid.length = sizeof(struct iw_scan_req);
-              scanreq.essid_len = strlen(ssid);
-        }
-    if (ioctl(sock, SIOCSIWSCAN, &iwr) < 0) {
-        perror("ioctl[SIOCSIWSCAN]");
-        ret = -1;
-    }
-    return ret;
-}
diff --git a/drivers/net/wireless/ar6003/host/tools/wmiconfig/wmiconfig.h b/drivers/net/wireless/ar6003/host/tools/wmiconfig/wmiconfig.h
deleted file mode 100644 (file)
index 3444733..0000000
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Copyright (c) 2004-2009 Atheros Communications Inc.
- * All rights reserved.
- *
- * 
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
- *
- * This file contains the definitions for wmiconfig utility
- */
-
-#ifndef _WMI_CONFIG_H_
-#define _WMI_CONFIG_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
-    WMI_GET_VERSION=501,     /* something that doesn't collide with ascii */
-    WMI_SET_POWER_MODE,
-    WMI_SET_IBSS_PM_CAPS,
-    WMI_SET_PM_PARAMS,
-    WMI_SET_SCAN_PARAMS,
-    WMI_SET_LISTEN_INTERVAL,
-    WMI_SET_BMISS_TIME,
-    WMI_SET_BSS_FILTER,
-    WMI_SET_RSSI_THRESHOLDS,
-    WMI_SET_CHANNEL,
-    WMI_SET_SSID,
-    WMI_SET_BADAP,
-    WMI_DELETE_BADAP,
-    WMI_CREATE_QOS,
-    WMI_DELETE_QOS,
-    WMI_GET_QOS_QUEUE,
-    WMI_GET_TARGET_STATS,
-    WMI_SET_TARGET_ERROR_REPORTING_BITMASK,
-    WMI_SET_AC_PARAMS,
-    WMI_SET_ASSOC_IE,
-    WMI_SET_DISC_TIMEOUT,
-    WMI_SET_ADHOC_BSSID,
-    WMI_SET_OPT_MODE,
-    WMI_OPT_SEND_FRAME,
-    WMI_SET_BEACON_INT,
-    WMI_SET_VOICE_PKT_SIZE,
-    WMI_SET_MAX_SP,
-    WMI_GET_ROAM_TBL,
-    WMI_SET_ROAM_CTRL,
-    WMI_SET_POWERSAVE_TIMERS,
-    WMI_SET_POWERSAVE_TIMERS_PSPOLLTIMEOUT,
-    WMI_SET_POWERSAVE_TIMERS_TRIGGERTIMEOUT,
-    WMI_GET_POWER_MODE,
-    WMI_SET_WLAN_STATE,
-    WMI_GET_WLAN_STATE,
-    WMI_GET_ROAM_DATA,
-    WMI_SET_BT_STATUS,
-    WMI_SET_BT_PARAMS,
-    WMI_SET_BTCOEX_FE_ANT,
-    WMI_SET_BTCOEX_COLOCATED_BT_DEV,
-    WMI_SET_BTCOEX_SCO_CONFIG,
-    WMI_SET_BTCOEX_A2DP_CONFIG,
-    WMI_SET_BTCOEX_ACLCOEX_CONFIG,
-    WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG,
-    WMI_SET_BTCOEX_DEBUG,
-    WMI_SET_BTCOEX_BT_OPERATING_STATUS,
-    WMI_GET_BTCOEX_CONFIG,
-    WMI_GET_BTCOEX_STATS,
-    WMI_SET_RETRYLIMITS,
-    WMI_START_SCAN,
-    WMI_SET_FIX_RATES,
-    WMI_GET_FIX_RATES,
-    WMI_SET_SNR_THRESHOLDS,
-    WMI_CLR_RSSISNR,
-    WMI_SET_LQ_THRESHOLDS,
-    WMI_SET_AUTH_MODE,
-    WMI_SET_REASSOC_MODE,
-    WMI_SET_LPREAMBLE,
-    WMI_SET_RTS,
-    WMI_SET_WMM,
-#ifdef USER_KEYS
-    USER_SETKEYS,
-#endif
-    WMI_APSD_TIM_POLICY,
-    WMI_SET_ERROR_DETECTION,
-    WMI_GET_HB_CHALLENGE_RESP,
-    WMI_SET_TXOP,
-    DIAG_ADDR,
-    DIAG_DATA,
-    DIAG_READ,
-    DIAG_WRITE,
-    WMI_GET_RD,
-    WMI_SET_KEEPALIVE,
-    WMI_GET_KEEPALIVE,
-    WMI_SET_APPIE,
-    WMI_SET_MGMT_FRM_RX_FILTER,
-    WMI_DBGLOG_CFG_MODULE,
-    WMI_DBGLOG_GET_DEBUG_LOGS,
-    WMI_SET_HOST_SLEEP_MODE,
-    WMI_SET_WOW_MODE,
-    WMI_GET_WOW_LIST,
-    WMI_ADD_WOW_PATTERN,
-    WMI_DEL_WOW_PATTERN,
-    DIAG_DUMP_CHIP_MEM,
-    WMI_SET_CONNECT_CTRL_FLAGS,
-    DUMP_HTC_CREDITS,
-    USER_SETKEYS_INITRSC,
-    WMI_SCAN_DFSCH_ACT_TIME,
-    WMI_SIMULATED_APSD_TIM_POLICY,
-    WMI_SET_AKMP_INFO,
-    WMI_AKMP_MULTI_PMKID,
-    WMI_NUM_PMKID,
-    WMI_PMKID_ENTRY,
-    WMI_SET_PMKID_LIST,
-    WMI_GET_PMKID_LIST,
-    WMI_SET_IEMASK,
-    WMI_SCAN_CHANNEL_LIST,
-    WMI_SET_BSS_PMKID_INFO,
-    WMI_BSS_PMKID_ENTRY,
-    WMI_BSSID,
-    WMI_ABORT_SCAN,
-    WMI_TARGET_EVENT_REPORT,
-    WMI_AP_GET_STA_LIST,    /* AP mode */
-    WMI_AP_HIDDEN_SSID,     /* AP mode */
-    WMI_AP_SET_NUM_STA,     /* AP mode */
-    WMI_AP_ACL_POLICY,      /* AP mode */
-    WMI_AP_ACL_MAC_LIST1,   /* AP mode */
-    WMI_AP_ACL_MAC_LIST2,   /* AP mode */
-    WMI_AP_GET_ACL_LIST,    /* AP mode */
-    WMI_AP_COMMIT_CONFIG,   /* AP mode */
-    WMI_AP_INACT_TIME,      /* AP mode */
-    WMI_AP_PROT_TIME,       /* AP mode */    
-    WMI_AP_SET_MLME,        /* AP mode */
-    WMI_AP_SET_COUNTRY,     /* AP mode */
-    WMI_AP_GET_COUNTRY_LIST,/* AP mode */
-    WMI_AP_DISABLE_REGULATORY, /* AP mode */
-    WMI_AP_SET_DTIM,        /* AP mode */    
-    WMI_AP_INTRA_BSS,       /* AP mode */    
-    WMI_AP_INTER_BSS,       /* AP mode */    
-    WMI_GET_IP,
-    WMI_SET_MCAST_FILTER,
-    WMI_DEL_MCAST_FILTER,
-    WMI_MCAST_FILTER,
-    WMI_DUMP_RCV_AGGR_STATS,
-    WMI_SETUP_AGGR,
-    WMI_CFG_ALLOW_AGGR,
-    WMI_CFG_DELE_AGGR,
-    WMI_SET_HT_CAP,
-    WMI_SET_HT_OP,
-    WMI_AP_GET_STAT,        /* AP mode */
-    WMI_AP_CLR_STAT,        /* AP mode */
-    WMI_SET_TX_SELECT_RATES,
-    WMI_SCAN_MAXACT_PER_SSID,
-    WMI_AP_GET_HIDDEN_SSID, /* AP mode */
-    WMI_AP_GET_COUNTRY,     /* AP mode */
-    WMI_AP_GET_WMODE,       /* AP mode */
-    WMI_AP_GET_DTIM,        /* AP mode */
-    WMI_AP_GET_BINTVL,      /* AP mode */    
-    WMI_GET_RTS,
-    DIAG_FETCH_TARGET_REGS,
-#ifdef ATH_INCLUDE_PAL
-    WMI_SEND_PAL_CMD,
-    WMI_SEND_PAL_DATA,
-#endif
-    WMI_SET_WLAN_CONN_PRECDNCE,
-    WMI_SET_AP_RATESET,     /* AP mode */
-    WMI_SET_TX_WAKEUP_POLICY,
-    WMI_SET_TX_NUM_FRAMES_TO_WAKEUP,
-    WMI_SET_AP_PS,
-    WMI_SET_AP_PS_PSTYPE,
-    WMI_SET_AP_PS_IDLE_TIME,
-    WMI_SET_AP_PS_PS_PERIOD,
-    WMI_SET_AP_PS_SLEEP_PERIOD,
-    WMI_SEND_CONNECT_CMD,
-    WMI_SEND_CONNECT_CMD1,
-    WMI_SEND_CONNECT_CMD2,
-    WMI_SET_WOW_FILTER,
-    WMI_SET_WOW_HOST_REQ_DELAY,
-    WMI_SET_QOS_SUPP,
-    WMI_SET_AC_VAL,
-    WMI_AP_SET_DFS, /* AP mode */
-    BT_HW_POWER_STATE,
-    SET_BT_HW_POWER_STATE,
-    GET_BT_HW_POWER_STATE,
-    DIAG_DUMP_CHIP_MEM_VENUS,
-    WMI_SET_TX_SGI_PARAM,
-    WMI_SGI_MASK,
-    WMI_PER_SGI,
-    WMI_WAC_ENABLE,
-    WMI_SET_WPA_OFFLOAD_STATE,
-    WMI_AP_ACS_DISABLE_HI_CHANNELS,
-    WMI_SET_DIVERSITY_PARAM,
-    WMI_SET_EXCESS_TX_RETRY_THRES,
-    WMI_FORCE_ASSERT,    
-    WMI_AP_SET_GNUM_STA,
-    WMI_AP_GET_GNUM_STA,
-    WMI_AP_GET_NUM_STA,
-    WMI_SUSPEND_DRIVER,
-    WMI_RESUME_DRIVER,    
-    WMI_SCAN_PROBED_SSID,
-    WMI_AP_SET_APSD,
-    WMI_GET_HT_CAP,
-};
-
-/*
-***************************************************************************
-**  How to form a regcode from CountryCode, Regulatory domain or WWR code:
-**
-**  WWR code is nothing but a special case of Regulatory domain.
-**
-**      code is of type U_INT32
-**
-**      Bit-31  Bit-30      Bit11-0
-**        0       0          xxxx    -> Bit11-0 is a Regulatory Domain
-**        0       1          xxxx    -> Bit11-0 is a WWR code
-**        1       X          xxxx    -> Bit11-0 is a Country code
-**  
-***************************************************************************
-*/
-#define REGCODE_IS_CC_BITSET(x)     ((x) & 0x80000000)
-#define REGCODE_GET_CODE(x)         ((x) & 0xFFF)
-#define REGCODE_IS_WWR_BITSET(x)    ((x) & 0x40000000)
-#ifdef ATH_INCLUDE_PAL
-#define MAX_BUFFER_SIZE             1512    
-#endif
-
-typedef struct {
-    A_UINT32        numPMKIDUser;          /* PMKIDs user wants to enter */
-    WMI_SET_PMKID_LIST_CMD  *pmkidInfo;
-} pmkidUserInfo_t;
-
-#define KEYTYPE_PSK     1
-#define KEYTYPE_PHRASE  2
-
-typedef struct {
-    char ssid[WMI_MAX_SSID_LEN];
-    A_UINT8 ssid_len;
-    A_UINT8 wpa;
-    A_UINT8 ucipher;
-    A_UINT8 mcipher;
-    char    psk[64];
-    A_UINT8 psk_type;
-    A_UINT8 pmk[WMI_PMK_LEN];
-    A_UINT8 auth;
-    A_UINT8 wep_key[4][26];
-    A_UINT8 def_wep_key;
-} profile_t;
-
-/*
- * Numbering from ISO 3166
- */
-enum CountryCode {
-    CTRY_ALBANIA              = 8,       /* Albania */
-    CTRY_ALGERIA              = 12,      /* Algeria */
-    CTRY_ARGENTINA            = 32,      /* Argentina */
-    CTRY_ARMENIA              = 51,      /* Armenia */
-    CTRY_ARUBA                = 533,     /* Aruba */
-    CTRY_AUSTRALIA            = 36,      /* Australia (for STA) */
-    CTRY_AUSTRALIA_AP         = 5000,    /* Australia (for AP) */
-    CTRY_AUSTRIA              = 40,      /* Austria */
-    CTRY_AZERBAIJAN           = 31,      /* Azerbaijan */
-    CTRY_BAHRAIN              = 48,      /* Bahrain */
-    CTRY_BANGLADESH           = 50,      /* Bangladesh */
-    CTRY_BARBADOS             = 52,      /* Barbados */
-    CTRY_BELARUS              = 112,     /* Belarus */
-    CTRY_BELGIUM              = 56,      /* Belgium */
-    CTRY_BELIZE               = 84,      /* Belize */
-    CTRY_BOLIVIA              = 68,      /* Bolivia */
-    CTRY_BOSNIA_HERZEGOWANIA  = 70,      /* Bosnia & Herzegowania */
-    CTRY_BRAZIL               = 76,      /* Brazil */
-    CTRY_BRUNEI_DARUSSALAM    = 96,      /* Brunei Darussalam */
-    CTRY_BULGARIA             = 100,     /* Bulgaria */
-    CTRY_CAMBODIA             = 116,     /* Cambodia */
-    CTRY_CANADA               = 124,     /* Canada (for STA) */
-    CTRY_CANADA_AP            = 5001,    /* Canada (for AP) */
-    CTRY_CHILE                = 152,     /* Chile */
-    CTRY_CHINA                = 156,     /* People's Republic of China */
-    CTRY_COLOMBIA             = 170,     /* Colombia */
-    CTRY_COSTA_RICA           = 188,     /* Costa Rica */
-    CTRY_CROATIA              = 191,     /* Croatia */
-    CTRY_CYPRUS               = 196,
-    CTRY_CZECH                = 203,     /* Czech Republic */
-    CTRY_DENMARK              = 208,     /* Denmark */
-    CTRY_DOMINICAN_REPUBLIC   = 214,     /* Dominican Republic */
-    CTRY_ECUADOR              = 218,     /* Ecuador */
-    CTRY_EGYPT                = 818,     /* Egypt */
-    CTRY_EL_SALVADOR          = 222,     /* El Salvador */
-    CTRY_ESTONIA              = 233,     /* Estonia */
-    CTRY_FAEROE_ISLANDS       = 234,     /* Faeroe Islands */
-    CTRY_FINLAND              = 246,     /* Finland */
-    CTRY_FRANCE               = 250,     /* France */
-    CTRY_FRANCE2              = 255,     /* France2 */
-    CTRY_GEORGIA              = 268,     /* Georgia */
-    CTRY_GERMANY              = 276,     /* Germany */
-    CTRY_GREECE               = 300,     /* Greece */
-    CTRY_GREENLAND            = 304,     /* Greenland */
-    CTRY_GRENADA              = 308,     /* Grenada */
-    CTRY_GUAM                 = 316,     /* Guam */
-    CTRY_GUATEMALA            = 320,     /* Guatemala */
-    CTRY_HAITI                = 332,     /* Haiti */
-    CTRY_HONDURAS             = 340,     /* Honduras */
-    CTRY_HONG_KONG            = 344,     /* Hong Kong S.A.R., P.R.C. */
-    CTRY_HUNGARY              = 348,     /* Hungary */
-    CTRY_ICELAND              = 352,     /* Iceland */
-    CTRY_INDIA                = 356,     /* India */
-    CTRY_INDONESIA            = 360,     /* Indonesia */
-    CTRY_IRAN                 = 364,     /* Iran */
-    CTRY_IRAQ                 = 368,     /* Iraq */
-    CTRY_IRELAND              = 372,     /* Ireland */
-    CTRY_ISRAEL               = 376,     /* Israel */
-    CTRY_ITALY                = 380,     /* Italy */
-    CTRY_JAMAICA              = 388,     /* Jamaica */
-    CTRY_JAPAN                = 392,     /* Japan */
-    CTRY_JAPAN1               = 393,     /* Japan (JP1) */
-    CTRY_JAPAN2               = 394,     /* Japan (JP0) */
-    CTRY_JAPAN3               = 395,     /* Japan (JP1-1) */
-    CTRY_JAPAN4               = 396,     /* Japan (JE1) */
-    CTRY_JAPAN5               = 397,     /* Japan (JE2) */
-    CTRY_JAPAN6               = 399,     /* Japan (JP6) */
-    CTRY_JORDAN               = 400,     /* Jordan */
-    CTRY_KAZAKHSTAN           = 398,     /* Kazakhstan */
-    CTRY_KENYA                = 404,     /* Kenya */
-    CTRY_KOREA_NORTH          = 408,     /* North Korea */
-    CTRY_KOREA_ROC            = 410,     /* South Korea (for STA) */
-    CTRY_KOREA_ROC2           = 411,     /* South Korea */
-    CTRY_KOREA_ROC3           = 412,     /* South Korea (for AP) */
-    CTRY_KUWAIT               = 414,     /* Kuwait */
-    CTRY_LATVIA               = 428,     /* Latvia */
-    CTRY_LEBANON              = 422,     /* Lebanon */
-    CTRY_LIBYA                = 434,     /* Libya */
-    CTRY_LIECHTENSTEIN        = 438,     /* Liechtenstein */
-    CTRY_LITHUANIA            = 440,     /* Lithuania */
-    CTRY_LUXEMBOURG           = 442,     /* Luxembourg */
-    CTRY_MACAU                = 446,     /* Macau */
-    CTRY_MACEDONIA            = 807,     /* the Former Yugoslav Republic of Macedonia */
-    CTRY_MALAYSIA             = 458,     /* Malaysia */
-    CTRY_MALTA                = 470,     /* Malta */
-    CTRY_MEXICO               = 484,     /* Mexico */
-    CTRY_MONACO               = 492,     /* Principality of Monaco */
-    CTRY_MOROCCO              = 504,     /* Morocco */
-    CTRY_NEPAL                = 524,     /* Nepal */   
-    CTRY_NETHERLANDS          = 528,     /* Netherlands */
-    CTRY_NETHERLAND_ANTILLES  = 530,     /* Netherlands-Antilles */
-    CTRY_NEW_ZEALAND          = 554,     /* New Zealand */
-    CTRY_NICARAGUA            = 558,     /* Nicaragua */
-    CTRY_NORWAY               = 578,     /* Norway */
-    CTRY_OMAN                 = 512,     /* Oman */
-    CTRY_PAKISTAN             = 586,     /* Islamic Republic of Pakistan */
-    CTRY_PANAMA               = 591,     /* Panama */
-    CTRY_PARAGUAY             = 600,     /* Paraguay */
-    CTRY_PERU                 = 604,     /* Peru */
-    CTRY_PHILIPPINES          = 608,     /* Republic of the Philippines */
-    CTRY_POLAND               = 616,     /* Poland */
-    CTRY_PORTUGAL             = 620,     /* Portugal */
-    CTRY_PUERTO_RICO          = 630,     /* Puerto Rico */
-    CTRY_QATAR                = 634,     /* Qatar */
-    CTRY_ROMANIA              = 642,     /* Romania */
-    CTRY_RUSSIA               = 643,     /* Russia */
-    CTRY_RWANDA               = 646,     /* Rwanda */
-    CTRY_SAUDI_ARABIA         = 682,     /* Saudi Arabia */
-    CTRY_MONTENEGRO           = 891,     /* Montenegro */
-    CTRY_SINGAPORE            = 702,     /* Singapore */
-    CTRY_SLOVAKIA             = 703,     /* Slovak Republic */
-    CTRY_SLOVENIA             = 705,     /* Slovenia */
-    CTRY_SOUTH_AFRICA         = 710,     /* South Africa */
-    CTRY_SPAIN                = 724,     /* Spain */
-    CTRY_SRILANKA             = 144,     /* Sri Lanka */
-    CTRY_SWEDEN               = 752,     /* Sweden */
-    CTRY_SWITZERLAND          = 756,     /* Switzerland */
-    CTRY_SYRIA                = 760,     /* Syria */
-    CTRY_TAIWAN               = 158,     /* Taiwan */
-    CTRY_THAILAND             = 764,     /* Thailand */
-    CTRY_TRINIDAD_Y_TOBAGO    = 780,     /* Trinidad y Tobago */
-    CTRY_TUNISIA              = 788,     /* Tunisia */
-    CTRY_TURKEY               = 792,     /* Turkey */
-    CTRY_UAE                  = 784,     /* U.A.E. */
-    CTRY_UKRAINE              = 804,     /* Ukraine */
-    CTRY_UNITED_KINGDOM       = 826,     /* United Kingdom */
-    CTRY_UNITED_STATES        = 840,     /* United States (for STA) */
-    CTRY_UNITED_STATES_AP     = 841,     /* United States (for AP) */
-    CTRY_UNITED_STATES_PS     = 842,     /* United States - public safety */
-    CTRY_URUGUAY              = 858,     /* Uruguay */
-    CTRY_UZBEKISTAN           = 860,     /* Uzbekistan */
-    CTRY_VENEZUELA            = 862,     /* Venezuela */
-    CTRY_VIET_NAM             = 704,     /* Viet Nam */
-    CTRY_YEMEN                = 887,     /* Yemen */
-    CTRY_ZIMBABWE             = 716      /* Zimbabwe */
-};
-
-#define CTRY_DEBUG      0
-#define CTRY_DEFAULT    0x1ff
-#define REGCODE_COUNTRY_BIT 0x80000000
-
-typedef struct {
-    A_UINT16    countryCode;       
-    A_CHAR      isoName[3];
-} COUNTRY_CODE_MAP;
-
-static COUNTRY_CODE_MAP allCountries[] = {
-    {CTRY_DEBUG,        "DB"}, 
-    {CTRY_DEFAULT,      "NA"},
-    {CTRY_ALBANIA,      "AL"},
-    {CTRY_ALGERIA,      "DZ"},
-    {CTRY_ARGENTINA,    "AR"},
-    {CTRY_ARMENIA,      "AM"},
-    {CTRY_ARUBA,        "AW"},
-    {CTRY_AUSTRALIA,    "AU"},
-    {CTRY_AUSTRALIA_AP, "AU"},
-    {CTRY_AUSTRIA,      "AT"},
-    {CTRY_AZERBAIJAN,   "AZ"},
-    {CTRY_BAHRAIN,      "BH"},
-    {CTRY_BANGLADESH,   "BD"},
-    {CTRY_BARBADOS,     "BB"},
-    {CTRY_BELARUS,      "BY"},
-    {CTRY_BELGIUM,      "BE"},
-    {CTRY_BELIZE,       "BZ"},
-    {CTRY_BOLIVIA,      "BO"},
-    {CTRY_BOSNIA_HERZEGOWANIA,   "BA"},
-    {CTRY_BRAZIL,       "BR"},
-    {CTRY_BRUNEI_DARUSSALAM, "BN"},
-    {CTRY_BULGARIA,       "BG"},
-    {CTRY_CAMBODIA,       "KH"},
-    {CTRY_CANADA,         "CA"},
-    {CTRY_CANADA_AP,      "CA"},
-    {CTRY_CHILE,          "CL"},
-    {CTRY_CHINA,          "CN"},
-    {CTRY_COLOMBIA,       "CO"},
-    {CTRY_COSTA_RICA,     "CR"},
-    {CTRY_CROATIA,        "HR"},
-    {CTRY_CYPRUS,         "CY"},
-    {CTRY_CZECH,          "CZ"},
-    {CTRY_DENMARK,        "DK"},
-    {CTRY_DOMINICAN_REPUBLIC, "DO"},
-    {CTRY_ECUADOR,        "EC"},
-    {CTRY_EGYPT,          "EG"},
-    {CTRY_EL_SALVADOR,    "SV"},
-    {CTRY_ESTONIA,        "EE"},
-    {CTRY_FINLAND,        "FI"},
-    {CTRY_FRANCE,         "FR"},
-    {CTRY_FRANCE2,        "F2"},
-    {CTRY_GEORGIA,        "GE"},
-    {CTRY_GERMANY,        "DE"},
-    {CTRY_GREECE,         "GR"},
-    {CTRY_GREENLAND,      "GL"},
-    {CTRY_GRENADA,        "GD"},
-    {CTRY_GUAM,           "GU"},
-    {CTRY_GUATEMALA,      "GT"},
-    {CTRY_HAITI,          "HT"},
-    {CTRY_HONDURAS,       "HN"},
-    {CTRY_HONG_KONG,      "HK"},
-    {CTRY_HUNGARY,        "HU"},
-    {CTRY_ICELAND,        "IS"},
-    {CTRY_INDIA,          "IN"},
-    {CTRY_INDONESIA,      "ID"},
-    {CTRY_IRAN,           "IR"},
-    {CTRY_IRELAND,        "IE"},
-    {CTRY_ISRAEL,         "IL"},
-    {CTRY_ITALY,          "IT"},
-    {CTRY_JAMAICA,        "JM"},
-    {CTRY_JAPAN,          "JP"},
-    {CTRY_JORDAN,         "JO"},
-    {CTRY_KAZAKHSTAN,     "KZ"},
-    {CTRY_KENYA,          "KE"},
-    {CTRY_KOREA_NORTH,    "KP"},
-    {CTRY_KOREA_ROC,      "KR"},
-    {CTRY_KOREA_ROC2,     "K2"},
-    {CTRY_KOREA_ROC3,     "K3"},
-    {CTRY_KUWAIT,         "KW"},
-    {CTRY_LATVIA,         "LV"},
-    {CTRY_LEBANON,        "LB"},
-    {CTRY_LIECHTENSTEIN,  "LI"},
-    {CTRY_LITHUANIA,     "LT"},
-    {CTRY_LUXEMBOURG,    "LU"},
-    {CTRY_MACAU,         "MO"},
-    {CTRY_MACEDONIA,     "MK"},
-    {CTRY_MALAYSIA,      "MY"},
-    {CTRY_MALTA,         "MT"},
-    {CTRY_MEXICO,        "MX"},
-    {CTRY_MONACO,        "MC"},
-    {CTRY_MOROCCO,       "MA"},
-    {CTRY_NEPAL,         "NP"},
-    {CTRY_NEW_ZEALAND,   "NZ"},
-    {CTRY_NETHERLANDS,   "NL"},
-    {CTRY_NETHERLAND_ANTILLES,    "AN"},
-    {CTRY_NORWAY,         "NO"},
-    {CTRY_OMAN,           "OM"},
-    {CTRY_PAKISTAN,       "PK"},
-    {CTRY_PANAMA,         "PA"},
-    {CTRY_PERU,           "PE"},
-    {CTRY_PHILIPPINES,    "PH"},
-    {CTRY_POLAND,         "PL"},
-    {CTRY_PORTUGAL,       "PT"},
-    {CTRY_PUERTO_RICO,    "PR"},
-    {CTRY_QATAR,          "QA"},
-    {CTRY_ROMANIA,        "RO"},
-    {CTRY_RUSSIA,         "RU"},
-    {CTRY_RWANDA,         "RW"},
-    {CTRY_SAUDI_ARABIA,   "SA"},
-    {CTRY_MONTENEGRO,     "CS"},
-    {CTRY_SINGAPORE,      "SG"},
-    {CTRY_SLOVAKIA,       "SK"},
-    {CTRY_SLOVENIA,       "SI"},
-    {CTRY_SOUTH_AFRICA,   "ZA"},
-    {CTRY_SPAIN,          "ES"},
-    {CTRY_SRILANKA,       "LK"},
-    {CTRY_SWEDEN,         "SE"},
-    {CTRY_SWITZERLAND,    "CH"},
-    {CTRY_SYRIA,          "SY"},
-    {CTRY_TAIWAN,         "TW"},
-    {CTRY_THAILAND,       "TH"},
-    {CTRY_TRINIDAD_Y_TOBAGO, "TT"},
-    {CTRY_TUNISIA,        "TN"},
-    {CTRY_TURKEY,         "TR"},
-    {CTRY_UKRAINE,        "UA"},
-    {CTRY_UAE,            "AE"},
-    {CTRY_UNITED_KINGDOM, "GB"},
-    {CTRY_UNITED_STATES,    "US"},
-    {CTRY_UNITED_STATES_AP, "US"},
-    {CTRY_UNITED_STATES_PS, "PS"},
-    {CTRY_URUGUAY,        "UY"},
-    {CTRY_UZBEKISTAN,     "UZ"},    
-    {CTRY_VENEZUELA,      "VE"},
-    {CTRY_VIET_NAM,       "VN"},
-    {CTRY_YEMEN,          "YE"},
-    {CTRY_ZIMBABWE,       "ZW"}
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _WMI_CONFIG_H_ */