ejcosta / clevo-keyboard-backlight

Driver for Clevo keyboards w/backlights
29 stars 14 forks source link

clevo-keyboard-backlight

:warning: This repo has been archived due to lack of time to maintain it, feel free to fork! :warning:

This is a bundle of TuxedoWmi driver for Clevo's keyboard with some additional extras. I've made some changes to kernel module in order to export parameters so you can control keyboard sectors and colors independently. A mix between this and this.

This was done for Ubuntu, feel free to adapt and test on other distros.

Additionally I’ve done a simple service in python to explore keyboard's functionalities and give some useful feedback to user. This service runs in background and have this features:

Code is divided in two parts (driver and service) in case you just want one of them.

Driver

Installation

Prior to install driver you probably need run this:

$ sudo apt-get update
$ sudo apt-get install git build-essential linux-source

Running "driver/install.sh" should be enough to get module compiled and running. This script is self-explanatory; compile kernel module, install and load. Additionally it adds an entry on "/etc/modules" to persist between restarts.

$ cd driver
$ sudo ./install.sh

Usage

This module exports some parameters to "/sys/module/tuxedo_wmi/parameters/" that you can use to manipulate keyboard's lights and colors.

Examples

$ cd /sys/module/tuxedo_wmi/parameters/
# set keyboard brightness to level 5
$ sudo su -c 'echo "5" > kb_brightness'
# set purple color on keyboard's center section (see all color codes above)
$ sudo su -c 'echo "3" > kb_center'
# set keyboard lights off
$ sudo su -c 'echo "1" > kb_off'

Color codes

'off':    '0',
'blue':   '1',
'red':    '2',
'purple': '3',
'green':  '4',
'ice':    '5',
'yellow': '6',
'white':  '7',
'aqua':   '8',

Service

Installation

Prior to install service you need install some dependencies:

$ pip install -r service/requirements.txt

Run "service/install.sh" to copy app to "/var/lib/kb_light_stats" and config file to "/etc/kb_light_stats/kb_light_stats.conf".

$ cd service
$ sudo ./install.sh

Edit config file to fit your needs.

Usage

Launch daemon:

$ sudo service/kb_light_stats.py

Todo's

Feel free to fork, change, discuss, etc.