genielabs / HomeGenie

HomeGenie, the programmable automation intelligence
https://homegenie.it
GNU General Public License v3.0
388 stars 154 forks source link

Support for CM19E X10 controller #343

Closed mralapete closed 5 years ago

mralapete commented 5 years ago

The X10 controller CM15Pro has now been discontinued. The only X10 controller now available for sale in Europe is the CM19E, a USB RF only unit. The Vendor ID number for the CM15Pro is 0bc70001 while the Vendor ID number for the CM19E is 0bc70002. The protocol for both units is similar except the CM19E does not include PL (Power Line) control.

Would it be possible to edit the XtenLib to add support for this controller.

tuicemen commented 5 years ago

This would also open HG to users of the CM19A (the North American version of the same module) When the CM15A became back ordered X10WTI shipped the CM19A as a replacement so there are lots of users with this module.

genemars commented 5 years ago

I personally do not own a CM19E but I could try extending XTenLib in order to support this device as well. @mralapete do you have a CM19E to eventually help testing/debugging?

tuicemen commented 5 years ago

I wonder if when doing this code could would also allow the cm15 to send RF or can it do that and Im missing something. I CAN test a CM19A

mralapete commented 5 years ago

@genemars I do indeed. I have it running on a Raspberry Pi using Mochad. The CM15Pro runs on the same Raspberry Pi by hot swapping the two controllers so if you need any testing done with it in HomeGenie just let me know

genemars commented 5 years ago

Ok... good to know you both can help testing. I'll give a peek at XTenLib code soon.

genemars commented 5 years ago

Ok.. I've got something to test. Can you guys compile and test xten-lib-donet from source? If so I will push the new driver to a new branch so you can test.

tuicemen commented 5 years ago

I'm on holidays right now for one more week with no access to my pi. Will be another week before I can test, hope that doesn't slow development to much

mralapete commented 5 years ago

@genemars could you include the link to your revised XTenLib revised source code

genemars commented 5 years ago

@mralapete

https://github.com/genielabs/x10-lib-dotnet/tree/cm19/

Run the Test.X10 program to test and debug. I am not sure that the protocol is the same as CM11/CM15 so there might be data decoding errors.

mralapete commented 5 years ago

@genemars I've cloned the Github https://github.com/genielabs/x10-lib-dotnet/tree/cm19/ on the Raspberry Pi but cannot compile as there's no makefie present. I'm in the folder x10-lib-dotnet and have used the ./configure, make and sudo make install method but it informs me that no makefile is present

genemars commented 5 years ago

compile with visual studio or monodevelop

genemars commented 5 years ago

if you want you can also compile from command line just typing xbuild in the folder `x10-lib-dotnet':

$ xbuild 
XBuild Engine Version 14.0
Mono, Version 4.6.2.0
Copyright (C) 2005-2013 Various Mono authors

Build started 12/11/2018 13:20:32.
__________________________________________________
Project "/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib.sln" (default target(s)):
    Target ValidateSolutionConfiguration:
        Building solution configuration "Debug|Any CPU".
    Target Build:
        Project "/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/XTenLib.csproj" (default target(s)):
            Target PrepareForBuild:
                Configuration: Debug Platform: AnyCPU
            Target GenerateSatelliteAssemblies:
            No input files were specified for target GenerateSatelliteAssemblies, skipping.
            Target _GenerateTargetFrameworkMonikerAttribute:
            Skipping target "_GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
            Target CoreCompile:
                Tool /usr/lib/mono/4.5/mcs.exe execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/XTenLib.dll Drivers/CM19.cs Properties/AssemblyInfo.cs Drivers/CM15.cs Drivers/CM11.cs Drivers/XTenInterface.cs XTenManager.cs Utility.cs Enums.cs X10Module.cs Events.cs obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs /target:library /define:"DEBUG;TRACE" /doc:bin/Debug/XTenLib.xml /nostdlib /reference:../packages/LibUsb.Common.2.2.18/lib/net45/LibUsb.Common.dll /reference:../packages/LibUsbDotNet.2.2.18/lib/net45/LibUsbDotNet.LibUsbDotNet.dll /reference:/usr/lib/mono/4.5/Microsoft.CSharp.dll /reference:../packages/NLog.4.5.10/lib/net45/NLog.dll /reference:/usr/lib/mono/4.5/System.dll /reference:/usr/lib/mono/4.5/System.Configuration.dll /reference:/usr/lib/mono/4.5/System.Data.dll /reference:/usr/lib/mono/4.5/System.IO.Compression.dll /reference:/usr/lib/mono/4.5/System.Runtime.Serialization.dll /reference:/usr/lib/mono/4.5/System.ServiceModel.dll /reference:/usr/lib/mono/4.5/System.Transactions.dll /reference:/usr/lib/mono/4.5/System.Windows.Forms.dll /reference:/usr/lib/mono/4.5/System.Xml.dll /reference:/usr/lib/mono/4.5/System.Core.dll /reference:/usr/lib/mono/4.5//mscorlib.dll /warn:4
            Target DeployOutputFiles:
                Copying file from '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/obj/Debug/XTenLib.dll.mdb' to '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/bin/Debug/XTenLib.dll.mdb'
                Copying file from '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/obj/Debug/XTenLib.dll' to '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/bin/Debug/XTenLib.dll'
        Done building project "/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/XTenLib.csproj".
        Project "/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib.Tests/XTenLib.Tests.csproj" (default target(s)):
            Target PrepareForBuild:
                Configuration: Debug Platform: AnyCPU
            Target GenerateSatelliteAssemblies:
            No input files were specified for target GenerateSatelliteAssemblies, skipping.
            Target _GenerateTargetFrameworkMonikerAttribute:
            Skipping target "_GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
            Target CoreCompile:
            Skipping target "CoreCompile" because its outputs are up-to-date.
        Done building project "/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib.Tests/XTenLib.Tests.csproj".
        Project "/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/Test.X10/Test.X10.csproj" (default target(s)):
            Target PrepareForBuild:
                Configuration: Debug Platform: AnyCPU
            Target CopyFilesMarkedCopyLocal:
                Copying file from '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/bin/Debug/XTenLib.dll' to '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/Test.X10/bin/Debug/XTenLib.dll'
                Copying file from '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/bin/Debug/XTenLib.dll.mdb' to '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/Test.X10/bin/Debug/XTenLib.dll.mdb'
                Copying file from '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/bin/Debug/XTenLib.xml' to '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/Test.X10/bin/Debug/XTenLib.xml'
            Target GenerateSatelliteAssemblies:
            No input files were specified for target GenerateSatelliteAssemblies, skipping.
            Target _GenerateTargetFrameworkMonikerAttribute:
            Skipping target "_GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
            Target CoreCompile:
                Tool /usr/lib/mono/4.5/mcs.exe execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/Test.CM15.exe Program.cs Properties/AssemblyInfo.cs obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs /target:exe /define:DEBUG /nostdlib /reference:/usr/lib/mono/4.5/Microsoft.CSharp.dll /reference:../packages/NLog.4.5.10/lib/net45/NLog.dll /reference:/usr/lib/mono/4.5/System.dll /reference:/usr/lib/mono/4.5/System.Configuration.dll /reference:/usr/lib/mono/4.5/System.Data.dll /reference:/usr/lib/mono/4.5/System.IO.Compression.dll /reference:/usr/lib/mono/4.5/System.Runtime.Serialization.dll /reference:/usr/lib/mono/4.5/System.ServiceModel.dll /reference:/usr/lib/mono/4.5/System.Transactions.dll /reference:/usr/lib/mono/4.5/System.Xml.dll /reference:/usr/lib/mono/4.5/System.Core.dll /reference:/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib/bin/Debug//XTenLib.dll /reference:/usr/lib/mono/4.5//mscorlib.dll /warn:4
            Target _CopyDeployFilesToOutputDirectoryPreserveNewest:
            Skipping target "_CopyDeployFilesToOutputDirectoryPreserveNewest" because its outputs are up-to-date.
            Target DeployOutputFiles:
                Copying file from '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/Test.X10/obj/Debug/Test.CM15.exe.mdb' to '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/Test.X10/bin/Debug/Test.CM15.exe.mdb'
                Copying file from '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/Test.X10/obj/Debug/Test.CM15.exe' to '/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/Test.X10/bin/Debug/Test.CM15.exe'
        Done building project "/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/Test.X10/Test.X10.csproj".
Done building project "/home/gene/Scrivania/Work/G-Labs/Development/Repositories/github-genielabs/x10-lib-dotnet/XTenLib.sln".

Build succeeded.
     0 Warning(s)
     0 Error(s)

Time Elapsed 00:00:01.5302760

I am not sure if this method automatically restores nuget packages or if you have to instal nuget as well and use nuget restore before xbuild.

mralapete commented 5 years ago

Yes nuget is required to successfully build with xbuild

Ran Test.CM15.exe with the CM19E attached and here's the output

2018-11-12 14:03:12.3609 XTenLib.Drivers.CM15.Open Error System.Exception: X10 CM15Pro device not connected. at XTenLib.Drivers.CM15.Open () [0x00022] in <2fbe82fc52354623bdf4e725fa062f3a>:0

mralapete commented 5 years ago

Contents of dmesg when CM19E is plugged in as follows

[ 992.298332] usb 1-1: New USB device found, idVendor=0bc7, idProduct=0002 [ 992.298352] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 992.298360] usb 1-1: Product: USB Transceiver [ 992.298368] usb 1-1: Manufacturer: X10 Wireless Technology Inc [ 992.334185] Registered IR keymap rc-ati-x10 [ 992.334412] rc rc0: X10 Wireless Technology Inc USB Transceiver as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/rc/rc0 [ 992.334657] input: X10 Wireless Technology Inc USB Transceiver as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/rc/rc0/input3 [ 992.337149] input: X10 Wireless Technology Inc USB Transceiver mouse as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/input/input4

Contents of lsusb as follows

Bus 001 Device 004: ID 0bc7:0002 X10 Wireless Technology, Inc. Firecracker Interface (ACPI-compliant)

It appears that the protocol for the CM15 Pro and the CM19E are the same. The only difference that I can see is the Vendor ID for the CM15Pro is idVendor=0bc7, idProduct=0001 while the Vendor ID for the CM19E is idVendor=0bc7, idProduct=0002. The CM19E only tx/rx RF codes.

mralapete commented 5 years ago

@genemars this is the url for your CM19 branch https://github.com/genielabs/x10-lib-dotnet/tree/cm19 yet this is the url for the clone or download https://github.com/genielabs/x10-lib-dotnet.git

Is that clone or download url for the master or branch

genemars commented 5 years ago

@mralapete this is the download link for cm19 branch:

https://github.com/genielabs/x10-lib-dotnet/archive/cm19.zip

mralapete commented 5 years ago

Do you have the git clone url. I'm doing this via a Raspbian terminal straight to the Raspberry Pi

genemars commented 5 years ago

Clone as usual then git checkout cm19 to switch to the proper branch.

Il giorno lun 12 nov 2018, 22:14 mralapete notifications@github.com ha scritto:

Do you have the git clone url. I'm doing this via a Raspbian terminal straight to the Raspberry Pi

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/genielabs/HomeGenie/issues/343#issuecomment-438015145, or mute the thread https://github.com/notifications/unsubscribe-auth/AGWJOd4zHyzAmB0DNglpBnZ8d7Ef61WFks5uudepgaJpZM4X9gKb .

mralapete commented 5 years ago

Ok got the correct branch and compiled ok.

Ran TestX10.exe and here's the output

2018-11-12 22:39:17.0342 XTenLib.Drivers.CM19.Open Error System.Exception: X10 CM19 device not connected. at XTenLib.Drivers.CM19.Open () [0x00022] in :0

Tried unplugging and plugging the CM19E and still the same output. It is not connecting.

My CM19E is working fine in Mochad so I know the unit is working

genemars commented 5 years ago

can you please do a lsusb ?

mralapete commented 5 years ago

Contents of lsusb as posted in previous post

Contents of lsusb as follows

Bus 001 Device 004: ID 0bc7:0002 X10 Wireless Technology, Inc. Firecracker Interface (ACPI-compliant)

genemars commented 5 years ago

Do a dmesg | tail -n 20 a few seconds after plugging the device. Perhaps a kernel module is already being loaded and it has to be blacklisted.

Il giorno mar 13 nov 2018, 04:07 mralapete notifications@github.com ha scritto:

Contents of lsusb as posted in previous post

Contents of lsusb as follows

Bus 001 Device 004: ID 0bc7:0002 X10 Wireless Technology, Inc. Firecracker Interface (ACPI-compliant)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/genielabs/HomeGenie/issues/343#issuecomment-438114819, or mute the thread https://github.com/notifications/unsubscribe-auth/AGWJOQNL9cz8KtKA5xvWt_qAARc53M_Jks5uujd5gaJpZM4X9gKb .

mralapete commented 5 years ago

$ dmesg | tail -n 20 [ 31.176275] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [ 31.176294] brcmfmac: power management disabled [ 31.467085] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 31.467097] Bluetooth: BNEP filters: protocol multicast [ 31.467124] Bluetooth: BNEP socket layer initialized [ 32.992146] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready [ 38.735535] input: lircd-uinput as /devices/virtual/input/input0 [ 657.763970] NOHZ: local_softirq_pending 40 [ 834.466534] Indeed it is in host mode hprt0 = 00041901 [ 834.676420] usb 1-1: new low-speed USB device number 2 using dwc_otg [ 834.677379] Indeed it is in host mode hprt0 = 00041901 [ 834.922719] usb 1-1: New USB device found, idVendor=0bc7, idProduct=0002 [ 834.922736] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 834.922744] usb 1-1: Product: USB Transceiver [ 834.922753] usb 1-1: Manufacturer: X10 Wireless Technology Inc [ 835.074702] Registered IR keymap rc-ati-x10 [ 835.074943] rc rc0: X10 Wireless Technology Inc USB Transceiver as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/rc/rc0 [ 835.075188] input: X10 Wireless Technology Inc USB Transceiver as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/rc/rc0/input1 [ 835.075483] input: X10 Wireless Technology Inc USB Transceiver mouse as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/input/input2 [ 835.083916] usbcore: registered new interface driver ati_remote pi@raspberrypi:~ $

mralapete commented 5 years ago

Ok just did a little searching and came across this. As you suggested there is a conflict with drivers

https://cuddonnet.blogspot.com/2013/02/how-to-disable-interfering-linux-kernel.html

Made the changes suggested and the dmesg output as follows

usb 1-1: New USB device found, idVendor=0bc7, idProduct=0002 [ 418.480942] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 418.480951] usb 1-1: Product: USB Transceiver [ 418.480958] usb 1-1: Manufacturer: X10 Wireless Technology Inc pi@raspberrypi:~ $

The offending drivers have now been blacklisted and are now no longer loading and everything looks ok.

Ran the TestX10.exe again and the output as follows

2018-11-13 12:37:54.9277 XTenLib.Drivers.CM19.Open Error System.Exception: X10 CM19 device not connected. at XTenLib.Drivers.CM19.Open () [0x00022] in :0

is there possibly other drivers other than lirc_atiusb and ati_remote thats stopping your test program from connecting to the CM19E

mralapete commented 5 years ago

This is the current output of your X10 test program

2018-11-13 13:51:04.2762 XTenLib.Drivers.CM19.Open Error System.Exception: X10 CM19 device not connected. at XTenLib.Drivers.CM19.Open () [0x00022] in f4e8e8a5b9b34544bdce6ae429ac9398:0

genemars commented 5 years ago

Ok blacklist is ok. Use sudo to run the program.

Il giorno mar 13 nov 2018, 13:46 mralapete notifications@github.com ha scritto:

Ok just did a little searching and came across this. As you suggested there is a conflict with drivers

https://cuddonnet.blogspot.com/2013/02/how-to-disable-interfering-linux-kernel.html

Made the changes suggested and the dmesg output as follows

usb 1-1: New USB device found, idVendor=0bc7, idProduct=0002 [ 418.480942] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 418.480951] usb 1-1: Product: USB Transceiver [ 418.480958] usb 1-1: Manufacturer: X10 Wireless Technology Inc pi@raspberrypi:~ $

The offending drivers have now been blacklisted and are now no longer loading and everything looks ok.

Ran the TestX10.exe again and the output as follows

2018-11-13 12:37:54.9277 XTenLib.Drivers.CM19.Open Error System.Exception: X10 CM19 device not connected. at XTenLib.Drivers.CM19.Open () [0x00022] in :0

is there possibly other drivers other than lirc_atiusb and ati_remote thats stopping your test program from connecting to the CM19E

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/genielabs/HomeGenie/issues/343#issuecomment-438253518, or mute the thread https://github.com/notifications/unsubscribe-auth/AGWJOaC3lXIPMZzqIWIOtkWXoJbzezkJks5uur8agaJpZM4X9gKb .

mralapete commented 5 years ago

Yes I did that already. I ran the test program with and without sudo. The output was the same in both cases. It still will not connect with the CM 19E.

I was thinking it might be a permissions issue at one stage. I have verified that the CM19E is still working.

mralapete commented 5 years ago

@genemars this might be a useful reference for you https://github.com/amccool/x10-cm19a

genemars commented 5 years ago

hi @mralapete the code I've posted is actually recognizing my CM21 USB device. The only difference is the product identifier which is "0005" for CM21 instead of "0002". As already pointed by you, in order to make it work, I had to blacklist the following modules: /etc/modprobe.d/blacklist.conf

blacklist ati_remote
blacklist rc_ati_x10

Reboot, then running the test program with sudo worked for me.

$ mono Test.CM15.exe  # without sudo throws error
XTenLib test program, waiting for connection.
2018-11-14 12:15:06.6676 XTenLib.Drivers.CM19.Open Error System.Exception: X10 CM19 device not connected.
  at XTenLib.Drivers.CM19.Open () [0x00020] in <0bbde8deb979486ca05f840ec3677259>:0 
^C

$ sudo mono Test.CM15.exe
XTenLib test program, waiting for connection.
USB Receiver
Interface connection status True

So I really have no clue why it is not working with your CM19.

mralapete commented 5 years ago

That looks promising.

Ok. Next question. What Mono version are you using. I’m using 5.4.0

Your GitHub built fine with no errors.

Did you build as root.

Did you modify udev rules to allow a user to access a usb device as you know root ownership can only access usb devices

I cloned your GitHub. I installed Nuget to restore packages. I did cd into the correct folder. I did XBuild (or Msbuild as its known now). I ran the X10 Test program using Mono and sudo Mono.

Did you do anything differently or did I leave a step out.

mralapete commented 5 years ago

Ok. I've tried to compile on Mono 4.6.2, the version you are using but I'm getting errors. It complies for me on Mono 5.4.0 of but will still not connect.

If you have a working version that you think might work on the CM19E could you add it to a Beta so I can test it there.

genemars commented 5 years ago

Did you install libusb-1.0-0-dev package?

sudo apt-get install libusb-1.0-0-dev

this package is installed automatically if you've already installed HG, so I forgot to mention about it.

mralapete commented 5 years ago

That's one of the first things I did. The test rig comprised of Raspbian Stretch Lite, Libusb-1.0-0-dev, Git to clone your Github, NUGet, Mono complete 4.6 ( your test program wouldn't compile with that version) replaced with Mono complete 5.4 which did allow me to compile.

I blacklisted the conflicting drivers as I mentioned earlier. In summary what I did was

  1. Git cloned your GitHub. Git checkout cm19
  2. Switched to your GitHub folder on my raspberry Pi
  3. Ran NUGET restore. All restored fine.
  4. Xbuild which compiled your test program ok 5 . Changed to the /bin folder where your test program compiled
  5. Blacklisted the conflicting drivers as detailed above
  6. In the /bin folder ran sudo mono your test program which would not connect to the CM19E

If I have carried out all the correct steps the only other thing I can think of is this may be down to an ownership/permissions issue with your test program not being allowed to open the USB device on my raspberry Pi.

mralapete commented 5 years ago

This is a kernel driver. Did you have a look at it https://github.com/amccool/x10-cm19a

mralapete commented 5 years ago

Just looking at these instructions to install another driver for the CM19. Note the instructions on chmod and chown. Does your test program require these changes.

Plugin the X10 CM19A transceiver Grant access to the appropriate USB device to your preferred user account Execute sudo lsusb to list devices. Look for a device with the name "X10 Wireless Technology, Inc. Firecracker Interface" and USB ID 0bc7:0002. Take note of the "Bus" and "Device" IDs. Execute chmod 600 /dev/bus/usb// to make the device readable and writable by its owner. Execute chown /dev/bus/usb// to set your preferred user account as the owner of the device.

genemars commented 5 years ago

Take note of the "Bus" and "Device" IDs. Execute chmod 600 /dev/bus/usb// to make the device readable and writable by its owner.

While trying to make CM21 work I've also come across similar solution and performed those chmod commands but I don't think that was relevant. What made my CM21 work was the /etc/modprobe.d/blacklist.conf.

At this point I think I really need to get hands on the CM19 to try to figure out the issue and make it work. I also believe that CM19 RF data encoding/decoding process might be a little bit different from CM15. So I just ordered a CM19... it might take a couple of weeks until it gets here.

mralapete commented 5 years ago

@genemars Mochad might be worth checking out. It handles both the CM15 and CM19 so might provide some clues. I did have a look at this Python driver but I'm not sure how it would perform as its been a few years ago since any work was done on it and it's written around a fairly old version of Python https://github.com/burnsfisher/x10pantilt

Hopefully you'll get your CM19E soon and figure out a working solution for HG. Thanks for your time and effort and hopefully my efforts helped too.

tuicemen commented 5 years ago

I've not been able to lay my hands on my CM19A as yet Still trying to catch up on all things here. I'll do some digging tonight to see if I can find it.

tuicemen commented 5 years ago

@genemars have you received you CM19 yet? I've been busy working on a HG SD downloadable image to get North American Users hooked on HG and the Pi and I just found my CM19A

genemars commented 5 years ago

@tuicemen I received my CM19E today and I already got it working. Well it's sending X10 RF commands but I'm actually having trouble receiving commands. Furthermore none of the existing CM19 programs for Linux I've tried worked for receiving but only sending.

Anyway I just realized that CM19 cannot be included as part of XTenLib since the PLC protocol is very different.

So I think I will be writing a C# console program from scratch that you can use to test CM19A, if everything works, then I will write a new specific library and HomeGenie interface driver for CM19.

tuicemen commented 5 years ago

Ok I'm ready to test when ever your ready I'll keep my cm19 at the top of my x10 parts bin

genemars commented 5 years ago

@tuicemen

https://github.com/genemars/CM19xTest

it is a very basic console application that will send a A1 ON command and then will output any RF command received by the CM19. If you want to send a different command than A1 ON you can edit the source code and use the following file for reference: https://github.com/erikdietrich/Daedalus/blob/master/AutomationService/CM19aProtocol.ini

blacklist the following kernel modules and reboot before running the program: /etc/modprobe.d/blacklist.conf

blacklist lirc_atiusb
blacklist ati_remote

the program must be run with sudo.

tuicemen commented 5 years ago

forgive me but I'm very new to using a Pi and not very experienced in Linux so just to confirm I make a file /etc/modprobe.d/blacklist.conf then place "blacklist lirc_atiusb" and "blacklist ati_remote" in it save and reboot?

tuicemen commented 5 years ago

Do I have to build CM19xTest if so How?

genemars commented 5 years ago

@tuicemen it's same as building XTenLib, like discussed earlier in this thread, using nuget restore and xbuild.

tuicemen commented 5 years ago

ok remember I'm to this? does nuget need to be installed? (i'm running raspbain Stretch lite) I keep getting -bash: nuget: command not found if so how? It sure would be quicker if you just supplied the CM19xTest app already compiled. HomeGenie stable is installed already with mono 5.4

tuicemen commented 5 years ago

ok says xbuild has depreciated to use msbuild instead but when I use that I get 5 warnings and 10 errors.

genemars commented 5 years ago

ok @tuicemen I'll attach here the compiled version. In the meanwhile I've made some progress with my CM19E by changing the value of the last byte in the initialization sequence. I can now receive X10 RF commands.

genemars commented 5 years ago

@tuicemen the error are due to missing packages that should be installed by nuget.

sudo apt-get install nuget
tuicemen commented 5 years ago

thanks I'll keep plugging away