Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] bearer: Fix LE Disconnect for devices with a random address
@ 2026-11-13  4:27 Kevin Dewald
  2026-11-13 10:57 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Dewald @ 2026-11-13  4:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Luiz Augusto von Dentz, Kevin Dewald

Disconnect passes bearer->type to btd_adapter_disconnect_device(), and
the LE bearer is always created with BDADDR_LE_PUBLIC. The kernel looks
up LE links by address type, so for a device with a random address it
finds no link and bluetoothd logs "Disconnecting failed: already
disconnected". The link stays up, and the Disconnect call is not
answered until the link drops some other way.

Use the address type of the device for LE, as Device1.Disconnect does.

Fixes: 4e21ebcaa5d0 ("bearer: Implement Connect/Disconnect methods")
Assisted-by: Claude:claude-opus-5.5
---
Tested on an RTL8761BU connected to an nRF52840 with a static random
address. Without the fix, Bearer.LE1.Disconnect got no reply within 10
seconds and left the link up, 3 times out of 3. With it, the call
replied after 2.3 to 2.8 seconds and the link went down. The functional
tests use public addresses, so they don't hit this.

 src/bearer.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/bearer.c b/src/bearer.c
index ebcdc2b4c..e5fc2ee3a 100644
--- a/src/bearer.c
+++ b/src/bearer.c
@@ -109,13 +109,17 @@ static bool bearer_disconnect_link(gpointer user_data)
 {
 	struct btd_bearer *bearer = user_data;
 	struct btd_device *device = bearer->device;
+	uint8_t type = bearer->type;
 
 	bearer->disconn_timer = 0;
 
-	if (btd_device_bdaddr_type_connected(device, bearer->type))
+	if (type != BDADDR_BREDR)
+		type = device_get_le_address_type(device);
+
+	if (btd_device_bdaddr_type_connected(device, type))
 		btd_adapter_disconnect_device(device_get_adapter(device),
 						device_get_address(device),
-						bearer->type);
+						type);
 	return FALSE;
 }
 

base-commit: 20ffd285b58facfd1f2478d159a5f941b09d5be1
-- 
2.54.0 (Apple Git-157)


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

* RE: [BlueZ] bearer: Fix LE Disconnect for devices with a random address
  2026-11-13  4:27 [PATCH BlueZ] bearer: Fix LE Disconnect for devices with a random address Kevin Dewald
@ 2026-11-13 10:57 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-11-13 10:57 UTC (permalink / raw)
  To: linux-bluetooth, kevin

[-- Attachment #1: Type: text/plain, Size: 858 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/series/1210153/

---Test result---

Test Summary:
CheckPatch                    PASS      0.47 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      19.02 seconds
BluezMake                     PASS      289.71 seconds
CheckSmatch                   PASS      293.34 seconds
bluezmakeextell               PASS      98.48 seconds
TestFunctional                PASS      1136.16 seconds
IncrementalBuild              PASS      286.75 seconds
ScanBuild                     PASS      1103.98 seconds



https://github.com/bluez/bluez/pull/2819

---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2026-11-13 10:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13  4:27 [PATCH BlueZ] bearer: Fix LE Disconnect for devices with a random address Kevin Dewald
2026-11-13 10:57 ` [BlueZ] " bluez.test.bot

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