Answering my question here :-) In short, I have managed to get the headset working with the command line only. I'm going to describe below what it involves maybe it saves somebody else 4 days of pleasure and despair
(not necessarily in that order). The information below represents what I've managed to accumulate in the last few days. The 4.x series of bluez software seems to almost lack any formal documentation (at the moment) so my understanding of various aspects could very well be inaccurate in places. Please don't hesitate to correct me. These instructions are specific to Slackware 12.2 but you should be able to apply them with suitable modifications to your distribution.
First some background info. The 4.x series of bluez seems to be a significant redesign over 3.x series. The config files are pretty much different, apparently no more 'hcid' and 'hdid' daemons and the pairing/pin helper agent is, well, almost gone. The only way to pair a device at the moment seems to be the Gnome Bluetooth applet/wizard, or the python scripts included in the bluez sources, under the 'test' folder. There is also the option to use dbus commands but I just couldn't get that to work. So, technically, there is no command line for pairing at the moment per se. However, sieving through the bluez developers mailing list there seems to be some intention to develop one at some point in time.
What I used:
a. Slackware 12.2
b. Original 2.6.27.7-smp kernel
c. Bluez 4.32 (latest at the moment)
d. Cambridge Silicon Radio Ltd Bluetooth Dongle
e. Jabra BT2010 bluetooth headset
As usual - please make sure you understand enough of what is going on and what you are doing - and that you take sufficient precautions against any type of data loss. Not only I can't be held responsible for any consequences as a result of you following these suggestions - but I would hate to think you ended up with even less of a functional machine by the end :-)
Now, step by step instructions:
1. Remove whatever version you have of everything bluez (unless you already have the one you want to try). I had bluez-libs, bluez-firmware, bluez-hcidump and bluez-tools. I used pkgtool (or removepkg command) but you can use whatever means your distribution provides for removing software.
Code:
removepkg buez-libs
removepkg buez-utils
removepkg buez-hcidump
removepkg buez-tools
2. Remove /etc/bluetooth and /var/lib/bluetooth directories entirely. This is where bluez settings and pairing information is stored we don't want them mixed up with newer versions.
Code:
rm -r /var/lib/bluetooth
rm -r /etc/bluetooth
3. On Slackware, I've also removed the /etc/rc.d/rc.bluetooth script as it is incompatible with the newer 4.x series. On your distribution you will have to find out where the init scripts are for bluetooth and how to remove/disable them.
Code:
rm /etc/rc.d/rc.bluetooth
4. Download bluez and bluez-firmware from
http://www.bluez.org/download/
(bluez-gnome didn't work for me and bluez-hcidump seems to be mostly used for debugging). I placed them under /usr/src so my commands will use that path you will have to adjust things depending on where you download them. I've also used what seems to be the Slackware traditional file locations for the configure command again this is up to you.
5. Unpack the sources, configure, compile and install them.
Code:
cd /usr/src
tar zxvf bluez-4.32.tar.gz
cd bluez-4.32
./configure prefix=/usr sysconfdir=/etc
make
make install
and for the firmware:
Code:
cd /usr/src
tar zxvf bluez-firmware-1.2.tar.gz
cd bluez-firmware-1.2
./configure prefix=/usr sysconfdir=/etc
make install
6. I've copied the init script provided under 'scripts' folder, and it seems to work fine for Slackware but see your distribution procedures:
Code:
cd /usr/src/bluez-1.43/scripts
cp ./bluetooth.init /etc/rc.d/rc.bluetooth
chmod +x /etc/rc.d/rc.bluetooth
7. Now for the connection and pairing process. You might want to restart the machine and make sure the bluetoothd daemon works fine.
Code:
ps -A | grep bluetoothd
should hopefully show the daemon running. I won't go into details on how to check the your bluetooth dongle or integrated bluetooth chipset is working fine and which chipsets are supported and which are not.
Run hciconfig' command to check everything is ok with your bluetooth adapter, that it is recognised and what is it's device name (I have zero'ed the mac address of my adapter but yours should show a real address):
Code:
bash-3.1# hciconfig
hci0: Type: USB
BD Address: 00:00:00:00:00:00 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:1070 acl:0 sco:0 events:38 errors:0
TX bytes:401 acl:0 sco:0 commands:36 errors:0
Place your headset in pairing mode (check manufacturers instructions). Run hcitool to discover it (again, you should see a real MAC address where the zeros are):
Code:
bash-3.1# hcitool scan
Scanning ...
00:00:00:00:00:00 Bluetooth headset
If hcitool refuses to scan make sure your bluetooth adapter is up (assuming your device has been assigned hci0 as most seem to) and then try the scan again:
8. I am a bit unclear if the command 'hcitool cc' is needed anymore but it didn't seem to break anything either. We are going to use the python script in the sources directory to connect to the headset. This seems to be a one-off process as once the pin has been passed to the headset the authentication seemed to survive across reboots. Use mac address discovered with 'hcitool scan' earlier on, instead of zeros:
Code:
hcitool cc 00:00:00:00:00:00
cd /usr/src/bluez-4.32/test
./simple-agent hci0 00:00:00:00:00:00
The last command should prompt for a pin (again, the pin for your headset is either in the documentation of the headset, or it might be generated automatically everytime if you have a fancy headset with a display). Enter the pin (0000 in my case). All going well your computer is paired with your headset.
9. I have placed the following in my /etc/asound.conf. This will affect global settings for all users. You can place them instead in ~/.asoundrc file, and it will affect only the user in question. There seem to be a variety of settings that can go in this file, for voice only headsets (simple, mobile phone type), or A2DP stereo headsets. Also, if you use pulse-audio or some other audio setup you might have to do some more digging. See links at the bottom. This works fine for my Slackware 12.2 box which apparently just uses Alsa. I didn't use the mac address of the headset as it seems to pick it up by default if you only have one. If you have problems use the mac address as in the examples on the bluez wiki.
Code:
GNU nano 2.0.9 File: asound.conf
pcm.headset {
type bluetooth
profile "voice"
}
ctl.headset {
type bluetooth
profile "voice"
}
10. Restart the computer (or just alsa) and you should be able to test things. I have tested mine like this (note that 'headset' is what I used in the asound.conf file above. If you used something else, adjust accordingly):
For playback:
Code:
aplay -D headset a_wav_file.wav
To see if the headset mic works:
Code:
arecord -D headset -f S16_LE | aplay -D headset -f S16_LE
If the mic works you should hear your own voice in the headset speaker.
Oh actually, in a way this is just the start as support for using headsets seems to vary depending on whatever app you are using. Some info I found useful can be found here:
http://wiki.bluez.org/wiki/HOWTO/AudioDevices
For example I am still not clear if I can get Ekiga working with the headset at the moment.
But at least I have managed to get the headset paired and working with Slackware 12.2 using command line only. Yey!!!!