From 4e118c847b2a3684768ad983fd08a187a33b83c1 Mon Sep 17 00:00:00 2001 From: Amit Purwar Date: Mon, 19 Dec 2016 15:42:30 +0530 Subject: [PATCH] D-Bus: Add 'freq' option to P2P Find method to specify starting channel This allows user to start P2P Find/Scan on a particular frequency and then move to scanning social channels. This support is already present on control socket. Signed-off-by: Amit Purwar --- doc/dbus.doxygen | 1 + wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen index b0e67d45b..f3bdb20cc 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -1297,6 +1297,7 @@ Interface for performing P2P (Wi-Fi Peer-to-Peer) P2P Device operations. TimeoutiTimeout for operating in secondsno RequestedDeviceTypesaayWPS Device Types to search forno DiscoveryTypes"start_with_full" (default, if not specified), "social", "progressive"no + freqiInitial scan channel (frequency in MHz) for the start_with_full case to limit the initial scan to the specified channelno diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index f50420b1a..4c91ee58f 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -90,6 +90,7 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message, int num_req_dev_types = 0; unsigned int i; u8 *req_dev_types = NULL; + unsigned int freq = 0; dbus_message_iter_init(message, &iter); entry.key = NULL; @@ -134,6 +135,10 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message, type = P2P_FIND_PROGRESSIVE; else goto error_clear; + } else if (os_strcmp(entry.key, "freq") == 0 && + (entry.type == DBUS_TYPE_INT32 || + entry.type == DBUS_TYPE_UINT32)) { + freq = entry.uint32_value; } else goto error_clear; wpa_dbus_dict_entry_clear(&entry); @@ -142,7 +147,7 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message, wpa_s = wpa_s->global->p2p_init_wpa_s; wpas_p2p_find(wpa_s, timeout, type, num_req_dev_types, req_dev_types, - NULL, 0, 0, NULL, 0); + NULL, 0, 0, NULL, freq); os_free(req_dev_types); return reply;