maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   How to use one of the leds as a scroll lock led (on N900). (https://talk.maemo.org/showthread.php?t=44267)

Matan 2010-02-12 16:07

How to use one of the leds as a scroll lock led (on N900).
 
I decided that I want to use the red led as a language indicator. Since I use groups for languages, this can easily done in X by using the option grp_led:scroll in the setxkbmap command. All that is left is to make the red led into a scroll lock led.

I decided to do this by using the led triggers mechanism. This is where the first problem appears: a bug in the lp5523 leds driver. See here for description and patch that fixes it.

After this bug is fixed (and incidentally, with this fix the leds can be used for displaying a heartbeat, or MMC activity), I wrote a simple trigger that allows any kernel code to turn the led on/off: http://my.arava.co.il/~matan/770/n900/kf/trig-keyb.diff .

Then I modified the keyboard driver, adding scroll lock led support: http://my.arava.co.il/~matan/770/n90...scrollock.diff . Unfortunately, the keyboard driver is compiled into the kernel, rather than as a module, so using this requires kernel flashing, while all the rest can be done with simple rmmod/insmod.

All that is left is setting the red led to be scroll lock led by a simple echo keyb > /sys/class/leds/lp5523:r/trigger and everything works as intended.

Only a small proble remains: mce is an always running program with two very annoying properties:
  • It is proprietary.
  • It takes control of almost all of the N900 hardware, and cannot be told to handoff. Specifically, it turns off the red led whenever something happens.

There are two ways to get mce to leave the red led alone: edit the binary (/usr/lib/mce/modules/libled.so) changing the string /sys/class/leds/lp5523:r/brightness to any other string. Or changing the kernel led driver to rename the red led, thus making sure mce will not find it. Having worked on the driver already, I chose the second approach: http://my.arava.co.il/~matan/770/n900/kf/red-a.diff .


All times are GMT. The time now is 20:24.

vBulletin® Version 3.8.8