[PATCH] This patch is to send P2P-DEVICE-FOUND event to upper layer on changing device name of the peer device.

Mayank Haarit mayank.h at samsung.com
Wed Dec 7 08:46:04 PST 2016


This is to handle the case when peer changes device name and same need to be updated to upper layer by P2P-DEVICE-FOUND event.
It is similiar to case when peer changes wfd_subelems and P2P-DEVICE-FOUND event goes to upper layer.

Signed-off-by: Mayank Haarit <mayank.h at samsung.com>
Signed-off-by: Avichal Agarwal <avichal.a at samsung.com>
---
 src/p2p/p2p.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index cd2fba3..2f1f294 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -711,6 +711,7 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
 	struct p2p_message msg;
 	const u8 *p2p_dev_addr;
 	int wfd_changed;
+	int devicename_changed;
 	int i;
 	struct os_reltime time_now;
 
@@ -821,6 +822,11 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
 	}
 	dev->info.level = level;
 
+	if(msg.device_name && (os_strcmp(dev->info.device_name, msg.device_name) != 0))
+		devicename_changed = 1;
+	else
+		devicename_changed = 0;
+
 	p2p_copy_wps_info(p2p, dev, 0, &msg);
 
 	for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) {
@@ -854,7 +860,7 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
 
 	p2p_update_peer_vendor_elems(dev, ies, ies_len);
 
-	if (dev->flags & P2P_DEV_REPORTED && !wfd_changed &&
+	if (dev->flags & P2P_DEV_REPORTED && !wfd_changed && !devicename_changed &&
 	    (!msg.adv_service_instance ||
 	     (dev->flags & P2P_DEV_P2PS_REPORTED)))
 		return 0;
-- 
1.7.9.5




More information about the Hostap mailing list