To begin, we start with a working Debian system, because that is god's chosen distribution. Lovely Debian.
You need some bluetooth packages, specifically:
bluezYou need to have a bluetooth adapter in your system, and you'll need to know the bluetooth adapter ID:
bluez-alsa
libbluetooth3
root@thorn 1> hcitool devWe'll need that bluetooth adapter ID a little later.
Devices:
hci0 00:02:76:09:69:4A
And, of course, you need some bluetooth headphones: I'm using Motorola S9-HD headphones, others should work.
Ok, make sure the bluetooth daemon is running:
root@thorn 2> ps -ef | grep bluetoothdAnd we turn on the headphones, and put them in pairing mode. For the S9-HD headphones, they automatically go into pairing mode when turned on (and unpaired), indicated by the LED remaining a solid blue.
root 5342 5263 0 00:53 pts/16 00:00:00 grep bluetoothd
First, to confirm that the bluetooth adapter can see the headphones, we query the list of pairable devices that you can see with:
root@thorn 3> hcitool scanThis means your computer can see the headphones, and that the bluetooth ID of those phones is 00:0D:FD:2D:51:88. Yay! Then we connect them like this:
Scanning ...
00:0D:FD:2D:51:88 Motorola S9-HD
root@thorn 4> hcitool cc 00:0D:FD:2D:51:88Oh noes! Something is wrong! The reason is that you need to tell your bluetooth adapter what the pin code is. One way is to run the bluetooth-agent, with the (common) pin code of 0000:
Can't create connection: Input/output error
root@thorn 5> bluetooth-agent 0000With this, when bluetoothd attempts to connect, it will use that pin code. However, it's a pain in the ass to have to run that, so instead we stick that code into a configuration file. The configuration file is:
/var/lib/bluetooth/ADAPTERID/pincodes
DEVICEID PIN
/var/lib/bluetooth/00:02:76:09:69:4A/pincodesand the line in that file showing the pin for the headphones is;
00:0D:FD:2D:51:88 0000Once that is set up, we should be able to connect:
root@thorn 6> hcitool cc 00:0D:FD:2D:51:88Hmm, I don't know how to query connected devices though. hcitool con seems like it should show something, but it doesn't. Hmm.
Anyway, now that we've connected our bluetooth device, we add a bluetooth clause to the ALSA config file, ~/.asoundrc:
pcm.bluetooth {Make sure you change the device bluetooth ID as needed.
type bluetooth
device 00:0D:FD:2D:51:88
}
Now, you can test this out with mplayer:
mplayer -ao alsa:device=bluetooth foo.mp3Ok, finally, we modify the Stepmania config file, ~/.stepmania/Save/preferences.ini, changing the SoundDevice line:
SoundDevice=bluetoothOnce that is done, running Stepmania should bring the sound through the headphone. Violet!