[PATCH 1/6] P2P: Moved P2P device level to get the information from D-BUS

Sane, Jayant jayant.sane
Thu Jun 9 09:40:46 PDT 2011


MOved level parameter from p2p_device to p2p_device_info in order
to et the information on D-BUS.
Modified D-BUS P2P handler to return this new parameter through
the P2P device Properties

Signed-off-by: Fabien Marotte <fabienx.marotte at intel.com>
Signed-off-by: Jayant Sane <jayant.sane at intel.com>
---
Note: This patch set applies on top of earlier submitted "DBus-add-support-for-P2P" series 
of patches


 src/p2p/p2p.c                               |    4 ++--
 src/p2p/p2p.h                               |    5 +++++
 src/p2p/p2p_i.h                             |    1 -
 wpa_supplicant/dbus/dbus_new_handlers_p2p.c |    3 +++
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index cc1c104..063e04c 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -576,7 +576,7 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
 	dev->listen_freq = freq;
 	if (msg.group_info)
 		dev->oper_freq = freq;
-	dev->level = level;
+	dev->info.level = level;
 
 	p2p_copy_wps_info(dev, 0, &msg);
 
@@ -2925,7 +2925,7 @@ int p2p_get_peer_info(struct p2p_data *p2p, const u8 *addr, int next,
 			  "invitation_reqs=%u\n",
 			  (int) (now.sec - dev->last_seen.sec),
 			  dev->listen_freq,
-			  dev->level,
+			  dev->info.level,
 			  p2p_wps_method_text(dev->wps_method),
 			  MAC2STR(dev->interface_addr),
 			  MAC2STR(dev->member_in_go_dev),
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 93acf01..bfe7c57 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -180,6 +180,11 @@ struct p2p_peer_info {
 	char serial_number[33];
 
 	/**
+	 * level - Signal level
+	 */
+	int level;
+
+	/**
 	 * config_methods - WPS Configuration Methods
 	 */
 	u16 config_methods;
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index d645e33..85e10c4 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -33,7 +33,6 @@ struct p2p_device {
 	struct dl_list list;
 	struct os_time last_seen;
 	int listen_freq;
-	int level;
 	enum p2p_wps_method wps_method;
 
 	struct p2p_peer_info info;
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index 21fe7e6..a0fbaed 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -1113,6 +1113,9 @@ DBusMessage *wpas_dbus_getter_p2p_peer_properties(DBusMessage * message,
 	if (!wpa_dbus_dict_append_uint16(&dict_iter, "config_method",
 					 info->config_methods))
 		goto err_no_mem;
+	if (!wpa_dbus_dict_append_uint16(&dict_iter, "level",
+					 info->level))
+		goto err_no_mem;
 	if (!wpa_dbus_dict_append_byte(&dict_iter, "devicecapability",
 				       info->dev_capab))
 		goto err_no_mem;
-- 
1.7.1




More information about the Hostap mailing list