This page is out of date: the format is now:
$ leds [ready|status|disk-1|disk-2] [on|off|slow|fast|panic|blink|flash|user|cpu|cpu-idle]
With the OpenSlug 1.12 beta release there is a simple command
leds which sets the LEDs on the NSLU2 to the running state after system boot has complete.
In the following releases
leds is enhanced to allow direct setting of all four of the settable LEDs - the two ready/status LEDs (one red, one green) and the disk 1 and disk 2 LEDs. Note that the red and green leds together form the ready/status indicator and hence together control one of the lights on the outside of the slug.
There is no way to control the ethernet LED using this interface.
Access for program writers is as before, and is documented in ProgrammingTheOpenSlugLEDs.
At this time user level access to the buzzer and to the power and reset button output is not available. Program level access is possible, and is documented in the above page.
The OpenSlug boot sequence uses the ready/status LED pair to indicate boot progress, this is described in OpenSlugLEDsDuringBoot. These settings are accomplished using the
In OpenSlug 1.12
leds simply resets all settable LEDs to a state where only the green ready/status LED is on.
In later releases
leds puts the LEDs into the same state if given no arguments. With arguments individual control of each LED is supported.
- Turns the given LEDs off.
- Turns the given LEDs on.
- Makes the given LEDs flash.
- Makes the LEDs alternate between the state given by the previous options and a state with the LEDs in the
/ option on. This creates a transition between the two settings.
The LEDs are are identified by one or more characters as follows:
- The red ready/status LED.
- The green ready/status LED.
- The disk 1 LED.
- The disk 2 LED.
- All four LEDs.
leds -A +g1 !r
This sets the state of all LEDs to off (
-A) then marks the green ready/status and disk 1 LED to be on (
+g1) and the red ready/status LED to flash (
!r). Thus the commands sets green on, red flashing, disk 1 on and disk 2 off. Because red and green share the same light pipe the result is that the ready/status LED seems to flash amber/green.
This just turns the red ready/status LED on - the other LEDs are not changed in any way.
The green ready/status LED starts flashing. Because each LED is controlled by a separate timer the result of setting LEDs to flashing in different
leds commands is unpredictable - the synchronisation (or lack thereof) of the flashing depends on the exact delay between the commands.
leds -A +gr /g1
The initial state is set with the disk LEDs off and green and red on (amber). The final state is with green and disk 1 on and (by implication) red and disk 2 off. The LEDs are set to alternate between these two states, so the ready/status LEDs flash amber/green and the disk 1 light flashes (on when the ready/status is green, off when amber.)
leds -A +g /g
There is no change in this transition. The
leds command handles this by flashing the LEDs on and off. This is used in the boot process to indicate a state transition between two run states which use the same LED colour.
leds -A +g /r
This is a red/green transition - the ready/status LEDs will flash alternately red/green. Programmers should be aware that this is the only way of invoking the
When using a transition it is necessary to specify both the before and after states of the LEDs to be changed, so:
leds +g -r /r
also causes the red/green alternate flashing, but does not change the state of either of the disk LEDs. If the
-r were to be omitted the initial state of the red LED would be unknown and so nothing would be done to it - the command would just cause the green LED to flash.