Bluetooth audio problems on M1 pro

I have bluetooth earbuds which work fine with my other laptop but on M1 pro they behave very inconsistently: when I pair them they always initially use the a2dp profile as expected. But when I turn them on later, they connect (I can see them connected in bluetoothctl) but sometime no audio profiles become available and at other times only Headset profile is available.

When they connect using a2dp I see the following messages from bluetoothctl

[EDIFIER X3s]# [NEW] Endpoint /org/bluez/hci0/dev_0C_AE_BD_89_10_DF/sep4 
[EDIFIER X3s]# [NEW] Endpoint /org/bluez/hci0/dev_0C_AE_BD_89_10_DF/sep2 
[EDIFIER X3s]# [NEW] Endpoint /org/bluez/hci0/dev_0C_AE_BD_89_10_DF/sep13 
[EDIFIER X3s]# [NEW] Endpoint /org/bluez/hci0/dev_0C_AE_BD_89_10_DF/sep12 
[EDIFIER X3s]# [NEW] Endpoint /org/bluez/hci0/dev_0C_AE_BD_89_10_DF/sep11 
[EDIFIER X3s]# [NEW] Player /org/bluez/hci0/dev_0C_AE_BD_89_10_DF/player0 [default]
[EDIFIER X3s]# [NEW] Transport /org/bluez/hci0/dev_0C_AE_BD_89_10_DF/fd0 

when they connect using headset profile the last two lines are missing and none of these lines appear when no profiles are available.

I have found this Bluetooth headset - ArchWiki and tried the suggestions there but they don’t help. Connecting manually using bluetoothctl does seem to help but I don’t know how to prevent autoconnect so hard to do.

After messing around with bluetoothctl, /etc/bluetooth/main.conf and var/lib/bluetooth it seems the only thing that can reliably connect with a2dp profile is removing the device and then pairing with it again.

The pattern seems to be

  1. Pair the earbuds and the a2dp profile will be used.
  2. Next couple of times they will connect quickly.
  3. A further couple of times they will take some time to connect but will eventually connect. From dbus the state shows up as connected but something is holding up completion of connection.
  4. Afterwards they stop connecting. From dbus I can see them initially connecting and then disconnecting. In the journal I see that,
profiles/audio/avdtp.c:cancel_request() Discover: Connection timed out (110)

so somehow it seems that with each connection, the time needed to connect starts becoming longer till eventually connection starts timing out. Very weird, I don’t know why that would be the case. Restarting bluetooth.service or even the laptop don’t seem to fix the issue.

  1. I can manually connect them but they with connect with HFP profile. Trying to connect audio_sink service manually results in br-connection-unknown errors.