Wednesday, 20 February 2013

Using RaspBMC 1.0 (Frodo) with bluetooth keyboard

Without having checked whether each step was actually necessary, this is how I got a Bluetooth keyboard working with RaspBMC 1.0 (Frodo). Mostly based on this installation and this setup.

SSH into your RaspBMC with username pi and password raspberry.

$ sudo su
# update-rc.d dbus defaults # prevents bluez installation failure
# apt-get install bluez python-gobject # gobject required by bluez-simple-agent

If the installation succeeded, the bluetooth service should be up and running (version bluez-4.99_2 in my case):

# service bluetooth status
[ ok ] bluetooth is running.

Otherwise it can be started with

# service bluetooth start

Put the keyboard into pairing mode and find out its address using

# hcitool scan
Scanning ...
        00:18:00:0A:F7:E3       BTKB-F7E3

With the keyboard still in pairing mode, I then attempted the pairing process with

# bluez-simple-agent hci0 00:18:00:0A:F7:E3
Creating device failed: org.bluez.Error.AlreadyExists: Already Exists

Apparently, the error indicates that the device is already paired (because I had previously used it on my PC), and the remedy is adding an arbitrary 3rd argument to the invocation.

# bluez-simple-agent hci0 00:18:00:0A:F7:E3 a
RequestPinCode (/org/bluez/1981/hci0/dev_00_18_00_0A_F7_E3)
Enter PIN Code: 1234
New device (/org/bluez/1981/hci0/dev_00_18_00_0A_F7_E3)

I first entered the PIN code when prompted and had typed it on the keyboard followed by Enter before the line that says "Release".

I then created the entry to automatically pair the device after it disconnects:

# bluez-test-device trusted 00:18:00:0A:F7:E3 yes

This adds a line containing the device address to the file /var/lib/bluetooth/<adaptor address>/trusts.

Now connect the keyboard and load the necessary uinput module.

# bluez-test-input connect 00:18:00:0A:F7:E3
# modprobe -i uinput
# echo uinput >> /etc/modules

After restarting XBMC, the keyboard worked.

# restart xbmc