Giter Club home page Giter Club logo

k810_k811_fkeys's Introduction

k810_k811_fkeys

Logitech K810/K811 Keyboard F-keys switcher for Linux (Ubuntu)

Usage

sudo k81x-fkeys [-d device_path] [-v] on|off

"On" enables the regular functions of F1-F13 keys and special functions (like volume or brightness) are accessible after pressing the Fn key. "Off" does the opposite.

Binary installation

If your system supports deb files, you can simply grab an automatic build from https://github.com/themech/k810_k811_fkeys/releases and install it:

sudo dpkg -i k81x-fkeys_<version>_amd64.deb

You can then run the program at /opt/k81x/k81x-fkeys.

For Arch Linux you can use the AUR package:

gpg --recv-keys --keyserver hkp://pool.sks-keyservers.net 7FBFBFD17A45CAE7
pacaur -S k81x-fkeys

Installing from source code

Building

Simply download the source and either run make or compile it yourself by running:

g++ k81x-fkeys.cpp k81x.cpp -o k81x-fkeys -ludev

Installing via make

You can type sudo make install to install the binary and udev the scripts.

Manual installation

I find it convenient to setup an udev rule for this utility so it automatically sets the desired F-keys functions when the keyboard is connecting.

In order to do so copy the k81x-fkeys binary to some location (like /opt/k81x/) and add a following k81x.sh bash script in the same directory:

#!/bin/bash
if [ -z "$1" ];
then
    /opt/k81x/k81x-fkeys -s on
else
    /opt/k81x/k81x-fkeys -s -u $1 on
fi

You can change on to off it that's your desired setup. And specify a device path with -d switch in case the autodetection doesn't work. Also remember about the execute permission: chmod a+x /opt/k81x/k81x.sh.

Now it is time to hook this bash script into udev. Create /etc/udev/rules.d/00-k81x.rules with the following content:

ACTION=="add", KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{address}=="XX:XX:XX:XX:XX:XX", RUN+="/opt/k81x/k81x.sh"

The XX:XX:XX:XX:XX:XX should be replaced with your keyboard Bluetooth address. To find the address simply go to the Bluetooth settings (All Settings>Bluetooth), select the Logitech keyboard on the Devices list and copy its address displayed there. You can also skip the ATTRS{address}=="XX:XX:XX:XX:XX:XX", part. In that case k81x.sh will be also executed for other devices but won't do anything.

Note: On some systems the address attribute is not available. You can try removing it and using this generic rule instead:

ACTION=="add", KERNEL=="hidraw*", SUBSYSTEM=="hidraw", RUN+="/opt/k81x/k81x.sh %S%p"

This means the k81x.sh can also be triggered for other HID devices than you keyboard. But as we're passing the device path as the parameter, calls from those devices will be ignored.

k810_k811_fkeys's People

Contributors

adrianmsmith avatar themech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

k810_k811_fkeys's Issues

Issue on Ubuntu 22.04

Hello

I have install using : sudo dpkg -i k81x-fkeys_0.2-1_amd64.deb

When I launch : sudo k81x-fkeys I get command not found

And how can I find my device_path ?

Thank you

Control for the keyboard backlight

Firstable, big thanks for putting effort into this, which would basically have been logitechs task. I suppose the backlight of the keyboard should be possible to control in a similar way? If so, it would be great to have it integrated here.

AUR Package support

Could be possible to have an AUR package submitted for this software? It's more useful and refined than k810-conf (as well as source-available), so it would be cool.

I'm asking this as it seems the project is still active and build procedures should not change a lot between versions.

Support for Logitech K380/K780

Hi, would it be possible to add support for the Logitech K380 and K710 Keyboard?

K380:
#define HID_DEVICE_ID_K380 (__s16)0xb342
const char k380_seq_fkeys_on[] = {0x10, 0xff, 0x0b, 0x1e, 0x00, 0x00, 0x00};
const char k380_seq_fkeys_off[] = {0x10, 0xff, 0x0b, 0x1e, 0x01, 0x00, 0x00};

K780:
#define HID_DEVICE_ID_K780 (__s16)0xc52b
const char k780_seq_fkeys_on[] = {0x10, 0x02, 0x0c, 0x1c, 0x00, 0x00, 0x00};
const char k780_seq_fkeys_off[] = {0x10, 0x02, 0x0c, 0x1c, 0x01, 0x00, 0x00};

HID Proxy (a long shot)

This is a long shot but thought I'd ask.

We've got a couple of K810's paired with D-Link DBT-120 bluetooth dongles. These dongles can run alternate firmware which enables HID Proxy mode. In essence our PC's don't see our K810's as bluetooth keyboards, but rather as USB ones via the DBT-120 dongles (and the OS doesn't even realise they are bluetooth dongles - not unless you run the hid2hci utility to swap it back).

We do this because it makes rebooting between OS's (and accessing the BIOS) a dream as there are no worries about pairing... and you can take the keyboard (with dongle) "to go" for other machines - kind of like a Logitech Unifying Receiver.

Is it likely that the k81x-fkeys utility can be used still given this? I'm getting the impression it just sends a magic sequence and it probably doesn't matter if it's a USB HID device or a Bluetooth one? Not had any luck just yet though...

p.s. Does anyone else find (irrespective of this utility) that the multimedia keys (on F5 to F12) do not function in the slightest on Linux? (I'm on Ubuntu MATE 18.04 personally)... I've read this may be something to do with keycodes higher than 255 but things like evtest/xev don't even recognize you've pushed any key (tried in HID proxy mode, tried in bluetooth mode using both the D-Link DBT-120 and also my laptops built in bluetooth).

Thank you

Just a huge thank you for this simple and effective fix. Works on Ubuntu 22 LTS for me using your provided .deb.

switch k810 fn key on mac

i'm on mac and i'm using the k810, it's not supported out of the box, is there a way to make this script work, or at least a terminal command to switch fn keys ?

Automatic recognition of the hidraw device

Hi there! I didn't know the existence of this repo so I was using k810-conf (the original, has an AUR package).

I usually use this command to turn on my F keys:

sudo k810-conf -d /dev/`grep -H "Logitech K810" /sys/class/hidraw/hidraw*/device/uevent | cut -d/ -f 5` -f on

Do you think this "discovery" is possible to implement on the code? I'm not versed on C++ and I understand executing shellcode is not the best way to do it, but nonetheless it should not be difficult, so I may try to fork it and send you a PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.