From 41d81d174858ca39ead245e12a8e2547e0314201 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Fri, 22 Nov 2013 15:54:27 -0800 Subject: wifi: Link libwpa_client only if wpa_supplicant was chosen Change-Id: Ic487c3767a17299880e83080b79a91dbbaef1234 Signed-off-by: Dmitry Shmidt --- wifi/Android.mk | 4 ++++ wifi/wifi.c | 30 ++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) (limited to 'wifi') diff --git a/wifi/Android.mk b/wifi/Android.mk index cde99d7..99a4b0e 100644 --- a/wifi/Android.mk +++ b/wifi/Android.mk @@ -27,4 +27,8 @@ endif LOCAL_SRC_FILES += wifi/wifi.c +ifdef WPA_SUPPLICANT_VERSION +LOCAL_CFLAGS += -DLIBWPA_CLIENT_EXISTS +LOCAL_SHARED_LIBRARIES += libwpa_client +endif LOCAL_SHARED_LIBRARIES += libnetutils diff --git a/wifi/wifi.c b/wifi/wifi.c index 82576e3..b1ddad1 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -24,7 +24,9 @@ #include #include "hardware_legacy/wifi.h" +#ifdef LIBWPA_CLIENT_EXISTS #include "libwpa_client/wpa_ctrl.h" +#endif #define LOG_TAG "WifiHW" #include "cutils/log.h" @@ -37,12 +39,6 @@ #include #endif -static struct wpa_ctrl *ctrl_conn; -static struct wpa_ctrl *monitor_conn; - -/* socket pair used to exit from a blocking read */ -static int exit_sockets[2]; - extern int do_dhcp(); extern int ifc_init(); extern void ifc_close(); @@ -52,6 +48,28 @@ extern int init_module(void *, unsigned long, const char *); extern int delete_module(const char *, unsigned int); void wifi_close_sockets(); +#ifndef LIBWPA_CLIENT_EXISTS +#define WPA_EVENT_TERMINATING "CTRL-EVENT-TERMINATING " +struct wpa_ctrl {}; +void wpa_ctrl_cleanup(void) {} +struct wpa_ctrl *wpa_ctrl_open(const char *ctrl_path) { return NULL; } +void wpa_ctrl_close(struct wpa_ctrl *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)) + { return 0; } +int wpa_ctrl_attach(struct wpa_ctrl *ctrl) { return 0; } +int wpa_ctrl_detach(struct wpa_ctrl *ctrl) { return 0; } +int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) + { return 0; } +int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl) { return 0; } +#endif + +static struct wpa_ctrl *ctrl_conn; +static struct wpa_ctrl *monitor_conn; + +/* socket pair used to exit from a blocking read */ +static int exit_sockets[2]; + static char primary_iface[PROPERTY_VALUE_MAX]; // TODO: use new ANDROID_SOCKET mechanism, once support for multiple // sockets is in -- cgit v1.1