From: Timo Mueller <timo.mueller@xxxxxxxxxxxx> Some plugins choose a default adapter when no specific adapter has been selected. This information was not exposed in the adapters D-Bus properties. With the new property users can find out which adapter is used if no adapter has been specified. This allows them to change the properties of the adapter beforehand, e.g. powering the adapter before oob data is sent. --- src/adapter.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index 41f7bd6..46174d6 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2126,6 +2126,17 @@ static gboolean property_get_modalias(const GDBusPropertyTable *property, return TRUE; } +static gboolean property_get_default(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *user_data) +{ + struct btd_adapter *adapter = user_data; + dbus_bool_t is_default = btd_adapter_is_default(adapter); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &is_default); + + return TRUE; +} + static int device_path_cmp(gconstpointer a, gconstpointer b) { const struct btd_device *device = a; @@ -2193,6 +2204,7 @@ static const GDBusPropertyTable adapter_properties[] = { { "UUIDs", "as", property_get_uuids }, { "Modalias", "s", property_get_modalias, NULL, property_exists_modalias }, + { "Default", "b", property_get_default }, { } }; @@ -5673,6 +5685,9 @@ static int adapter_unregister(struct btd_adapter *adapter) new_default = adapters->data; new_default->is_default = true; + + g_dbus_emit_property_changed(dbus_conn, new_default->path, + ADAPTER_INTERFACE, "Default"); } adapter_list = g_list_remove(adapter_list, adapter); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html