Last tested on bluez 5.15
A few notes on how to setting up an audio connection between a smartphone and a PC running Linux. Skifta is useful just for mp3's but I need to run iReal jazz backing tracks through my PC's speaker system for keyboard improvisation practice for which bluetooth is required.
I am using Gentoo but these notes should be applicable to other distributions.
The key software to install is bluez version 5 and Pulseaudio (the latest at the time of writing is 4.99.4). Pavucontrol (Pulseaudio volume control should also be installed). Kernel options to enable are described here.
Hardware I am using is the Atheros Communications AR3011 bluetooth dongle (badged as Trust and bought from Ebuyer). The phone is HTC One V.
Blueman currently doesn't work with bluez 5 so is no use for this purpose. Bluedevil (a KDE dongle) does work. I haven't tested Bluetooth using the Gnome control center.
In my experience it is much easier to use the bluetoothctl interactive command line utility than it is to use GUI programs like Blueman and Bluedevil. If the connection fails the GUI programs don't give very helpful output.
Connection attempts may appear to "hang" and it's not clear why. The Arch wiki is a useful guide to bluetoothctl but there doesn't seem to be a great deal of documentation available apart from this.
The bluetooth daemon (service) has to be running either through /etc/init.d/bluetooth start or through systemd (where the command is systemctl start bluetooth).
There are some forum posts about configuration of /etc/bluetooth/audio.conf, for instance whether Disable=Socket is necessary. Unless specific bluetooth services are to be disabled, none of these service should be specifically enabled or disabled. Every service that is implemented on your system with then be available.
There are two main stages to the bluetooth audio setup: pairing and connecting.
Bluetooth obviously must be enabled on the phone, discoverable to all nearby devices and within range of the dongle.
Enter bluetoothctl which will give you the bluetoothctl command line:
[bluetooth]#
Subsequent commands below are all within the bluetoothctl utility.
Power on the controller. if you don't do this, neither the controller (dongle) or the phone may be picked up:
[bluetooth]#power on
Make the dongle discoverable:
[bluetooth]# discoverable on
Another useful command if the phone isn't showing (e.g. when you enter the devices command) is:
[bluetooth]# scan on
Use the devices command to check what devices have been picked up. This should return a MAC (hardware) address which looks like this:
[bluetooth]# Device E6:48:C2:AB:91:32 my_smartphone
Use the info command to check what bluetooth services are available, e.g.
[bluetooth]# info E6:48:C2:AB:91:32
Before trying to pair the dongle and the smartphone make sure you register the agent:
[bluetooth]# agent on
There are other options for this command, but this is sufficient to ensure the dongle and smartphone are ready to be paired. If this command isn't used, a pairing prompt appears on the phone but without a passkey. Although this prompt can be accepted, the phone and teh dongle won't be paired.
Use show command to check the controller is pairable and likewise the device command for the phone. If both are shown as pairable, enter the pair command with the phone's MAC address e.g.:
[bluetooth]# pair E6:48:C2:AB:91:32
You are returned to the bluetoothctl prompt. Wait until bluetoothctl confirms the pairing is successful.
Now run up pavucontrol (pulseaudio volume control). Select the "Playback" tab and then select "All streams" from the picklist at the bottom of the screen. pavucontrol helps you monitor whether a successful audio connection has been made using the A2DP protocol.
Next try to connect the phone to the dongle, e.g.
[bluetooth]# connect E6:48:C2:AB:91:32
bluetoothctl should indicate if the connection is successful. If so you should also see the phone shown as a "loopback" device in pavucontrol.
At this point, I sometimes find that the phone appears to be connected as an audio source but there is no sound. The only workaround for this issue appears to be to using the bluetoothctl disconnect command followed by connect.