From 28fd9bc31990969ccdc765a1b67978551ba4cc74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Date: Tue, 10 Sep 2019 16:25:44 -0700 Subject: [PATCH] bluetooth: backend-native: Pass profile id in register_profile* Passing the profile id to register_profile and register profile reply makes a clearer debug and will allow easier tracking of the profile status changes. Part-of: --- src/modules/bluetooth/backend-native.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c index f22e016e3..a3f2c26e5 100644 --- a/src/modules/bluetooth/backend-native.c +++ b/src/modules/bluetooth/backend-native.c @@ -487,16 +487,16 @@ static void register_profile_reply(DBusPendingCall *pending, void *userdata) { DBusMessage *r; pa_dbus_pending *p; pa_bluetooth_backend *b; - char *object; + pa_bluetooth_profile_t profile; pa_assert(pending); pa_assert_se(p = userdata); pa_assert_se(b = p->context_data); - pa_assert_se(object = p->call_data); + pa_assert_se(profile = (pa_bluetooth_profile_t)p->call_data); pa_assert_se(r = dbus_pending_call_steal_reply(pending)); if (dbus_message_is_error(r, BLUEZ_ERROR_NOT_SUPPORTED)) { - pa_log_info("Couldn't register object %s because this UUID is disabled in BlueZ", object); + pa_log_info("Couldn't register profile %s because it is disabled in BlueZ", pa_bluetooth_profile_to_string(profile)); goto finish; } @@ -511,17 +511,15 @@ finish: PA_LLIST_REMOVE(pa_dbus_pending, b->pending, p); pa_dbus_pending_free(p); - - pa_xfree(object); } -static void register_profile(pa_bluetooth_backend *b, const char *object, const char *uuid) { +static void register_profile(pa_bluetooth_backend *b, const char *object, const char *uuid, pa_bluetooth_profile_t profile) { DBusMessage *m; DBusMessageIter i, d; dbus_bool_t autoconnect; dbus_uint16_t version, chan; - pa_log_debug("Registering Profile %s %s", object, uuid); + pa_log_debug("Registering Profile %s %s", pa_bluetooth_profile_to_string(profile), uuid); pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, "/org/bluez", BLUEZ_PROFILE_MANAGER_INTERFACE, "RegisterProfile")); @@ -546,7 +544,7 @@ static void register_profile(pa_bluetooth_backend *b, const char *object, const } dbus_message_iter_close_container(&i, &d); - send_and_add_to_pending(b, m, register_profile_reply, pa_xstrdup(object)); + send_and_add_to_pending(b, m, register_profile_reply, (void *)profile); } static void transport_put(pa_bluetooth_transport *t) @@ -1090,7 +1088,7 @@ static void profile_init(pa_bluetooth_backend *b, pa_bluetooth_profile_t profile } pa_assert_se(dbus_connection_register_object_path(pa_dbus_connection_get(b->connection), object_name, &vtable_profile, b)); - register_profile(b, object_name, uuid); + register_profile(b, object_name, uuid, profile); } static void profile_done(pa_bluetooth_backend *b, pa_bluetooth_profile_t profile) {