N810 LED Howto
Last edited February 1, 2008
More by darklajid »
LED Pattern Format

LED styles (called "Pattern") are defined in /etc/mce/mce.ini, in the [LEDPatternNJoyRGB] section. The comments in there are good, but for the sake of this tutorial I'll go through it once again, looking at two predefined patterns

PatternError=0;1;0;40002000200040ff200020000000;0000;0000
PatternBatteryFull=40;4;0;0000;407f0000;0000

The parameters, in order:
  • Priority: More than one pattern can be active, only one "wins" though, according to this number
  • ScreenOn, specifies in which device state the pattern is used (see the mce.ini comments)
  • Timeout, the number of seconds the pattern will be active. 0 for infinite
  • NJoy script for red
  • NJoy script for green
  • NJoy script for blue
The last three parameters need some clarifications, for this we'll look at the samples above:

PatternError flashes a red light on and off. Therefor the green and blue part of the pattern are not used (set to 0000, which does nothing on its own). The red part is interesting here. It's parsed in 2 byte steps (4 letters):

4000:
    This sets (40) the brightness of this color to 00, turning the color effectively off
2000:
    This waits a short amount of time (20 could increase/decrease the speed of the animation, but the parameter 00 doesn't change anything: This is a sleep())
2000:
    See above
40ff
    This sets (40) the brightness of this color to FF, turning the red part to max. brightness
2000
    See 2000 above.
2000
    Same
0000
    This loops back to the start of the pattern (thereby reaching 4000, turning the LED off again etc..)

PatternBatteryFull just shows a green light.. Therefor the red and blue part of the pattern are not used (set to 0000, which does nothing on its own). This time we look at the green part:

407f:
    This sets (40) the brightness of this color to 7F, about half power for the green LED
0000:
    This loops the entry, therefor keeping the LED at 7F constantly


 Pattern Usage

You can activate patterns with the dbus-send command:

/usr/bin/dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate string:"YourPatternHere"

and deactivate it respectively with

/usr/bin/dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate string:"YourPatternHere"

I suggest creating oneliner scripts for both commands that activate/deactivate the pattern that
you provide on the commandline:

#!/bin/sh
/usr/bin/dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate string:"$1"
The content on this page is provided by a Google Notebook user, and Google assumes no responsibility for this content.