Code Monkey home page Code Monkey logo

clevo-keyboard-backlight's Introduction

clevo-keyboard-backlight

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:

  • Reads CPU load and based in this value, changes the color on one of keyboard's sector between green, yellow and red.
  • Reads Memory usage and based in this value, changes the color on one of keyboard's sector between green, yellow and red.
  • Detects display event of going idle and dims keyboard light gradually to zero till screen gets blank. On wakeup, keyboard's brightness is restored to its original value. (this is done based on dbus events, see code for details)

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.

  • kb_brightness - Set keyboard brightness (from 0 to 10)
  • kb_left - Set color of keyboard's left section
  • kb_center - Set color of keyboard's central section
  • kb_right - Set color of keyboard's right section
  • kb_off - Turns keyboard lights off/on

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

  • Install python app as a service

Feel free to fork, change, discuss, etc.

clevo-keyboard-backlight's People

Contributors

ejcosta-nos avatar ejcosta avatar

Watchers

James Cloos avatar Jaco Labuschagne avatar

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.