[PATCH] switch probe-net-bluetooth to use changesets

Guillem Jover guillem.jover at nokia.com
Mon Nov 5 16:20:45 PST 2007


---
 hald/linux/probing/probe-net-bluetooth.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/hald/linux/probing/probe-net-bluetooth.c b/hald/linux/probing/probe-net-bluetooth.c
index 69ddb0a..ecad4b0 100644
--- a/hald/linux/probing/probe-net-bluetooth.c
+++ b/hald/linux/probing/probe-net-bluetooth.c
@@ -41,8 +41,8 @@
 #define BLUEZ_NET_SERVER_IFACE "org.bluez.network.Server"
 
 static void
-get_properties (DBusConnection *conn, LibHalContext *ctx, const char *udi,
-				const char *id, const char *path)
+get_properties (DBusConnection *conn, LibHalChangeSet *cs,
+                const char *id, const char *path)
 {
 	DBusMessage *msg;
 	DBusMessage *reply = NULL;
@@ -100,7 +100,7 @@ get_properties (DBusConnection *conn, LibHalContext *ctx, const char *udi,
 
 			HAL_INFO (("reply: %s:%s", key, value));
 
-			libhal_device_set_property_string (ctx, udi, prop, value, &error);
+			libhal_changeset_set_property_string (cs, prop, value);
 			break;
 		}
 		case DBUS_TYPE_INT32:
@@ -111,7 +111,7 @@ get_properties (DBusConnection *conn, LibHalContext *ctx, const char *udi,
 
 			HAL_INFO (("reply: %s:%d", key, value));
 
-			libhal_device_set_property_int (ctx, udi, prop, value, &error);
+			libhal_changeset_set_property_int (cs, prop, value);
 			break;
 		}
 		default:
@@ -138,6 +138,7 @@ main (int argc, char *argv[])
 	char network[8] = "network";
 	const char *pnetwork = network;
 	LibHalContext *ctx = NULL;
+	LibHalChangeSet *cs = NULL;
 	DBusConnection *conn;
 	DBusMessage *msg = NULL;
 	DBusMessage *reply = NULL;
@@ -217,13 +218,22 @@ main (int argc, char *argv[])
 	if (ctx == NULL)
 		goto out;
 
-	get_properties (conn, ctx, udi, id, connection);
+	cs = libhal_device_new_changeset (udi);
+	if (cs == NULL)
+		goto out;
+
+	get_properties (conn, cs, id, connection);
 
 out:
 	if (msg)
 		dbus_message_unref (msg);
 	if (reply)
 		dbus_message_unref (reply);
+	if (cs != NULL) {
+		dbus_error_init (&error);
+		libhal_device_commit_changeset (ctx, cs, &error);
+		libhal_device_free_changeset (cs);
+	}
 	if (ctx != NULL) {
 		dbus_error_init (&error);
 		libhal_ctx_shutdown (ctx, &error);
-- 
1.5.3.5



More information about the hal mailing list