aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2012-07-20 10:00:35 +0300
committerArik Nemtsov <arik@wizery.com>2012-08-02 13:04:02 +0300
commit8b4bce98f1de19ad6427c9ca7b3be10638e606ff (patch)
treec1c69208907c87225df3d531989dce4913b5bd62
parentc30103324efcc7d7203039ba1c7a57f706a663db (diff)
downloadexternal_wpa_supplicant_8_ti-8b4bce98f1de19ad6427c9ca7b3be10638e606ff.zip
external_wpa_supplicant_8_ti-8b4bce98f1de19ad6427c9ca7b3be10638e606ff.tar.gz
external_wpa_supplicant_8_ti-8b4bce98f1de19ad6427c9ca7b3be10638e606ff.tar.bz2
P2P: Defer p2p scan if scanning on other interfaces (BRCM)
The current defer p2p scan until scan complete works only when the scanning is done on the same interface. However in Android case there are scans in progress on the STA interface so these would fail the p2p_scan and consequently the p2p find. Signed-off-by: Eyal Shapira <eyal@wizery.com>
-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;
}