aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/p2p/p2p.c9
-rw-r--r--src/p2p/p2p.h16
-rw-r--r--wpa_supplicant/events.c45
3 files changed, 63 insertions, 7 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index a515949..7f34be4 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -4049,6 +4049,15 @@ p2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next)
return &dev->info;
}
+#ifdef ANDROID_P2P
+int p2p_search_in_progress(struct p2p_data *p2p)
+{
+ if (p2p == NULL)
+ return 0;
+
+ return p2p->state == P2P_SEARCH;
+}
+#endif
int p2p_in_progress(struct p2p_data *p2p)
{
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 91c0426..9be5b84 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -1688,6 +1688,22 @@ int p2p_set_pref_chan(struct p2p_data *p2p, unsigned int num_pref_chan,
*/
int p2p_in_progress(struct p2p_data *p2p);
+#ifdef ANDROID_P2P
+/**
+ * p2p_search_in_progress - Check whether a P2P SEARCH is in progress
+ * @p2p: P2P module context from p2p_init()
+ * Returns: 0 if P2P module is idle or 1 if an operation is in progress
+ */
+int p2p_search_in_progress(struct p2p_data *p2p);
+
+/**
+ * p2p_search_pending - Check whether there is a deferred P2P SEARCH
+ * @p2p: P2P module context from p2p_init()
+ * Returns: 0 if there is no deferred P2P search or 1 if there is one
+ */
+int p2p_search_pending(struct p2p_data *p2p);
+#endif
+
/**
* p2p_other_scan_completed - Notify completion of non-P2P scan
* @p2p: P2P module context from p2p_init()
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 2ad0ec5..adf0d24 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1047,10 +1047,14 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
}
-/* Return < 0 if no scan results could be fetched or if scan results should not
- * be shared with other virtual interfaces. */
+/* Return < 0 if no scan results could be fetched. */
+#ifdef ANDROID_P2P
+static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
+ union wpa_event_data *data, int suppress_event)
+#else
static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
union wpa_event_data *data)
+#endif
{
struct wpa_bss *selected;
struct wpa_ssid *ssid = NULL;
@@ -1130,10 +1134,14 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
wpa_scan_results_free(scan_res);
return 0;
}
-
- wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available");
- wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
- wpas_notify_scan_results(wpa_s);
+#ifdef ANDROID_P2P
+ if(!suppress_event)
+#endif
+ {
+ wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available");
+ wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
+ wpas_notify_scan_results(wpa_s);
+ }
wpas_notify_scan_done(wpa_s, 1);
@@ -1238,8 +1246,11 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
{
const char *rn, *rn2;
struct wpa_supplicant *ifs;
-
+#ifdef ANDROID_P2P
+ if (_wpa_supplicant_event_scan_results(wpa_s, data, 0) < 0) {
+#else
if (_wpa_supplicant_event_scan_results(wpa_s, data) < 0) {
+#endif
/*
* If no scan results could be fetched, then no need to
* notify those interfaces that did not actually request
@@ -1270,7 +1281,27 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
if (rn2 && os_strcmp(rn, rn2) == 0) {
wpa_printf(MSG_DEBUG, "%s: Updating scan results from "
"sibling", ifs->ifname);
+#ifdef ANDROID_P2P
+ if ( (ifs->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE) || (ifs->p2p_group_interface != NOT_P2P_GROUP_INTERFACE)) {
+ /* Do not update the scan results from STA interface to p2p interfaces */
+ wpa_printf(MSG_DEBUG, "Not Updating scan results on interface %s from "
+ "sibling %s", ifs->ifname, wpa_s->ifname);
+ continue;
+ }
+ else {
+ /* P2P_FIND will result in too many SCAN_RESULT_EVENTS within
+ * no time. Avoid announcing it to application as it may not
+ * be that useful (since results will be that of only 1,6,11).
+ * over to any other interface as it
+ */
+ if(p2p_search_in_progress(wpa_s->global->p2p))
+ _wpa_supplicant_event_scan_results(ifs, data, 1);
+ else
+ _wpa_supplicant_event_scan_results(ifs, data, 0);
+ }
+#else
_wpa_supplicant_event_scan_results(ifs, data);
+#endif
}
}
}