Bluetooth headphones initialize with Audio Profile = Off upon connection, possibly because of "Profile a2dp_sink has no transport" problem

This is a fully updated Ubuntu 18.04 with blueman. Whenever I connect a paired headset, the connection goes through reliably, except the Audio Profile is initialized to Off. Which means no sound is outputted by the headphones, until I manually set the Audio Profile to High Fidelity Playback (A2DP Sink) in the blueman-manager gui, after which the headphones work perfectly.

Is there a way to automatically switch Audio Profile to High Fidelity Playback (A2DP Sink) upon connection?

I suspect this might be the default mode of operation, and its failure may have to do with the following warning pulseaudio outputs when I connect the headphone:

W: [pulseaudio] module-bluez5-device.c: Profile a2dp_sink has no transport

Just as a reminder: when I manually switch after I connect and see this warning, sound output works perfectly and I no longer see any warnings.

I can also set audio profile from the command line:

pacmd set-card-profile 2 a2dp_sink

This achieves the same result as switching the profile from the blueman-manager gui: the headphones then work well.


Solution 1:

This seems to be one of the numerous errors that are never fixed (keeping all non nerd users from using Ubuntu)

I wrote a little script for that and created a desktop symbol for it, so I don't need to fiddle with the bluetooth settings ten times a day. This only works if you have exactly one device attached.

# Find the index no. of the bluetooth device
bt_dev_index=`pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}'`
echo -e index = $bt_dev_index\\n
# Set desired bluetooth audio profile for the found index.
pacmd set-card-profile $bt_dev_index a2dp_sink