CM11/HEYU History. Ver 0.0 ported from the Linux version of the Larry Campbell source to x10. Ver 0.9 Initial release. Ver 1.0 Added protocol.txt to tar file. Added version number that's visible when no arguments are given. Added clear flag to setclock. Changed info to show readable status bits. Added history file to tar file. Ver 1.1 Internal Ver 1.2 Added UUCP style lock file for the tty device. Ver 1.3 Internal Ver 1.4 Has a status command that works with RR501 remote RF receivers. Ver 1.5 The macro address should be 12 bits. (per section 5.4.3) Changed X10 to use version.h Changed status to display Iseconds, etc instead of the raw bytes. Added extra check4poll in status.c for when a status is waiting. Changed the xread to wait a FULL second using setitimer. Ver 1.6 Initial version that uses a relay daemon to allow monitor to run while turning lights on and off. The 'stop' is used to stop the daemon. Ver 1.7 Ver 1.6 could build a large history file. This version moves the getinfo req to the daemon, thus satisfying the CM11 immediately. Ver 1.8 The monitor now handles transmitted as well as received bytes. Ver 1.9 I was concerned about two things: The monitor took up too much CPU time, and the commands felt sluggish because of the timeouts waiting for characters to come in from the interface. The solution is to only do a read from the FIFO when it's changed since the last read, IE the file pointer has changed. The protocol.txt file was also updated to incorporate recent changes to the version available from www.x10.com. The relay daemon was not deleting the fifo when the daemon was killed. This worked OK until the file ended up owned by root :-( The file is now deleted upon SIGINT and SIGTERM. Ver 1.10 - 1.12 Aborted test versions that were never released. Ver 1.13 The default directories I chose were not standard in all Linux distributions, so I've changed them to use /var/tmp instead. The CM11A output messages for macros are now interpreted correctly. Ver 1.14 The default lock files for Red Hat were different, causing the daemon to malfunction. I've changed the logging so that most errors log via the syslog functions. The daemon now uses a timer to ensure that the powerfail indicator is not part of the normal data stream. The RI (Ring Indicator) modem line is looked at to avoid trying to talk to the CM11 while it's talking. Unfortunately, the CM11 does not have anyway to prevent the reverse. Changed x10.c, stop.c and relay.c so that a ps(1) command will show that the relay daemon is heyu_relay. It was kind of unkind to let unsuspecting people untar the archive into their current directory. The file now untars to the directory heyu.dir Ver 1.15 Corrected the blank line handling for x10config (thanks to David Dee) Added the includes needed by the new redhat glibc, supplied by Michael Fulbright (msf@redhat.com) Ver 1.16 Corrected the error message that reports spool file failure. Thanks to Paul Chamberlain for the report AND the fix. Corrected the condition that kept the 'stop' command from working in some cases. ver 1.17 Finally added code that would make the X10 retry commands multiple times (three, in fact) when the interface interrupts an RS232 command transmission due to a macro activation or powerline transmission. This has reduced failures to virtually 0. Ver 1.18 The program exits if it's in monitor mode and the spool file goes away. The program was (sometimes) core dumping if two instances of the program finished and 'info' at the same time (quit function). The lock file was moved to /var/lock in keeping with the FHS (filesystem hierarchy standard). Thanks to Peter Kim for the pointer to the FHS. The define for LOCKDIR was moved up into x10.h The defines for nextstep 3.3 were added to the make file. Added help and version options. Ver 1.19 Added defines for Solaris 2.5 Ver 1.20 Added patches submitted by erv@cne.dynip.com, jruschme@exit109.com and rdiamond@cisco. There should be better information in the system logs when the spool file or TTY can't be opened. It should handle signals a little cleaner The all off and all on were reversed. It should compile a little better with Redhat's configuration. The firmware version nibble was being misused. This caused problems for the early adopters with beta versions of the CM11. It now reports the firmware version. Ver 1.21 Cleaned up the errors that show when CC is invoked with -Wall. Ian! D. Allen reported a bug (introduced in 1.20) in xread that was causing monitor to report 'Poll received unknown value' after sending a command. Added code to lock the tty before writing. This prevents programs from stepping on each other. Ver 1.23 Moved some error messages around. The configuration file defaults to /etc/x10.conf if all else fails. Added error checking code if the spool files can't be opened. Ver 1.25 Added preset dims from code donated by Gregory Gulik. Fixed an 'fclose' in tty.c that shouldn't have been there. Added stricter checking for lock directories. Ver 1.28 Added presets to the man page. Added timers and macros to the program and man page. Added a man page for the timer/macro schedules. Set up a sample .x10sched.conf file. Fixed a memory leak that was causing the monitor mode to grow by 1K with each event it saw. Added define for freebsd to makefile. Added the hidden command qerase to try to revive locked up CM11. It's been tested once when teh CM11 locked up. It worked that time. Added the Julian date to the 'info' printout. The julian now matches the documentation. In previous versions it was offset by 1. This only affected downloaded timers that are date range sensitive. Ver 1.28a I found that I could cause a core dump by using a trigger with an undefined macro. A call to find_macro() fixed it. This version was made public 45 minutes after version 1.28. SIGH! Ver 1.28b An array boundry was exceeded on macro labels, causing core dump. The tr_count was also not initialized, causing false 'prom out of memory' errors. Thanks to James Gurganus (james@gurganus.net) for reporting it. Ver 1.28c Cleaned up the garbage that 'monitor' displayed when the power fail routine ran. Changed the format of the monitor output slightly to better tell the difference between a macro trigger and a timer. This only shows if the flag NEWFORMAT is in the .x10config file. Added special units lightson, lightsoff, hail allon and alloff so you can do heyu turn lightson and heyu hail Ready for beta??? Ver 1.28d I found that the CM11A does NOT like it when I initialize unused space to Zero. It caused many spurious triggers. I changed the initialization to all 1's and the macros and timers work great! Changed the day of the week to month/day in the monitor mode if 'newformat' is set. Added correction for macros that dim (thanks to Scott Hassan for the patch) This version was released as a 'beta' for 1.29 Ver 1.28e Two weeks of beta without failures. Thanks to brianc@palaver.net for finding a bug in the sched parser that improperly checked the macro pointer. Changed the names for loading macros to 'upload' and the validate flag to 'check'. Updated the man pages for sched, x10config and heyu. Ver 1.28f bug fix. The status argument was always using the same unitcode. Thanks go to Mace Moneta (mmoneta@qsun.mt.att.com) for spotting this. Ver 1.28g Compatibility fix: long != time_t on openbsd. I fixed it in date.c and in setclock.c Corrected the printf() in monitor.c so that heyu monitor | tee ds would work logically. It previously had a mixture of stdout and stderr. The fflushes were added for quicker response. Ver 1.28h Multiple reports of heyu monitor eating up all available CPU. This version is 1.28f with the 'hasselect' commented out of the Makefile. Ver 1.28i Multiple reports of heyu monitor eating up all available CPU. The select function call in monitor.c was reurning immediately, causing a tight loop checking for incoming characters in the spool. This was changed to use select as a 1/2 second timer instead. Moved the check for a blank line back to the right spot. This prevents trailing blank lines from complaining "Some macros are missing..." It also fixed a problem that caused complaints of 'incomplete macros.' Moved the file lock to the start of the process, providing a lock that persists until the process is finished. The relay function is the only one that does not honor a lock. Fixed date output. It was 01172309 0 instead of 0117230900 Added new option to the .x10config file: MACROXREF is the name of the file in which to store the eeprom locations. Added the macro names when in monitor. Added the alias names to the display when in monitor. Updated x10config.5 Updated sample x10config file. Relay will die gracefully if the spoolfile exceeds 1 Meg. Integrated the patches for OSF1 (alpha) from Christopher R. Wren (cwren@media.mit.edu) Ver 128.i1 Beta release bug fix. egcs compiler used in red hat uses a sscanf that behaved differently than GCC when misused. This caused loaded macros to fail to load the bright/dim values if compiled under redhat. EGCS scanf does not allow you to write to the same variable that you are reading from. Fixed the include in tty.h for Solaris. (thanks to Dan Malone) Changed the makefile to use CC Ver 1.28.i2 Added the code to do hail requests. Changed the algorithm of the relay to assume that it is in the proper syncronized state after 5 seconds of quiet. This allows much faster responses to incoming messages. Relay now reports and responds to hail requests. Added the hidden option to select the date and time to which the CM11A is set. It expects MMDDhhmm (not finished yet). This will be used for debugging. Ver 1.29 No one has complained about 1.28i2, SO it is released as 1.29 Ver 1.pre30_1 through _3 Added make file options for SCO and NetBSD. The Makefile has been reconfigured a touch to make it clearer what needs to be done for each OS. Turn was accepting invalid option as in heyu turn allaskljas. It now complains and exits. Thanks to Robert E. Laughlin for beta testing the SCO changes. Ver 1.pre30_4 Found bug in scanning the macros. (thanks to David Pointer) Ver 1.pre30_5 Dan Eble reported a bug (or feature) that allows chaining macros with delays. I've fixed the bug but not enabled the feature. Version 1.pre30.6 Makesched utility created. This utility pre-preocesses a file in the x10sched format and sends a revised version to standard output with the strings "dawn" and "dusk" expanded to appropriate values. Cleaned up some error messages to give feedback when the locks fail. Added a configure script to customize the makefile Added a post install script to check for directory permissions and such. Version 1.30 No changes from the beta. Version 1.31 Changed default for Configure to /bin/sh, as it should have been all along. Version 1.31_1 Changed the Configure script to delete leading tabs in the make file Version 1.31_2 Changed the default Makefile to one that calls configure. Version 1.31_3 A coding error was causing the dates in the schedule loader to be off in some cases. Thanks to Charles Sullivan for finding and reporting the bug and it's fix Version 1.32_2 Added a few compiler flags to allow freebsd to compile without changes. Tested against freebsd 4.2, Linux and Solaris The use of just the -v option caused a sigfault. The errant code was corrected in x10.c main(). Version 1.33 No bugs reported on the 1.32_2 beta. Releasing as stable. Version 1.34 The array bound checking for the x10sched.conf file was missing. Certain noise on the line would cause repetitive bytes to fill the buffer. relay.c code was tightened to look for this. The spool file is truncated after 1 million bytes. The jumpbuf in xread.c was getting corrupted, causing the second trigger to hang. That's fixed. Relay.c checks every 10 minutes for the need to change to daylight savings time. It changes the clock if needed. Added the ability to run two CM11's. Each needs it's own config file. The tty device is used to differentiate the spool files. Add the keywords "option" and "alias" to the config file to help ensure that it is parsed properly. Version 1.34beta6 corrected x10.h "endif" with trailing coment Added patch from "Tony Machon" that allows use of config file aliases in the x10sched file. Changed device to 0x0 when doing , alloff or lighston or lightsoff per patch provided by rrauenza<%>shroop.net. Thanks to Michael Skora, there is a way to send just the address or just the function. Version 1.34beta7 Added a siginterrupt(2) call so the alarm(2) calls will correctly abort the read(2) calls. Added local.h as a place to put local config defines (such as USESIGINT). Configure creates this as neededd. Did more cleanup so that there won't be hangs when sending cm11 directives that have a checksum of 0x5a. Added "relay" mode so the relay can be studied in the fore-ground, ala 'strace ./heyu -v relay'. Still need to add verbose entries to take advantage of the -v option. Added code to check the "write lock" file when evaluating that damned 0x5a that can be generated out of the blue as well as being used as a checksum. Version 1.34beta7.4 Corrected the munlock function. It was being used inconsistently, sometimes needing a full lock string, other times not. The tty device was deleted in one case. Version 1.34beta7.5 Still having problems with resends involving 0x5a Updated FAQ Added openbsd option to Configure. Version 1.34beta7.6 Cleaned up x10.c compile warnings. Version 1.34beta7.7 Finally realized that the best wording was heyu turn c1 up 10 heyu turn c1 down 5 Version 1.35 Final Version. Added external program trigger based on suggestion and sample code from chuck@liderbug.com Added heyuhelper script to be called when trigger is detected. Updated documentation Added HELPER to x10.h file.