Page 2 of 8
Re: Plugin for USB PC Remote Controller
Posted: Mon Jun 29, 2009 1:24 pm
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().
Re: Plugin for USB PC Remote Controller
Posted: Mon Jun 29, 2009 7:30 pm
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
Re: Plugin for USB PC Remote Controller
Posted: Mon Jun 29, 2009 7:45 pm
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.
Re: Plugin for USB PC Remote Controller
Posted: Wed Jul 01, 2009 5:20 pm
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?
Re: Plugin for USB PC Remote Controller
Posted: Wed Jul 01, 2009 6:16 pm
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.
Re: Plugin for USB PC Remote Controller
Posted: Thu Jul 02, 2009 9:58 am
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.
Re: Plugin for USB PC Remote Controller
Posted: Thu Jul 02, 2009 8:37 pm
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
Re: Plugin for USB PC Remote Controller
Posted: Thu Jul 02, 2009 8:52 pm
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?
Re: Plugin for USB PC Remote Controller
Posted: Thu Jul 02, 2009 9:08 pm
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
Re: Plugin for USB PC Remote Controller
Posted: Thu Jul 02, 2009 9:34 pm
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.
Re: Plugin for USB PC Remote Controller
Posted: Fri Jul 03, 2009 10:39 am
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
Re: Plugin for USB PC Remote Controller
Posted: Sun Jul 05, 2009 8:11 am
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
Re: Plugin for USB PC Remote Controller
Posted: Tue Jul 14, 2009 9:51 am
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'
Re: Plugin for USB PC Remote Controller
Posted: Mon Jul 20, 2009 2:24 pm
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?
Re: Plugin for USB PC Remote Controller
Posted: Mon Jul 20, 2009 2:50 pm
by easy
BTW, if there is no Microsoft Visual C++ Redistributable installed - the driver install crashes... Tested on two PC's with XP SP3