xref: /netbsd-src/share/man/man4/man4.sun2/leds.4 (revision ec184f3bfb1748cb9888890166d23cf91dc27cf8)
1.\"	$NetBSD: leds.4,v 1.11 2022/08/28 10:48:16 hgutch Exp $
2.\"
3.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by der Mouse and Jeremy Cooper.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd March 2, 1996
31.Dt LEDS 4 sun2
32.Os
33.Sh NAME
34.Nm leds
35.Nd sun2 diagnostic Light Emitting Diodes driver
36.Sh SYNOPSIS
37.In machine/leds.h
38.Sh DESCRIPTION
39All sun2 machines are equipped
40a diagnostic display of eight Light Emitting Diodes (LEDs), located
41on either the front (deskside chassis) or the back (desktop machine)
42of the system unit.
43.Pp
44The kernel changes the display during periods of idle processor activity
45according to a stored sequential pattern list.
46The
47.Pa /dev/leds
48interface provides a way of manipulating the pattern list via simple file I/O.
49.Pp
50The structure of the file is as follows:
51.Bd -literal
52struct led_patterns {
53        u_char divisor;
54        u_char patlen;
55        u_char pat[256];
56};
57.Ed
58.Bl -tag -width divisor
59.It Sy divisor
60The number of idle periods to wait before switching to the next pattern in
61the array.
62.It Sy patlen
63The number of patterns stored in the array.
64.It Sy pat
65The array of patterns to display.
66.El
67.Pp
68When a clock interrupt occurs while the processor is idle, a pattern
69countdown timer is decremented.
70When the countdown timer reaches zero
71it is reset with the
72.Sy divisor
73value and the next pattern in the array is selected and displayed.
74.Pp
75Each 8-bit pattern describes the state of the diagnostic LEDs.
76A set bit in a pattern indicates that its
77corresponding LED should be extinguished,
78while a reset bit indicates an LED to be illuminated.
79.Sh FILES
80.Bl -tag -width /dev/leds -compact
81.It Pa /dev/leds
82.El
83.Sh EXAMPLES
84The following example uses
85.Xr awk 1
86to display the repeating animation of a single lit LED scrolling from one end
87of the display to the other, using six clock ticks between each update.
88.Bd -ragged -offset indent
89# echo 5 8 254 253 251 247 239 223 191 127 |
90  awk '{ for (i=1;i<=NF;i++) printf("%c",$i+0); }' > /dev/leds
91.Ed
92.Sh ERRORS
93An I/O transfer to
94.Pa /dev/leds
95will complete successfully unless:
96.Bl -tag -width Er
97.It Bq Er EIO
98A read or write starting beyond the end of the file was attempted.
99.El
100.Sh SEE ALSO
101.Xr ppt 6
102.Sh HISTORY
103.Pa /dev/leds
104first appeared in
105.Nx 1.2 .
106