diff --git a/hald/linux/probing/probe-net-bluetooth.c b/hald/linux/probing/probe-net-bluetooth.c index d016224..76e0786 100644 --- a/hald/linux/probing/probe-net-bluetooth.c +++ b/hald/linux/probing/probe-net-bluetooth.c @@ -90,13 +90,12 @@ main (int argc, char *argv[]) char *udi; char *iface; char *id; - char **connections; + const char *connection; const char *name; const char *description; const char *uuid; char network[8] = "network"; const char *pnetwork = network; - int i; LibHalContext *ctx = NULL; DBusConnection *conn; DBusMessage *msg = NULL; @@ -157,12 +156,14 @@ main (int argc, char *argv[]) msg = dbus_message_new_method_call (id, BLUEZ_NET_PATH, BLUEZ_NET_MANAGER_IFACE, - "ListConnections"); + "FindConnection"); if (msg == NULL) goto out; - HAL_INFO (("%s.ListConnections()", BLUEZ_NET_MANAGER_IFACE)); + HAL_INFO (("%s.FindConnection('%s')", BLUEZ_NET_MANAGER_IFACE, iface)); + dbus_message_append_args (msg, DBUS_TYPE_STRING, &iface, + DBUS_TYPE_INVALID); reply = dbus_connection_send_with_reply_and_block (conn, msg, -1, &error); if (dbus_error_is_set (&error) || dbus_set_error_from_message (&error, @@ -174,44 +175,28 @@ main (int argc, char *argv[]) dbus_message_unref (msg); msg = NULL; - dbus_message_get_args (reply, &error, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, - &connections, &i, DBUS_TYPE_INVALID); + dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &connection, + DBUS_TYPE_INVALID); if (dbus_error_is_set (&error)) { dbus_error_free (&error); goto out; } - dbus_message_unref (reply); - reply = NULL; - - i--; - for (; i >= 0; i--) { - const char *connection; - - connection = get_property (conn, id, connections[i], "GetInterface"); - - if (connection && (strcmp (connection, iface) == 0)) - break; - } - - if (i < 0) - goto out; - - name = get_property (conn, id, connections[i], "GetName"); + name = get_property (conn, id, connection, "GetName"); if (name == NULL) goto out; libhal_device_set_property_string (ctx, udi, "net.bluetooth.name", name, &error); - description = get_property (conn, id, connections[i], "GetDescription"); + description = get_property (conn, id, connection, "GetDescription"); if (description == NULL) goto out; libhal_device_set_property_string (ctx, udi, "net.bluetooth.description", description, &error); - uuid = get_property (conn, id, connections[i], "GetUUID"); + uuid = get_property (conn, id, connection, "GetUUID"); if (uuid == NULL) goto out; -- 1.4.4.2