ALSA Bluetooth Headset Driver ============================= http://www.gargan.org/linux/snd-bt-sco/ Original: Jonathan Paisley http://www.dcs.gla.ac.uk/~jp/snd-bt-sco/ March 14, 2004 Update: 24-08-2004 Niko Berger New Patch that integrates the missing files and adds the snd-bt-sco driver for selection in the make config scripts. Works for 2.6.7 and 2.6.8 (both tested). Added "impatient" section in the README. 28-07-2004 Niko Berger Changed the patch so it integrates into kernel source (2.6.7 might work with others too) Upated Installation Instructions in README. For the impatient: ================== - get the most current kernel patch (http://www.gargan.org/linux/snd-bt-sco/kernel-2.6.7-8.24-08-04.patch) - get the current version of the user space program (http://www.gargan.org/linux/snd-bt-sco/btsco-0.3.tar.gz) - apply the patch (you may have to do that as root): cd /usr/src/linux patch -p1 /path/to/kernel-2.6.7-8.24-08-04.patch - select the snd-bt-sco module with make menuconfig/make xconfig (under Device Drivers-Sound-Advances Linux Sound Architecture-ALSA Bluetooth device) - recompile and install the kernel (make && make modules_install && make install) - compile the user space program (use ./configure and make) - ready to go... History ======= This is a preliminary driver for Bluetooth headsets. The original version of the driver (dated 2003-09-15 and called 'snd-bluez-sco') worked with kernel 2.4. This version should work with 2.6 (but not 2.4) and has been renamed 'snd-bt-sco'. It has only been tested with the following configurations: USB Bluetooth adapter (Bluecore02) usb-ohci driver (on a desktop) kernel 2.6.7-2.6.8 single processor HBH-60 Bluetooth headset 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 act as a server. There seems to be some unexplained noise that's noticeable when a program has the device open but is not sending audio data. Instead of seeing all silence, the driver is receiving the occasional non-zero byte. I've added a temporary filter to eliminate this, but I'd really like to know what's causing it. There are a number of debugging kernel printk() left in the code since it is still experimental. Usage ===== Load the snd-bt-sco kernel module. Run btsco-0.x/btsco where is the bdaddr of your headset. You can find out which channel is appropriate with: sdptool search --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 somefile.wav or alsaplayer -d plughw:Headset somefile.mp3 You may find the 'aplay' command fails with the following error: ALSA lib pcm.c:824:(snd_pcm_sw_params) snd_pcm_sw_params: params->avail_min problem for start_threshold I'm not sure exactly what's causing this, but setting the buffer size to exactly one second seems to work around it: aplay -B 1000000 -D plughw:Headset somefile.wav For recording: arecord -D plughw:Headset blah.wav Installation ============ You may have to get a current kernel from www.kernel.org (tested with 2.6.7 and 2.6.8 - for gentoo users: emerge gentoo-dev-sources) Get the most current kernel patch (http://www.gargan.org/linux/snd-bt-sco/kernel-2.6.7-8.24-08-04.patch) Get the current version of the user space program (http://www.gargan.org/linux/snd-bt-sco/btsco-0.3.tar.gz) These installation instructions and the packaging are a bit sketchy, but I hope you'll get the gist. # First it is necessary to patch the kernel # and copy the missinf files ( cd /usr/src/linux-2.6.8 patch -p1 < /path/to/snd-bt-sco-....patch # now select the new module (under Device Drivers-Sound-Advances Linux Sound Architecture-ALSA Bluetooth device) make menuconfig make modules sudo make modules_install sudo make install # may differ depending on your setup # restart or reload hci_usb module etc ) # Now create the btsco proggy ( cd btsco-0.3 ./configure make )