1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00
freebsd/libexec/xtend/xtend.8
1994-10-22 09:53:33 +00:00

175 lines
5.5 KiB
Groff

.\" Copyright (c) 1992, 1993 Eugene W. Stark
.\" 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Eugene W. Stark.
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (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.
.\"
.Th XTEND 8 "30 Oct 1993"
.Dd Oct 30, 1993
.Dt XTEND 8
.Os BSD FreeBSD
.Sh NAME
xtend \- X-10 daemon
.Sh SYNOPSIS
.Nm xtend
.Sh DESCRIPTION
.Nm Xtend
interfaces between user-level programs and the TW523 X-10 controller.
It logs all packets received from the TW523, attempts to track the
status of all X-10 devices, and accepts socket connections from user-level
client programs that need to manipulate X-10 devices.
.Pp
When
.Nm xtend
is started, it forks, releases the controlling terminal, then opens
its log file, where it subsequently records all X-10 activity and
diagnostic messages. It then begins processing packets received from
the TW523 and accepting connections one at a time from clients
wishing to issue X-10 commands. The usual place to start xtend would
be from the
.Pa /etc/rc.local
startup script.
.Pp
Sending
.Nm xtend
a SIGHUP causes it to close and reopen its log file. This is useful
in shell scripts that rotate the log files to keep them from growing
indefinitely.
If
.Nm xtend
receives a SIGTERM, it shuts down gracefully and exits.
A SIGPIPE causes
.Nm xtend
to abort the current client connection.
.Pp
.Nm Xtend
communicates with client processes by a simple protocol in which a one-line
command is sent by the client, and is acknowledged by a one-line response
from the daemon.
.Pp
.Nm Xtend
understands four types of commands. The command
.Bl -tag
.It status H U
.El
.Pp
where H is a single letter house code, and U is a numeric unit code,
causes
.Nm xtend
to respond with one line of status information about the specified device.
The command
.Bl -tag
.It send H U N
.El
.Pp
where H is a single-letter house code, U is either a numeric unit code
or a function code (see source file
.Pa xtend/packet.c
) for a list, and N is a number indicating the number of times (usually 2)
the packet is to be transmitted without gaps,
causes
.Nm xtend
to perform the specified X-10 transmission. If the transmission was apparently
successful, a single-line response containing
.B
OK
is issued, otherwise a single-line response containing
.B
ERROR
is produced.
The command
.Bl -tag
.It dump
.El
.Pp
causes
.Nm xtend
to dump the current status of all devices to an ASCII file in the spool
directory. The response
.B
OK
is issued, regardless of whether the status dump was successful.
The command
.Bl -tag
.It monitor H U
.El
.Pp
causes
.Nm xtend
to add the current client socket connection to a list of clients that are to
be notified about activity concerning the specified X-10 device.
The single-line acknowledgement
.B
OK
is returned if the maximum (currently 5) number of such clients was not
exceeded, otherwise
.B
ERROR
is returned.
.Nm Xtend
then returns to its normal mode of accepting connections from clients.
However, each subsequent change in the status of the specified device will
cause
.Nm xtend
to write one line of status information for the device (in the same
format as produced by the
.B
status
command) to the saved socket. This feature is useful for writing programs
that need to monitor the activity of devices, like motion detectors, that can
perform X-10 transmissions.
.Sh OPTIONS
None.
.Sh SEE ALSO
.Xr xten 1
.Xr tw 4
.Sh FILES
.Bl -tag -width /var/spool/xten/Status -compact
.It Pa /dev/tw0
the TW523 special file
.It Pa /var/run/tw523
socket for client connections
.It Pa /var/run/xtend.pid
pid file
.It Pa /var/spool/xten/Log
log file
.It Pa /var/spool/xten/Status
device status file (binary)
.It Pa /var/spool/status.out
ASCII dump of device status
.El
.Sh BUGS
There is currently no timeout on client socket connections, so a hung
client program can prevent other clients from accessing the daemon.
.Pp
.Nm Xtend
does the best it can at trying to track device status, but there is
usually no way it can tell when a device has been operated manually.
This is due to the fact that most X-10 devices are not able to
respond to queries about their status.
.Sh AUTHOR
Eugene W. Stark (stark@cs.sunysb.edu)