Skip to content

Instantly share code, notes, and snippets.

@AndreaGhizzoni
Last active March 4, 2018 10:58
Show Gist options
  • Save AndreaGhizzoni/bbd38dc8346da03b00af73f31524ccf3 to your computer and use it in GitHub Desktop.
Save AndreaGhizzoni/bbd38dc8346da03b00af73f31524ccf3 to your computer and use it in GitHub Desktop.
ubuntu_audio_bluetooth_dondle.md

Ubuntu audio via bluetooth dongle

1. Dependency

sudo apt-get install pulseaudio-module-bluetooth

and start the bluetooth daemon

sudo service bluetooth start

2. Configuration

Then from this edit etc/pulse/default.pa and comment out (with an # at the beginning of the line) the following line:

[...]
#load-module module-bluetooth-discover
[...]

Then edit /usr/bin/start-pulseaudio-x11 and after the following line:

if [ x”$SESSION_MANAGER” != x ] ; then
    /usr/bin/pactl load-module module-x11-xsmp “display=$DISPLAY ession_manager=$SESSION_MANAGER” > /dev/null
fi

add this line:

/usr/bin/pactl load-module module-bluetooth-discover

This way the Pulse audio’s Bluetooth modules will not be downloaded at boot time but after x11 is started.

From this source now edit /etc/bluetooth/audio.conf (create it if not present):

[General]
Enable=Source,Sink,Media,Socket

Make sure that in /etc/bluetooth/main.conf there are the following line:

[Policy]
AutoEnable=true

because otherwise your Bluetooth adapter will not power on after a reboot.

Then restart pulseaudio

sudo killall pulseaudio
pulseaudio --start

Then shutdown -r now.

3. Using bluetoothctl

Source. Plug the dongle and run bluetoothctl, then:

[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# default-agent

Then start scanning with

[bluetooth]# scan on

Now make sure that your headset is in pairing mode. It should be discovered shortly. For example,

[NEW] Device 00:1D:43:6D:03:26 Lasmex LBT10

shows a device that calls itself "Lasmex LBT10" and has MAC address 00:1D:43:6D:03:26. We will now use that MAC address to initiate the pairing:

bluetooth]# pair 00:1D:43:6D:03:26

After pairing, you also need to explicitly connect the device (every time?):

bluetooth]# connect 00:1D:43:6D:03:26

If everything works correctly, you now have a separate output device in pavucontrol.

NOTE: Once connected, remember to set High Fidelity Playback (A2DP Sink) in pavucontrol > Configuration.

To remove a device

bluetooth]# remove aa:bb:cc:dd:ee:ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment