RaspberryPi Zero W + Logitech k830 bluetooth keyboard

I’m trying to get the Logitech k830 bluetooth keyboard to work with my Raspi Zero W using the on-board bluetooth with the OSMC image from 03/25/2017. OSMC recognizes the keyboard, pairing (using PIN) works (keyboard is connected via ssh and bluetoothctl info [MAC]) but nothing happens after that meaning no input from the keyboard is recognized.

You can find a full log here where I did the following steps http://paste.osmc.io/aqebexigew

  • boot
  • My OSMC → Network → Bluetooth → start/stop discovery
  • turn on keyboard and enter pairing mode
  • select found keyboard and pair with PIN
  • enter PIN on keyboard & hit enter → keyboard appears as connected under paired devices
  • type “Hello World!!!” on keyboard and play around with arrow keys → no reaction

I also did a hcidump via ssh afterwards but there is no activity when I play around with the keyboard.

The keyboard definitely works as I’m using it since months with multiple windows computers without any problems. Furthermore, I tried LibreELEC 8.0.1 on the Raspi Zero W and it worked out-of-the box with the keyboard (I’m not able to use LibreELEC because of other problems).

So has anyone experienced the same problems and/or may have an idea for a solution? I’m not that familiar with Linux to solve this on my own.

Many thanks in advance!

Anybody got any idea what could be the reason or might be the solution?

According to this, your keyboard should show up with id 046d:c52b, which I can’t find in your log. Instead, a Cherry keyboard appears to be recognised. If you have another keyboard nearby, it may be hogging the BT connection.

Thanks for you comment!

Actually, there are two versions of the keyboard. One comes with an extra USB dongle and the other one comes without any dongle but with bluetooth connectivity (see here) . I’m using the one without dongle but with native bluetooth.

The ID of the keyboard is CA:4D:07:A9:2E:F4 and as you can see in the log it is successfully found and connected/paired. I guess the problem is, that it is not recognized as an input device but I’m not sure on that.

The cherry keyboard you see in the log is connected via USB as I need a keyboard to use the RasPi because the bluetooth keyboard is not recognized.

— edit —

Tried it with the latest release (2017.04-1) and still the same problem :cry:
If somebody please could at least try to give some support or point me where to search for a possible solution that would be highly appreciated!

Hi,

I’m not sure why you not getting any output from the keyboard or if it is in fact pairing correctly. You may have more success if try it from the command line.

DBMandrake posted some instructions sometime back, which look good to me. They can be found here

If you are still having issues, if you advise the output of the command line commands; we should be able to advise further.

Thanks Tom.

Hi Tom!

I tried connecting via bluetoothctl and everything seems to work correctly (see console output). Nevertheless, the keyboard is not working with the RasPi meaning that I can hit whatever button I want but nothing happens. Any idea what could be the reason or how to track this down and fix this?
I noticed, that the MAC is changing/increasing every time I start the pairing mode on the keyboard (you can see the difference compared to my previous posts)…is this a usual behavior with bluetooth?

Thanks,
doppelhertz

osmc@RASPI-MJ:~$ bluetoothctl
[NEW] Controller B8:27:EB:32:3C:9A RASPI-MJ [default]
[bluetooth]# agent on
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:27:EB:32:3C:9A Discovering: yes
[New] Device CA:4D:07:A9:2F:01 K830
[bluetooth]# scan off
[CHG] Device CA:4D:07:A9:2F:01 RSSI is nil
Discovery stopped
[CHG] Controller B8:27:EB:32:3C:9A Discovering: no
[bluetooth]# pair CA:4D:07:A9:2F:01
Attempting to pair CA:4D:07:A9:2F:01
[CHG] Device CA:4D:07:A9:2F:01 Connected: yes
[agent] Passkey: 315267
[CHG] Device CA:4D:07:A9:2F:01 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device CA:4D:07:A9:2F:01 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device CA:4D:07:A9:2F:01 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb
[CHG] Device CA:4D:07:A9:2F:01 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
[CHG] Device CA:4D:07:A9:2F:01 UUIDs: 00001812-0000-1000-8000-00805f9b34fb
[CHG] Device CA:4D:07:A9:2F:01 UUIDs: 00010000-0000-1000-8000-011f2000046d
[CHG] Device CA:4D:07:A9:2F:01 Modalias: usb:v046DpB335d0010
[CHG] Device CA:4D:07:A9:2F:01 Paired: yes
Pairing successful
[K830]# trust CA:4D:07:A9:2F:01
[CHG] Device CA:4D:07:A9:2F:01 Trusted: yes
Changing CA:4D:07:A9:2F:01 trust succeeded
[K830]# connect CA:4D:07:A9:2F:01
Attempting to connect to CA:4D:07:A9:2F:01
Connection successful
[K830]# info CA:4D:07:A9:2F:01
Device CA:4D:07:A9:2F:01
		Name: K830
		Alias: K830
		Appearance: 0x03c1
		Icon: input-keyboard
		Paired: yes
		Trusted: yes
		Blocked: no
		Connected: yes
		LegacyPairing: no
		UUID: Generic Access Profile	(00001800-0000-1000-8000-00805f9b34fb)
		UUID: Generic Attribute Profile	(00001801-0000-1000-8000-00805f9b34fb)
		UUID: Device Information		(0000180a-0000-1000-8000-00805f9b34fb)
		UUID: Battery Service			(0000180f-0000-1000-8000-00805f9b34fb)
		UUID: Human Interface Device	(00001812-0000-1000-8000-00805f9b34fb)
		UUID: Vendor specific			(00010000-0000-1000-8000-011f2000046d)
		Modalias: usb:v046DpB335d0010	
[K830]#

try

bluetoothctl

remove aa:bb:cc:dd:ee:ff (aa:bb:cc:dd:ee:ff being mac address of the device)

sudo restart 0.

Then try and pair the device again.

Thanks Tom.

It says sudo: restart: command not found. Did you maybe mean sudo reboot 0? Because that command exists. I tried removing the bluetooth device like you said, sudo reboot 0, pair, trust & connect the device but result is exactly a previously - everything is successful but when typing on the keyboard, no characters show up in the shell.

Hi,

Sorry it was sudo reboot.

I’ve been doing some googling and there quite a few results, for either not typing or not pairing for this model keyboard.

One of successes suggests holding down the delete key & Bluetooth key till it syncs. I’m not sure if that will help. After that All I can suggest that keyboard is still working correctly on your pc, its very unlike but it may have failed.

Thanks Tom.

What do you mean by ‘holding down the delete key & Bluetooth key till it syncs’?

To get the keyboard in pairing mode I have to press FN + DEL as you can see on the picture of the bluetooth version of the K830 keyboard here. I do this on every new try to connect the keyboard, e.g. before ‘bluetoothctl scan on’.

The strange thing is, that the keyboard has been working with every other computer and OS combination so far. It even worked on the Raspi Zero W when using LibreELEC (tested with version 8.0.1). So the keyboard definitely works, even under Linux on the Raspi Zero W. Unfortunately, I no expert with Linux and don’t know enough to have any clue why it works with e.g. LibreELEC and not with OSMC. I guess there are some different libraries and/or versions used but that just a guess.

Any other ideas how I could fix this or at least narrow down the problem?

Thanks,
doppelhertz

Hi,

Apologies I’ve not got this keyboard, so alot of this is guess working and google searches; searches which may not be giving the best results.

I’m hoping this manual is for the right keyboard as I’m using it as reference to try and narrow down the issue.

Does the touch-pad work, when paired?
Does disabling the touch-pad, get the keyboard typing to work?
Does disabling the back-light for keyboard, have any effect?

Thanks Tom.

Thanks for yor efforts Tom!
There are two versions of this keyboard: one using a proprietary USB dongle and one using plain normal BLE. Besides the connectivity they are exactly the same. The manual you linked referes to the dongle version but unfortunately I don’t find any link to the BLE version. But I don’t think it is that important because they are the same besides the connectivity.

The touchpad does also not work. I have not tested disabling the backlight so far but I will check tomorrow. Also I have to check if/how I can disable the touchpad as I was not aware this can be done. Will check this also tomorrow.

----- Update -----

Turns out touchpad can’t be deactivated and disabling the backlight also has no effect. But by experimenting,
Nevertheless, I made some progress as I managed to get an output in hcidump for each key stroke and touchpad touch. I achieved this by re-connecting the already paired keyboard using bluetoothctl connect CA:… This only works if I turn on the keyboard after entering bluetoothctl connect CA:… if I do it the other way round, connection fails. Also automatic reconnection is not working (don’t know if it should).
If re-connecting in the right order I get output in hcidump for each key but when I try to use the keyboard outside hcidump it is still not working.

Hi,

I’m glad to here you’ve made progress.

I’d surprised if autoconnect works, if this is process to get it connected autoconnect would be a longshot. Now that you’ve got it paired and typing in hcidump, rebooting and pressing fn+bluetooth key; will it pair then?

Thanks Tom.

Sorry, but I’m not sure if I understand correctly what you want me to do. You suggest, after I’m in console mode and have hcidump running with output when typing to restart the Pi in normal mode (to OSMC/Kodi) and then hit fn+bluetooth key?

If so, I’m pretty sure I can tell you what will happen…the keyboard goes into pairing mode which causes any current connection to abort and it will only work again if paired using a PIN. After that I’ll have to turn off the keyboard, try to (re-)connect either via OSMC menu or via bluetoothctl and while trying to connect turn on the keyboard. Nevertheless, I will try things like you want it if you could tell me if I understood correctly what I should be :wink:

To my understanding, pairing does not seem to be the problem as pairing always succeeds (via OSMC as well as via bluetoothctl) as shown in the console output in my previous post

I’m not a bluetooth expert but my feeling is, that the keyboard is correctly connected (at least after manually reconnenct and turning the keyboard on right afterwards) as the hcidump shows. I guess the problem is, that the data send from the keyboard are not recognized as keystrokes. Eventually the keyboard is not recognized as an input device? But I don’t know how to check this.
What do you think? Does this sound plausible to you? And would this provide any further information on what I could check (e.g. is it recognized as input device/keyboard)?

Again, thanks a lot for your help!

Hi,

Sorry I’m not export of bluetooth either, I’ve asked the rest of team and we can’t out why this wasn’t working.

You asked about auto connecting, and hcidump. I was trying work things out one setup at a time.

As far as auto connecting works, I think the closest we can achieve is by placing the the device is paring mode and see if it connects. I was trying to see if on reboot with bluetooth enabled and placing the keyboard in paring mode. whether it would connect with out repeating the steps in the console or in myosmc.

Thanks Tom.

I tried like you said and tried rebooting with bluetooth enabled and placing the keyboard in pairing mode. Result: keyboard is not recognized until I manually start pairing and connecting again. Althought the automatic reconnect would be nice, it is not of priority right now because the keyboard still does not work. :disappointed:

The current status is as said: I can get the keyboard to successfully pair & connect and also there is some output visible when running sudo hcidump and hitting any keys on the keyboard. But when in normal console or running Kodi, the keyboard input is ignored, i.e. nothing happens when I hit any key or using the touchpad.

Anyone any ideas?

Did you already tried if you can get it going with raspbian?

I just tried with a clean installation of Raspbian Jessie with Pixle (Release Date 2017-04-10) and it does not work. Actually, the behavior is very strange.

I tried connecting via the GUI and the following happend

  • there wasn’t a PIN to be entered via the keyboard as it should be
  • after pairing there opened a box with

Paired successfully, but this device has no services which can be used with Raspberry Pi.

  • the light on the keyboard kept blinking fast (as it does when in pairing mode)

Then I tried to connect via bluetoothctl (using agent on, default-agent, pair XX:XX…, trust XX:XX…, connect XX:XX) and the following happend

  • upon pair XX:XX… a PIN was shown in the console but before I could enter it on the keyboard execution continued and said pairing successful
  • again, light on keyboard kept blinking as in pairing mode
  • but bluetoothctl said ‘connected’

Either way, the keyboard did not work.

Hi,

This is a long shot, if it doesn’t work I’m really out of ideas. Have you tried (on osmc):

sudo hciconfig hci0 up

If this reports bac “Can’t init device hci0: Operation not possible due to RF-kill”

Then:

sudo nano /var/lib/connman/settings

Change Enable=false to true, under bluetooth.

sudo reboot 0 and try the original command again.

hcitool cc aa:bb:cc:dd:ee:ff

If you still can’t type:

hciconfig hci0 reset

If it still won’t type, I’m sorry I’m out of ideas. Like you say it works in hcidump, so it should work elsewhere. Anyway I hope this works.

Thanks Tom.

I will be travelling the next days and try these steps when I come back.

Just a quick comment: I already played around with hcitool and as far as I remember
hcitool cc aa:bb:cc:dd:ee:ff
won’t work because it is a BLE device. I remember that the device was not discovered by using
hcitool scan
but only by using
hcitool lescan

Probably this is another hint. Maybe another approach would be if someone could tell where exactly are the differences in bluetooth implementation (used libraries etc) between OSMC and LibreELEC because with LibreELEC the keyboard works out-of-the-box even when using the GUI/Kodi.

This may also be related to the fact, that the bluez library seems to have dramatically changed from version 4.x to 5.x. Most of other threads suggest trying commands that are no longer available under bluez 5.x. Further, I noticed that OSMC seems to have a very strange bluez version number (99.9 if I remember correctly).

I don’t know what to make of this but hopefully someone reading this can provide details/thoughts on any of these points.

Many thanks in advance!
doppelhertz