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>
This commit is contained in:
parent
ecd40fef74
commit
884c649e26
2 changed files with 9 additions and 9 deletions
|
@ -39,7 +39,7 @@ endif
|
||||||
|
|
||||||
# Use Android specific directory for control interface sockets
|
# Use Android specific directory for control interface sockets
|
||||||
L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
|
L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
|
||||||
L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/wpa_supplicant\"
|
L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/misc/wifi/sockets\"
|
||||||
|
|
||||||
# Use Android specific directory for wpa_cli command completion history
|
# Use Android specific directory for wpa_cli command completion history
|
||||||
L_CFLAGS += -DCONFIG_WPA_CLI_HISTORY_DIR=\"/data/misc/wifi\"
|
L_CFLAGS += -DCONFIG_WPA_CLI_HISTORY_DIR=\"/data/misc/wifi\"
|
||||||
|
|
|
@ -4180,18 +4180,17 @@ static char * wpa_cli_get_default_ifname(void)
|
||||||
{
|
{
|
||||||
char *ifname = NULL;
|
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
|
#ifdef CONFIG_CTRL_IFACE_UNIX
|
||||||
struct dirent *dent;
|
struct dirent *dent;
|
||||||
DIR *dir = opendir(ctrl_iface_dir);
|
DIR *dir = opendir(ctrl_iface_dir);
|
||||||
if (!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;
|
return NULL;
|
||||||
}
|
}
|
||||||
while ((dent = readdir(dir))) {
|
while ((dent = readdir(dir))) {
|
||||||
|
@ -4235,6 +4234,7 @@ static char * wpa_cli_get_default_ifname(void)
|
||||||
}
|
}
|
||||||
wpa_ctrl_close(ctrl);
|
wpa_ctrl_close(ctrl);
|
||||||
#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
|
#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
|
||||||
|
#endif /* ANDROID */
|
||||||
|
|
||||||
return ifname;
|
return ifname;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue