Pulseaudio don't show bluetooth headset when turned on the first time

Hello,

I have a boring issue. When I turn on my headset (tested with multiple bluetooth headset), it connect to the computer but pulse don’t see it, I can see it in the gnome menu
Capture d’écran du 2024-02-07 20-00-36
but its not in pulse (here in pavucontrol)


and of course audio is on the computer speaker and can’t select the headset in the gnome menu.

But when I disconnect and reconnect (in the gnome menu, I do not turn off the headset). its detected in pulse and I can’t switch to them (in fact it does it automatically).

Here the dmesg on the first connect

[ 7févr. 19:40] hid-sensor-hub 0005:00E0:3004.000C: unknown main item tag 0x0
[  +0,000063] hid-sensor-hub 0005:00E0:3004.000C: hidraw3: BLUETOOTH HID v0.01 Device [Pixel Buds Pro] on bc:f4:d4:d3:48:7a
[  +0,179208] input: Pixel Buds Pro (AVRCP) as /devices/virtual/input/input33
[ 7févr. 19:50] nvidia 0000:01:00.0: Enabling HDA controller
[ 7févr. 19:51] input: Pixel Buds Pro (AVRCP) as /devices/virtual/input/input34
[ 7févr. 19:59] input: Pixel Buds Pro (AVRCP) as /devices/virtual/input/input35

and the second time

[ 7févr. 20:04] input: Pixel Buds Pro (AVRCP) as /devices/virtual/input/input36
[  +1,160727] hid-sensor-hub 0005:00E0:3004.000D: unknown main item tag 0x0
[  +0,000072] hid-sensor-hub 0005:00E0:3004.000D: hidraw3: BLUETOOTH HID v0.01 Device [Pixel Buds Pro] on bc:f4:d4:d3:48:7a

If you have an idea

Please post more information about PulseAudio configuration for both non-working and working headset

pacmd dump; pactl list cards

and compare both responses to find any differences in configuration

Here the diff for the pacmd pacmd dump before and after - Diffchecker
and the diff for pactl : pactl list card before and after - Diffchecker

We can see tha card some différence and it seem that its not detected correctly the first time but why and how to solve or investigate ?

module-bluez5-device is loading with the same configuration in both cases. the modules are not loaded in the same order with respect to module-cli-protocol-unix but that shouldn’t be any problem

But the first (non-working) configuration is showing the card-profile is set to off
for the working configuration the card-profile is set to a2dp_sink

To change the card profile:

pactl set-card-profile bluez_card.74_74_46_1E_D5_C9 a2dp_sink

Or change the card Profile in pavucontrol GUI Configuration tab - pavucontrol --tab=5

The card profile can be locked in pavucontrol GUI by clicking on the padlock icon. But locking the Profile for a Bluetooth headset would prevent device switching from headphone mode to headset mode for voice calls automatically

Just an Idea: Have you considered switching from Pulseaudio to Pipewire?
I recently had some issues with my Bluetooth headset as well (laggy behaviour / multiple connects required / bluez & pulseaudio not working fine with each other).
I followed this entry and my bluetooth headset worked fine afterwards, same as the rest of the audio & bluetooth components.

in terms of required setup, that was all I had to do, same as others:

I do not use wayland for now (hybrid graphic card, some issue when switching to nvidia), so I can’t switch to pipewire (as far as I know).

I just tested your command @nikgnomic , pactl give me an input/output error (buds first time turn on) and pavucontrol show me a menu item list for it and the a2dp is marked as not available and I can’t select it (can only select turned off or HFP).

ArchWiki has a few possible solutions for A2DP not working with PulseAudio

For some headsets, using the headset’s volume or play/pause controls while connected can trigger the A2DP profile to become available.

try restarting the bluetooth.service

systemctl restart bluetooth

It is possible that connecting to a headset via bluetoothctl from bluez-utils will make the A2DP sink profile available

pactl set-card-profile bluez_card.74_74_46_1E_D5_C9 off
sleep 2
echo -e "disconnect 74_74_46_1E_D5_C9\n quit"|bluetoothctl
sleep 5
echo -e "connect 74_74_46_1E_D5_C9\n quit"|bluetoothctl
sleep 5
pactl set-card-profile  bluez_card.74_74_46_1E_D5_C9 a2dp_sink

Disable the headset profile

/etc/bluetooth/main.conf

[General]
Disable=Headset

Enable MultiProfile support. This may help with headsets that support A2DP as well as Headset audio.

/etc/bluetooth/main.conf

[General] MultiProfile=multiple

okay , I tried restarting bluetooth service, no result,
I can’t set card profile to a2dp_sink manually when its not already auto selected (the first time I turn them on).
Disabling the headset didn’t do anything either.
and multipleprofile neither, since the issue is not a issue between a2dp and headset (don’t seem so).

Looking more carefully, I saw that when I first turn them on, it pass on a2dp for 10 seconds ~ (show well on pavucontrol) then it fallback to off.
dmesg show simply a new attribution

[  +0,141422] input: Pixel Buds Pro (AVRCP) as /devices/virtual/input/input30

[ +13,300022] input: Pixel Buds Pro (AVRCP) as /devices/virtual/input/input31

Do you know where I could see bluetooth log to debug that ?