From 37a9dc9e18d549f7f9508d7d870cf33b8d856c33 Mon Sep 17 00:00:00 2001 From: Eyal Shapira Date: Sat, 21 Jul 2012 01:38:35 +0300 Subject: P2P: Start blocked p2p find even if scan was on another interface (BRCM) p2p find can now defer starting the p2p scan due to an ongoing scan on a different interface. Relying on p2p_cb_on_scan_complete which is a per interface flag is wrong here and we won't resume the p2p find in case the scan wasn't on the same interface (which is the case in Android JB). Fix this by relying on the global p2p state instead. (This description is based on analysis of the code as the original BRCM commit doesn't contain any useful information) Signed-off-by: Eyal Shapira --- src/p2p/p2p.c | 12 ++++++++++++ wpa_supplicant/events.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 5dc874f..a515949 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -1050,6 +1050,18 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout, return res; } +#ifdef ANDROID_P2P +int p2p_search_pending(struct p2p_data *p2p) +{ + if(p2p == NULL) + return 0; + + if(p2p->state == P2P_SEARCH_WHEN_READY) + return 1; + + return 0; +} +#endif int p2p_other_scan_completed(struct p2p_data *p2p) { diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 2f7b194..2ad0ec5 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1065,7 +1065,11 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, wpa_supplicant_notify_scanning(wpa_s, 0); #ifdef CONFIG_P2P +#ifdef ANDROID_P2P + if (p2p_search_pending(wpa_s->global->p2p) && !wpa_s->global->p2p_disabled && +#else if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && +#endif wpa_s->global->p2p != NULL) { wpa_s->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { -- cgit v1.1