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];
};
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. With the exception of the 3/80, a set bit in a pattern indicates that its corresponding LED should be extinguished, while a reset bit indicates an LED to be illuminated. On the 3/80 the polarity of the bits is reversed and only the lowest order bit is used.
/dev/leds
# echo 5 8 254 253 251 247 239 223 191 127 | awk '{ for (i=1;iNF;i++) printf("%c",$i+0); }' > /dev/leds
/dev/leds
will complete successfully unless:
EIO
]
/dev/leds
first appeared in
NetBSD1.2.