Patchwork P2P: Notify upper framework on stopping the p2p_find(SEARCH)

login
register
mail settings
Submitter Jithu Jance
Date Jan. 18, 2012, 9:51 p.m.
Message ID <6C370B347C3FE8438C9692873287D2E1195AE35DA4@SJEXCHCCR01.corp.ad.broadcom.com>
Download mbox | patch
Permalink /patch/136697/
State Accepted
Commit 8aebb0e471f2e89e146713ebf9f3e1cbb58e8f52
Headers show

Comments

Jithu Jance - Jan. 18, 2012, 9:51 p.m.
This patch notifies the upper framework that an on-going discovery has been stopped. This is useful in cases where
a p2p_find with a timeout value initiated by the upper framework has been finished or when the framework initiated
"p2p_find" is stopped by a "p2p_connect". 



 Signed-hostap: Jithu Jance <jithu@broadcom.com>

---
 src/common/wpa_ctrl.h |    1 +
 src/p2p/p2p.c         |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)
Jouni Malinen - Jan. 22, 2012, 3:23 p.m.
On Wed, Jan 18, 2012 at 01:51:59PM -0800, Jithu Jance wrote:
> This patch notifies the upper framework that an on-going discovery has been stopped. This is useful in cases where
> a p2p_find with a timeout value initiated by the upper framework has been finished or when the framework initiated
> "p2p_find" is stopped by a "p2p_connect". 

Thanks, applied.

> diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
> @@ -994,6 +995,10 @@ void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq)
>  	wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Stopping find");
>  	eloop_cancel_timeout(p2p_find_timeout, p2p, NULL);
>  	p2p_clear_timeout(p2p);
> +	if(p2p->state == P2P_SEARCH) {
> +		wpa_printf(MSG_DEBUG, "P2P-FIND-STOPPED");
> +		wpa_msg(p2p->cfg->msg_ctx, MSG_INFO, P2P_EVENT_FIND_STOPPED);
> +	}

Though, I removed the wpa_printf call here to avoid duplicated entry in
debug log.

Patch

diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
index 6cd9de5..d13ba02 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -128,6 +128,7 @@  extern "C" {
 #define P2P_EVENT_SERV_DISC_RESP "P2P-SERV-DISC-RESP "
 #define P2P_EVENT_INVITATION_RECEIVED "P2P-INVITATION-RECEIVED "
 #define P2P_EVENT_INVITATION_RESULT "P2P-INVITATION-RESULT "
+#define P2P_EVENT_FIND_STOPPED "P2P-FIND-STOPPED "
 
 #define INTERWORKING_AP "INTERWORKING-AP "
 #define INTERWORKING_NO_MATCH "INTERWORKING-NO-MATCH "
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index e61e133..d9db956 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -17,6 +17,7 @@ 
 #include "common.h"
 #include "eloop.h"
 #include "common/ieee802_11_defs.h"
+#include "common/wpa_ctrl.h"
 #include "common/ieee802_11_common.h"
 #include "wps/wps_i.h"
 #include "p2p_i.h"
@@ -994,6 +995,10 @@  void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq)
 	wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Stopping find");
 	eloop_cancel_timeout(p2p_find_timeout, p2p, NULL);
 	p2p_clear_timeout(p2p);
+	if(p2p->state == P2P_SEARCH) {
+		wpa_printf(MSG_DEBUG, "P2P-FIND-STOPPED");
+		wpa_msg(p2p->cfg->msg_ctx, MSG_INFO, P2P_EVENT_FIND_STOPPED);
+	}
 	p2p_set_state(p2p, P2P_IDLE);
 	p2p_free_req_dev_types(p2p);
 	p2p->start_after_scan = P2P_AFTER_SCAN_NOTHING;
-- 
1.7.4.1
d-off-by: Jithu Jance <jithu@broadcom.com>

---
 src/common/wpa_ctrl.h |    1 +
 src/p2p/p2p.c         |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
index 6cd9de5..d13ba02 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -128,6 +128,7 @@  extern "C" {
 #define P2P_EVENT_SERV_DISC_RESP "P2P-SERV-DISC-RESP "
 #define P2P_EVENT_INVITATION_RECEIVED "P2P-INVITATION-RECEIVED "
 #define P2P_EVENT_INVITATION_RESULT "P2P-INVITATION-RESULT "
+#define P2P_EVENT_FIND_STOPPED "P2P-FIND-STOPPED "
 
 #define INTERWORKING_AP "INTERWORKING-AP "
 #define INTERWORKING_NO_MATCH "INTERWORKING-NO-MATCH "
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index e61e133..d9db956 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -17,6 +17,7 @@ 
 #include "common.h"
 #include "eloop.h"
 #include "common/ieee802_11_defs.h"
+#include "common/wpa_ctrl.h"
 #include "common/ieee802_11_common.h"
 #include "wps/wps_i.h"
 #include "p2p_i.h"
@@ -994,6 +995,10 @@  void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq)
 	wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Stopping find");
 	eloop_cancel_timeout(p2p_find_timeout, p2p, NULL);
 	p2p_clear_timeout(p2p);
+	if(p2p->state == P2P_SEARCH) {
+		wpa_printf(MSG_DEBUG, "P2P-FIND-STOPPED");
+		wpa_msg(p2p->cfg->msg_ctx, MSG_INFO, P2P_EVENT_FIND_STOPPED);
+	}
 	p2p_set_state(p2p, P2P_IDLE);
 	p2p_free_req_dev_types(p2p);
 	p2p->start_after_scan = P2P_AFTER_SCAN_NOTHING;