From 063167c27c3e2cf9ac647a617abf345451de0787 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 1 Nov 2008 01:17:12 +0100 Subject: Make FindAdapter return the any object if present --- src/manager.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/manager.c') diff --git a/src/manager.c b/src/manager.c index c43ef5b8..3b3f52df 100644 --- a/src/manager.c +++ b/src/manager.c @@ -189,7 +189,12 @@ static DBusMessage *find_adapter(DBusConnection *conn, /* hci_devid() would make sense to use here, except it is restricted to devices which are up */ - if (!strncmp(pattern, "hci", 3) && strlen(pattern) >= 4) + if (!strcmp(pattern, "any") || !strcmp(pattern, "00:00:00:00:00:00")) { + path = adapter_any_get_path(); + if (path != NULL) + goto done; + dev_id = -1; + } if (!strncmp(pattern, "hci", 3) && strlen(pattern) >= 4) dev_id = atoi(pattern + 3); else dev_id = find_by_address(pattern); @@ -207,14 +212,15 @@ static DBusMessage *find_adapter(DBusConnection *conn, if (!adapter) return no_such_adapter(msg); + path = adapter_get_path(adapter); + +done: reply = dbus_message_new_method_return(msg); if (!reply) return NULL; - path = adapter_get_path(adapter); - dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_INVALID); + DBUS_TYPE_INVALID); return reply; } -- cgit