From 8bf8600e5956e7b708c8cb3775e1203d95c1d8e3 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 11 Oct 2025 20:40:48 +0300 Subject: [PATCH] bluez5: if Acquire results to NoReply, try to clean up with Release If BlueZ doesn't reply, it may consider the operation still active. Try to Release the transport to get to a known state. This can happen if device doesn't respond to operations in reasonable time and BlueZ doesn't have its own timeout which is the case for BAP currently (which is a bug there). --- spa/plugins/bluez5/bluez5-dbus.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index 07b122c63..4b5ca1d65 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -3868,6 +3868,21 @@ static void transport_acquire_reply(DBusPendingCall *pending, void *user_data) spa_log_error(monitor->log, "Acquire %s returned error: %s", transport->path, dbus_message_get_error_name(r)); + + /* If no reply, BlueZ may consider operation still active, so release to + * try to get to a known state. + */ + if (spa_streq(dbus_message_get_error_name(r), DBUS_ERROR_NO_REPLY)) { + spa_autoptr(DBusMessage) m = NULL; + + spa_log_info(monitor->log, "Releasing transport %s (clean up NoReply)", + transport->path); + m = dbus_message_new_method_call(BLUEZ_SERVICE, transport->path, + BLUEZ_MEDIA_TRANSPORT_INTERFACE, "Release"); + if (m) + dbus_connection_send(monitor->conn, m, NULL); + } + ret = -EIO; goto finish; }