diff mbox

dbus: Add a device configuration entry to set the P2P WPS methods

Message ID 1410870475-8761-1-git-send-email-tomasz.bursztyka@linux.intel.com
State Superseded
Headers show

Commit Message

Tomasz Bursztyka Sept. 16, 2014, 12:27 p.m. UTC
It is thus possible to select which WPS methods is prefered for a P2P
device.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
---
 wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Jouni Malinen Sept. 28, 2014, 4:38 p.m. UTC | #1
On Tue, Sep 16, 2014 at 03:27:55PM +0300, Tomasz Bursztyka wrote:
> It is thus possible to select which WPS methods is prefered for a P2P
> device.

I have nothing against making wpa_s->conf->config_methods configurable
through D-Bus, but this commit message is confusing. First of all, this
parameter is in no way specific to P2P, i.e., it applies to all WPS
operations. Furthermore, it is not a preference; it is a list of all
supported configuration methods and it should not really change unless
the device capabilities changes.

Could you please clarify how you are planning on using this and why this
would be in P2P-specific D-Bus setter?
Tomasz Bursztyka Sept. 29, 2014, 9:45 a.m. UTC | #2
Hi Jouni,

> On Tue, Sep 16, 2014 at 03:27:55PM +0300, Tomasz Bursztyka wrote:
>> It is thus possible to select which WPS methods is prefered for a P2P
>> device.
> I have nothing against making wpa_s->conf->config_methods configurable
> through D-Bus, but this commit message is confusing. First of all, this
> parameter is in no way specific to P2P, i.e., it applies to all WPS
> operations. Furthermore, it is not a preference; it is a list of all
> supported configuration methods and it should not really change unless
> the device capabilities changes.
>
> Could you please clarify how you are planning on using this and why this
> would be in P2P-specific D-Bus setter?

Indeed, let's change this.

I'll post another patch, and this will be set through global settings 
DBus interface.

Tomasz
diff mbox

Patch

diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index 5e90b37..4a84c22 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -991,7 +991,20 @@  dbus_bool_t wpas_dbus_setter_p2p_device_config(DBusMessageIter *iter,
 		else if (os_strcmp(entry.key, "p2p_search_delay") == 0 &&
 			 entry.type == DBUS_TYPE_UINT32)
 			wpa_s->conf->p2p_search_delay = entry.uint32_value;
-		else
+		else if (os_strcmp(entry.key, "ConfigMethods") == 0 &&
+			 entry.type == DBUS_TYPE_STRING) {
+			char *methods;
+
+			methods = os_strdup(entry.str_value);
+			if (!methods)
+				goto err_no_mem_clear;
+
+			os_free(wpa_s->conf->config_methods);
+			wpa_s->conf->config_methods = methods;
+
+			wpa_s->conf->changed_parameters |=
+					CFG_CHANGED_CONFIG_METHODS;
+		} else
 			goto error;
 
 		wpa_dbus_dict_entry_clear(&entry);