1.\" $NetBSD: leds.4,v 1.8 2002/02/13 08:18:05 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 sun3 39.Os 40.Sh NAME 41.Nm leds 42.Nd sun3 diagnostic Light Emitting Diodes driver 43.Sh SYNOPSIS 44.Fd #include \*[Lt]machine/leds.h\*[Gt] 45.Sh DESCRIPTION 46With the exception of the Sun 3/80, all sun3 machines are equipped 47a diagnostic display of eight Light Emitting Diodes (LEDs), located 48on the back of the system unit. 49The Sun 3/80 has a single LED, which is located on the front panel. 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. 83With the exception of the 3/80, a set bit in a pattern indicates that its 84corresponding LED should be be extinguished, 85while a reset bit indicates an LED to be illuminated. 86On the 3/80 the polarity of the bits is reversed and only the lowest order bit 87is used. 88.Sh FILES 89.Bl -tag -width /dev/leds -compact 90.It Pa /dev/leds 91.El 92.Sh EXAMPLES 93The following example uses 94.Xr awk 1 95to display the repeating animation of a single lit LED scrolling from one end 96of the display to the other, using six clock ticks between each update. 97.Bd -ragged -offset indent 98# echo 5 8 254 253 250 247 239 223 191 127 | 99 awk '{ for (i=1;i\*[Le]NF;i++) printf("%c",$i+0); }' \*[Gt] /dev/leds 100.Ed 101.Sh ERRORS 102An I/O transfer to 103.Pa /dev/leds 104will complete successfully unless: 105.Bl -tag -width Er 106.It Bq Er EIO 107A read or write starting beyond the end of the file was attempted. 108.El 109.Sh SEE ALSO 110.Xr ppt 6 111.Sh HISTORY 112.Pa /dev/leds 113first appeared in 114.Nx 1.2 . 115