Getting your X10 CM19A Module Working in Linux

A short time ago, I wrote on how to get your X10 CM17A Firecracker module working in Linux. Since then, I have migrated to a new home server, and I am left with no serial ports. That means that I have to get a USB module working. I already have the CM19A here at home, so I went on a task to find a driver to work for this one. I did succeed, so read on to find out how you can get it working yourself.

I will show you how to do this using Ubuntu 7.10 using the Generic desktop kernel. This tutorial can probably be adapted to other Linux/Unix distros. I tried it with the Ubuntu server kernel, but had no success. If you can get it, please post how you did it.

Setting it Up

  1. Plug in your USB CM19a Module. Then fire up a terminal and type:

    dmesg

    The last several lines should look like this:

    [ 4037.694734] usb 1-2.2: new low speed USB device using uhci_hcd and address 6
    [ 4037.834968] usb 1-2.2: configuration #1 chosen from 1 choice
    [ 4038.121493] input: X10 Wireless Technology Inc USB Transceiver as /class/input/input7
    [ 4038.123803] usbcore: registered new interface driver ati_remote
    [ 4038.124444] /build/buildd/linux-source-2.6.22-2.6.22/drivers/input/misc/ati_remote.c: Registered USB driver ATI/X10 RF USB Remote Control v. 2.2.1
    [ 4038.128544] /build/buildd/linux-source-2.6.22-2.6.22/drivers/input/misc/ati_remote.c: Weird data, len=1 ff 00 00 00 00 00 …
    [ 4038.212107] lirc_dev: IR Remote Control driver registered, at major 61
    [ 4038.235359]
    [ 4038.235365] lirc_atiusb: USB remote driver for LIRC $Revision: 1.61 $
    [ 4038.235379] lirc_atiusb: Paul Miller <pmiller9@users.sourceforge.net>
    [ 4038.276958] usbcore: registered new interface driver lirc_atiusb

    The important thing to note is that it is using the “lirc_atiusb” driver. This doesn’t work with this device. We need to find a better one.

  2. Download X10MMS and extract it.
  3. Go back to your terminal, and cd into that extracted directory.
  4. As per the instructions in the software’s readme file, run the following commands:

    sudo make
    sudo make install
    sudo modprobe x10-cm19a

    We’re not done yet. If you were to plug in your device, and run dmesg again, you would notice that it’s still running that pesky lirc_atiusb driver, so let’s blacklist it.

  5. Type in a terminal:

    sudo gedit /etc/modprobe.d/blacklist

  6. Then add to the end of the file:

    # causes the custom cm19a driver to fail
    blacklist lirc_atiusb
    blacklist ati_remote

  7. Type in a terminal:

    sudo rmmod lirc_atiusb
    sudo rmmod ait_remote

  8. One last thing…this step allows all users to access the device. Some may say this is a security risk, but I don’t want to be root to use it.Type in the following command to open the udev rules file:

    sudo gedit /etc/udev/rules.d/40-permissions.rules

  9. Add the following to the end of the file:

    KERNEL==”cm19a0″, MODE=”0666″

  10. One last commad to run:

    sudo chmod 0666 /dev/cm19a0

  11. You’re done, yay! Now it’s time to test it out. Remember, this driver only provides an interface to the module. You will have to write your own software / scripts / cron jobs to make it useful.The interface works by sending strings to it. To turn on A1, we send +A1 to it. To turn off C4, we send -C5 to it. In practice, type in the following command to turn on A1:

    echo +A1 > /dev/cm19a0

    Hopefully, your transeiver module will turn on.

Update (9/14/2008)

I just went back and used this post to reconfigure this device on the new kernel.  Turns out that for Ubuntu Hardy Heron (8.04), an additional kernel module needs to be blacklisted: ati_remote.  That module has been added to the previous steps.

Troubleshooting

If your test commands are not working, make sure that the driver is being loaded properly. Disconnect the module, wait a few seconds, and reconnect the device. Then type this in a terminal:

dmesg

The last several lines should look like this:

[ 7110.487961] usb 1-2.2: new low speed USB device using uhci_hcd and address 12
[ 7110.629155] usb 1-2.2: configuration #1 chosen from 1 choice
[ 7110.632117] x10-cm19a: Probing x10-cm19a…
[ 7110.632136] x10-cm19a: Found input endpoint: 81, and output endpoint: 2
[ 7110.637872] x10-cm19a: freeing buffer in callback (0xd78eb0c0/0x178eb0c0)
[ 7111.197615] x10-cm19a: freeing buffer in callback (0xd78eb0c0/0x178eb0c0)
[ 7111.197863] x10-cm19a: X10 CM19A USB RF Transceiver connected.
[ 7111.197870] x10-cm19a: X10 CM19A USB RF Transceiver initialized to listen for remote controls.
[ 7111.205631] x10-cm19a: freeing buffer in callback (0xd78eb0c0/0x178eb0c0)

If they don’t, make sure you followed all the steps. If you didn’t understand one of them, please post a question.

More Information

A couple of tips were taken from Dan at Zenlike.ca -> Another homebrew Linux X10 Dawn simulator

The software driver mentioned in this entry can be found here -> X10MMS

This entry was posted on Thursday, December 27th, 2007 at 12:08 pm and is filed under Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

35 Responses to “Getting your X10 CM19A Module Working in Linux”

minesh September 6th, 2008 at 8:13 pm

when I plug in my cm19a, I don’t see /dev/cm19a0.
instead I see:
usbdev1.8_ep00
usbdev1.8_ep02
usbdev1.8_ep81
(they weren’t there before I plugged in my cm19a module.

if I do “ls /dev/usbdev1.8_ep00″ I get an error “No such device or address”

I’m running ubuntu 7.10, linux 2.6.22-14-generic

minesh September 6th, 2008 at 9:29 pm

after I rebooted my system, I am able to see /dev/cm19a0

and echo +A1 > /dev/cm19a0 works.

JPBrain November 4th, 2008 at 4:33 pm

Hi,
I just followed this guide with Ubuntu server 8.04. the only problem I had was that the dev was not created.
Then I did “/dev/MAKEDEV” update and /dev/cm19a0 appeared.
soooo..  echo +A1 > /dev/cm19a0 now works.

Regards, JP.

Andrew Wells November 4th, 2008 at 4:36 pm

Thanks for the tip, JP.  I just upgraded my home server to 8.04 a couple weeks ago, and I still have to reinstall this driver before Christmas lights go up. :)

tom November 19th, 2008 at 11:09 am

Hello.

Does anyone have, or is willing to create a custom driver set for the CM19a?  This would be a simple driver set that shows “Wireless system” or something generic like that in the Device Manager?  This would need to run on Windows – all recent versions.

AA January 10th, 2009 at 2:49 pm

I believe the following patch to drivers/usb/comm/x10-cm19a.c is required to compile the driver under more recent kernels

19c19
< #include <linux/config.h>

> #include <linux/autoconf.h>
25d24
< #include <linux/config.h>
43d41
< typedef int bool;
162c160
< MODULE_PARM(ReadTimeout, “i”);

> module_param(ReadTimeout, int, 0);
165c163
< MODULE_PARM(MaxTscvrCnt, “i”);

> module_param(MaxTscvrCnt, int, 0);

CM19a USB X10 Transceiver « AC’s Blog April 17th, 2009 at 6:05 pm

[...] Some great instructions on how to install it are located here: http://wp.pr0gr4mm3r.com. [...]

Belcat August 23rd, 2009 at 10:15 pm

What exactly do you do with MAKEDEV to make the device show up?  I can’t get it to show up!

alek October 10th, 2009 at 10:47 am

That works great – I have now replaced the serial interface Firecracker CM17 with the USB CM19 for my Halloween setup – http://www.komar.org/cgi-bin/halloween_webcam

BTW, minor typo in the step-by-step above as the “ati” is transposed to “ait” here – sudo rmmod ait_remote

steve April 10th, 2010 at 4:19 pm

echo +A1 > /dev/cm19a0 works. but I have figure out how to use “u,d,r,l” with my ninja pan and tilt which is why I bought the cm19a.

Alan May 15th, 2010 at 3:29 pm

I’m stuck.  It will not load the driver after I plug in the cm19a.  It compiles fine.  My log is below:

usb 2-1: USB disconnect, address 8
usb 2-1: new low speed USB device using uhci_hcd and address 9
usb 2-1: configuration #1 chosen from 1 choice
x10-cm19a: Probing x10-cm19a…
x10-cm19a: Found input endpoint: 81, and output endpoint: 2
/root/cm19/x10-cm19a-0.1.1/drivers/usb/comm/x10-cm19a.c: Couldn’t submit interrupt_out_urb -28
x10-cm19a: init_remotes: Failed to initialize transceiver to listen to CR12A and CR14A remote controls.
x10-cm19a: probe of 2-1:1.0 failed with error -5

Any ideas?

Andrew Wells May 15th, 2010 at 3:36 pm

Alan – what distro are you running?

Alan May 15th, 2010 at 3:40 pm

Old Fedora Core 6 on this machine.  Kernel 2.6.22.  Haven’t had the time to switch it over to CentOS 5.2 like the rest of my servers.  But she’s been reliable running Misterhouse.

Andrew Wells May 17th, 2010 at 8:15 pm

I was rooting through my closet trying to find that module, but I can’t seem to find it. I will keep my eyes peeled for it, and once I find it, I will follow my article through again to make sure the steps are still accurate and let you know what I find.

Conrad June 8th, 2010 at 2:40 am

thank you! thank you! thank you!
I read the (rather sparse) one-page X10MMS instructions and although I’d got the driver install and it looked like it was working  and all… ok now what?
no mention of the elusive “echo +A1 > /dev/cm19a0” command to actually, you know, do stuff…
 
once again, THANK YOU!

Sean June 9th, 2010 at 4:09 pm

Building X10-CM19A for 2.5/2.6 kernel…
   (make sure you have write access to your kernel source tree)
make -C /lib/modules/`uname -r`/build SUBDIRS=/home/CONSUMERS/smckee/Documents/src/x10-cm19a-0.0.5 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-22-generic’
scripts/Makefile.build:49: *** CFLAGS was changed in “/home/CONSUMERS/smckee/Documents/src/x10-cm19a-0.0.5/Makefile”. Fix it to use EXTRA_CFLAGS.  Stop.
make[1]: *** [_module_/home/CONSUMERS/smckee/Documents/src/x10-cm19a-0.0.5] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-22-generic’
make: *** [all] Error 2

Sean June 9th, 2010 at 4:12 pm

got this:

Building X10-CM19A for 2.5/2.6 kernel…
   (make sure you have write access to your kernel source tree)
make -C /lib/modules/`uname -r`/build SUBDIRS=/home/CONSUMERS/smckee/Documents/src/x10-cm19a-0.0.5 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-22-generic’
scripts/Makefile.build:49: *** CFLAGS was changed in “/home/CONSUMERS/smckee/Documents/src/x10-cm19a-0.0.5/Makefile”. Fix it to use EXTRA_CFLAGS.  Stop.
make[1]: *** [_module_/home/CONSUMERS/smckee/Documents/src/x10-cm19a-0.0.5] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-22-generic’
make: *** [all] Error 2

Charlie July 23rd, 2010 at 5:01 pm

Building x10-cm19a for Ubuntu 9.10 I get:
Building X10-CM19A for 2.5/2.6 kernel…
(make sure you have write access to your kernel source tree)
make -C /lib/modules/`uname -r`/build SUBDIRS=/tmp/x10-cm19a-0.1.1 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.31-34-fitpc2′
CC [M]  /tmp/x10-cm19a-0.1.1/drivers/usb/comm/x10-cm19a.o
LD [M]  /tmp/x10-cm19a-0.1.1/x10-cm19a.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
‘make CONFIG_DEBUG_SECTION_MISMATCH=y’
CC      /tmp/x10-cm19a-0.1.1/x10-cm19a.mod.o
LD [M]  /tmp/x10-cm19a-0.1.1/x10-cm19a.ko
Is this section mismatch a problem?  I’m on a custom kernel for this system so I need to be a bit careful.
 
 

Tom July 28th, 2010 at 7:41 pm

Just compiled and installed the driver on Fedora 13  Kernel 2.6.33.6-147.fc13.x86_64
No problems, after I installed the kernel-devel pkg.
It works great.

Shelby Denike August 5th, 2010 at 1:19 pm

Thanks for the tutorial, seems to be working for the MOST part… The driver compiles and loads.  I am able to echo commands to it and the devices turn on/off … but after X hours when i try to send commands to the device I get the following

$ echo +A1 > /dev/cm19a0
bash: /dev/cm19a0: No space left on device
$

Any ideas on this?  Running this on Ubuntu Server 10.4 … Thanks!

Shelby Denike August 5th, 2010 at 1:21 pm

Also when this happens the syslog shows the following

Aug  5 11:20:19 control kernel: [  223.292866] x10-cm19a: devf_open: Couldn’t submit interrupt input URB: -28
Aug  5 11:20:22 control kernel: [  226.360844] x10-cm19a: devf_open: Couldn’t submit interrupt input URB: -28

And dmesg shows the following

[  223.292866] x10-cm19a: devf_open: Couldn’t submit interrupt input URB: -28
[  226.360844] x10-cm19a: devf_open: Couldn’t submit interrupt input URB: -28
This is Linux Kernel 2.6.32-21-generic-pae

David Merrick August 14th, 2010 at 6:01 pm

@Charlie–I’m getting the same error message installing on an Ubuntu 9.10 server as well. I had done the same install successfully on a 9.10 Desktop, so it doesn’t make sense to me why this isn’t working. I’ll try a few things on my own to figure it out and will post back.

David Merrick August 14th, 2010 at 6:34 pm

@Charlie: I got mine working with the Python driver from http://www.cuddon.net/2009/08/python-driver-v01-for-cm19a-x10.html. It’s not as clean of a solution as this one, but seeing as this one has a few bugs on Ubuntu 9.10 server for now it works faster than I had expected and is easy to set up.

David Merrick August 26th, 2010 at 3:35 pm

I actually realized my problem was I didn’t have build-essential installed. After I did, the modules compiled just fine.

Doug September 9th, 2010 at 8:59 pm

Using SUSE 10.2 and I had the CM19 working fine I thought but lately I am getting the ” x10-cm19a: devf_open: Couldn’t submit interrupt” message. If I pull the USB connection and reconnect it works alright for awhile and then eventually fails with this message. I don’t have lirc_atiusb but did remove the ati_remote and blacklisted both.
Any ideas would be appreciate.
 

Doug September 9th, 2010 at 9:14 pm

Here is my log after connecting -
Sep  9 22:03:36 slate kernel: usb 5-2: new low speed USB device using uhci_hcd and address 6
Sep  9 22:03:36 slate kernel: usb 5-2: new device found, idVendor=0bc7, idProduct=0002
Sep  9 22:03:36 slate kernel: usb 5-2: new device strings: Mfr=1, Product=2, SerialNumber=0
Sep  9 22:03:36 slate kernel: usb 5-2: Product: USB Transceiver
Sep  9 22:03:36 slate kernel: usb 5-2: Manufacturer: X10 Wireless Technology Inc
Sep  9 22:03:36 slate kernel: usb 5-2: configuration #1 chosen from 1 choice
Sep  9 22:03:36 slate kernel: x10-cm19a: Probing x10-cm19a…
Sep  9 22:03:36 slate kernel: x10-cm19a: Found input endpoint: 81, and output endpoint: 2
Sep  9 22:03:36 slate kernel: x10-cm19a: freeing buffer in callback (0xf5957020/0×35957020)
Sep  9 22:03:37 slate kernel: x10-cm19a: freeing buffer in callback (0xf5957020/0×35957020)
Sep  9 22:03:37 slate kernel: x10-cm19a: X10 CM19A USB RF Transceiver connected.
Sep  9 22:03:37 slate kernel: x10-cm19a: X10 CM19A USB RF Transceiver initialized to listen for remote co
ntrols.
Sep  9 22:03:37 slate kernel: x10-cm19a: freeing buffer in callback (0xf5957020/0×35957020)

and after sending a command (when it is working) -
Sep  9 22:05:46 slate kernel: x10-cm19a: devf_write called with buffer length 4
Sep  9 22:05:46 slate kernel: x10-cm19a: got off command
Sep  9 22:05:46 slate kernel: x10-cm19a: house code a
Sep  9 22:05:46 slate kernel: x10-cm19a: unit = 7
Sep  9 22:05:46 slate kernel: x10-cm19a: Created HA command: off a 7
Sep  9 22:05:46 slate kernel: x10-cm19a: Transmitting 5 byte command:
Sep  9 22:05:46 slate kernel: x10-cm19a: buf[0] = 20
Sep  9 22:05:46 slate kernel: x10-cm19a: buf[1] = 60
Sep  9 22:05:46 slate kernel: x10-cm19a: buf[2] = 9F
Sep  9 22:05:46 slate kernel: x10-cm19a: buf[3] = 68
Sep  9 22:05:46 slate kernel: x10-cm19a: buf[4] = 97
Sep  9 22:05:46 slate kernel: x10-cm19a: wrote command
Sep  9 22:05:46 slate kernel: x10-cm19a: freeing buffer in callback (0xf5957020/0×35957020)
Sep  9 22:05:47 slate kernel: x10-cm19a: read back interrupt data
Sep  9 22:05:47 slate kernel: x10-cm19a: devf_write: back from x10_transmit_cmd
and when it is not this -
Sep  9 20:29:01 slate kernel: x10-cm19a: devf_open: Couldn’t submit interrupt input URB: -22

Doug September 17th, 2010 at 11:21 pm

I was in email contact with Mike Lemay andhe really has no answer for the error “x10-cm19a: devf_open: Couldn’t submit interrupt inpu” That many are getting. I get it sporadically but often enough to disrupt operations. My quick fix is to call a script twice a day that removes and reinstalls the driver. This always fixes the problem. A real squirely way to do it but for now it works. Mike said he is moving to a Python userspace solution. I see there is already one out there that others have tried. When I get time I will try that solution.
In the meantime if anyone has an answer to this kernel driver problem it would be great.

Michael LeMay October 10th, 2010 at 2:03 pm

I’m glad to see that you’re all getting some use out of the driver!  To follow up on Doug’s comment, I did finally get around to porting the driver to Python, and the new version is posted here: http://m.lemays.org/projects/x10-cm19a-linux-driver  I added a bit of a tutorial on using the new version as well.  Enjoy!

Eric October 18th, 2010 at 5:36 pm

Does anyone have a mirror of the previous version of the driver?  I had it working perfectly but had to do a new install and didn’t keep the .tar archive.  I can’t get the Python version to work no matter what, and I’d rather just use what works than fiddle with a new implementation.

Michael LeMay October 27th, 2010 at 9:15 am

I re-uploaded the Linux C driver for those of you that still need it.  I wish you would also post the challenges you’ve experienced with the Python one, though.  Thanks!

Doug October 27th, 2010 at 9:42 am

I had luck using the Python driver at http://www.cuddon.net/2009/08/python-driver-v01-for-cm19a-x10.html
This is a userspace driver. It does not use the kernel driver and the kernel driver should not be installed for it to work.
 
I was unable to get the above Python link from Michael to work. It says “page not found. “   Does this driver work similiar to the cuddon.net driver?

Michael LeMay October 27th, 2010 at 10:25 am

For some reason the blog software added a space at the end of the link I posted.  Maybe it’ll work if I put a period after it: http://m.lemays.org/projects/x10-cm19a-linux-driver.

Conrad December 17th, 2010 at 1:08 am

Hi just wondering what would be the command to send an ALL LIGHTS ON or OFF?
 
cheers

Brian December 7th, 2011 at 11:38 am

Is it possible to get the status of the device using this driver? 

Michael LeMay January 13th, 2012 at 11:40 pm

The driver does not currently support retrieving the status of a device.

Leave a Reply