summaryrefslogtreecommitdiffstats
path: root/libexec/xtend/xtend.8
blob: a990118c682d5cd06171b109dde8bbfcf15935a2 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
.\" 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.
.\"
.\"	$Id: xtend.8,v 1.8 1997/12/04 07:25:18 charnier Exp $
.\"
.Th XTEND 8 "30 Oct 1993"
.Dd Oct 30, 1993
.Dt XTEND 8
.Os BSD FreeBSD
.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 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 SIGTERM, it shuts down gracefully and exits.
A 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.  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
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
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
to dump the current status of all devices to an
.Tn 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
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
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/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
OpenPOWER on IntegriCloud