Hey there,

hence there is no tutorial out there for a Logitech Ultra Thin Keyboard (Update: the Logitech Solar Keyboard Folio works fine, too!)
and Raspbmc I’m going to write one.
In general it’s the same procedure like connecting a normal bluetooth keyboard.

Step 1 – Connect your hardware
Of course connect your Bluetooth Dongle first! 🙂
Make sure your Hub has enough power, if you are not connecting directly to your Pi! 
 

Step 2 – SSH connection and getting ready
SSH into your Raspberry Pi, I added an alias in the /etc/hosts file so that I can use just “pi”

ssh [email protected]
password (default) is: raspberry

It’s also not a bad idea to update your cache of available packages via

sudo apt-get update

 

Step 3 – Enable dbus
First of all we need to enable the dbus support

sudo update-rc.d -f dbus defaults

 

Step 4 – Install bluetooth packages
Now we can go on and install the required bluetooth tools suite via apt-get

sudo apt-get install bluez python-gobject

This might take some time, depending on your internet connection.
 

Step 5 – Test your hardware
Now your Bluetooth Dongle should be found by the OS. If not re-plug it!
Test the device if it’s listed as hciX (X is a number) as “UP” with

hciconfig

(For example:)

hci0:  Type: BR/EDR  Bus: USB
    BD Address: 00:1A:7D:DA:71:14  ACL MTU: 310:10  SCO MTU: 64:8
    UP RUNNING PSCAN
    RX bytes:6901 acl:96 sco:0 events:280 errors:0
    TX bytes:3367 acl:78 sco:0 commands:106 errors:0

 

Step 6 – Scan for the keyboard
It’s time to start a scan (make sure the Logitech Keyboard is visible and turned on!)

hcitool scan

It should display something similar to this

Scanning ...
    00:1F:20:5D:FE:39   Logitech Ultrathin KB Cover

If you find the keyboard, copy the MAC adress (something like 00:1F:20:5D:FE:39), you are going to need this one.
 

Step 7 – Pairing and fixing conflicts
In general you would now only need to pair the device with

bluez-simple-agent hci0 00:1F:20:5D:FE:39

In my case (or maybe due to the Logitech Ultrathin Keyboard) I got the following error message

Creating device failed: org.bluez.Error.AuthenticationRejected: Authentication Rejected

There is a simple fix for it. You need to change an occurrence of “KeyboardDisplay” with “DisplayYesNo” in a bluez python script.

sudo vi /usr/bin/bluez-simple-agent

(vi noob? Read this: Hit / and then type KeyboardDisplay, now you have found the line, press I and delete the KeyboardDisplay and write DisplayYesNo. Now hit ESC and type :x, you are done)

Now we can issue the pairing command again and it should work and you will see something like this

DisplayPasskey (/org/bluez/1284/hci0/dev_00_1F_20_5D_FE_39, 328877)

See the 328877? You need to type this code on the keyboard and hit enter!
You will see some more infos

Release
New device (/org/bluez/1284/hci0/dev_00_1F_20_5D_FE_39)

Congratulations, it’s now paired!
 

Step 8 – Connecting
Next we will mark the device as trusted

bluez-test-device trusted 00:1F:20:5D:FE:39 yes

And now connect it (will auto-reconnect after a reboot!)

bluez-test-input connect 00:1F:20:5D:FE:39

 

That’s it, wait a few seconds and the keyboard should work on Raspbmc
 

 

Troubleshooting
If you receive an error called

dbus.exceptions.DBusException: org.bluez.Error.Failed: Host is down (112)

That means the keyboard is not discoverable, simply press the bluetooth key again

If you receive an error called

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method “Connect” with signature “” on interface “org.bluez.Input” doesn’t exist

Make sure to enable the input plugin in the bluetooth config.
Open

sudo vi /etc/bluetooth/main.conf

It should not be listed under “DisabledPlugins” (either DisabledPlugins starts with a # or it’s not listed there)

 

 

Thanks for reading, I hope this tutorial will help some people.
If you have any suggestions or problems, feel free to comment below.

Cheers,
xGhOsTkiLleRx

HowTo – Connect your bluetooth keyboard to Raspbmc (Logitech Ultrathin Keyboard)
The short URL of this article is: https://dustpla.net/gJEF4

10 thoughts on “HowTo – Connect your bluetooth keyboard to Raspbmc (Logitech Ultrathin Keyboard)

  • July 15, 2014 at 9:36 am
    Permalink

    I found that on my system, the dbus init.d script was missing.

    To reinstall it, before step 3 run:

    sudo apt-get install --reinstall -o Dpkg::Options::="--force-confmiss" dbus

    Reply
    • July 18, 2014 at 1:31 pm
      Permalink

      Thanks for sharing! 🙂

      Reply
  • November 7, 2014 at 12:56 pm
    Permalink

    Hello, I am trying to include my ps3 keyboard of sony.

    I modified the /usr/bin/bluez-simple-agent ,as you said, but I am still having problems to pair my keyboard.

    When I try “bluez-simple-agent hci0 xx:xx:xx:xx:xx:xx” , the code still doesn´t appear:
    New device (/org/bluez/1284/hci0/dev_xx_xx_xx_xx_xx_xx),

    I don´t know what can be the reason,

    If can help me, please!

    Regards,

    Reply
  • January 10, 2015 at 11:44 am
    Permalink

    Splendid!

    Works with a Logitech K480 too!

    Reply
  • March 22, 2015 at 7:14 am
    Permalink

    Thanks!
    It made my Logitech UltraThin Keyboard work AFTER reboot 🙂

    Reply
  • May 12, 2015 at 8:56 am
    Permalink

    bluez-simple-agent hci0 $bdaddr , enter pin , bluez-simple-device trusted $bdaddr
    IF I REMEMBER CORRECTLY

    however each time your bt kbd powers off to conserve battery, the daemon handling bluetooth won’t notice when the kbd comes back online. That means you can do some shell-trolling like this and call it in a crontab:
    — snip —
    #!/bin/sh
    # damnit!
    hciconfig hci0 up # just make sure its not snafu again, love linux to death for real
    bluez-test-input connect $bdaddr >/dev/null 2>&1 # don’t want cron mailing you? ok.
    — snip —
    ^ this will make your bluetooth adapter have a look if your keyboard is indeed once again powered on and ready for your tactile delights.
    crontab ( as root -> lol )

    */1 * * * * /root/bin/lortpaapikken.sh
    ^ your elate bluetooth stay-alive script

    LINUX + BLUETOOTH = HATE

    If this all doesnt make sense to you boffins, it’s because it’s senseless. I should have just gotten a damned wired keyboard. There’s a lesson for you all: wireless is CRAP. IrDA is better than this. Always reliable, and doesn’t try to murder your good mood.

    Reply
  • May 12, 2015 at 10:52 am
    Permalink

    or ‘echo -n 1234 | bluez-simple-agent hci0 $bdaddr’ and then ‘bluez-simple-device trusted $bdaddr’ – use ‘hcidump -ati hci0’ to look at the traffic on hci0 (your first bluetooth modem, you may have more). not trying to be an 31337 linux blockhead, just want my %#”#¤!”#!”@ kbd to be on when I am on, and otherwise idle and able to enter standby mode. sheesh.

    Reply
  • May 12, 2015 at 10:54 am
    Permalink

    and now I read that I have to make some custom udev rules for my keyboard to regulate this odd behaviour – any boffins want to point me in the simplest, fastest direction? not that my crontab stayalive stub isn’t working… but it’s an awful hak.

    Reply
  • August 28, 2015 at 12:35 pm
    Permalink

    Hi,

    I have been trying to connect bluetooth of my android phone to my ubuntu 12.04. In ubuntu PC I have connected bluetooth dongle. I have followed below steps:

    1) To get the adapter:
    $ hcitool dev
    hci0 00:15:83:17:E8:FC

    2) To get the bdaddr of my phone:
    $ hcitool scan
    74:51:BA:83:36:0D Redmi

    3) To pair with this device:
    $ bluez-simple-agent hci0 74:51:BA:83:36:0D
    which asks for PIN number and I have entered the PIN and same number is required to enter in the phone.
    After entering the same PIN , my phone is able to pair with the bluetooth of my ubuntu PC.

    4) To make it in trusted device
    $ bluez-test-device trusted 74:51:BA:83:36:0D yes

    5) To connect the device
    $ bluez-test-input connect 74:51:BA:83:36:0D
    but it shows error as below:
    Traceback (most recent call last):
    File “/usr/bin/bluez-test-input”, line 40, in
    input.Connect()
    File “/usr/lib/python2.7/dist-packages/dbus/proxies.py”, line 70, in call
    return self._proxy_method(*args, **keywords)
    File “/usr/lib/python2.7/dist-packages/dbus/proxies.py”, line 145, in call
    **keywords)
    File “/usr/lib/python2.7/dist-packages/dbus/connection.py”, line 651, in call_blocking
    message, timeout)
    dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method “Connect” with signature “” on interface “org.bluez.Input” doesn’t exist

    I have checked the /etc/bluetooth/main.conf but input plugin is not listed under “DisabledPlugins” (actually DisabledPlugins starts with a #)

    Please help me to sort it out. My bluez version is 4.98-2ubuntu7.2 I have tried same steps in ubuntu 14.04 and the bluez version is 4.101-0ubuntu13 but the same error occured.

    Thanks in advance.

    Reply
    • February 22, 2017 at 9:32 am
      Permalink

      I also meet the obstacle in step “5) To connect the device ” as you described.
      Have you handle it?
      Thanks for sharing!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *