public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH BlueZ 0/1] device: Fix rare ERR_BREDR_CONN_BUSY during connect
@ 2025-04-14 11:50 Oleg Lyovin
  2025-04-14 11:50 ` [PATCH BlueZ 1/1] " Oleg Lyovin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Oleg Lyovin @ 2025-04-14 11:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Oleg Lyovin

Hello everyone,

While experimenting with a device acting as and A2DP Source, I have
encountered the following very rare case during connection to an
external speaker:

  1970-01-01 00:37:47 debug bluetoothd[240]: profiles/audio/sink.c:sink_set_state() State changed /org/bluez/hci0/dev_28_2B_B9_40_00_1B: SINK_STATE_CONNECTING -> SINK_STATE_DISCONNECTED
  1970-01-01 00:37:47 debug bluetoothd[240]: profiles/audio/avdtp.c:avdtp_unref() 0x17c1350: ref=1
  1970-01-01 00:37:47 debug bluetoothd[240]: profiles/audio/a2dp.c:channel_remove() chan 0x17ac468
  1970-01-01 00:37:47 debug bluetoothd[240]: profiles/audio/avdtp.c:avdtp_unref() 0x17c1350: ref=0
  1970-01-01 00:37:47 debug bluetoothd[240]: profiles/audio/avdtp.c:avdtp_free() 0x17c1350
  1970-01-01 00:37:50 debug bluetoothd[240]: src/shared/mgmt.c:can_read_data() [0x0000] event 0x000c
  1970-01-01 00:37:50 debug bluetoothd[240]: src/adapter.c:dev_disconnected() Device 28:2B:B9:40:00:1B disconnected, reason 2
  1970-01-01 00:37:50 debug bluetoothd[240]: src/adapter.c:adapter_remove_connection() 
  1970-01-01 00:37:50 debug bluetoothd[240]: src/device.c:device_remove_connection() connection removed while Connect() is waiting reply
  1970-01-01 00:37:50 debug bluetoothd[240]: plugins/policy.c:disconnect_cb() reason 2
  1970-01-01 00:37:50 debug bluetoothd[240]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 28:2B:B9:40:00:1B type 0 status 0xe
  1970-01-01 00:37:50 debug bluetoothd[240]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
  1970-01-01 00:37:50 debug bluetoothd[240]: src/device.c:device_bonding_failed() status 14

Subsequent attempts to connect using bluetoothctl lead to
"br-connection-busy":
  [bluetooth]# connect 28:2B:B9:40:00:1B
  Attempting to connect to 28:2B:B9:40:00:1B
  Failed to connect: org.bluez.Error.InProgress br-connection-busy

The reason is that "connect_profiles" does the following check:
  if (dev->pending || dev->connect || dev->browse)
    return btd_error_in_progress_str(msg, ERR_BREDR_CONN_BUSY);

In the above scenario, "dev->pending" is not NULL. I have prepared
the RFC patch that frees it when a disconnect occurs in the
"device_remove_connection" code path. I'm not sure if this is the
correct way to solve the issue, but with this patch it can no longer
be reproduced.

Oleg Lyovin (1):
  device: Fix rare ERR_BREDR_CONN_BUSY during connect

 src/device.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.34.1


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

end of thread, other threads:[~2025-06-02  7:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 11:50 [RFC PATCH BlueZ 0/1] device: Fix rare ERR_BREDR_CONN_BUSY during connect Oleg Lyovin
2025-04-14 11:50 ` [PATCH BlueZ 1/1] " Oleg Lyovin
2025-04-14 13:50   ` bluez.test.bot
2025-04-24 17:04   ` bluez.test.bot
2025-05-16  6:08 ` [RFC PATCH BlueZ 0/1] " Oleg Lyovin
2025-06-02  7:15 ` Oleg Lyovin

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