-
Add
Enable=Sourceto /etc/bluetooth/audio.conf right after[General]. -
Find address in form XX:XX:XX:XX:XX:XX of phone with
hcitool scan. -
Pair and trust smartphone with
sudo bluez-simple-agent hci0 XX:XX:XX:XX:XX:XXandsudo bluez-test-device trusted XX:XX:XX:XX:XX:XX yes. -
Create loopback in pulseaudio connection bluetooth a2dp source with alsa sink:
pactl load-module module-loopback \ source=bluez_source.XX_XX_XX_XX_XX_XX \ sink=alsa_output.pci-0000_00_1b.0.analog-stereo
You can find your own values for source and sink with pacmd list-sources and pacmd list-sinks.
@domenpuncer I've modified your python script to remove the loopback module when the device disconnects. If the module is kept loaded, it can cause some nasty feedback.
Gist is here: https://gist.github.com/dghodgson/8406352
Unfortunately I'm not very familiar with python, or dbus's python interface, so my solution is a bit of a hack. It just checks for a dbus message which consistently pops up when the device connects, and runs a shell command that removes all loopback modules for that device. Kind of ugly, but it seems to work reliably for me.