Bluetooth headset

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Created (this does not work yet))
 
(Fixed. Now works.)
Line 1: Line 1:
== Edit /etc/bluetooth/audio.conf ===
+
This is mostly based on [[Neo 1973 audio subsystem]] and [http://lists.openmoko.org/pipermail/openmoko-kernel/2009-February/009019.html this thread on the kernel mailing list].
 +
 
 +
== Preparing ==
 +
 
 +
=== Get the bluetooth alsa state and DAC setup script ===
 +
Download [http://www.robsims.com/GSMBLUETOOTH.txt GSMBLUETOOTH.txt] and [http://handheldshell.com/bluetooth_pcm bluetooth_pcm]
 +
 
 +
=== Edit /etc/bluetooth/audio.conf ===
  
 
  # Configuration file for the audio service
 
  # Configuration file for the audio service
Line 26: Line 33:
 
  #[A2DP]
 
  #[A2DP]
 
  #SourceCount=2
 
  #SourceCount=2
 +
 +
The important part is the SCORouting.
  
 
== Connect and setup the headset ==
 
== Connect and setup the headset ==
Line 47: Line 56:
 
  dbus-send --system --type=method_call --print-reply --dest=org.bluez \
 
  dbus-send --system --type=method_call --print-reply --dest=org.bluez \
 
   "/org/bluez/audio/device0" org.bluez.audio.Headset.Play
 
   "/org/bluez/audio/device0" org.bluez.audio.Headset.Play
 +
 +
== During the call ==
 +
After having answered / placed the call, switch the audio to the bluetooth headset. You need a small workaround to get audio in, which is included below.
 +
 +
alsactl -f GSMBLUETOOTH.txt restore
 +
./bluetooth_pcm &
 +
 +
the workaround is to switch '''Capture Left Mixer''' first to '''Analogue Mix Right''' and then back to '''Analogue Mix Right'''. This can be done with alsamixer:
 +
 +
alsamixer
 +
 +
(lookup '''Capture Left Mixer''' in the "gui" and toggle the value).

Revision as of 20:59, 26 February 2009

This is mostly based on Neo 1973 audio subsystem and this thread on the kernel mailing list.

Contents

Preparing

Get the bluetooth alsa state and DAC setup script

Download GSMBLUETOOTH.txt and bluetooth_pcm

Edit /etc/bluetooth/audio.conf

# Configuration file for the audio service

# This section contains options which are not specific to any
# particular interface
[General]

# If we want to disable support for specific services
# Defaults to supporting all implemented services
#Disable=Control,Source

# SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
# Defaults to HCI
SCORouting=PCM

# Headset interface specific options (i.e. options which affect how the audio
# service interacts with remote headset devices)
[Headset]

# Set to true to only support HSP
# Defaults to false
DisableHFP=false

# Just an example of potential config options for the other interfaces
#[A2DP]
#SourceCount=2

The important part is the SCORouting.

Connect and setup the headset

export DEVICE=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 --type=method_call --print-reply --dest=org.bluez \
 /org/bluez/audio org.bluez.audio.Manager.CreateHeadset string:$DEVICE

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

dbus-send --system --type=method_call --print-reply --dest=org.bluez \
 "/org/bluez/audio/device0" org.bluez.audio.Headset.Play

During the call

After having answered / placed the call, switch the audio to the bluetooth headset. You need a small workaround to get audio in, which is included below.

alsactl -f GSMBLUETOOTH.txt restore
./bluetooth_pcm &

the workaround is to switch Capture Left Mixer first to Analogue Mix Right and then back to Analogue Mix Right. This can be done with alsamixer:

alsamixer

(lookup Capture Left Mixer in the "gui" and toggle the value).

Personal tools

This is mostly based on Neo 1973 audio subsystem and this thread on the kernel mailing list.

Preparing

Get the bluetooth alsa state and DAC setup script

Download GSMBLUETOOTH.txt and bluetooth_pcm

Edit /etc/bluetooth/audio.conf

# Configuration file for the audio service

# This section contains options which are not specific to any
# particular interface
[General]

# If we want to disable support for specific services
# Defaults to supporting all implemented services
#Disable=Control,Source

# SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
# Defaults to HCI
SCORouting=PCM

# Headset interface specific options (i.e. options which affect how the audio
# service interacts with remote headset devices)
[Headset]

# Set to true to only support HSP
# Defaults to false
DisableHFP=false

# Just an example of potential config options for the other interfaces
#[A2DP]
#SourceCount=2

The important part is the SCORouting.

Connect and setup the headset

export DEVICE=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 --type=method_call --print-reply --dest=org.bluez \
 /org/bluez/audio org.bluez.audio.Manager.CreateHeadset string:$DEVICE

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

dbus-send --system --type=method_call --print-reply --dest=org.bluez \
 "/org/bluez/audio/device0" org.bluez.audio.Headset.Play

During the call

After having answered / placed the call, switch the audio to the bluetooth headset. You need a small workaround to get audio in, which is included below.

alsactl -f GSMBLUETOOTH.txt restore
./bluetooth_pcm &

the workaround is to switch Capture Left Mixer first to Analogue Mix Right and then back to Analogue Mix Right. This can be done with alsamixer:

alsamixer

(lookup Capture Left Mixer in the "gui" and toggle the value).