Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

Thanks!

share|improve this question
add comment

3 Answers

Well, as it turns out, someone else actually figured it out. A huge "Thank You" to "klystron34" over in the notebookreview.com 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://git.code.sf.net/p/clevo-wmi/code clevo-wmi-code

Go into the directory with the source code:

cd clevo-wmi-code

"Make" the kernel module:

make

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:

/sys/devices/platform/clevo_wmi/kbled

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:

clevo_wmi

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 28 mins ago
add comment

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: ubuntuforums.org/showthread.php?t=1998969 –  david6 Sep 7 '12 at 7:53
    
    
PDF (source model): bestdeal4u.com.au/store/files/Clevo_W595_Brochure_June_2012.pdf –  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
add comment

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: http://www.linux-onlineshop.de/forum/index.php?page=Thread&threadID=26

Have fun :)

share|improve this answer
add comment

Your Answer

 
discard

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.