freebsd-dev/share/man/man4/led.4
Poul-Henning Kamp 9491306ad3 Improve semantics of the 'sequence' command to led(4) devices:
use lowercase for off and upper case for on.

Approved by:	re@
2003-11-27 20:23:32 +00:00

165 lines
4.4 KiB
Groff

.\" Copyright (c) 2003 Sergey A. Osokin <osa@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd November 3, 2003
.Dt LED 4
.Os
.Sh NAME
.Nm led
.Nd enable soekris hardware specific options like the error LED
.Sh SYNOPSIS
.In dev/led/led.h
.Bd -literal
typedef void led_t(void *priv, int onoff);
.Ed
.Ft dev_t
.Fo led_create
.Fa "led_t *func"
.Fa "void *priv"
.Fa "char const *name"
.Fc
.Ft void
.Fo led_destroy
.Fa "dev_t dev"
.Fc
.Sh DESCRIPTION
The
.Nm
driver provides generic support for handling LEDs, lamps and other
announciators.
.Pp
The hardware driver must supply a function to turn the announciator on and off
and the device
.Va name
of the announciator relative "/dev/led/".
The
.Va priv
argument is passed back to this on/off function and can be used however
the hardware driver sees fit.
.Pp
The lamp can be controlled by opening and writing ascii strings to the
"/dev/led/bla" device.
.Pp
In the following we will use this special notation to indicate the resulting
output of the announciator:
.Bl -tag -width Ds -offset indent -compact
.It Ic *
The announciator is on for 1/10th secound.
.It Ic _
The announciator is off for 1/10th secound.
.El
.Pp
State can be set directly, and since the change happens immediately,
it is possible to flash the announciator with very short periods and
synchronize it with program events.
It should be noted that there is a non-trivial overhead, so this may
not be usable for benchmarking or measuring short intervals.
.Bl -tag -width Ds -offset indent -compact
.It Ic 0
Turn the announciator off immediately.
.It Ic 1
Turn the announciator on immediately.
.El
.Pp
Flashing can be set with a given period. The pattern continues endlessly.
.Bl -tag -width Ds -offset indent -compact
.It Ic f
_*
.It Ic f1
_*
.It Ic f2
__**
.It Ic f3
___***
.It Ic ...
.It Ic f9
_________*********
.El
.Pp
Three high-level commands are available:
.Bl -tag -width Ds -offset indent -compact
.It Ic d%d
numbers. Each digit is blinked out at 1/10th second, zero as
ten pulses. Between digits a one second pause and after the last
digit a two second pause after which the sequence is repeated.
.It Ic s%s
string.
This gives full control over the announciator.
Letters 'A' ... 'J' turns the announciator on for from 1/10th to one full
second.
Letters 'a' ... 'j' turns the announciator off for 1/10th
to one full second. The sequence is immediately repeated.
.It Ic m%s
morse.
.Bl -tag -width Ds -offset indent -compact
.It Ic '.'
becomes _*
.It Ic '-'
becomes _***
.It Ic ' '
becomes __
.It Ic '\en'
becomes ____
.El
.Pp
.El
The sequence is repeated after a one second pause.
.Sh EXAMPLES
A 'd12' flashes the lamp
.Bd -literal -offset indent
*__________*_*______________________________
.Ed
.Pp
A 'sAaAbBa' flashes
.Bd -literal -offset indent
_*_**__*
.Ed
.Pp
/usr/games/morse -l "Soekris rocks" > /dev/led/error
.Sh FILES
.Bl -tag -width /dev/led/*
.It Pa /dev/led/*
.El
.Sh SEE ALSO
.Xr morse 6
.Sh HISTORY
The
.Nm
driver first appeared in
.Fx 5.2 .
.Sh AUTHORS
.An -nosplit
This software was written by
.An Poul-Henning Kamp
.Aq phk@FreeBSD.org .
.Pp
This manual page was written by
.An Sergey A. Osokin
.Aq osa@FreeBSD.org
and
.An Poul-Henning Kamp
.Aq phk@FreeBSD.org .