XTEND(8)

NAME
xtend - X-10 daemon

SYNOPSIS
xtend

DESCRIPTION
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.

When 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 /etc/rc.local startup script.

Sending 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 xtend receives a SIGTERM, it shuts down gracefully and exits. A SIGPIPE causes xtend to abort the current client connection.

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.

Xtend understands four types of commands. The command

status H U

where H is a single letter house code, and U is a numeric unit code, causes xtend to respond with one line of status information about the specified device. The command

send H U N

where H is a single-letter house code, U is either a numeric unit code or a function code (see source file 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 xtend to perform the specified X-10 transmission. If the transmission was apparently successful, a single-line response containing OK is issued, otherwise a single-line response containing ERROR is produced. The command

dump

causes xtend to dump the current status of all devices to an ASCII file in the spool directory. The response OK is issued, regardless of whether the status dump was successful. The command

monitor H U

causes 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 OK is returned if the maximum (currently 5) number of such clients was not exceeded, otherwise ERROR is returned. 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 xtend to write one line of status information for the device (in the same format as produced by the 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.

OPTIONS
None.

SEE ALSO
xten(1) tw(4)

FILES
/dev/tw0
    the TW523 special file
/var/run/tw523
    socket for client connections
/var/run/xtend.pid
    pid file
/var/spool/xten/Log
    log file
/var/spool/xten/Status
    device status file (binary)
/var/spool/status.out
    ASCII dump of device status

BUGS
There is currently no timeout on client socket connections, so a hung client program can prevent other clients from accessing the daemon.

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.

AUTHOR
Eugene W. Stark (stark@cs.sunysb.edu)