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