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).
This commit is contained in:
Pauli Virtanen 2025-10-11 20:40:48 +03:00
parent 126d61db1b
commit 8bf8600e59

View file

@ -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;
}