public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bluez] src/adapter: Fix RemoveDevice timeout when device already disconnected
@ 2025-07-12  9:23 Ye He via B4 Relay
  2025-07-12  9:41 ` Paul Menzel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ye He via B4 Relay @ 2025-07-12  9:23 UTC (permalink / raw)
  To: Linux Bluetooth; +Cc: Ye He

From: Ye He <ye.he@amlogic.com>

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 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

Signed-off-by: Ye He <ye.he@amlogic.com>
---
This patch fix org.bluez.Adapter1.RemoveDevice method call timeout
when device already disconnected.
---
 src/adapter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 79802300bedf4b25cb7c6bc3ea659c122a01efcb..5d68fa4c7dea251af4ff3b05a1ad66204c847c37 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) {

---
base-commit: 806dd732fcda584fa6c44322a74373d2b739c781
change-id: 20250712-adapter-rm-device-12aae5651251

Best regards,
-- 
Ye He <ye.he@amlogic.com>



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bluez] src/adapter: Fix RemoveDevice timeout when device already disconnected
  2025-07-12  9:23 [PATCH bluez] src/adapter: Fix RemoveDevice timeout when device already disconnected Ye He via B4 Relay
@ 2025-07-12  9:41 ` Paul Menzel
  2025-07-12 10:44 ` [bluez] " bluez.test.bot
  2025-07-15 14:50 ` [PATCH bluez] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Menzel @ 2025-07-12  9:41 UTC (permalink / raw)
  To: Ye He; +Cc: linux-bluetooth

Dear Ye,


Thank you for your patch. In the summary, you could remove `src/` from 
the prefix as it’s uncommon to add it there.


Am 12.07.25 um 11:23 schrieb Ye He via B4 Relay:
> From: Ye He <ye.he@amlogic.com>
> 
> 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 sync termination. However, BlueZ is not

What is PA? PulseAudio?

> 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
> 
> Signed-off-by: Ye He <ye.he@amlogic.com>
> ---
> This patch fix org.bluez.Adapter1.RemoveDevice method call timeout
> when device already disconnected.
> ---
>   src/adapter.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/adapter.c b/src/adapter.c
> index 79802300bedf4b25cb7c6bc3ea659c122a01efcb..5d68fa4c7dea251af4ff3b05a1ad66204c847c37 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) {

The diff looks good to me.


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [bluez] src/adapter: Fix RemoveDevice timeout when device already disconnected
  2025-07-12  9:23 [PATCH bluez] src/adapter: Fix RemoveDevice timeout when device already disconnected Ye He via B4 Relay
  2025-07-12  9:41 ` Paul Menzel
@ 2025-07-12 10:44 ` bluez.test.bot
  2025-07-15 14:50 ` [PATCH bluez] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-07-12 10:44 UTC (permalink / raw)
  To: linux-bluetooth, ye.he

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=981701

---Test result---

Test Summary:
CheckPatch                    PENDING   0.32 seconds
GitLint                       PENDING   0.26 seconds
BuildEll                      PASS      20.46 seconds
BluezMake                     PASS      2544.14 seconds
MakeCheck                     PASS      20.14 seconds
MakeDistcheck                 PASS      186.08 seconds
CheckValgrind                 PASS      235.86 seconds
CheckSmatch                   PASS      307.18 seconds
bluezmakeextell               PASS      128.31 seconds
IncrementalBuild              PENDING   0.26 seconds
ScanBuild                     PASS      922.53 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bluez] src/adapter: Fix RemoveDevice timeout when device already disconnected
  2025-07-12  9:23 [PATCH bluez] src/adapter: Fix RemoveDevice timeout when device already disconnected Ye He via B4 Relay
  2025-07-12  9:41 ` Paul Menzel
  2025-07-12 10:44 ` [bluez] " bluez.test.bot
@ 2025-07-15 14:50 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2025-07-15 14:50 UTC (permalink / raw)
  To: Ye He; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Sat, 12 Jul 2025 17:23:42 +0800 you wrote:
> From: Ye He <ye.he@amlogic.com>
> 
> 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 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.
> 
> [...]

Here is the summary with links:
  - [bluez] src/adapter: Fix RemoveDevice timeout when device already disconnected
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8c9977b02169

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-15 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-12  9:23 [PATCH bluez] src/adapter: Fix RemoveDevice timeout when device already disconnected Ye He via B4 Relay
2025-07-12  9:41 ` Paul Menzel
2025-07-12 10:44 ` [bluez] " bluez.test.bot
2025-07-15 14:50 ` [PATCH bluez] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox