Nov 6, 2016 - Bluetooth Headset and Pulseadio

Comments

Bluetooth headset and pulseaudio

Ok, so this Sunday I had a problem. I was going to make some cake and while I was baking, I wanted to listen to some music via my wireless headset. But turns out, I never did the set up with my new laptop. So before I need to surf the web for this topic again, I write the steps down this time. :)

Setup the basics

Ok, so first of all you need to install the bluetooth libraries bluez and bluez-utils. This is done with pacman via

sudo pacman -Suy bluez bluez-utils

After that, the btusb module must be loaded into the kernel by:

modprobe btusb

Last but not least the bluetooth service must be loaded. So lets do that via:

sudo systemctl start bluetooth

If yoeveningke to permanently enable the service you can do this with systemctl enable

sudo systemctl enable bluetooth

Next lets actually talk to the bluetooth headset.

Bluetooth Connection

For the connection to the headset we use the tool bluetoothctl. As this is an interactive tool, start it up via:

bluetoothctl

Within this tool we are able to communicate with the bluetooth stack. So first of all, lets power on the bluetooth stack:

power on

After that, we need to turn the bluetooth agent on. The agent allows us to handle the pairing of devices. For this purpose a default agent is sufficient, so we set this parameter.

agent on
default-agent

Now bring your headset into discoverable mode and then start scanning for that device by:

scan on

You should see some output like this:

[NEW] Device 00:11:22:33:44:55 Philips SHB7000

With this information you are now able to pair with that device by:

pair 00:11:22:33:44:55

And after a successful pairing one is able to connect to that device:

connect 00:11:22:33:44:55

Once the connection is established, we can clean up and end bluetoothctl:

scan off
exit

We have now a connection to the bluetooth headset and are able to stream audio to that device.

A2DP

My headset supports the A2DP profile and therefore is able to playback my music with a much higher quality. But I must switch my bluetooth card into a a2dp sink. This is done by this simple command.

pacmd set-card-profile 2 a2dp_sink

After that switch, I'm now able to listen to my music in great quality, cordless and could now concentrate on baking that fine cake :)

Have a nice day