Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

"Cyp Se WitheHome" Remote Plugin

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
vishal
Posts: 2
Joined: Wed Jul 22, 2009 10:52 pm

"Cyp Se WitheHome" Remote Plugin

Post by vishal »

Hi there,
I bought a remote control from ebay a while back which acts as a sort of keyboard. Because of this, when you press a button the signal is sent to the active application. For example if you have firefox open and you press the [Pause] button, it sends {CTRL + P} to firefox, which open the print dialogue. Annoying huh...

Anyway after reading through this topic and installing the driver created by Bitmonster (Download Driver) I am having trouble creating a plugin to work with this reciever.

I have installed the Driver and upgraded the default driver. It now shows up as "USB PC Remote Controller".
When I plug the reciever in the USB port I get the following message in the log:

Code: Select all

System.DeviceAttached [u'\\\\?\\USB#VID_04B4&PID_0100#5&2fce8547&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}']
So I went ahead and created a plugin, and this is the content of my __init__.py file:

Code: Select all

import eg

eg.RegisterPlugin(
    name = "Cyp Se WitheHome",
    author = "Vishal",
    version = "1.0.0",
    kind = "remote",
    description = __doc__,
)

class Cyp_Se_WitheHome(eg.PluginBase):
               
    def __start__(self):
        self.usb = eg.WinUsbRemote(
            "{a5dcbf10-6530-11d2-901f-00c04fb951ed}", 
            self.Callback, 
            1
        )
        if not self.usb.IsOk():
            raise self.Exceptions.DeviceNotFound

    def __stop__(self):
        self.usb.Close()

    def Callback(self, data):
        print data
When I then add the plugin to EventGhost I get:

Code: Select all

Error starting plugin: Cyp Se WitheHome
Device not found!
I've tried to make it load, but I'm new to this and haven't got a clue.
A few links that might help:
http://www.eventghost.org/forum/viewtop ... 32&start=0 (mentioned above)
http://ubuntuforums.org/showthread.php?t=805876 (Same remote but configured in Linux for MythTV)

Anyone able to see what the problem is??? or can help me build this plugin?
Would be much appreciated...

Cheers
Vishal
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: "Cyp Se WitheHome" Remote Plugin

Post by Bitmonster »

You have the wrong GUID. Unpack the driver package (with WinRar oder 7-zip) and open the driver.inf file. There you will see these sections:

Code: Select all

[Remotes.NTx86]
%Device001.DeviceDesc%=Install001,USB\VID_0000&PID_0000
%Device002.DeviceDesc%=Install002,USB\VID_0000&PID_0000
%Device003.DeviceDesc%=Install003,USB\VID_046D&PID_C101&MI_00
%Device004.DeviceDesc%=Install004,USB\VID_046D&PID_C101&MI_01
%Device005.DeviceDesc%=Install005,USB\VID_1784&PID_0004&MI_00
%Device006.DeviceDesc%=Install006,USB\VID_1784&PID_0004&MI_01
%Device007.DeviceDesc%=Install007,USB\VID_147A&PID_E02D
%Device008.DeviceDesc%=Install008,USB\VID_06B4&PID_1C70

[Remotes.NTamd64]
%Device001.DeviceDesc%=Install001,USB\VID_0000&PID_0000
%Device002.DeviceDesc%=Install002,USB\VID_0000&PID_0000
%Device003.DeviceDesc%=Install003,USB\VID_046D&PID_C101&MI_00
%Device004.DeviceDesc%=Install004,USB\VID_046D&PID_C101&MI_01
%Device005.DeviceDesc%=Install005,USB\VID_1784&PID_0004&MI_00
%Device006.DeviceDesc%=Install006,USB\VID_1784&PID_0004&MI_01
%Device007.DeviceDesc%=Install007,USB\VID_147A&PID_E02D
%Device008.DeviceDesc%=Install008,USB\VID_06B4&PID_1C70
Change the first line in both sections to

Code: Select all

%Device001.DeviceDesc%=Install001,USB\VID_04B4&PID_0100
Then start DPinstSwitcher.exe to start the driver installation and you should get a "WinUSB Test Device #1" in the device manager.
In the plugin code, you should then use the GUID "{5607ED2F-AD3C-4CE8-9DE6-97CD4B0FFEF1}" for the eg.WinUsbRemote call.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
vishal
Posts: 2
Joined: Wed Jul 22, 2009 10:52 pm

Re: "Cyp Se WitheHome" Remote Plugin

Post by vishal »

Thank you for replying.
Its seems we have different driver.inf files. My file doesn't have 2 blank devices.
But anyway, I figured I have to use the GUID you have in the driver.inf, so I used the GUID for "USB PC Remote Controller". After doing this, and assigning the remote the USB PC Remote Controller driver the plugin now loads.

Also when playing around with the driver.inf and installing it various times, the system how has various drivers of the same thing. How can i remove all but the default 6?

Hmm... I actually forgot to post what i wrote and in that time i've got the plugin to work.
I've imported all codes from the remote to the plugin so all buttons are recognised.

Here's the lastest __init__.py

Code: Select all

import eg

eg.RegisterPlugin(
    name = "Cyp Se WitheHome",
    author = "Vishal",
    version = "1.0.0",
    kind = "remote",
    description = __doc__,
)

CODES = {
    (2,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0): "Power",
    (1,1,0,4,0,0,0,0,1,0,0,0,0,0,0,0): "Radio",
    (1,1,0,23,0,0,0,0,1,0,0,0,0,0,0,0): "TV",
    (4,1,0,0,0,0,0,0,4,0,0,0,0,0,0,0): "Media Center",
    (1,1,0,17,0,0,0,0,1,0,0,0,0,0,0,0): "DVD",
    (1,1,0,16,0,0,0,0,1,0,0,0,0,0,0,0): "Music",
    (1,1,0,12,0,0,0,0,1,0,0,0,0,0,0,0): "Photo",
    (1,1,0,8,0,0,0,0,1,0,0,0,0,0,0,0): "Video",
    (1,1,0,25,0,0,0,0,1,0,0,0,0,0,0,0): "DVD Menu",
    (1,0,0,65,0,0,0,0,1,0,0,0,0,0,0,0): "Mute",
    (1,0,0,42,0,0,0,0,1,0,0,0,0,0,0,0): "Back",
    (1,0,0,58,0,0,0,0,1,0,0,0,0,0,0,0): "Guide",
    (1,1,0,21,0,0,0,0,1,0,0,0,0,0,0,0): "Record",
    (1,3,0,21,0,0,0,0,1,0,0,0,0,0,0,0): "Repeat",
    (1,0,0,40,0,0,0,0,1,0,0,0,0,0,0,0): "Enter",
    (1,0,0,82,0,0,0,0,1,0,0,0,0,0,0,0): "Arrow Up",
    (1,0,0,79,0,0,0,0,1,0,0,0,0,0,0,0): "Arrow Left",
    (1,0,0,81,0,0,0,0,1,0,0,0,0,0,0,0): "Arrow Down",
    (1,0,0,80,0,0,0,0,1,0,0,0,0,0,0,0): "Arrow Right",
    (3,1,0,0,0,0,0,0,3,0,0,0,0,0,0,0): "Volume +",
    (3,2,0,0,0,0,0,0,3,0,0,0,0,0,0,0): "Volume -",
    (1,0,0,75,0,0,0,0,1,0,0,0,0,0,0,0): "Channel +",
    (1,0,0,78,0,0,0,0,1,0,0,0,0,0,0,0): "Channel -",
    (1,0,0,30,0,0,0,0,1,0,0,0,0,0,0,0): "Number 1",
    (1,0,0,31,0,0,0,0,1,0,0,0,0,0,0,0): "Number 2",
    (1,0,0,32,0,0,0,0,1,0,0,0,0,0,0,0): "Number 3",
    (1,0,0,33,0,0,0,0,1,0,0,0,0,0,0,0): "Number 4",
    (1,0,0,34,0,0,0,0,1,0,0,0,0,0,0,0): "Number 5",
    (1,0,0,35,0,0,0,0,1,0,0,0,0,0,0,0): "Number 6",
    (1,0,0,36,0,0,0,0,1,0,0,0,0,0,0,0): "Number 7",
    (1,0,0,37,0,0,0,0,1,0,0,0,0,0,0,0): "Number 8",
    (1,0,0,38,0,0,0,0,1,0,0,0,0,0,0,0): "Number 9",
    (1,0,0,39,0,0,0,0,1,0,0,0,0,0,0,0): "Number 0",
    (1,3,0,19,0,0,0,0,1,0,0,0,0,0,0,0): "Play",
    (1,1,0,19,0,0,0,0,1,0,0,0,0,0,0,0): "Pause",
    (1,1,0,22,0,0,0,0,1,0,0,0,0,0,0,0): "Stop",
    (1,3,0,7,0,0,0,0,1,0,0,0,0,0,0,0): "Rewind",
    (1,3,0,9,0,0,0,0,1,0,0,0,0,0,0,0): "Forward",
    (1,1,0,5,0,0,0,0,1,0,0,0,0,0,0,0): "Skip Back",
    (1,1,0,9,0,0,0,0,1,0,0,0,0,0,0,0): "Skip Forward",

}

class Cyp_Se_WitheHome(eg.PluginBase):
               
    def __start__(self):
        self.usb = eg.WinUsbRemote(
            "{72679574-1865-499d-B182-4B099D6D1391}", 
            self.Callback, 
            16
        )
        if not self.usb.IsOk():
            raise self.Exceptions.DeviceNotFound

    def __stop__(self):
        self.usb.Close()

    def Callback(self, data):
        value = data[:16]
        if value in CODES:
            self.TriggerEvent(CODES[value])
        else:
            print data
I'm going to work on some sort of universal config file for it, and post what i come up with.
User avatar
zian
Site Admin
Posts: 569
Joined: Wed Jun 24, 2009 3:54 pm

Re: "Cyp Se WitheHome" Remote Plugin

Post by zian »

Thanks for your help fella's.

I had this remote for months now and could NOT get it to work well with EG...if at all.
until this morning...using both of your files and suggestions.

PEACHY!!!
eventghost.net
Be there or be square.
User avatar
zian
Site Admin
Posts: 569
Joined: Wed Jun 24, 2009 3:54 pm

Re: "Cyp Se WitheHome" Remote Plugin

Post by zian »

zian wrote:Thanks for your help fella's.

I had this remote for months now and could NOT get it to work well with EG...if at all.
until this morning...using both of your files and suggestions.

PEACHY!!!

The above applied to when I was running WinXP.
Days gone by.

Would the process to get this remote working in Win7 64bit be much different?
Would it even be possible?
(so far it has not)
eventghost.net
Be there or be square.
User avatar
zian
Site Admin
Posts: 569
Joined: Wed Jun 24, 2009 3:54 pm

Re: "Cyp Se WitheHome" Remote Plugin

Post by zian »

I got it to work.

I think the trick was using WinRAR to unpack the driver.exe (not peaZip)...
And also going to a way classic Version of EG.
eventghost.net
Be there or be square.
Post Reply