Patchwork hostapd: Allow hostapd_cli to work on Android

login
register
mail settings
Submitter Jeff Johnson
Date Sept. 4, 2012, 5:12 a.m.
Message ID <20131106004239.7A21C13FAD3@ushik.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/288694/
State Accepted
Headers show

Comments

Jeff Johnson - Sept. 4, 2012, 5:12 a.m.
Add definitions of the Android specific directories used for control
interface sockets so that hostapd_cli can connect to the Android
hostapd.

Change-Id: Iabcd8d70ef61fae6656066991240d55e65a032e4
---
 hostapd/Android.mk    | 4 ++++
 hostapd/hostapd_cli.c | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

Patch

diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index 7f1e6e6..ed9f654 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -33,6 +33,10 @@  L_CFLAGS += -DANDROID_QCOM_WCN
 L_CFLAGS += -DANDROID_P2P
 endif
 
+# Use Android specific directory for control interface sockets
+L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
+L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/hostapd\"
+
 # To force sizeof(enum) = 4
 ifeq ($(TARGET_ARCH),arm)
 L_CFLAGS += -mabi=aapcs-linux
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index aed981c..27bea2a 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -93,7 +93,12 @@  static const char *commands_help =
 static struct wpa_ctrl *ctrl_conn;
 static int hostapd_cli_quit = 0;
 static int hostapd_cli_attached = 0;
-static const char *ctrl_iface_dir = "/var/run/hostapd";
+
+#ifndef CONFIG_CTRL_IFACE_DIR
+#define CONFIG_CTRL_IFACE_DIR "/var/run/hostapd"
+#endif /* CONFIG_CTRL_IFACE_DIR */
+static const char *ctrl_iface_dir = CONFIG_CTRL_IFACE_DIR;
+
 static char *ctrl_ifname = NULL;
 static const char *pid_file = NULL;
 static const char *action_file = NULL;