BluetoothHeadsetHacking

  1. BlueTooth Headset
    1. Install new firmware
    2. Compile the Driver
    3. Use your Headset

BlueTooth Headset

This page summarizes the steps required to play with the 770 and a bluetooth headset. Currently, only recording is working. Playing back via the headset does not work (for me).

Install new firmware

1 . Download the latest bluetooth firmware from http://maemo.org/downloads/Nokia_770_Other.php

2 . Get the initfs image from the firmware:

$ flasher-3.0 -F SU-18_2006SE_3.2006.49-2_PR_F5_MR0_ARM.bin -u

3 . Mount the image

$ mkdir initfs
$ su
Password:
# modprobe mtdcore
# modprobe jffs2
# modprobe mtdram total_size=2048 erase_size=128
# modprobe mtdchar
# modprobe mtdblock
# dd if=initfs.jffs2 of=/dev/mtdblock0
# mount -t jffs2 /dev/mtdblock0 initfs

4 . create a modified initfs

# cp -a initfs initfs.new
# umount initfs
# cp brf6150fw.bin initfs.new/usr/lib/hotplug/firmware/
# mkfs.jffs2 -d initfs.new -o initfs.new.jffs2 -e 128 -l

6 . Flash the new initfs

# flasher-3.0 -f -n initfs.new.jffs2 -R
# exit

Compile the Driver

1 . Get kernel sources

Install and compile the kernel sources as described in How to Compile the Kernel.

2 . Get the current bluetooth-alsa sources

$ cvs -d:pserver:anonymous@bluetooth-alsa.cvs.sourceforge.net:/cvsroot/bluetooth-alsa login
$ cvs -d:pserver:anonymous@bluetooth-alsa.cvs.sourceforge.net:/cvsroot/bluetooth-alsa co btsco

3 . Compile the kernel module

$ cd btsco/kernel
$ make -C ~/kernel-build/su-18-kernel-2.6.16/kernel-source-2.6.16 M=`pwd` modules
$ cd ../..

4 . Get & compile ALSA

$ wget 
$ wget 
$ tar xzf alsa-lib_1.0.8.orig.tar.gz
$ cd alsa-lib-1.0.8
$ zcat ../alsa-lib_1.0.8-3.diff.gz | patch -p1
$ DEB_BUILD_OPTIONS=no-jack-dep fakeroot debian/rules binary
$ cd ..
$ fakeroot dpkg -i libasound2_1.0.8-3_armel.deb libasound2-dev_1.0.8-3_armel.deb

5 . Compile the userspace bluetooth headset stuff

$ cd btsco
patch << EOF
--- btsco.c.orig        2007-02-06 21:07:36.849795008 +0100
+++ btsco.c     2007-02-06 21:07:52.259452384 +0100
@@ -232,9 +232,7 @@
                // Get control handle for selected card
                sprintf(card_id, "hw:%i", card);
                if ((err = snd_ctl_open(&ctl_handle, card_id, 0)) < 0) {
-                       error("control open (%s): %s", card_id,
-                             snd_strerror(err));
-                       return -1;
+                       continue;
                }
                // Read control hardware info from card
                if ((err = snd_ctl_card_info(ctl_handle, card_info)) < 0) {
EOF
$ gcc btsco.c -o btsco -lasound -lpthread -lbluetooth

Use your Headset

You'll need the btsco binary and the snd-bt-sco.ko kernel module. Also, you need the libasound2 installed on your 770.

Then you can load the kernel module like this:

# insmod /mnt/initfs/lib/modules/2.6.16.27-omap1/snd-hwdep.ko
# insmod /mnt/initfs/lib/modules/2.6.16.27-omap1/sco.ko
# insmod ./snd-bt-sco.ko

Next, you'll need to figure out the bluetooth address of your headphone. Assume it's aa:bb:cc:dd:ee:ff. Then you can fire up the bluetooth connection:

# ./btsco -v aa:bb:cc:dd:ee:ff

Do something with it... the ALSA device is named plughw:Headset. I don't know if any existing software supports ALSA on the 770. You can compile aplay and arecord from alsa-utils to play a bit with your headset.


CategoryBluetooth