summaryrefslogtreecommitdiff
path: root/share/man/man4/man4.sun3/leds.4
blob: 680cf294ef5f927b058172d088a63d6cebf0cd28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.\"	$OpenBSD: leds.4,v 1.4 2001/10/05 14:45:54 mpech Exp $
.\"
.Dd March 2, 1996
.Dt LEDS 4 sun3
.Os
.Sh NAME
.Nm leds
.Nd back-panel LEDs
.Sh DESCRIPTION
The file
.Pa /dev/leds
is an interface to the diagnostic array of 8 light-emitting diodes on
the back of the computer.
.Pp
This file contains two
.Li unsigned int Ns s
(in native byte order, as would be written by passing the address of an
.Sy unsigned int
to
.Xr write 2 ,
which on a Sun-3 means big-endian), followed by a string of bytes.
The string of bytes gives the successive patterns to be displayed on the
LEDs; each byte's bits are taken and used to drive the LEDs.
A 0 bit illuminates the corresponding LED; a 1 bit leaves the corresponding
LED dark.
The first
.Li unsigned int
gives the number of clock ticks that are skipped after each pattern is
loaded before the next is loaded.
For example, if this value is 0, a new pattern is loaded each clock tick;
if it is 3, a new pattern will be loaded every fourth clock tick (i.e., three
ticks will be skipped between loads).
The second
.Li unsigned int
gives the number of patterns in the list, that is, the number of bytes
following the two
.Li unsigned int Ns s.
.Pp
There are limits on the two integer values; attempting a write that
would cause either of them to take on too large a value causes the
write to return EIO without affecting anything.
The limits are compiled into the kernel; as of this writing, the first one
can be at most 128, the second at most 10240.
.Sh EXAMPLES
This example displays a single lit LED scrolling from one end of the
display to the other, over and over, moving every six clock ticks.
The first eight bytes supply the two
.Li unsigned int Ns s
mentioned above; the other eight specify the patterns.
(Convert them to binary, and remember that 0 bits mean lit LEDs.)
.Bd -ragged -offset -ident
# echo 0 0 0 5 0 0 0 8 254 253 250 247 239 223 175 127 |
  awk '{ for (i=1;i<=NF;i++) printf("%c",$i+0); }' > /dev/leds
.Ed
.Sh FILES
.Bl -tag -width /dev/leds -compact
.It Pa /dev/leds
.El
.Sh HISTORY
.Pa /dev/leds
appeared in post-2.0 OpenBSD.