Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] adapter: Trigger profile connection on inbound device connection
@ 2026-07-14  9:54 Chengyi Zhao
  2026-07-14 11:41 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 3+ messages in thread
From: Chengyi Zhao @ 2026-07-14  9:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Chengyi Zhao

When a bonded device initiates an inbound ACL connection before the
host sends an outbound one (e.g., after resume the remote wins the
race), BlueZ accepts the ACL link via connected_callback() but does
not establish AVDTP/AVCTP profiles. The remote's subsequent L2CAP
connect for PSM 25 fails with "security block" because the link is
not yet encrypted, and the kernel does not retry. The ACL link stays
up with no audio.

Fix: in connected_callback(), call btd_device_connect_services() for
bonded inbound devices. This initiates outbound profile connections
from the host side. Unlike inbound L2CAP, outbound L2CAP is queued
by the kernel until encryption completes, so it survives the race.
Safe when the host already won: the function returns -EBUSY if
dev->connect or dev->pending is set.
---
 src/adapter.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index 4ffa32a52..e6b5f297a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -9606,6 +9606,10 @@ static void connected_callback(uint16_t index, uint16_t length,
 		adapter_msd_notify(adapter, device, eir_data.msd_list);
 
 	eir_data_free(&eir_data);
+
+	/* Trigger profile connection for bonded inbound devices */
+	if (device_is_bonded(device, BDADDR_BREDR))
+		btd_device_connect_services(device, NULL);
 }
 
 static void controller_resume_notify(struct btd_adapter *adapter)
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH BlueZ] adapter: Trigger profile connection on inbound device connection
@ 2026-07-14  8:20 Chengyi Zhao
  2026-07-14 10:00 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 3+ messages in thread
From: Chengyi Zhao @ 2026-07-14  8:20 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Chengyi Zhao

When a bonded device initiates an inbound ACL connection before the
host sends an outbound one (e.g., after resume the remote wins the
race), BlueZ accepts the ACL link via connected_callback() but does
not establish AVDTP/AVCTP profiles. The remote's subsequent L2CAP
connect for PSM 25 fails with "security block" because the link is
not yet encrypted, and the kernel does not retry. The ACL link stays
up with no audio.

Fix: in connected_callback(), call btd_device_connect_services() for
bonded inbound devices. This initiates outbound profile connections
from the host side. Unlike inbound L2CAP, outbound L2CAP is queued
by the kernel until encryption completes, so it survives the race.
Safe when the host already won: the function returns -EBUSY if
dev->connect or dev->pending is set.
---
 src/adapter.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index 4ffa32a52..4f1bda4ab 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -9606,6 +9606,9 @@ static void connected_callback(uint16_t index, uint16_t length,
 		adapter_msd_notify(adapter, device, eir_data.msd_list);
 
 	eir_data_free(&eir_data);
+
+	if (device_is_bonded(device, BDADDR_BREDR))
+		btd_device_connect_services(device, NULL);
 }
 
 static void controller_resume_notify(struct btd_adapter *adapter)
-- 
2.50.1


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

end of thread, other threads:[~2026-07-14 11:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14  9:54 [PATCH BlueZ] adapter: Trigger profile connection on inbound device connection Chengyi Zhao
2026-07-14 11:41 ` [BlueZ] " bluez.test.bot
  -- strict thread matches above, loose matches on Subject: below --
2026-07-14  8:20 [PATCH BlueZ] " Chengyi Zhao
2026-07-14 10:00 ` [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