Logitech K810/K811 Bluetooth Keyboard on Raspberry Pi

For Christmas, I got the Logitech K811 Bluetooth keyboard for my Apple Pi setup. It supports multiple profiles for up to three Bluetooth devices, which is great for me. Apple TV, Raspberry Pi, and either an iPad or MacBook. Thanks to my bebe for buying it for me! The K810 is the PC version.

It’s not all roses off the bat though. The standard installation didn’t work. You may recognize it as such.

hcitool scan
sudo hciconfig hci0 sspmode 0
bluez-simple-agent hci0 ma:ca:dd:re:ss
bluez-test-device trusted ma:ca:dd:re:ss yes
bluez-test-input connect ma:ca:dd:re:ss

The problem is that once you call bluez-simple-agent, it waits for a PassKey, doesn’t display it for whatever reason, and then times out. Authentication fails, and you feel that familiar feeling of disappointment and dissatisfaction with your life and who you are.

The first solution you’ll find, especially for the K810 for various flavours of Linux, is to use this approach. Monitor the Bluetooth discussion so you can actually see the PassKey in order to pass it to the system.

sudo apt-get install bluez-hcidump # in case you don’t have it installed already
sudo hcidump -at # open this in another terminal for monitoring
sudo bluez-simple-agent hci0 ma:ca:dd:re:ss # perform this in your original terminal.

The second terminal running hcidump will tell you the PassKey. Carry on as usual. That way you don’t time out.

What you actually need to do is take another approach.

sudo hidd –search

This connected the keyboard, which alleviated a lot of the friction of setting up electronic Christmas presents. To make it persist, do the following.

sudo nano /etc/default/bluetooth
HIDD_ENABLED=1 # this value normally set to 0, so change it to 1
HIDD_OPTIONS=”–connect ma:ca:dd:re:ss -server”

I still have a little bit of testing to do, but I’m hopeful so far. Saved it to device 1, and ready to enjoy some awesome single keyboard, multiple device awesomeness.

Update Mar. 31, 2014: Well, this has been delayed for an entire three months, but I finally got the keyboard working as intended. As with my tendency to overcomplicate things, I found a simple and elegant solution after walking away from the situation. I’ll list what I did, but I’m not entirely sure it was all necessary. I’m on the K811.

sudo hciconfig hci0 sspmode 0 # Will this step help anyone?

Then I clicked the Bluetooth connect button on the back. All three Wifi LEDs should be blinking. Then run the standard command.

sudo bluez-simple-agent hci0 ma:ca:dd:re:ss
Passcode:

Say what? Now it’s asking for me to enter a passcode of my choosing into the Terminal. I didn’t get that before. Proceed as per us’.

bluez-test-device trusted ma:ca:dd:re:ss yes
bluez-test-input connect ma:ca:dd:re:ss

Now I can finally get it to switch back and forth between the Raspberry Pi on the left (registered to Bluetooth Device 1/F1 on the K811), the Apple TV 2 on the right (Device 2), and my iPad Air on Device 3. This is a good day, boys. Time to watch Trailer Park Boys on Netflix.

link1 link2 link3

Advertisements
About

Christian. Audio. Technology. Go-Getter. Concise.

Posted in Hacks, Technology
4 comments on “Logitech K810/K811 Bluetooth Keyboard on Raspberry Pi
  1. Philipp Wagner says:

    Hey Jonathan, same here K811. Do you happen to know how to turn off the F1, F2, F3 Bluetooth Keys? I always lose the connection with the keyboard when triggering any them.

  2. Jonathan Le says:

    That looks like an awesome resource, Philipp. Thanks for sharing.

  3. Chuck says:

    What did you enter for the “passcode”? Mine did not accept ANY passcode. 0000, 1234, etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s