Logitech K810 Keyboard Configurator 2012/12/31

Recently I bought a Logitech K810 Keyboard. The small bluetooth keyboard can connect wireless to PCs or other devices e.g. phones. It is equipped with backlight and supports 3 paired connections to devices.

Logitech K810

To use these extended functions and switch between profiles the function keys (F-keys) have a double meaning.

Logitech K810 function keys

After my purchase I found out that the default configuration uses the F-keys for the extended functionality on a direct key press. In order to use the regular F-keys the user has to hold down the FN-key in addition. As I want to use the keyboard mainly on a regular PC I could not live with it. Luckily Logitech offers a configuration tool for there range of mouses and keyboards under the name "SetPoint" for Microsoft Windows.

Logitech Setpoint software

However I was disappointed when I figured out that the configuration is not permanently stored in the keyboard and has to be sent everytime the keyboard is turned on. As I prefer Linux as operating system and do not use Microsoft Windows I could not use Logitech's software. I analyzed the communication to the HID device and created a small piece of software to sent the configuration message to the keyboard. In order to trace the bluetooth messages I executed SetPoint in a VirtualBox environment. The VM could connect trough an attached Bluetooth USB dongle to the keyboard. On the Linux host I loaded the usbmon kernel module in order to trace all messages on the USB layer to the CSR Bluetooth chip:

$ mount -t debugfs none_debugs /sys/kernel/debug
$ modprobe usbmon

As my Bluetooth dongle 0a12:0001 was attached to the 3rd bus I executed:

$ cat /sys/kernel/debug/usb/usbmon/3u

Linux shell - usbmon

When I toggled in SetPoint the flag 'Swap F key functions.' I figured out that the message payload was changing at a fixed position -> Found it!:

# Disable - Swap F key functions. -> use regular F key directly (OUT) 
ffff8803ea0853c0 3469985170 S Bo:3:003:2 -115 16 = 47000c00 08004200 a210ff06 15000000
# Response from Keyboard (IN)
ffff8803e6c36980 3470086675 C Bi:3:003:2 0 29 = 47201900 15004100 a111ff06 15000100 00000000 00000000 00000000 00

# Enable  - Swap F key functions. -> use regular F key together with FN key (OUT)
ffff8803277b0480 3483623889 S Bo:3:003:2 -115 16 = 47000c00 08004200 a210ff06 15010000
# Response from Keyboard (IN)
ffff8803e6c36980 3483991655 C Bi:3:003:2 0 29 = 47201900 15004100 a111ff06 15010100 00000000 00000000 00000000 00

The next steps were easy. Whenever the keyboard connects to BlueZ stack in Linux a 'hidraw' device is created:

[   65.632036] input: Logitech K810 as /devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.4/3-1.4:1.0/bluetooth/hci0/hci0:11/input18
[   65.632268] generic-bluetooth 0005:046D:B319.0001: input,hidraw0: BLUETOOTH HID v12.01 Keyboard [Logitech K810] on XX:XX:XX:XX:XX:XX

Therefore I wrote a small program k810_conf to send the message sequence 0x10, 0xff, 0x06, 0x15, 0x00, 0x00, 0x00 to the keyboard's 'hidraw' device. My system is configured to automatically execute k810_conf whenever the keyboard connects.

The source of k810_conf was tested on Debian GNU Linux (Wheezy) and can be found here.

Update 2014-02-10:

In order to automate running the configuration everytime the keyboard connects the following udev rule can be used:

$ cat /etc/udev/rules.d/00-k810.rules
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{address}=="00:1F:AA:BB:CC:DD", \
  RUN+="/path/to/script/k810.sh %p"

you need to exchange 00:1F:AA:BB:CC:DD with your bluetooth id of the keyboard.

The script k810.sh can look like this:

if [ "$ACTION" == "add" ];
    # configure k810 ($DEVPATH) at $DEVNAME.
    /path/to/bin/k810_conf -d $DEVNAME -f on

$DEVNAME is automatically replaced by UDEV to the correct hidraw device path of the keyboard.

Add a comment

Comments (6)

Hi, how can i do this in windows? I cant seem to get any setpoint software work with the K810
Written on Thu, 23 Aug 2018 11:54:59 by sascha
Wow, really great stuff! Works like a charm on my Dell XPS13 (Fedora26). Thanks a lot for this!
Written on Wed, 15 Nov 2017 18:24:31 by LoJo
ATTRS{address} cannot be used anymore: https://bugzilla.redhat.com/show_bug.cgi?id=1391854
Written on Wed, 25 Jan 2017 16:17:13 by Jerther
I am using Ubuntu 16.04 mate x64. I got this to work with minor modifications. Sorry Wrong link is last post Here is a link to my process. https://goo.gl/W150yf
Written on Tue, 04 Oct 2016 22:13:35 by Paul
I am using Ubuntu 16.04 mate x64. I got this to work with minor modifications. Here is a link to my process. https://goo.gl/LebqAq
Written on Tue, 04 Oct 2016 22:10:44 by Paul
Hi, thank you for this. I am running Ubuntu 16.04 (with gnome desktop). Whenever I hit ALT F4 to close a window with the K810, it would instantly log me out of gnome, and mess up my gnome extensions. I could not find a way to disable the function keys. This post solved my problems. But note that I had to use #!/bin/bash instead of #!/bin/sh, otherwise the script wouldn't run. I am not sure why. And it needs x of course. And note that the address to use is the one from dmesg, in my case 18:5e:0f:6c:ef:7f. [ 544.208166] input: Logitech K810 as /devices/pci0000:00/0000:00:14.0/usb2/2-7/2-7:1.0/bluetooth/hci0/hci0:256/0005:046D:B319.0006/input/input20 [ 544.208531] hid-generic 0005:046D:B319.0006: input,hidraw3: BLUETOOTH HID v12.02 Keyboard [Logitech K810] on 18:5e:0f:6c:ef:7f Because at first I tried with the bluetooth address of the K810 that I get when running bluetoothctl (same address is displayed in the Bluetooth settings window in gnome), but that address turned out to be the wrong one to use.
Written on Wed, 03 Aug 2016 15:36:14 by Simonn