1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00
freebsd/libexec/xtend/xtend.8
2001-07-15 07:53:42 +00:00

180 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.
.\"
.\" $FreeBSD$
.\"
.Dd October 30, 1993
.Dt XTEND 8
.Os
.Sh NAME
.Nm xtend
.Nd X-10 daemon
.Sh SYNOPSIS
.Nm /usr/libexec/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
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.
.Nm Xtend
is started from
.Pa /etc/rc.i386
startup script if enabled in
.Pa /etc/rc.conf
script.
.Pp
Sending
.Nm
a
.Dv 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
receives a
.Dv SIGTERM ,
it shuts down gracefully and exits.
A
.Dv SIGPIPE
causes
.Nm
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:
.Bl -tag -width "monitor H U
.It Ic status Ar H U
where
.Ar H
is a single letter house code, and
.Ar U
is a numeric unit code,
causes
.Nm
to respond with one line of status information about the specified device.
.It Ic send Ar H U N
where
.Ar H
is a single-letter house code,
.Ar U
is either a numeric unit code
or a function code (see source file
.Pa xtend/packet.c )
for a list, and
.Ar N
is a number indicating the number of times (usually 2)
the packet is to be transmitted without gaps,
causes
.Nm
to perform the specified X-10 transmission. If the transmission was apparently
successful, a single-line response containing
.Sy OK
is issued, otherwise a single-line response containing
.Sy ERROR
is produced.
.It Ic dump
causes
.Nm
to dump the current status of all devices to an
.Tn ASCII
file in the spool
directory. The response
.Sy OK
is issued, regardless of whether the status dump was successful.
.It Ic monitor Ar H U
causes
.Nm
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
.Sy OK
is returned if the maximum (currently 5) number of such clients was not
exceeded, otherwise
.Sy 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
to write one line of status information for the device (in the same
format as produced by the
.Ic 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.
.El
.Sh OPTIONS
None.
.Sh SEE ALSO
.Xr xten 1 ,
.Xr tw 4
.Sh FILES
.Bl -tag -width /var/spool/xten/status.out -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/xten/status.out
.Tn 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 AUTHORS
.An Eugene W. Stark Aq stark@cs.sunysb.edu