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.

Plugin for USB PC Remote Controller

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Plugin for USB PC Remote Controller

Post by Bitmonster »

This is the same PID/VID as the remote of srs. So most likely the driver should already work and the plugin from srs also. If you want to rewrite his plugin to the new eg.WinUsbRemote() start with a plugin like this:

Code: Select all

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

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

    def Callback(self, data):
        print data
Now you should see data coming in on button presses. If you always get the same number of bytes on every button press, you can increase the third parameter of eg.WinUsbRemote to the wanted size. So if you say 6, it will always read six bytes from the device. And then you have to find some algorithm to map the bytes to some readable events in the Callback().
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Plugin for USB PC Remote Controller

Post by Pako »

Very thank you.
I tried it and it looks like it will work.
The algorithm but not totally simple.
I have (meantime) three different types of buttons.
Some send 4 bytes for key-down and 4 for key-up, some 2x4 for key-down and 1x4 for key-up and some even 6x4 for key-down and 3x4 for key-up. And yet I have not mentioned the "joystick", which emulates a mouse. There's the key codes transmitted continuously.
Pako
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Plugin for USB PC Remote Controller

Post by Bitmonster »

There is a fourth parameter to eg.WinUsbRemote. If you set it to True, it will suppress repeated reception of the same data. So if you receive (0, 0, 0, 0) continuously, you will only get the first (0, 0, 0, 0) and then only again, if the data changes to another value. Since the transfer from the USB pipe to your callback consumes some CPU power, it might be useful to enable this, if everything can be decoded this way.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
tom101
Posts: 8
Joined: Thu Jun 25, 2009 10:22 am

Re: Plugin for USB PC Remote Controller

Post by tom101 »

Well this seems to work extremely well with the Conceptronic remote so thank you very much. The only thing I cannot do is wake the PC from standby now that the device is not a HID. Is there a way to do this, or would it take the aforementioned filter driver?
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Plugin for USB PC Remote Controller

Post by Bitmonster »

Interesting finding. Haven't noticed they have the ability to wake the machine out of standby. I have updated the driver package and wake-up should work as before now. If you don't want it, you can disable it on the power management tab in the device manager for the two Conceptronics devices.

The UltraX has the same feature and it is enabled also now.

The TechniSat doesn't seem to have such feature.

@pako
Does your remote support wake out of standby with the normal HID driver? I have enabled it for this remote in the replacement driver also now, so if it supports this feature, there should be a power management tab in the device manager.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
tom101
Posts: 8
Joined: Thu Jun 25, 2009 10:22 am

Re: Plugin for USB PC Remote Controller

Post by tom101 »

That's great! Waking from standby now works, but unfortunately as soon as it wakes it goes back into standby, I think because event ghost registers the button press that was made when the pc was in standby. A workaround for this is to use a different button to put the pc into standby though.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Plugin for USB PC Remote Controller

Post by Pako »

Bitmonster wrote:@pako
Does your remote support wake out of standby with the normal HID driver? I have enabled it for this remote in the replacement driver also now, so if it supports this feature, there should be a power management tab in the device manager.
Yes, with my remote control I can wake the computer from Standby mode. It works with both drivers (standard HID driver and driver "USB PC Remote Controller") if I press button "Power".
Bitmonster wrote:There is a fourth parameter to eg.WinUsbRemote. If you set it to True, it will suppress repeated reception of the same data. So if you receive (0, 0, 0, 0) continuously, you will only get the first (0, 0, 0, 0) and then only again, if the data changes to another value. Since the transfer from the USB pipe to your callback consumes some CPU power, it might be useful to enable this, if everything can be decoded this way.
I finished the first version of plugin for my remote using eg.WinUsbRemote. Meantime there can not use "Mouse-Joystick", but I would like to make it possible to use like the navigational button. But I am not sure, whether this is possible.
I tried the fourth parameter eg.WinUsbRemote, but it can not be set to True. Otherwise for some of the buttons "disappear" key-up event.
Pako
Attachments
DX_USB_Remote.zip
(15.45 KiB) Downloaded 454 times
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Plugin for USB PC Remote Controller

Post by Bitmonster »

So does the remote send data, even if you don't press any button? Or does it only continuously send if the mouse pad is pressed?
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Plugin for USB PC Remote Controller

Post by Pako »

Bitmonster wrote:So does the remote send data, even if you don't press any button? Or does it only continuously send if the mouse pad is pressed?
B-variant is correct. Continuously send only mouse-pad. What data send other button, you can see in the tuple "CODES". The first item is data for the key-down and the second item for the key-up.
Pako
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Plugin for USB PC Remote Controller

Post by Bitmonster »

If it only sends much data on button presses, then there shouldn't be any problem. I was only afraid, the remote would produce needless CPU consumption because data has to be decoded all the time in Python, even if no button is pressed.

Btw. you should rethink your CODES table. There are just to many "[item[0][0] for item in CODES]". Most the times, the fastest way in Python is to arrange such data in one or multiple dictionaries, so you get all needed information with a single dictionary-lookup.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Plugin for USB PC Remote Controller

Post by Pako »

Bitmonster wrote:Btw. you should rethink your CODES table. There are just to many "[item[0][0] for item in CODES]". Most the times, the fastest way in Python is to arrange such data in one or multiple dictionaries, so you get all needed information with a single dictionary-lookup.
Thank you for your very valuable comment. I made a simple change to the dictionary, and I left the same algorithm.
Pako
Attachments
DX_USB_Remote.zip
Version 1.0.1 2009-07-03
(15.59 KiB) Downloaded 371 times
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Plugin for USB PC Remote Controller

Post by Pako »

I finished a new version of my plugin. The biggest change is the use of Mousepad. I could not find any algorithm, how to reliably identify all four directions, however two directions can be reliably identify. I think, that even so it's very useful. Directions left/right can be controlled via L and R mouse buttons, while the directions up/down can be controlled via Mousepad.
I tried the plugin from srs, and there it looks, that Mousepad is unused.
Pako
Attachments
DX_USB_Remote.zip
Version 1.0.2 2009-07-05
(15.86 KiB) Downloaded 425 times
tom101
Posts: 8
Joined: Thu Jun 25, 2009 10:22 am

Re: Plugin for USB PC Remote Controller

Post by tom101 »

There may be a bug in the usb driver. If I resume from standby a few minutes later the PC goes back into standby mode. This only happens if the system is idle and when using the conceptronic remote to resume. It doesn't matter if eventghost runs on startup or not, and it doesn't happen after a restart or if resuming using the power button on the PC. I have all my power settings set to 'always on'
easy
Posts: 46
Joined: Wed Dec 05, 2007 10:05 pm

Re: Plugin for USB PC Remote Controller

Post by easy »

BitMonster, please, could You include the link for the driver in the Downloads page, so there would be no need to search forums in the future after each PC reinstall?
easy
Posts: 46
Joined: Wed Dec 05, 2007 10:05 pm

Re: Plugin for USB PC Remote Controller

Post by easy »

BTW, if there is no Microsoft Visual C++ Redistributable installed - the driver install crashes... Tested on two PC's with XP SP3
Post Reply