Manually using Bluetooth

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Headset Audio)
(Power it up)
Line 11: Line 11:
 
  root@fic-gta01:~$ modprobe hci_usb
 
  root@fic-gta01:~$ modprobe hci_usb
  
Power up and reset the adapter--works best from a script so they are sent one after the other:
+
Power up and (possibly) reset the adapter from a script. Only enable the reset if the power_on action is not sufficient.
  
  root@fic-gta01:~$ echo "1" > /sys/bus/platform/devices/gta01-pm-bt.0/power_on  
+
  root@fic-gta01:~$ echo "1" > /sys/bus/platform/devices/gta01-pm-bt.0/power_on ; echo "1" > /sys/bus/platform/devices/gta01-pm-bt.0/reset  
root@fic-gta01:~$ echo "1" > /sys/bus/platform/devices/gta01-pm-bt.0/reset  
+
  
 
Check to see if the adapter is up and running:
 
Check to see if the adapter is up and running:

Revision as of 05:02, 7 June 2007

At the moment, we've just started to introduce Bluetooth into our Neo1973 Hardware.

We have quite a lot of plans about what exactly Bluetooth should be used for.

Contents

Power it up

Bluetooth may not be powered up.

Load the usb bluetooth driver, most convenient if hci_usb is named in (eg) /etc/modutils/hci-usb, but could also be manual:

root@fic-gta01:~$ modprobe hci_usb

Power up and (possibly) reset the adapter from a script. Only enable the reset if the power_on action is not sufficient.

root@fic-gta01:~$ echo "1" > /sys/bus/platform/devices/gta01-pm-bt.0/power_on ; echo "1" > /sys/bus/platform/devices/gta01-pm-bt.0/reset 

Check to see if the adapter is up and running:

hciconfig

(If you have an older rootfs, you may need to modprobe gta01-pm-bt but it's built in currently.)

Bluetooth Functions

HID (Human Input Device)

Being able to use HID devices

We want to be able to use a bluetooth keyboard to type into the various applications of our Neo1973.


Acting as HID device

We want to be able to use the Neo1973 as a HID device, being able to use it as controller for presentations.

OBEX

Networking

Bluetooth should behave just like our usbnet and provide full TCP/IP access to the phone. BNEP has to be used.

On the laptop:

  • Start bluetooth
elara /home/alphaone # /etc/init.d/bluetooth start
  • Start pand as server
elara /home/alphaone # pand -s
  • As soon as pand is started on the phone configure your IP address
elara /home/alphaone # ip a add 10.0.0.1/24 dev bnep0
elara /home/alphaone # ip l set bnep0 up
  • Configure IP forwarding and masquerading to your liking

On the phone:

  • Power on bluetooth (see above)
  • Scan for the laptop
root@fic-gta01:~$ hcitool scan
Scanning ...
        00:0E:6D:C0:0l:6A       Sho
        00:20:E0:5A:FE:C8       BlueZ (0)
  • Connect to the laptop pand
root@fic-gta01:~$ pand -c 00:20:E0:5A:FE:C8
  • Configure your IP address
ip a add 10.0.0.2/24 dev bnep0
ip r add default via 10.0.0.1
  • Enjoy
root@fic-gta01:~$ wget http://www-public.tu-bs.de:8080/~y0019680/tmp/thereisnophone.mp3 
Connecting to www-public.tu-bs.de[134.169.9.108]:8080
thereisnophone.mp3   100****************************************************|   266 KB 00:00:00 ETA
root@fic-gta01:~$ madplay thereisnophone.mp3 
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.
630 frames decoded (0:00:22.6), -0.9 dB peak amplitude, 0 clipped samples

A2DP

The A2DP codec, SBC, runs pretty well now in 32-bit fixed-point math. It's been successfully tested on a faster ARM but not yet on neo. There is test code in the bluetooth-alsa.sf.net plugz module for using alsa plugins to send A2DP audio out and it's starting to be reimplemented "properly" in the bluez core.

Headset Audio

Bluez has an audio daemon for headset audio that should work to set up the control connection to the headset. It will need hooks in the openmoko gui.

Neo1973_Audio_Subsystem has more detail about what magic needs to happen with the Wolfson codec so system audio can be switched to use the bluetooth audio channel and later back to the speaker/earpiece/wired headset.

There seems to be a proposal for audio scenario management there but no detail about whether that is how things are done currently. How does audio management currently work when eg plugging in/unplugging the wired headset?

Further reading

http://www.holtmann.org/papers/bluetooth/ols2006_slides.pdf http://wiki.bluez.org/wiki/Audio#org.bluez.Audio

Personal tools

At the moment, we've just started to introduce Bluetooth into our Neo1973 Hardware.

We have quite a lot of plans about what exactly Bluetooth should be used for.

Power it up

Bluetooth may not be powered up.

Load the usb bluetooth driver, most convenient if hci_usb is named in (eg) /etc/modutils/hci-usb, but could also be manual:

root@fic-gta01:~$ modprobe hci_usb

Power up and reset the adapter--works best from a script so they are sent one after the other:

root@fic-gta01:~$ echo "1" > /sys/bus/platform/devices/gta01-pm-bt.0/power_on 
root@fic-gta01:~$ echo "1" > /sys/bus/platform/devices/gta01-pm-bt.0/reset 

Check to see if the adapter is up and running:

hciconfig

(If you have an older rootfs, you may need to modprobe gta01-pm-bt but it's built in currently.)

Bluetooth Functions

HID (Human Input Device)

Being able to use HID devices

We want to be able to use a bluetooth keyboard to type into the various applications of our Neo1973.


Acting as HID device

We want to be able to use the Neo1973 as a HID device, being able to use it as controller for presentations.

OBEX

Networking

Bluetooth should behave just like our usbnet and provide full TCP/IP access to the phone. BNEP has to be used.

On the laptop:

  • Start bluetooth
elara /home/alphaone # /etc/init.d/bluetooth start
  • Start pand as server
elara /home/alphaone # pand -s
  • As soon as pand is started on the phone configure your IP address
elara /home/alphaone # ip a add 10.0.0.1/24 dev bnep0
elara /home/alphaone # ip l set bnep0 up
  • Configure IP forwarding and masquerading to your liking

On the phone:

  • Power on bluetooth (see above)
  • Scan for the laptop
root@fic-gta01:~$ hcitool scan
Scanning ...
        00:0E:6D:C0:0l:6A       Sho
        00:20:E0:5A:FE:C8       BlueZ (0)
  • Connect to the laptop pand
root@fic-gta01:~$ pand -c 00:20:E0:5A:FE:C8
  • Configure your IP address
ip a add 10.0.0.2/24 dev bnep0
ip r add default via 10.0.0.1
  • Enjoy
root@fic-gta01:~$ wget http://www-public.tu-bs.de:8080/~y0019680/tmp/thereisnophone.mp3 
Connecting to www-public.tu-bs.de[134.169.9.108]:8080
thereisnophone.mp3   100****************************************************|   266 KB 00:00:00 ETA
root@fic-gta01:~$ madplay thereisnophone.mp3 
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.
630 frames decoded (0:00:22.6), -0.9 dB peak amplitude, 0 clipped samples

A2DP

The A2DP codec, SBC, runs pretty well now in 32-bit fixed-point math. It's been successfully tested on a faster ARM but not yet on neo. There is test code in the bluetooth-alsa.sf.net plugz module for using alsa plugins to send A2DP audio out and it's starting to be reimplemented "properly" in the bluez core.

Headset Audio

Bluez has an audio daemon for headset audio that should work to set up the control connection to the headset. It will need hooks in the openmoko gui.

Neo1973_Audio_Subsystem has more detail about what magic needs to happen with the Wolfson codec so system audio can be switched to use the bluetooth audio channel and later back to the speaker/earpiece/wired headset.

There seems to be a proposal for audio scenario management there but no detail about whether that is how things are done currently. How does audio management currently work when eg plugging in/unplugging the wired headset?

Further reading

http://www.holtmann.org/papers/bluetooth/ols2006_slides.pdf http://wiki.bluez.org/wiki/Audio#org.bluez.Audio