UPDATE Aug 2017: The solution marked as accepted by me apppears to have worked until Ubuntu 15.10. For 16.04+ choose one of the more recent solutions.
For 16.04+ the config file is /etc/bluetooth/main.conf
NOT /etc/bluetooth/audio.conf .
I have a bluetooth speaker, Sony SRS-BTX300, which works in linux/ubuntu 13.04, but only after some fiddling. (Update Dec 2013: same problems remain in 13.10)
I have to set the preferred bandwidth mode to "High fidelity playback" (A2DP) each time after switching on the computer and reconnecting the speaker.
The mode resets itself to "telephony/duplex" (=low bandwidth) every time. It takes about 20 clicks to reset the speaker, (click through menu, disconnect, reconnects, select mode, test), and these are definitely too many clicks.
How can I make "A2DP" mode the default mode, an do so in a persistent manner?
A few screen shots will illustrate.
After choosing this menu by clicking on the bluetooth icon in the top panel in Unity...
After setting up this...
... the preferred mode will be reset to this after restarting/suspending the computer
There's an option in
/etc/bluetooth/audio.conf
called aAutoConnect=true
which is hashed out.Delete the "#" at the start of the AutoConnect=true line
I found enabling this option by removing the
#
and got things connecting properly with my bluetooth headsetRestart the bluetooth service for the change to take effect:
Add the following line to
/etc/bluetooth/audio.conf
:and then run this command:
Thread: (Natty) Connect only A2DP profile for bluetooth headset.
For those wondering, I found in Ubuntu 16.04 there is a slight difference to the answer:
And update the following line
to
Followed by
For me, this defaulted the audio profile to A2DP Sink when connecting a bluetooth audio device.
I'm using Gnome3 and after some time my headset no longer connected at A2DP again. I had to stop Gnome creating a pulseaudio daemon by creating the file
/var/lib/gdm3/.config/pulse/client.conf
(as root) and adding the following lines to it:Then set the owner to gdm:
Then log off/on or look for the pulseaudio process running as the
gdm
user withps aux | grep pulse
(Trimmed) output looks like:
Then kill the process with
kill <pid>
which for me was2943
Running
bluetoothctl
and connecting again, I could then runpacmd list-cards
and find my deviceindex: 2
and change to the a2dp_sink withpacmd set-card-profile 2 a2dp_sink
.Finally working again!
In order to auto switch audio into A2DP bluetooth device when connected in Ubuntu 14.04 I followed the instructions from https://sandalov.org/blog/2146/ and it worked perfectly.
Modify
/etc/pulse/default.pa
to automatically switch pulseaudio sink to Bluez:Modify
/etc/bluetooth/audio.conf
to auto select A2DP profile (instead of HSP/HFP):Apply changes:
More info at: https://wiki.archlinux.org/index.php/Bluetooth_headset
The real problem here is, that the default configuration allows only one profile per device. This can be changed by setting
MultiProfile
tosingle
ormultiple
in/etc/bluetooth/main.conf
. Restart the bluetooth daemon afterwards. You will then be able to change the profile on the fly.