aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wpa_supplicant/p2p_supplicant.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 3adca69..fa9627a 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -58,6 +58,9 @@
#endif /* P2P_MAX_INITIAL_CONN_WAIT */
+#ifdef ANDROID
+static int wpas_global_scan_in_progress(struct wpa_supplicant *wpa_s);
+#endif
static void wpas_p2p_long_listen_timeout(void *eloop_ctx, void *timeout_ctx);
static struct wpa_supplicant *
wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated,
@@ -77,6 +80,22 @@ static void wpas_p2p_set_group_idle_timeout(struct wpa_supplicant *wpa_s);
static void wpas_p2p_fallback_to_go_neg(struct wpa_supplicant *wpa_s,
int group_added);
+#ifdef ANDROID
+static int wpas_global_scan_in_progress(struct wpa_supplicant *wpa_s)
+{
+ struct wpa_supplicant *iface = NULL;
+
+ for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
+ if(iface->scanning || iface->wpa_state == WPA_SCANNING) {
+ wpa_printf(MSG_DEBUG, "P2P: Scan in progress on %s,"
+ "defer P2P SEARCH", iface->ifname);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+#endif
static void wpas_p2p_scan_res_handler(struct wpa_supplicant *wpa_s,
struct wpa_scan_results *scan_res)
@@ -162,8 +181,13 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
wpabuf_free(ies);
if (ret) {
+#ifdef ANDROID
+ if (wpa_s->scanning || wpa_s->scan_res_handler == wpas_p2p_scan_res_handler
+ || wpas_global_scan_in_progress(wpa_s)) {
+#else
if (wpa_s->scanning ||
wpa_s->scan_res_handler == wpas_p2p_scan_res_handler) {
+#endif
wpa_s->p2p_cb_on_scan_complete = 1;
ret = 1;
}