Wednesday 7 March 2012

Call for testing: BlueZ A2DP and HSP/HFP profiles

We just landed bluez 4.98-2ubuntu2 in Precise. The key change was to enable the Source and Gateway profiles by default, which will now allow people to use their system as an audio output device. It works great on Android, but any help in testing this on a bunch of different devices (especially on iPhone) would be much appreciated!

The Source profile is what enables the A2DP bluetooth profile. With it, you can use your system as a stereo audio output device: in other words, you can send output audio from an external device such as a phone or a tablet to your computer (though this will require a bit of work on the PulseAudio side to get the audio stream to go through the right devices).

There's the AskUbuntu question "Can I use my computer as an A2DP receiver?" that describes the steps to use this right now. Thanks to Steve Langasek for figuring out the details. I've also written a draft script that implements the suggested steps and makes it simple:

#!/bin/sh

BTSOURCE=`pactl list short sources | grep bluez_source | awk '{print $2;}'`
SINK=`pactl list short sinks | grep -v Monitor | grep alsa_output.pci | awk '{ print $2; }'`

case $1 in
enable)
 pactl load-module module-loopback source=$BTSOURCE sink=$SINK
 ;;
disable)
 pactl unload-module $(pactl list short modules | grep loopback | grep $BTSOURCE | cut -f 1) || true
 ;;
esac 

That script is meant to be called as '"whatever_you_named_it" enable'. Don't forget the "enable" part, or "disable" to turn off the streams, otherwise it won't work.

The Gateway profile enables the HSP/HFP bluetooth profiles. This means we're getting closer to supporting phone calls from a bluetooth-connected phone on a Ubuntu computer. There's already some amounts of support for this via Ofono and the telepathy-ring project, although there is some extra work needed -- hopefully we can fix this by the Precise release. :D