View source for FreeRunner/Buttons and LEDs

From Openmoko

Jump to: navigation, search

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Administrators.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page:

Template used on this page:

Return to FreeRunner/Buttons and LEDs.

Personal tools

This is the Software specification for the Openmoko Neo FreeRunner Button and LEDs.

In progress: This article or section documents one or more features whose implementation are in progress.


What's currently implemented


Those are all userspace directories for controlling the LEDs. echo 0 > brightness will turn the LED off. echo 1 > brightness will turn it on. trigger currently does nothing.


  • AUX = Button on the left side of the device, upper area
  • POWER = Button on the right side of the device, center area (right below the USB socket)


EVENT red behind AUX button
HEARTBEAT orange behind POWER button
WIRELESS / BLUETOOTH blue behind POWER button
MIXING TWO LEDS purple behind POWER button if turning on the blue and the orang buttons together


  • OFF = Device has no power or has been shutdown
  • ON = Device is fully powered
  • ON+CHARGING = Device is fully powered and has been connected to a USB host or Openmoko charger.
  • LOCK = Device is fully powered, but has screen lock displayed
  • SUSPEND = Device has been suspended to low-power mode

Basic Button Usage

This is grouped by mode:

Mode: OFF

  • To switch the device on: Press and hold POWER until the boot logo appears.
  • To enter the "normal" (NAND) boot menu: Press and hold POWER, one second later press and hold AUX.
  • To enter the "rescue" (NOR) boot menu: Press and hold AUX, then press and hold POWER.

Mode: ON

  • To suspend the device: Press POWER.
  • To shut down the device: Press and hold POWER for 4 seconds. If the device hangs, press and hold POWER for 8 seconds. If it still hangs, remove the battery and disconnect from USB.
  • To go to the home screen: Press AUX.
  • To display the profile screen: Press and hold AUX until it appears.


  • To wakeup the device: Press POWER.

Basic LED Usage

LEDs are very useful in broadcasting valuable basic status information to the user in a way that the user does not have to unlock the device, enable the screen or turning the screen saver off and subsequently search the screen for basic status information.

This is grouped by mode:

Mode: OFF

  • All LEDs will be turned off.

Mode: ON

  • HEARTBEAT will emit a short blink every 4 seconds.
  • If Bluetooth is powered on, WIRELESS will emit a short blink every 2 seconds.
  • If Wifi is powered on, WIRELESS will emit a long blink every 2 seconds.
  • If Bluetooth and Wifi are powered on, WIRELESS will be lit continuosly.


Same as ON, with the exception of

  • HEARTBEAT will increase blinking as the charge level of the battery increases.
  • HEARTBEAT will be continuosly lit, if the battery has been fully charged.


  • All LEDs will be turned off.

Advanced Button/LED Usage

  • In ON-Mode, EVENT will blink every 2 seconds if there's an event that needs your attention.
  • The more events, the faster EVENT will blink.
  • Pressing AUX will acknowledge the event with the topmost priority and display it to you.
  • EVENT will stop to blink once all events have been acknowledged.

A first rules implementation

A C implementation of these rules has been done by smurfy - phil and is available at

Python Script For Blinking Leds By Beats

Reads beats from a file and blinks FreeRunners leds.

File format is human readable text, consisting of a simple sequence of integer quartet (4 numbers). The first number representing status of blue power-led, second means status of orange power-led and third means status of red aux-led. 0=OFF, 1=ON. (If blue=1 and orange=1 then power=lila. This has nothing to do with this python script or this file format.) The last number represents the duration in milliseconds to hold that situation of leds. Any non digit characters in the file count as a separators between numbers, but are otherwise ignored.

It requires packages python-core and python-re from opkg.

Led blinker

"""Led Blinker Player

Usage: python [filename]
import sys
import time
import re

def loadFromTextFile(filename):
   infile = open(filename)
   contents =
   return re.findall("(\d+)\D*(\d+)\D*(\d+)\D*(\d+)", contents)

def playNote(blue_value, orange_value, red_value, duration):
   blue.write(str(blue_value) + "\n")
   orange.write(str(orange_value) + "\n")
   red.write(str(red_value) + "\n")
   time.sleep(float(duration) / 1000.0)

def playFile(filename):
   global blue, orange, red 
   notes = loadFromTextFile(filename)
   blue = open("/sys/class/leds/gta02-power:blue/brightness", "w", 1)
   orange = open("/sys/class/leds/gta02-power:orange/brightness", "w", 1)
   red = open("/sys/class/leds/gta02-aux:red/brightness", "w", 1)

   for first,second,third, duration in notes:

   playNote(0, 0, 0, 0)

if __name__ == "__main__":

Example Beat

The following is an example "fireworks"-file that can be used to test the led blinker.

1 0 0 100
1 0 1 100
1 1 0 100
0 1 0 100
0 1 1 100
0 0 1 100
1 1 1 100
1 0 0 100
1 0 1 100
1 1 0 100
0 1 0 100
0 1 1 100
0 0 1 100
1 1 1 100
1 0 0 100
1 0 1 100
1 1 0 100
0 1 0 100
0 1 1 100
0 0 1 100
1 1 1 100

Led Power Status Perl Script

Use the blue and orange LED's under the power button to show battery power status. Install perl using "opkg install perl" to use this script. The script will indicate high battery with blue, medium battery by purple (blue + orange), and low battery by orange. Adjust values for your needs.

You can have it autostart by saving the script as /etc/init.d/
then creating a shell script /etc/init.d/ with just one line:

/etc/init.d/ &

and then create a symlink to it to auto start by running

ln -s /etc/init.d/ /etc/rc5.d/S15startlights

my $high_thresh = 75;
my $low_thresh = 30;
while(1) {
    my $command = `apm`;
    if ($command =~ m/battery .*: (\d*)%/) {
        print("Value: " . $1 . "\n");
    if($1 < $low_thresh) {
        print("Low Battery\n");
        $command = `echo 1 > /sys/devices/platform/gta02-led.0/leds/gta02-power:orange/brightness`;
        $command = `echo 0 > /sys/devices/platform/gta02-led.0/leds/gta02-power:blue/brightness`;
    if($1 > $high_thresh) {
        print("High Battery\n");
        $command = `echo 1 > /sys/devices/platform/gta02-led.0/leds/gta02-power:blue/brightness`;
        $command = `echo 0 > /sys/devices/platform/gta02-led.0/leds/gta02-power:orange/brightness`;
    if(($1 <= $high_thresh) && ($1 >= $low_thresh)){
        print("Mid Battery\n");
        $command = `echo 1 > /sys/devices/platform/gta02-led.0/leds/gta02-power:blue/brightness`;
        $command = `echo 1 > /sys/devices/platform/gta02-led.0/leds/gta02-power:orange/brightness`;