Xbox remote controller plugin

Questions and comments specific to a particular plugin should go here.

Xbox remote controller plugin

Postby jinxdone » Sat Oct 18, 2008 1:06 am

This is the support thread for the Xbox DVD kit remote plugin for the original Xbox, not Xbox360. Feel free to post any questions, comments, problems, suggestions etc. about this plugin in here.

This plugin should be included in recent EG builds and you can also get it from the EG SVN: http://eventghost.svn.sourceforge.net/v ... ns/XBCDRC/

I have moved this thread here from the coding corner and quoted the original starting post of this thread below for future reference.

The past few days I have taken some time to figure out how to get an xbox(original, not 360) dvd remote kit to work with EventGhost.

Obiviously first you need to wire the receiver unit to an usb port on your computer, because of the non-standard usb connector you need to either solder an usb cable into the receiver pcb or get an adapter cable/hub. After that install the XBCDRC open source drivers for the remote by redcl0ud. You don't need to use the piece of software that generates keypresses from the remote buttons being pushed.. that's what we want EventGhost to do now! ;)

It is an HID device/driver, but unfortunately there are issues trying to use it with the 'Generic HID' plugin. Only way to get response from it is to set the hid plugin into 'raw' mode. Now the problem is that hid plugin should sleep and wait for data from the driver, but it seems there is always data to be read and thus the hid plugin enters an endless loop generating events. (even when no buttons are pressed) (not to mention the raw data events are quite hard to make sense of as is)

What I did was to modify the hid plugin to get the button presses from the raw data that it is able to read and map those into events. Arguably the better way to approach it instead would be to modify the driver to make it compatible but that would mean lots of work and you would need to understand how to write device drivers. (I for one lack that knowledge..)


If you guys have any suggestions or comments I'd be glad to hear them. If it passes your scrutiny I hope it can be put on the official distribution and I'll open up a support thread on the plugin forum.


-jinxdone

Last edited by jinxdone on Thu Feb 12, 2009 10:46 pm, edited 3 times in total.
User avatar
jinxdone
Plugin Developer
 
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: Xbox remote controller plugin

Postby Bitmonster » Mon Oct 20, 2008 6:14 pm

Would it be possible to remove all/most of the configuration options? I find it a bit confusing, that it has all options of the HID plugin.

I would also like to split the HID, PS3 and your plugin a bit, so they could use common HID functions and structures from the EG-lib. But that would need some work from Bartman I suppose.

Anyhow you can place it into the SVN trunk.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Bitmonster
Site Admin
 
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Xbox remote controller plugin

Postby Bartman » Mon Oct 20, 2008 6:24 pm

We actually had a PM conversation.
Is there an example I can use to move some core HID functions into the EG-lib?
Bartman
Plugin Developer
 
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Xbox remote controller plugin

Postby Bitmonster » Mon Oct 20, 2008 6:51 pm

I suppose you simply add a Hid.py to eg/WinApi and provide some fucntions and structures there. Actually I guess most if not all ctypes structures could be created by the eg.WinApi.Dynamic hook automatically. But to start the automatic creation, you need VC7.1 and some other stuff installed on your machine.

I'm currently working on getting EG to run under Python 2.6 and this will simplify things, as everything under Python 2.6 can be build with the free Visual Studio 2008 Express Edition.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Bitmonster
Site Admin
 
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Xbox remote controller plugin

Postby DeathAxe » Fri Dec 19, 2008 8:42 pm

Hi, I am using this program for the first time as recomended by a guy on another forum. I added the plugin into the plugins folder, added it to the program, but all I get is a big list of errors down the side pane. help? :(
DeathAxe
 
Posts: 13
Joined: Fri Dec 19, 2008 8:38 pm

Re: Xbox remote controller plugin

Postby jinxdone » Fri Dec 19, 2008 11:36 pm

Hi.

Yep, that guy would be me.

What are the error messages you get?
User avatar
jinxdone
Plugin Developer
 
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: Xbox remote controller plugin

Postby waldo22 » Tue Feb 10, 2009 1:29 am

Got these errors...

Code: Select all
Plugin: Xbox remote control (XBCDRC / HID)
Error starting plugin: Xbox remote control (XBCDRC / HID)
Traceback (most recent call last) (1487):
  File "C:\Program Files\EventGhost\eg\Classes\PluginInfo.py", line 300, in Start
TypeError: __start__() takes at least 10 arguments (1 given)
Main.OnInit
Main.OnInitAfterBoot
Error while configuring: Plugin: Xbox remote control (XBCDRC / HID)
Traceback (most recent call last):
  File "C:\Program Files\EventGhost\eg\Classes\MainFrame\__init__.py", line 802, in OnCmdAddPlugin
    ).switch(self.document, pluginInfo)
  File "C:\Program Files\EventGhost\eg\Classes\UndoHandler\NewPlugin.py", line 42, in Do
    if not eg.UndoHandler.Configure().Do(pluginItem, True):
  File "C:\Program Files\EventGhost\eg\Classes\UndoHandler\Configure.py", line 57, in Do
    newArgs = gr.switch(*item.GetArgs())
  File "C:\Program Files\EventGhost\plugins\XboxReceiver\__init__.py", line 778, in Configure
    panel = eg.ConfigPanel(self, resizeable=True)
TypeError: __init__() got an unexpected keyword argument 'resizeable'


Any ideas?

Thanks,

Wes
waldo22
 
Posts: 8
Joined: Sun Jan 25, 2009 5:27 am

Re: Xbox remote controller plugin

Postby jinxdone » Tue Feb 10, 2009 7:31 am

Hello.

Looks to me like something has changed between now and when I made the first version. Try the 0.1.1 attached in the first post.

It's not extensively tested so far, and may have some bugs..

-jinxdone
User avatar
jinxdone
Plugin Developer
 
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: Xbox remote controller plugin

Postby waldo22 » Wed Feb 11, 2009 3:19 am

Awesome! That did the trick. Where do I send the beer?

I had to replace the plugin folder, remove the plugin, and reinstall it, but it works like a charm now.

I did run in to a possible bug, but I don't know how big of a deal it is.

I am using my Yamaha receiver remote, programmed to control an RCA DVD Player, and if I press the "ENT." number key (next to the numbers, to "enter" the numbers for the receiver) it crashes the XBCDRC remote plugin. It does the same thing when I press the "audio" key (next to the fast forward and rewind keys). Granted, these aren't buttons I ever need to press, but it worries me that I can crash the thing by pressing it by accident. No other buttons on the remote have any effect at all on the program (I tried them all).

It doesn't crash EventGhost, just the plugin. I can still do things in EventGhost. It's really hard to get it working again, however. I have to delete the plugin, restart EventGhost, add the plugin, restart EventGhost, Delete, restart, add, and restart. ...but as long as I don't press either of those two keys again, it seems to work great. Great response time, no lag, all buttons work as expected, etc.

Here is the error that it throws:
Code: Select all
Exception in thread \\?\hid#vid_045e&pid_0284&mi_00#7&350b2e8d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}:
Traceback (most recent call last):
  File "threading.pyc", line 486, in __bootstrap_inner
  File "C:\Program Files\EventGhost\plugins\XBCDRC\__init__.py", line 590, in run
KeyError: '006af0a'


Is there any debug info that I could provide you with? Maybe we could set the plugin to ignore remote codes other than the 17 standard buttons on the xbox remote?

Thanks for a GREAT plugin,

-Wes
waldo22
 
Posts: 8
Joined: Sun Jan 25, 2009 5:27 am

Re: Xbox remote controller plugin

Postby jinxdone » Wed Feb 11, 2009 8:32 am

It's not really a bug as-is, I only have the original Microsoft remote and only the codes it uses are recognized so far.

You can put any additional codes from any other remotes like yours to make it more compatible. The code -> key mapping array is around line 400 in the __init__.py file, you can just open it with any text editor to start adding codes. I think the buttons that crash the plugin can probably be added and the ones that cause absolutely nothing are most likely not even received by the hardware..

Do the following for each button that causes the error:
- Push the button
- Look at the "KeyError: '006af0a'" line in the log window, that hex string is the new unrecognized code..
- In __init__.py make a new entry for the new code-name pair in the array
- Save the __init__.py file
- Restart EG so that the modified plugin is being used.. test the new button
- Repeat for other non-working buttons

If you press and hold a button it may also trigger multiple different codes after a while, that's why there are three codes for every button in the array at the moment. If it does so just add all codes a button causes to the array like I have done with the existing ones.


Example of adding a value in the array, notice that the last entry does not have a comma ',' at the end:
...
'006c70a': '8', '0066305': '8', '00663fd': '8',
'006c60a': '9', '00663f5': '9', '006630d': '9',
'006cf0a': '0', '0066705': '0', '00667fd': '0',
'xxxxxxx': 'ENT', 'yyyyyyy': 'ENT', 'zzzzzzz': 'ENT',
'006af0a': 'AUDIO'

}
...

When you are done post all the new codes in here so I can add them as well and others don't have to go through that trouble a second time!

-jinxdone


Ps. I know I should make a learning-mode and atleast handle the error when a new code comes across, I'll try to fix that later today. The plugin has sort of been left on little attention and I havn't touched it since the initial version.. Sorry about that.
User avatar
jinxdone
Plugin Developer
 
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: Xbox remote controller plugin

Postby waldo22 » Wed Feb 11, 2009 2:32 pm

Ps. I know I should make a learning-mode and atleast handle the error when a new code comes across, I'll try to fix that later today


That's what I really meant, not really a bug, but handle the error when an unknown code is received.

That way, any random code that happens to be received by the hardware won't crash the plugin....

In the meantime, though, I'll just add the offending codes to the list.

This has been a really great thing, though, and I really appreciate the work you've done.

In fact, I wrote (what I think is) a good tutorial here:

http://xbmc.org/forum/showthread.php?t=45337

Thanks again,

Wes
waldo22
 
Posts: 8
Joined: Sun Jan 25, 2009 5:27 am

Re: Xbox remote controller plugin

Postby jinxdone » Thu Feb 12, 2009 12:05 am

Ok, new version as promised.

Changes:
- Cleaned up the configuration dialog, it will now simply attempt to find a device with the right vendor/device id. (Hopefully this approach works as I'm not 100% sure whether all devices have the same ID's!)
- It won't crash now when unknown codes are received but instead prints out a simple error message in the log.
- It should handle removing / readding the receiver device neatly now

You can get the new version from the SVN. It should also be included in new beta builds from now on.

I will open up a support thread in the plugin area of the forum for this soon.


waldo22: The method I described earlier still applies more or less for adding new codes and I'd like to know any that you came across. The idea is to add more to the plugin so the possible extra buttons in 3rd party remotes people might have would also work out of the box.

-jinxdone
User avatar
jinxdone
Plugin Developer
 
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: Xbox remote controller plugin

Postby waldo22 » Thu Feb 12, 2009 4:29 am

Thanks, jinxdone, that's great.

The error handling was really the important thing.

Those other buttons will probably be different for everyone. Of course, there's no harm in supporting them, but as long as every button on the XBox remote works and rogue codes don't crash the plugin, it's hard to complain.

I gotta tell you, this is working great for me. Response is every bit as good as the xbox.

Thanks a lot.

-Wes
waldo22
 
Posts: 8
Joined: Sun Jan 25, 2009 5:27 am

Re: Xbox remote controller plugin

Postby waldo22 » Thu Feb 12, 2009 6:19 pm

I can't get this new SVN version to work.

I get:
Code: Select all
Error finding an Xbox IR receiver: Vendor ID 1118

Under Device Manager, my device info is:
Code: Select all
USB\VID_045E&PID_0284&MI_00\6&279BE874&0&0000

I tried changing line 710 of the plugin to read:
Code: Select all
        self.vendorID = 045E

but then EventGhost can't even find the plugin to load from the plugin list.

I get
Code: Select all
Error while loading plugin-file XBCDRC.
Traceback (most recent call last) (1487):
  File "C:\Program Files\EventGhost\eg\Classes\PluginManager.py", line 177, in LoadPluginInfo
  File "C:\Program Files\EventGhost\eg\Classes\PluginInfo.py", line 119, in ImportPlugin
  File "C:\Program Files\EventGhost\plugins\XBCDRC\__init__.py", line 710
    self.vendorID = 045E
                       ^
SyntaxError: invalid token

Clearly, I don't know what I'm doing though.

Version 0.1.1 still works fine. When I add plugin 0.1.1, it seems to detect the device manufacturer as "Vendor ID 1118", so I don't know what's up.

-Wes
waldo22
 
Posts: 8
Joined: Sun Jan 25, 2009 5:27 am

Re: Xbox remote controller plugin

Postby jinxdone » Thu Feb 12, 2009 7:46 pm

Hmm.. The Vendor and Device id should be the same. The thing is I pretty much removed the config dialog and hard coded it in instead. Probably it went a bit sideways there, works on my IR receiver though. :roll:

Could you try changing lines 361-363 of the version from SVN:
Code: Select all
                if item[VENDOR_ID] == vendorID \
                    and item[PRODUCT_ID] == productID \
                    and item[VERSION_NUMBER] == versionNumber:


to this: (remove or comment out the third line)
Code: Select all
                if item[VENDOR_ID] == vendorID \
                    and item[PRODUCT_ID] == productID:



Are you using IRC? some sort of IM program? I'd like to get this debugged asap.
User avatar
jinxdone
Plugin Developer
 
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Next

Return to Plugin Support

Who is online

Users browsing this forum: No registered users and 1 guest