Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/6] gdbus: Fix up Properties.Set() code path
@ 2012-10-06  7:02 Lucas De Marchi
  2012-10-06  7:02 ` [PATCH BlueZ 2/6] core: Remove useless memset and make icon optional Lucas De Marchi
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Lucas De Marchi @ 2012-10-06  7:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

Minor fixes to make setter actually work:

	- Add propdata in pending_property_set
	- Break loop when we are removing propdata from list and we
	  found it
	- in_args and out_args were swapped
	- interface and method name arguments were swapped
---
 gdbus/object.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 444728c..66431de 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -433,6 +433,8 @@ static struct property_data *remove_pending_property_data(
 		propdata = l->data;
 		if (propdata->id != id)
 			continue;
+
+		break;
 	}
 
 	if (l == NULL)
@@ -844,7 +846,7 @@ static DBusMessage *properties_set(DBusConnection *connection,
 					"Invalid argument type: '%c'",
 					dbus_message_iter_get_arg_type(&iter));
 
-	dbus_message_iter_get_basic(&iter, &name);
+	dbus_message_iter_get_basic(&iter, &interface);
 	dbus_message_iter_next(&iter);
 
 	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
@@ -852,7 +854,7 @@ static DBusMessage *properties_set(DBusConnection *connection,
 					"Invalid argument type: '%c'",
 					dbus_message_iter_get_arg_type(&iter));
 
-	dbus_message_iter_get_basic(&iter, &interface);
+	dbus_message_iter_get_basic(&iter, &name);
 	dbus_message_iter_next(&iter);
 
 	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
@@ -887,6 +889,7 @@ static DBusMessage *properties_set(DBusConnection *connection,
 	propdata = g_new(struct property_data, 1);
 	propdata->id = next_pending_property++;
 	propdata->message = dbus_message_ref(message);
+	pending_property_set = g_slist_prepend(pending_property_set, propdata);
 
 	property->set(property, &sub, propdata->id, iface->user_data);
 
@@ -898,9 +901,10 @@ static const GDBusMethodTable properties_methods[] = {
 			GDBUS_ARGS({ "interface", "s" }, { "name", "s" }),
 			GDBUS_ARGS({ "value", "v" }),
 			properties_get) },
-	{ GDBUS_ASYNC_METHOD("Set", NULL,
+	{ GDBUS_ASYNC_METHOD("Set",
 			GDBUS_ARGS({ "interface", "s" }, { "name", "s" },
 							{ "value", "v" }),
+			NULL,
 			properties_set) },
 	{ GDBUS_METHOD("GetAll",
 			GDBUS_ARGS({ "interface", "s" }),
-- 
1.7.12.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH BlueZ 1/6] gdbus: Fix up Properties.Set() code path
@ 2012-10-06  7:10 Lucas De Marchi
  2012-10-06  7:10 ` [PATCH BlueZ 5/6] core: Add setters and signals to Device interface Lucas De Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Lucas De Marchi @ 2012-10-06  7:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

From: Lucas De Marchi <lucas.de.marchi@gmail.com>

Minor fixes to make setter actually work:

	- Add propdata in pending_property_set
	- Break loop when we are removing propdata from list and we
	  found it
	- in_args and out_args were swapped
	- interface and method name arguments were swapped
---
 gdbus/object.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 444728c..66431de 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -433,6 +433,8 @@ static struct property_data *remove_pending_property_data(
 		propdata = l->data;
 		if (propdata->id != id)
 			continue;
+
+		break;
 	}
 
 	if (l == NULL)
@@ -844,7 +846,7 @@ static DBusMessage *properties_set(DBusConnection *connection,
 					"Invalid argument type: '%c'",
 					dbus_message_iter_get_arg_type(&iter));
 
-	dbus_message_iter_get_basic(&iter, &name);
+	dbus_message_iter_get_basic(&iter, &interface);
 	dbus_message_iter_next(&iter);
 
 	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
@@ -852,7 +854,7 @@ static DBusMessage *properties_set(DBusConnection *connection,
 					"Invalid argument type: '%c'",
 					dbus_message_iter_get_arg_type(&iter));
 
-	dbus_message_iter_get_basic(&iter, &interface);
+	dbus_message_iter_get_basic(&iter, &name);
 	dbus_message_iter_next(&iter);
 
 	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
@@ -887,6 +889,7 @@ static DBusMessage *properties_set(DBusConnection *connection,
 	propdata = g_new(struct property_data, 1);
 	propdata->id = next_pending_property++;
 	propdata->message = dbus_message_ref(message);
+	pending_property_set = g_slist_prepend(pending_property_set, propdata);
 
 	property->set(property, &sub, propdata->id, iface->user_data);
 
@@ -898,9 +901,10 @@ static const GDBusMethodTable properties_methods[] = {
 			GDBUS_ARGS({ "interface", "s" }, { "name", "s" }),
 			GDBUS_ARGS({ "value", "v" }),
 			properties_get) },
-	{ GDBUS_ASYNC_METHOD("Set", NULL,
+	{ GDBUS_ASYNC_METHOD("Set",
 			GDBUS_ARGS({ "interface", "s" }, { "name", "s" },
 							{ "value", "v" }),
+			NULL,
 			properties_set) },
 	{ GDBUS_METHOD("GetAll",
 			GDBUS_ARGS({ "interface", "s" }),
-- 
1.7.12.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-10-06  7:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-06  7:02 [PATCH BlueZ 1/6] gdbus: Fix up Properties.Set() code path Lucas De Marchi
2012-10-06  7:02 ` [PATCH BlueZ 2/6] core: Remove useless memset and make icon optional Lucas De Marchi
2012-10-06  7:02 ` [PATCH BlueZ 3/6] doc: Mark optional properties in Device interface Lucas De Marchi
2012-10-06  7:02 ` [PATCH BlueZ 4/6] core: Add DBus.Properties getters for " Lucas De Marchi
2012-10-06  7:02 ` [PATCH BlueZ 5/6] core: Add setters and signals to " Lucas De Marchi
2012-10-06  7:02 ` [PATCH BlueZ 6/6] core: Move functions to avoid forward declaration Lucas De Marchi
  -- strict thread matches above, loose matches on Subject: below --
2012-10-06  7:10 [PATCH BlueZ 1/6] gdbus: Fix up Properties.Set() code path Lucas De Marchi
2012-10-06  7:10 ` [PATCH BlueZ 5/6] core: Add setters and signals to Device interface Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox