LEDS(4) (Sun2)

LEDS(4) | Kernel Interfaces Manual (Sun2) | LEDS(4)

# NAME

leds — sun2 diagnostic Light Emitting Diodes driver

# SYNOPSIS

#include <machine/leds.h>

# DESCRIPTION

All sun2 machines are equipped a diagnostic display of eight Light Emitting Diodes (LEDs), located on either the front (deskside chassis) or the back (desktop machine) of the system unit.

The kernel changes the display during periods of idle processor activity according to a stored sequential pattern list. The /dev/leds interface provides a way of manipulating the pattern list via simple file I/O.

The structure of the file is as follows:

    struct led_patterns {
            u_char divisor;
            u_char patlen;
            u_char pat[256];
    };

divisor
  The number of idle periods to wait before switching to the next pattern in the array.
patlen
  The number of patterns stored in the array.
pat
  The array of patterns to display.

When a clock interrupt occurs while the processor is idle, a pattern countdown timer is decremented. When the countdown timer reaches zero it is reset with the divisor value and the next pattern in the array is selected and displayed.

Each 8-bit pattern describes the state of the diagnostic LEDs. A set bit in a pattern indicates that its corresponding LED should be extinguished, while a reset bit indicates an LED to be illuminated.

# FILES

/dev/leds

# EXAMPLES

The following example uses awk(1) to display the repeating animation of a single lit LED scrolling from one end of the display to the other, using six clock ticks between each update.

# echo 5 8 254 253 251 247 239 223 191 127 |
awk '{ for (i=1;i≤NF;i++) printf("%c",$i+0); }' > /dev/leds

# ERRORS

An I/O transfer to /dev/leds will complete successfully unless:

[EIO]
  A read or write starting beyond the end of the file was attempted.

# SEE ALSO

ppt(6)

# HISTORY

/dev/leds first appeared in NetBSD 1.2.

March 2, 1996 | NetBSD 5.99