A2DP

From Openmoko

Revision as of 19:45, 9 February 2009 by SimonKagstrom (Talk | contribs)

Jump to: navigation, search

The A2DP bluetooth profile allows high quality audio to be transferred from the phone.

This page describes how to setup A2DP on the Freerunner.

Contents

How to setup A2DP manually

This information is mostly taken from this mail thread. It has been tested on FDOM, but should also work on 2009.12. I have not been able to get it working with FSO milestone 5.

1. Check installed packages

First check that you have the correct package versions installed with grep blue. The versions should be these:

bluez-audio - 3.33-r3
bluez-utils - 3.33-r3
bluez-utils-alsa - 3.33-r3
bluez-utils-compat - 3.33-r3
libbluetooth2 - 3.33-r0

2. Add bluetooth device to /etc/asound.conf

Your /etc/asound.conf should contain these:

pcm.!default {
   type plug
   slave.pcm "dmix"
}
ctl.mixer0 {
   type hw
   card 0
}
pcm.bluetooth {
       type bluetooth
       device "XX:XX:XX:XX:XX:XX"
       profile "auto"
}

XX:XX:XX should be replaced with your device ID.

3. Connect to the device

Turn on bluetooth in the GUI and then do

export DEVICE=XX:XX:XX:XX:XX:XX

/etc/init.d/bluetooth stop
/etc/init.d/bluetooth start

passkey-agent --default 0000 &

dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.CreateBonding string:$DEVICE

dbus-send --system --print-reply --dest=org.bluez /org/bluez org.bluez.Manager.ActivateService string:audio

dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/audio org.bluez.audio.Manager.CreateDevice string:$DEVICE

dbus-send --system --type=method_call --print-reply --dest=org.bluez "/org/bluez/audio/device0" org.bluez.audio.Sink.Connect

If the last step fails, see to it that the device returned in the step before is device0 - otherwise use the other number.

4. Start playing

To play a file with mplayer use the following command:

mplayer -ao alsa:device=bluetooth /path/to/file.ogg

Potential troubles

  • If you experience problems with choppiness, try changing your hcid.conf to include "lm accept,master;" and "lp hold,sniff,park;" You may also have to bond (commonly known as 'pairing') your phone and your headset. See http://wiki.bluez.org/wiki/HOWTO/Bonding for details. Mercury 17:36, 5 September 2008 (UTC)
Personal tools

The A2DP bluetooth profile allows high quality audio to be transferred from the phone.

This page describes how to setup A2DP on the Freerunner.

How to setup A2DP manually

This information is mostly taken from this mail thread. It has been tested on FDOM, but should also work on 2009.12. I have not been able to get it working with FSO milestone 5.

1. Check installed packages

First check that you have the correct package versions installed with grep blue. The versions should be these:

bluez-audio - 3.33-r3
bluez-utils - 3.33-r3
bluez-utils-alsa - 3.33-r3
bluez-utils-compat - 3.33-r3
libbluetooth2 - 3.33-r0

2. Add bluetooth device to /etc/asound.conf

Your /etc/asound.conf should contain these:

pcm.!default {
   type plug
   slave.pcm "dmix"
}
ctl.mixer0 {
   type hw
   card 0
}
pcm.bluetooth {
       type bluetooth
       device "XX:XX:XX:XX:XX:XX"
       profile "auto"
}

XX:XX:XX should be replaced with your device ID.

3. Connect to the device

Turn on bluetooth in the GUI and then do

export DEVICE=XX:XX:XX:XX:XX:XX

/etc/init.d/bluetooth stop
/etc/init.d/bluetooth start

passkey-agent --default 0000 &

dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.CreateBonding string:$DEVICE

dbus-send --system --print-reply --dest=org.bluez /org/bluez org.bluez.Manager.ActivateService string:audio

dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/audio org.bluez.audio.Manager.CreateDevice string:$DEVICE

dbus-send --system --type=method_call --print-reply --dest=org.bluez "/org/bluez/audio/device0" org.bluez.audio.Sink.Connect

If the last step fails, see to it that the device returned in the step before is device0 - otherwise use the other number.

4. Start playing

To play a file with mplayer use the following command:

mplayer -ao alsa:device=bluetooth /path/to/file.ogg

Potential troubles

  • If you experience problems with choppiness, try changing your hcid.conf to include "lm accept,master;" and "lp hold,sniff,park;" You may also have to bond (commonly known as 'pairing') your phone and your headset. See http://wiki.bluez.org/wiki/HOWTO/Bonding for details. Mercury 17:36, 5 September 2008 (UTC)