From 8c9977b02169621f4643106c18de4de9824485a9 Mon Sep 17 00:00:00 2001 From: Ye He Date: Tue, 15 Jul 2025 17:28:20 +0800 Subject: [PATCH] adapter: Fix RemoveDevice timeout when device already disconnected When attempting to use RemoveDevice to delete a BIS source device that was synchronized by the BIS sink scan delegator, the kernel marks the device as disconnected due to PA(period adv) sync termination. However, BlueZ is not notified of this disconnection and still proceeds to send MGMT Disconnect command. The kernel responds with MGMT_STATUS_DISCONNECTED, which BlueZ does not currently handle as a successful case. As a result, the RemoveDevice call never completes and no D-Bus reply is returned. Fixes: https://github.com/bluez/bluez/issues/1421 --- src/adapter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/adapter.c b/src/adapter.c index 79802300b..5d68fa4c7 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -8619,7 +8619,8 @@ static void disconnect_complete(uint8_t status, uint16_t length, const struct mgmt_rp_disconnect *rp = param; struct btd_adapter *adapter = user_data; - if (status == MGMT_STATUS_NOT_CONNECTED) { + if (status == MGMT_STATUS_NOT_CONNECTED || + status == MGMT_STATUS_DISCONNECTED) { btd_warn(adapter->dev_id, "Disconnecting failed: already disconnected"); } else if (status != MGMT_STATUS_SUCCESS) { -- 2.47.3