[PATCH 2/6] adding wps manufacturer as property in dbus

Avichal Agarwal avichal.a at samsung.com
Wed Dec 21 04:24:21 PST 2016


Signed-off-by: Avichal Agarwal <avichal.a at samsung.com>
Signed-off-by: Kyeong-Chae Lim <kcya.lim at samsung.com>
Signed-off-by: Mayank Haarit <mayank.h at samsung.com>

---
 wpa_supplicant/dbus/dbus_new.c              |  6 +++
 wpa_supplicant/dbus/dbus_new_handlers.h     |  2 +
 wpa_supplicant/dbus/dbus_new_handlers_wps.c | 61 ++++++++++++++++++++++++++++-
 3 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 9113dd4..055a86d 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3240,6 +3240,12 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
 	  wpas_dbus_setter_wps_device_name,
 	  NULL
 	},
+	{
+	  "Manufacturer" ,WPAS_DBUS_NEW_IFACE_WPS, "s" ,
+	  wpas_dbus_getter_wps_manufacturer,
+	  wpas_dbus_setter_wps_manufacturer,
+	  NULL
+	},
 #endif /* CONFIG_WPS */
 #ifdef CONFIG_P2P
 	{ "P2PDeviceConfig", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}",
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index 935cd8c..a12f483 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -188,6 +188,8 @@ DECLARE_ACCESSOR(wpas_dbus_getter_config_methods);
 DECLARE_ACCESSOR(wpas_dbus_setter_config_methods);
 DECLARE_ACCESSOR(wpas_dbus_getter_wps_device_name);
 DECLARE_ACCESSOR(wpas_dbus_setter_wps_device_name);
+DECLARE_ACCESSOR(wpas_dbus_getter_wps_manufacturer);
+DECLARE_ACCESSOR(wpas_dbus_setter_wps_manufacturer);
 
 DBusMessage * wpas_dbus_handler_tdls_discover(DBusMessage *message,
 					      struct wpa_supplicant *wpa_s);
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_wps.c b/wpa_supplicant/dbus/dbus_new_handlers_wps.c
index ff36788..1fe176e 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_wps.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_wps.c
@@ -457,6 +457,66 @@ dbus_bool_t wpas_dbus_getter_wps_device_name(
 }
 
 /**
+ * wpas_dbus_setter_wps_manufacturer - Get current manufacturer name
+ * @iter: Pointer to incoming dbus message iter
+ * @error: Location to store error on failure
+ * @user_data: Function specific data
+ * Returns: TRUE on success, FALSE on failure
+ *
+ * Setter for "Manufacturer" property. Returned boolean will be true if
+ * providing the relevant string worked, or false otherwise.
+ */
+dbus_bool_t wpas_dbus_setter_wps_manufacturer(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	char *methods;
+	char *devname;
+
+	if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_STRING,
+					      &methods))
+		return FALSE;
+
+	if(os_strlen(methods) > 64)
+		return FALSE;
+
+	devname = os_strdup(methods);
+	if (!devname)
+		return FALSE;
+
+	os_free(wpa_s->conf->manufacturer);
+	wpa_s->conf->manufacturer = devname;
+	wpa_s->conf->changed_parameters |= CFG_CHANGED_WPS_STRING;
+	wpa_supplicant_update_config(wpa_s);
+
+	return TRUE;
+}
+
+/**
+ * wpas_dbus_getter_wps_manufacturer - Get current manufacturer name
+ * @iter: Pointer to incoming dbus message iter
+ * @error: Location to store error on failure
+ * @user_data: Function specific data
+ * Returns: TRUE on success, FALSE on failure
+ *
+ * Getter for "Manufacturer" property. Returned boolean will be true if
+ * providing the relevant string worked, or false otherwise.
+ */
+dbus_bool_t wpas_dbus_getter_wps_manufacturer(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	char *manufacturer = wpa_s->conf->manufacturer;
+
+	if (manufacturer == NULL)
+		manufacturer = "";
+	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
+						&manufacturer, error);
+}
+
+/**
  * wpas_dbus_getter_config_methods - Get current WPS configuration methods
  * @iter: Pointer to incoming dbus message iter
  * @error: Location to store error on failure
@@ -479,7 +539,6 @@ dbus_bool_t wpas_dbus_getter_config_methods(
 						&methods, error);
 }
 
-
 /**
  * wpas_dbus_setter_config_methods - Set WPS configuration methods
  * @iter: Pointer to incoming dbus message iter
-- 
2.7.4




More information about the Hostap mailing list