-
Notifications
You must be signed in to change notification settings - Fork 130
X10 CM15A
##Installing the CM15A on Linux:
There are two versions of the CM15A driver out there.
- Craig's v0.01 driver
- Neil's v0.02
Quick note on installing the modules The INSTALL directions mention rebuilding the kernel. I think that's only necessary if you want to keep the hid module and do the fancy footwork to get the cm15a driver on its blacklist. No need to rebuild or reboot or anything if you can live without that module.
After the modules have been installed, you probably want to test them out, eh? There are two scripts I've found that can do that. Paul DeMarco has provided them both. One is a standalone perl script and the other is a MH perl module with some sample code
- Paul's MH module & sample code
I was able to get the v0.01 driver running by following the directions, but I'll post my results from both for everyone's reference.
==Installing the cm15a driver v0.01==
-
Download the driver source http://cwoodward.linux-site.net/x10/cm15a-driver.tgz I've saved my stuff in /usr/src, but it doesn't matter where you put it, really.
-
Unpack the code From here on, you should probably be the root user.
{{su root}} {{cd /usr/src}} {{tar -zxf cm15a-driver.tgz}}
- Read the install help ** /usr/src/cm15a-driver/INSTALL ** There are two parts, depending what version of the kernel you have.
{{frank:/usr/src/cm15a-driver/driver/linux-2.6# uname -r}} {{2.6.8-2-686}}
Looks like I'm running the 2.6 kernel, so I'll be running the steps in that section of the INSTALL file.
-
Compile the code {{frank:/usr/src# cd /usr/src/cm15a-driver/driver/linux-2.6 frank:/usr/src/cm15a-driver/driver/linux-2.6# make make -C /lib/modules/2.6.8-2-686/build SUBDIRS=/usr/src/cm15a-driver/driver/linux-2.6 modules make[1]: Entering directory
/usr/src/kernel-headers-2.6.8-2-686' CC [M] /usr/src/cm15a-driver/driver/linux-2.6/cm15a.o Building modules, stage 2. MODPOST CC /usr/src/cm15a-driver/driver/linux-2.6/cm15a.mod.o LD [M] /usr/src/cm15a-driver/driver/linux-2.6/cm15a.ko make[1]: Leaving directory
/usr/src/kernel-headers-2.6.8-2-686'}} -
Install the cm15a module ** dmesg will tell us what happens when we install the module. So lets take a look at what's going on first so we can tell what happens after we install it.
{{frank:/usr/src/cm15a-driver/driver/linux-2.6# dmesg ...system log stuff...remember what the last line was...}}
Now, install the module and see what happened
{{frank:/usr/src/cm15a-driver/driver/linux-2.6# insmod cm15a.ko frank:/usr/src/cm15a-driver/driver/linux-2.6# dmesg ...whatever your previous last line was... /usr/src/cm15a-driver/driver/linux-2.6/cm15a.c: Cm15a USB #240 now attached to major 180 minor 240 usbcore: registered new driver cm15a /usr/src/cm15a-driver/driver/linux-2.6/cm15a.c: X10 CM15A USB Driver v0.01}}
Woo Hoo! You got the cm15a driver v0.01 installed!
==Installing the cm15a driver v0.01==
I'll finish this section later, since it didn't work for me anyway.
==Installing and running the scripts that use the driver==
===Standalone perl===
- Download the script or copy it from Paul's website: http://users.zoominternet.net/%7Ecm15a/
I don't know enough about the cm* interfaces to know how to pack commands, etc. But the fact that I can run this script with no output is a good thing. I get "Cannot open device: No such device" when running the v0.02 version of the driver.
===MH perl===
- Download the perl module from Paul's website and stick it someplace where MH will find it: http://users.zoominternet.net/%7Ecm15a/CM15A.pm
I have the following line in my mh.ini file
{{#use the libraries in my home space lib_dir = /home/bryon/misterhouse/lib}}
So I put CM15A under my ~/misterhouse/lib/ directory.
{{bryon@frank:~$ ls -l ~/misterhouse/lib/ControlX10/CM15A.pm -rw-r--r-- 1 bryon bryon 5628 2006-07-29 11:14 /home/bryon/misterhouse/lib/ControlX10/CM15A.pm}}
- Download the MH code that uses the module from Paul's website
Again, I have my code_dir set to look at my HOME directory from mh.ini:
{{#use the code in my home space code_dir = /home/bryon/misterhouse/code}}
So I put that script there and called it cm15a_test.pl. I made a couple of changes because I'm lazy. A6 happens to be the light in my computer room, so that's why I'm twiddling that one.
{{bryon@frank:~$ ls -l ~/misterhouse/code/cm15a_test.pl -rw-r--r-- 1 bryon bryon 889 2006-07-29 14:34 /home/bryon/misterhouse/code/cm15a_test.pl}}
Here's the contents of that file:
# cm15a_test.pl
#
#
# Category=cm15
use Fcntl;
use ControlX10::CM15A qw( send_cm15a 0.00 );
$v_cm15_cmd = new Voice_Cmd "Turn [on,off] the cm15a test light";
if ( $state = said $v_cm15_cmd ) {
print_log "Turning the test light $state";
sysopen( CM15A, "/dev/usb/cm15a0", O_RDWR |O_NOCTTY | O_NONBLOCK ) || die "Cannot open device $!";
if ( $state eq "on" ) {
#set $test_light "on";
send_cm15a( \*CM15A, "A6J" ); # turn A6 ON
} else {
send_cm15a( \*CM15A, "A6K" ); # turn A6 OFF
#set $test_light "off";
}
#send_cm15a( \*CM15A, "AO" ); # turn all lights on house code A ON
#send_cm15a( \*CM15A, "AN" ); # turn all lights on house code A OFF
#send_cm15a( \*CM15A, "A5J" ); # turn A5 ON
#send_cm15a( \*CM15A, "A5K" ); # turn A5 OFF
#send_cm15a( \*CM15A, "A3J" ); # turn A3 ON
#send_cm15a( \*CM15A, "A3K" ); # turn A3 OFF
close( CM15A );
}
- Bring up mh and run the "Turn on the cm15a test light" command and watch the lights blink to life!