Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here's my situation:

I recently purchased a Sager NP9170 (same as the Clevo P170EM) and it has a multi-colored, backlit keyboard. Under Windows 7, you can launch an app that allows you to change the color of the backlighting to any of a handful of colors (blue, green, red, etc).

I want that same functionality under Linux. I haven't been able to find any software that does this, so I guess I'm going to have to write it myself. I'm a programmer by trade, but I've haven't done much low level programming, and I've certainly never written a device driver, so I was wondering if anyone could answer these two questions:

1) Is there any software already out there that does this sort of thing? I've looked fairly thoroughly but haven't found anything applicable.

2) Where would I start in trying to reverse engineer this sort of thing? Any useful articles, tutorials, books that might help?

And just to clarify: The backlighting already works, that's not the problem. I just want to be able to change the color of the backlighting. This functionality is supported by the hardware. The laptop came with windows software that does this and I want the same functionality in Linux. I am willing to write this software myself, I just want to know the best way to go about it.


share|improve this question

Well, as it turns out, someone else actually figured it out. A huge "Thank You" to "klystron34" over in the forums. Check out the forum thread for more information.

Note: As far as I know, this will work for many/most laptops based on the stock Clevo P150EM and the P170EM. This was personally verified by me on a Sager NP9170 on Ubuntu 12.04. Proceed at your own risk. I'm not responsible for any damage you might cause doing this, and any other standard internet disclaimers. Proceed at your own risk. Now, onto the good stuff:

First, you need to be able to compile a kernel module, so update your repositories:

sudo apt-get update

Now, install git, the build tools and the kernel source:

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

Now create a working directory. I prefer to use a "dev" folder located in my home directory:

cd ˜
mkdir dev
cd dev

Now, download the source for the kernel module:

git clone git:// clevo-wmi-code

Go into the directory with the source code:

cd clevo-wmi-code

"Make" the kernel module:


You should now have a file called clevo_wmi.ko

Now, let's test and see if the module actually works by loading the module:

sudo insmod /home/<your-username-here>/dev/clevo-wmi-code/clevo_wmi.ko

If it worked, you should now have a new directory called:


Change over to that directory:

cd /sys/devices/platform/clevo_wmi/kbled

You should now be able to change the colour of the middle section of your keyboard by executing the following command:

sudo su -c 'echo 100 > middle'

The middle section of your keyboard should now be green. Replace middle with left or right to change the corresponding section of the keyboard. Here's a list of the color codes:

GRB (Green-Red-Blue)
000 - Off
111 - White
100 - Green
010 - Red
001 - Blue
110 - Yellow
011 - Purple
101 - Aqua

To install this kernel module permanently, copy it into the same location as the rest of your kernel modules (NOTE: You will probably have to perform this step and the next step anytime you change your kernel):

sudo cp ~/dev/clevo-wmi-code/clevo_wmi.ko /lib/modules/`uname -r`/kernel/drivers/platform/x86/

Next, do this (I think rebuilds the list of kernel modules):

sudo depmod -a

Then edit your /etc/modules file and add this line to the end of the file:


Save your changes to /etc/modules.

Now, whenever you reboot, the module should be loaded and you can then change the colour of the backlight on your keyboard. Figuring out how to have it change colours on reboot and remembering your last colour setting is an exercise left up to the reader. Check the docs directory in the sourcecode for instructions on how to use the dynamic colour changing features.

Thanks agin to the developer(s) that worked hard on writing this kernel module!

share|improve this answer
I am delighted :D Thanks. Would be great if it got included in the kernel someday. BTW: are there any standard ways of exposing this to the UI, so that Unity or other WM could use it? – bcelary Apr 18 '14 at 15:33

How do you access such functionality?

This can probably be achieved by some clever scripting, and startup functionality.

( In Windows you would likely need to write code in an exotic memory model allowing direct hardware access, or instead need to write a driver (and API) to detect and control the hardware. )

How do you select your preferences?

Then some basic scripts (or icon calling scripts) could select a specific color-preference.

If you used Python, for a front-end GUI, it would also be fairly simple.

share|improve this answer
Thanks for your response! What I'm looking for is either: a) a link to some software that I missed that already does this. b) some guidance on where to start in determining more about the keyboard. – PopeJamal Sep 7 '12 at 3:06
Check out: – david6 Sep 7 '12 at 7:53
PDF (source model): – david6 Sep 7 '12 at 8:15
You need to identify the part number/brand for the keyboard component .. – david6 Sep 7 '12 at 8:19

There already exists an driver for all the functions for the whole keyboard AND flymode-key! TUXEDO Computers developed this driver and offers it through their support-forum:

Have fun :)

share|improve this answer

I created a script for changing the colors using the above method by Pope. You can find it here: pb aDWe9s6d (not sure if the formatting here will work right so safer to copy from there)

#! /bin/bash
#changes keyboard colors
#Noah B.

#Prompt for root
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"




if [ -z "$left" ]
    echo "Enter desired color for the left side:
read -p "Color choice: " left

eval "l_code=\$$left"

echo $l_code > /sys/devices/platform/clevo_wmi/kbled/left


if [ -z "$middle" ]
    echo "Enter desired color for the middle:
read -p "Color choice: " middle

eval "m_code=\$$middle"

echo $m_code > /sys/devices/platform/clevo_wmi/kbled/middle


if [ -z "$right" ]
    echo "Enter desired color for the right side:
read -p "Color choice: " right

eval "r_code=\$$right"

echo $r_code > /sys/devices/platform/clevo_wmi/kbled/right
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.