hal: Branch 'master' - 2 commits

Danny Kukawka dkukawka at kemper.freedesktop.org
Tue Nov 20 06:36:33 PST 2007


 hald/linux/probing/probe-net-bluetooth.c |   35 +++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 11 deletions(-)

New commits:
commit d0794f6c3d61e0bb396d2c08604c332a9c035921
Author: Guillem Jover <guillem.jover at nokia.com>
Date:   Tue Nov 20 15:36:20 2007 +0100

    switch probe-net-bluetooth to use changesets
    
    Switch probe-net-bluetooth to use changesets.

diff --git a/hald/linux/probing/probe-net-bluetooth.c b/hald/linux/probing/probe-net-bluetooth.c
index 69ddb0a..ec4cd25 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,24 @@ 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) {
+		HAL_ERROR(("Cannot initialize changeset"));
+		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);
commit 031cbb3317250bca61de97d62df334b907c6b4be
Author: Guillem Jover <guillem.jover at nokia.com>
Date:   Tue Nov 20 15:30:44 2007 +0100

    probe-net-bluetooth: get property from env instead of asking hald
    
    Get property from environment instead of asking hald.

diff --git a/hald/linux/probing/probe-net-bluetooth.c b/hald/linux/probing/probe-net-bluetooth.c
index 854e8e7..69ddb0a 100644
--- a/hald/linux/probing/probe-net-bluetooth.c
+++ b/hald/linux/probing/probe-net-bluetooth.c
@@ -147,16 +147,13 @@ main (int argc, char *argv[])
 	if (udi == NULL)
 		goto out;
 
-	dbus_error_init (&error);
-	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
+	iface = getenv ("HAL_PROP_NET_INTERFACE");
+	if (iface == NULL)
 		goto out;
 
-	iface = libhal_device_get_property_string (ctx, udi, "net.interface", NULL);
-
 	HAL_INFO (("Investigating '%s'", iface));
 
-	if (iface == NULL)
-		goto out;
+	dbus_error_init (&error);
 
 	if ((conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error)) == NULL)
 		goto out;
@@ -216,6 +213,10 @@ main (int argc, char *argv[])
 		goto out;
 	}
 
+	ctx = libhal_ctx_init_direct (&error);
+	if (ctx == NULL)
+		goto out;
+
 	get_properties (conn, ctx, udi, id, connection);
 
 out:


More information about the hal-commit mailing list