ALSA Bluetooth Headset Driver
=============================

This is a preliminary driver for Bluetooth headsets. It has only been
tested with the following configurations:

    USB Bluetooth adapter (Bluecore02 and 01b)
    usb-ohci, usb-uhci and uhci driver (on a desktop and laptop)
    kernel 2.4.20 single processor (there may be race conditions)
    alsa-0.9.6
    HBH-60 Bluetooth headset
    recent bluez, hci_usb with my extra patches for SCO support (hciusb-isoc.patch)

Only 8-bit (8000hz) mode is supported at the moment. You must configure
your hci device with 'hciconfig hci0 voice 0x0040'.

The speaker and microphone volume levels are presented as ALSA mixer 
controls. The HBH-60 only supports speaker volume, so I haven't managed
to test the microphone support.

The ALSA device doesn't produce or consume any audio data when the headset
isn't connected via the bluezsco control program -- this will cause apps
to time out after a few seconds.

Pressing the headset button while connected will disconnect. Pressing
the headset button while disconnected (assuming the headset decides to connect
to your PC rather than your phone) will not work, since the control program
doesn't (yet) act as a server.

There are a number of debugging kernel printk() left in the code since it
is still experimental.

Please get in touch if you manage to get it to work or have any questions.

Jonathan Paisley
jp@dcs.gla.ac.uk
September 14, 2003

Usage
=====

Load the snd-bluez-sco kernel module. 

Run 

    bluezsco-0.1/bluezsco <bdaddr> <channel>

where <headset> is the bdaddr of your headset.
    
You can find out which channel is appropriate with:

    sdptool search --bdaddr <bdaddr> 0x1108
    
If all is well, a connection to your headset will be made and the SCO
connection handed off to the kernel module. For a simple test you can enable
the 'Loopback' switch via the alsa mixer. This causes the kernel module
to send all incoming audio back to the headset.

For normal use, you can use the ALSA device 'plughw:Headset':

    aplay -D plughw:Headset blah.wav
or
    alsaplayer -d plughw:Headset blah.mp3

Equally well, for recording:

    arecord -D plughw:Headset blah.wav

Installation
============

The download package contains patches against the ALSA 0.9.6
drivers and lib package, and a directory for the bluezsco control
package.

These installation instructions and the packaging are a bit sketchy, but I
hope you'll get the gist.

In summary, apply the patches and build and install the two ALSA
packages, then build the bluezsco package.



# Untar the base packages
tar xjvf alsa-driver-0.9.6.tar.bz2
tar xjvf alsa-lib-0.9.6.tar.bz2

# Patch in the headset driver sources
patch -p0 < alsa-driver-0.9.6-bluezsco.patch

# We must redo the autoconf stuff
(   
    cd alsa-driver-0.9.6
    aclocal
    autoconf
    ./configure --with-cards=bluez-sco # maybe add --with-kernel=blah
    sudo make install
)

# This patch only changes the hwdep.h include file.
# You can just replace your installed include/hwdep.h 
# (it's needed by the bluezsco control package)
patch -p0 < alsa-lib-0.9.6-bluezsco.patch
(
    cd alsa-lib-0.9.6.tar.bz2
    ./configure
    make
    sudo make install
)

(
    # Depends on bluezsco.h from alsa-driver and updated hwdep.h from alsa-lib
    cd bluezsco-0.1
    ./configure
    make
)
