aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpa_cli.c
diff options
context:
space:
mode:
authorDaichi Ueura <daichi.ueura@gmail.com>2015-07-13 15:31:21 (GMT)
committerJouni Malinen <j@w1.fi>2015-08-02 18:37:10 (GMT)
commit884c649e261357289683430daec99617aa9e04a0 (patch)
tree210da959e1f20ca45e3641bff071a9c362be68da /wpa_supplicant/wpa_cli.c
parentecd40fef7413c27d1a1feae6363971f9a0417099 (diff)
downloadhostap-884c649e261357289683430daec99617aa9e04a0.zip
hostap-884c649e261357289683430daec99617aa9e04a0.tar.gz
hostap-884c649e261357289683430daec99617aa9e04a0.tar.bz2
Android: Make wpa_cli work on wifi.interface without extra params
Currently wpa_cli connects to global control interface if -i/-p parameters are not specified. wpa_cli on global control interface is not useful since the prefix like "IFNAME=wlan0 " needs to be added to some commands like "IFNAME=wlan0 scan". And, specifying -i/-p parameters every time is annoying. To improve efficiency of debugging, this patch enables to make wpa_cli work without extra parameters. If you still want to connect to global control interface, the following command can be used instead: $ wpa_cli -g@android:wpa_wlan0 (or -gwlan0) Signed-off-by: Daichi Ueura <daichi.ueura@sonymobile.com>
Diffstat (limited to 'wpa_supplicant/wpa_cli.c')
-rw-r--r--wpa_supplicant/wpa_cli.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index dbe653c..042ba76 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -4180,18 +4180,17 @@ static char * wpa_cli_get_default_ifname(void)
{
char *ifname = NULL;
+#ifdef ANDROID
+ char ifprop[PROPERTY_VALUE_MAX];
+ if (property_get("wifi.interface", ifprop, NULL) != 0) {
+ ifname = os_strdup(ifprop);
+ printf("Using interface '%s'\n", ifname ? ifname : "N/A");
+ }
+#else /* ANDROID */
#ifdef CONFIG_CTRL_IFACE_UNIX
struct dirent *dent;
DIR *dir = opendir(ctrl_iface_dir);
if (!dir) {
-#ifdef ANDROID
- char ifprop[PROPERTY_VALUE_MAX];
- if (property_get("wifi.interface", ifprop, NULL) != 0) {
- ifname = os_strdup(ifprop);
- printf("Using interface '%s'\n", ifname);
- return ifname;
- }
-#endif /* ANDROID */
return NULL;
}
while ((dent = readdir(dir))) {
@@ -4235,6 +4234,7 @@ static char * wpa_cli_get_default_ifname(void)
}
wpa_ctrl_close(ctrl);
#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
+#endif /* ANDROID */
return ifname;
}