User talk:Gabrys

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Step three: load ALSA settings to switch codec "mode" to GSM BT)
Line 9: Line 9:
 
Set /etc/bluetooth/audio.conf like this:
 
Set /etc/bluetooth/audio.conf like this:
  
  # SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)   
+
# SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)   
  # Defaults to HCI                                                               
+
# Defaults to HCI                                                               
  SCORouting=PCM                                                                   
+
SCORouting=PCM                                                                   
  
 
Then
 
Then
  
  echo 1 > /sys/bus/platform/devices/neo1973-pm-bt.0/power_on
+
echo 1 > /sys/bus/platform/devices/neo1973-pm-bt.0/power_on
  hciconfig hci0 up
+
hciconfig hci0 up
  bluetoothd
+
bluetoothd
  
 
then use simple-agent from here: http://wiki.openmoko.org/wiki/Manually_using_Bluetooth#Pair to pair the device.
 
then use simple-agent from here: http://wiki.openmoko.org/wiki/Manually_using_Bluetooth#Pair to pair the device.
Line 23: Line 23:
 
Test: "hcitool con" should say:
 
Test: "hcitool con" should say:
  
  Connection
+
Connection
 
       ACL 00:13:17:78:7B:A3 handle 0 state 5 lm MASTER
 
       ACL 00:13:17:78:7B:A3 handle 0 state 5 lm MASTER
  

Revision as of 21:15, 6 April 2010

Contents

Testing GSM <-> BT

Basics: We need to tell audio codec to route sound from GSM chip to BT chip. Codec is controlled by ALSA and mixer settings.

Prerequisites: BT device must be paired before the operation.

Step one: powering on bluetooth, setting up bluetoothd, pairing

Set /etc/bluetooth/audio.conf like this:

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

Then

echo 1 > /sys/bus/platform/devices/neo1973-pm-bt.0/power_on
hciconfig hci0 up
bluetoothd

then use simple-agent from here: http://wiki.openmoko.org/wiki/Manually_using_Bluetooth#Pair to pair the device.

Test: "hcitool con" should say:

Connection
     ACL 00:13:17:78:7B:A3 handle 0 state 5 lm MASTER

Step two: make a call

Call to the phone and answer (or place a call, whichever is cheaper).

Step three: load ALSA settings to switch codec "mode" to GSM <=> BT

Wait till frameworkd sets its statefile and then overwrite it with your own:

alsactl restore < /path/to/the/statefile

(Find working statefile first)

Then due to kernel bug, do:

amixer sset "Capture Left Mixer" "Analogue Mix Right"
amixer sset "Capture Left Mixer" "Analogue Mix Left"

Then issue dbus call (check what it is exactly) this starts exchanging audio between GSM and BT (hopefully):

org.bluez.Headset Play()

We would also need to set bluetooth IIS to 8000 rate:

import alsaaudio

pcm_play = alsaaudio.PCM( alsaaudio.PCM_PLAYBACK, alsaaudio.PCM_NONBLOCK, "hw:0,1" )
pcm_play.setchannels(1)
pcm_play.setrate(8000)
pcm_play.setformat(alsaaudio.PCM_FORMAT_S16_LE)
pcm_play.setperiodsize(500000)

pcm_cap = alsaaudio.PCM( alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NONBLOCK, "hw:0,1" )
pcm_cap.setchannels(1)
pcm_cap.setrate(8000)
pcm_cap.setformat(alsaaudio.PCM_FORMAT_S16_LE)
pcm_cap.setperiodsize(500000)

We should hear something in the BT headset and not in phone's speaker.

Personal tools

Testing GSM <-> BT

Basics: We need to tell audio codec to route sound from GSM chip to BT chip. Codec is controlled by ALSA and mixer settings.

Prerequisites: BT device must be paired before the operation.

Step one: powering on bluetooth, setting up bluetoothd, pairing

Set /etc/bluetooth/audio.conf like this:

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

Then

echo 1 > /sys/bus/platform/devices/neo1973-pm-bt.0/power_on
hciconfig hci0 up
bluetoothd

then use simple-agent from here: http://wiki.openmoko.org/wiki/Manually_using_Bluetooth#Pair to pair the device.

Test: "hcitool con" should say:

Connection
     ACL 00:13:17:78:7B:A3 handle 0 state 5 lm MASTER

Step two: make a call

Call to the phone and answer (or place a call, whichever is cheaper).

Step three: load ALSA settings to switch codec "mode" to GSM <=> BT

Wait till frameworkd sets its statefile and then overwrite it with your own:

alsactl restore < /path/to/the/statefile

(Find working statefile first)

Then due to kernel bug, do:

amixer sset "Capture Left Mixer" "Analogue Mix Right"
amixer sset "Capture Left Mixer" "Analogue Mix Left"

Then issue dbus call (check what it is exactly) this starts exchanging audio between GSM and BT (hopefully):

org.bluez.Headset Play()

We would also need to set bluetooth IIS to 8000 rate:

import alsaaudio

pcm_play = alsaaudio.PCM( alsaaudio.PCM_PLAYBACK, alsaaudio.PCM_NONBLOCK, "hw:0,1" )
pcm_play.setchannels(1)
pcm_play.setrate(8000)
pcm_play.setformat(alsaaudio.PCM_FORMAT_S16_LE)
pcm_play.setperiodsize(500000)

pcm_cap = alsaaudio.PCM( alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NONBLOCK, "hw:0,1" )
pcm_cap.setchannels(1)
pcm_cap.setrate(8000)
pcm_cap.setformat(alsaaudio.PCM_FORMAT_S16_LE)
pcm_cap.setperiodsize(500000)

We should hear something in the BT headset and not in phone's speaker.