[PATCH] P2P: Stop p2p listen when listen duration is over.
Syed Asifful Dayyan Rafiuddeen
syedd
Wed Jul 3 04:05:37 PDT 2013
Even after listen duration is over, supplicant stays in
p2p_listen_only state, which is blocking the STA scan. This
patch will stop p2p listen and update p2p_state to idle
when listen duration expires.
Signed-hostap: Syed Asifful Dayyan <syedd at broadcom.com>
---
src/p2p/p2p.c | 7 +++++++
src/p2p/p2p.h | 8 ++++++++
wpa_supplicant/p2p_supplicant.c | 4 ++++
3 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 54f5ee8..fec4af7 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -1113,6 +1113,13 @@ void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq)
p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
}
+#ifdef ANDROID_P2P
+void p2p_stop_listen(struct p2p_data *p2p)
+{
+ p2p_stop_listen_for_freq(p2p, 0);
+ p2p_set_state(p2p, P2P_IDLE);
+}
+#endif /* ANDROID_P2P */
void p2p_stop_find(struct p2p_data *p2p)
{
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index e911474..e4eed3c 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -903,6 +903,14 @@ void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq);
*/
int p2p_listen(struct p2p_data *p2p, unsigned int timeout);
+#ifdef ANDROID_P2P
+/**
+ * p2p_stop_listen - Stop P2P Listen
+ * @p2p: P2P module context from p2p_init()
+ */
+void p2p_stop_listen(struct p2p_data *p2p);
+#endif /* ANDROID_P2P */
+
/**
* p2p_connect - Start P2P group formation (GO negotiation)
* @p2p: P2P module context from p2p_init()
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index cbc0a38..9b9d353 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -4055,6 +4055,10 @@ void wpas_p2p_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
}
+#ifdef ANDROID_P2P
+ else /* When listen duration is over, stop listen & update p2p_state to IDLE. */
+ p2p_stop_listen(wpa_s->global->p2p);
+#endif /* ANDROID_P2P */
}
--
1.7.6
More information about the Hostap
mailing list