Linux bluetooth development
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
To: linux-bluetooth@vger.kernel.org
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>
Subject: [PATCH BlueZ 1/6] gdbus: Fix up Properties.Set() code path
Date: Sat,  6 Oct 2012 04:02:35 -0300	[thread overview]
Message-ID: <1349506960-9398-1-git-send-email-lucas.de.marchi@gmail.com> (raw)

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


             reply	other threads:[~2012-10-06  7:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-06  7:02 Lucas De Marchi [this message]
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:43 ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349506960-9398-1-git-send-email-lucas.de.marchi@gmail.com \
    --to=lucas.demarchi@profusion.mobi \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox