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: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
This commit is contained in:
João Paulo Rechi Vita 2019-09-10 16:25:44 -07:00 committed by Igor Kovalenko
parent a631d4c07c
commit 28fd9bc319

View file

@ -487,16 +487,16 @@ static void register_profile_reply(DBusPendingCall *pending, void *userdata) {
DBusMessage *r; DBusMessage *r;
pa_dbus_pending *p; pa_dbus_pending *p;
pa_bluetooth_backend *b; pa_bluetooth_backend *b;
char *object; pa_bluetooth_profile_t profile;
pa_assert(pending); pa_assert(pending);
pa_assert_se(p = userdata); pa_assert_se(p = userdata);
pa_assert_se(b = p->context_data); 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)); pa_assert_se(r = dbus_pending_call_steal_reply(pending));
if (dbus_message_is_error(r, BLUEZ_ERROR_NOT_SUPPORTED)) { 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; goto finish;
} }
@ -511,17 +511,15 @@ finish:
PA_LLIST_REMOVE(pa_dbus_pending, b->pending, p); PA_LLIST_REMOVE(pa_dbus_pending, b->pending, p);
pa_dbus_pending_free(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; DBusMessage *m;
DBusMessageIter i, d; DBusMessageIter i, d;
dbus_bool_t autoconnect; dbus_bool_t autoconnect;
dbus_uint16_t version, chan; 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")); 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); 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) 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)); 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) { static void profile_done(pa_bluetooth_backend *b, pa_bluetooth_profile_t profile) {