Controlling the Status LED on the Nokia N900
My latest adventure with the Nokia N900 has been learning how to control the Status LED on the front of the Nokia N900. The best discussion of this can be found in the thread (N900) Possible to change the colour of the notification light???.
Codemonkey listed the current set of patterns and said that adding new patterns to the list should be easy, but that getting other applications to use the new patterns might be difficult. So, I figured I would go out and add a few new patterns and see if I could get them to work.
The patterns are in the /etc/mce/mce.ini file. This is a text file you can edit with any text editor. It is suggested that you make a backup copy of the mce.ini file, which is a good idea. However, I don’t believe you can really do a lot of damage editing this file.
Editing existing patterns is relatively simple. The one thing that you need to know is that the N900 appears to use the patterns in the [LEDPatternLystiRX51] section, so make sure you are editing the right pattern in the right section. I did find it challenging to use multiple engines, which is what appears to be necessary to make the led flash different colors. I may come back to that again later.
Adding a new pattern requires one additional step. There is a section called [LED] which have a list of patterns. Any new pattern should be added to this semi-colon delimited list. For my purposes, the first thing I did was add the PatternExample pattern to this list so I could use it in testing. Later, I added PatternFoo for additional testing. For my purposes, I may add seven new patterns, PatternR, PatternG, PatternB, PatternRG, PatternRB, PatternBG and PatternRGB. Each of these would leave the LED on for the specified color.
The next step was to reload the patterns. I used the command
initctl stop mce; sleep 2; initctl start mce
Finally, I could test my patterns. Lifting from the script that CodeMonkey provided, I used the commands
dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate string:PatternExample
dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate string:PatternExample
to turn on and off the LED patterns. Throwing this into a shell script with appropriately placed ‘sleep’ commands, I could make an interesting set of LED display sequences.
With that, I am now thinking about different things I could do with this. For example, I probably set up dbus-scripts to make the lights do different things when various events happen on the phone. I could use this to add lights to various other scripts that I use, such as the hdr script I’ve been playing with. I could also see this as a nice addon to various games, for example a racing game where the LED goes from red to amber to green to indicate the start of the race.
So, are you doing anything interesting with the Status LED on your Nokia N900?