All Projects → whereswaldon → Kfreestyle2d

whereswaldon / Kfreestyle2d

Licence: mit
Unofficial Kinesis Freestyle 2 Userspace Linux Driver

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Kfreestyle2d

uchroma
An advanced driver for Razer Chroma hardware in Linux
Stars: ✭ 45 (+9.76%)
Mutual labels:  keyboard, driver
Emojikeyboard
自定义表情键盘(支持系统表情, 图片表情),仅供参考学习~
Stars: ✭ 33 (-19.51%)
Mutual labels:  keyboard
Adfilter
This is a ad filter software using dns based on tdifw
Stars: ✭ 15 (-63.41%)
Mutual labels:  driver
Hdbc Mysql
This package provides a MySQL driver for Haskell's HDBC library, implemented via bindings to the C mysqlclient library.
Stars: ✭ 29 (-29.27%)
Mutual labels:  driver
Keystroke dynamics
a keystroke dynamics algorithm in python (recognizes a person by the way s/he types)
Stars: ✭ 21 (-48.78%)
Mutual labels:  keyboard
Networkmnt
Monitor network float of process
Stars: ✭ 31 (-24.39%)
Mutual labels:  driver
Sodieremojikeyboardplus
支持自定义emoji表情,icon font , FontAwesome,斜体,超链接,粗体,下划线,字体,颜色,镂空字体等富文本
Stars: ✭ 14 (-65.85%)
Mutual labels:  keyboard
Jquery Keyfilter
This plugin filters keyboard input by specified regular expression.
Stars: ✭ 37 (-9.76%)
Mutual labels:  keyboard
Kitchen Terraform
Test Kitchen plugins for testing Terraform configurations
Stars: ✭ 963 (+2248.78%)
Mutual labels:  driver
Mechanical Keyboard
DIY mechanical keyboard and where to find them
Stars: ✭ 947 (+2209.76%)
Mutual labels:  keyboard
Silence
A simple, clean macro recorder written in C#. Windows 10 compatible.
Stars: ✭ 29 (-29.27%)
Mutual labels:  keyboard
Ds4 driver
DualShock 4 driver for ROS
Stars: ✭ 28 (-31.71%)
Mutual labels:  driver
Clj Odbp
A Clojure driver for OrientDB binary protocol
Stars: ✭ 31 (-24.39%)
Mutual labels:  driver
Rust Uefi Runtime Driver
Template for UEFI runtime drivers written in Rust with serial logging and debugging support.
Stars: ✭ 21 (-48.78%)
Mutual labels:  driver
Cmd Toutiao
摸鱼神器:在命令行中看今日头条
Stars: ✭ 34 (-17.07%)
Mutual labels:  keyboard
Awesome Android Things
A curated list of awesome android things tutorials, libraries and much more at one place
Stars: ✭ 883 (+2053.66%)
Mutual labels:  driver
Voyager65 Keyplus
65% keyboard PCB for Keyplus firmware. Simplified variants available.
Stars: ✭ 29 (-29.27%)
Mutual labels:  keyboard
Androidthings Drivers
Android Things open source peripheral drivers
Stars: ✭ 30 (-26.83%)
Mutual labels:  driver
React Spreadsheet Grid
An Excel-like grid component for React with custom cell editors, performant scroll & resizable columns
Stars: ✭ 996 (+2329.27%)
Mutual labels:  keyboard
Chrome Virtual Keyboard
Touch-friendly Virtual Keyboard for Chrome browser
Stars: ✭ 35 (-14.63%)
Mutual labels:  keyboard

kfreestyle2d

Unofficial Kinesis Freestyle 2 Userspace Linux Driver

SECURITY NOTICE: This program should not run as root! Read the Install instructions for details on how to set the correct permissions on the device files that the driver opens so that it can do so with normal user permissions.

The Kinesis Freestyle 2 keyboard is a fantastic split keyboard for people who don't want RSI in their wrists. It has four multimedia keys on F8-F11 that do not work in Linux. This is a simple program that enables those keys. If you care how it works, keep reading. If not, skip to the Build instructions.

Origin

I spent a weekend digging into how this keyboard sent input for these multimedia keys. I documented the process in a series of blog posts:

Supported Systems

kfreestyle2d itself only depends on the Linux kernel. If you run Linux with uinput version 4 or later, you should be fine.

The automatic execution of kfreestyle2d currently depends on udev and systemd. If you run a system that uses a different init system or device manager, we'd love some help with automatic installation procedures on those systems.

How it works

The multimedia keys seem not to be understood properly by the hid-generic kernel module that usually interprets events from HID (Human Interface Devices). They are understood by the hidusb kernel module though, so you can read the raw HID file to get the stream of bytes coming from the USB device.

This program uses a special kernel interface called uinput that allows drivers for input devices to run as user programs. kfreestyle2d simply opens the raw byte stream from the keyboard's special function keys. When it reads a keypress, it translates the HID Usage ID of the key that it read into a keypress that the uinput system understands. This allows the kernel to interpret the keypress correctly and dispatch it to userspace programs like Xorg properly.

Build

make will create the binary kfreestyle2d in the current directory. If you want to try it without installing it, skip to the Manual Run section below.

Install

Please check the makefile before installing. You may wish to adjust the value of PREFIX or one of the other macros.

To properly install kfreestyle2d, you should be able to simply run sudo make install. This will:

  • Create a directory (default is /usr/local/share/kfreestyle2d) to store the executable and script.
  • Create some udev rules in /etc/udev/rules.d/99-kfreestyle2d.rules
  • Create a new systemd service file in /etc/systemd/system/kfreestyle2d.service

Once those things are done, the driver should run automatically when you plug in the keyboard and should stop when you unplug it. If you have any problems running this command, please open an issue.

Please note that the current setup only supports one Kinesis Freestyle 2. If you want to plug multiple Kinesis Freestyle 2 keyboards into the same computer, you'll need to customize the automatic execution accordingly.

Manual Run

This procedure will work to test whether the userspace driver is working without the udev and systemd automation in place. If you already followed the Install directions, you shouldn't need to do this.

First, ensure that the uinput kernel module is loaded with lsmod | grep uinput. If that does not return a line containing uinput, run sudo modprobe uinput to load the userspace input module into your kernel.

The driver expects to be given the path to an HID raw input device that corresponds to the special function keys of a Kinesis Freestyle 2.

To find the correct HID raw input device, unplug your keyboard and ls /dev/hidraw*. Then plug it in and ls /dev/hidraw*.

There should be two new /dev/hidrawX files the second time.

Try sudo head -c 1 /dev/hidrawA where A is the first new raw input file. Then type on your keyboard. If the command exits, it just read normal keyboard input from that file, which means that it is not the special function key raw input file. If the command does not exit, try typing one of the special keys (mute, volumedown, volumeup, calculator). Remember to press the function key before trying to use these. If the command exits when you type a special key, this is the file you're looking for.

To start the driver, run: ./kfreestyle2d /dev/hidrawX where X is the number of the raw input device for the special keys.

When the driver is running, it should create a new /dev/input/eventXX file, where XX is some number with 1-3 digits. You can run sudo evtest /dev/input/eventXX on that file to see the output generated by the driver when you press those keys.

If the driver isn't generating output, feel free to create an issue.

If it is, you should now be able to configure your programs to handle these keys using ordinary X or Wayland key configuration.

Contribute

Suggestions and PRs welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].