[WINDOWS] Zen and the Art of Media Center Remote Controls

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jhsrennie Offline
Team-XBMC Developer
Posts: 7,236
Joined: Nov 2008
Reputation: 119
Location: Chester, UK
Thumbs Up  [WINDOWS] Zen and the Art of Media Center Remote Controls
Post: #1
How about the following for a Wiki article? I'll post it here for comments because the Wiki appears to be locked down.

----8<----

Zen and the Art of Media Center Remote Controls

This article discusses some of the issues you’ll run into trying to use a Windows Media Center Edition remote control with XBMC. The article only considers running XBMC on Microsoft Windows, not Linux or OSX. Also it’s more of a general discussion than a HowTo, though there are links to some HowTos in the article. Also see http://forum.xbmc.org/showthread.php?tid=38585 for a list of articles on making remote controls work.

The reason why an article like this is necessary is because not all MCE remotes are equal. Specifically remotes fall into three classes:

1. The official MS MCE remote (and true compatibles)
2. Cheap clone remotes that send MCE keyboard shortcuts
3. Cheap clone remotes that send multimedia keystrokes

And just to confuse matters most remotes are a combination of these three classes, for example the official Microsoft MCE remote also sends some MCE keyboard shortcuts like the cheap clone remotes. Also the cheap clones generally send a mixture of MCE shortcuts and multimedia keystrokes.

I’ll describe the difference between the three types of remotes below, but to understand the differences you need to appreciate that these remotes were originally designed for use with Windows Media Center, and there are three ways to control Media Center.

Through the infrared driver
Media Center links to the Windows infra-red device driver (irbus.sys and hidir.sys) and processes the infra-red commands from the remote directly. This is (mostly) how the official MS remote works.

With keyboard shortcuts
All the Media Center commands have a keyboard shortcuts using keys on a standard keyboard. For example "Play" is control-shift-P and "Stop" is control-shift-S. The remote can send these keystrokes when you press a button.

With multimedia keyboard keystrokes
You can buy keyboards with extra multimedia keys that don't appear on a standard keyboard. The Microsoft MCE Keyboard is a good example. The remote can simulate keystrokes from the extra multimedia keys when you press a button.

The next sections describe how the various types of remote work and how they can be used with XBMC.

Cheap clone remotes

We'll start by considering the cheap clone remotes because they are simpler than the official MS remote. These are classes 2 and 3 in my classification above. The official MS remote is actually a very sophisticated and expensive remote controller, and it didn't take suppliers long to realise they could make a simpler and cheaper remote that did much the same. That's why I've categorised these as "cheap clone remotes".

The cheap clone remotes appear to Windows as a keyboard (sometimes a mouse too) and not as an IR device. Once you've connected the remote, if you open Device Manager you'll find that under the "Human Interface Devices" section you have some new devices. Unplug the receiver and you'll see them disappear.

You will find that a lot of the keys on the remote work with all Windows apps. For example the left, right, up and down buttons usually just send the same keystrokes as the arrow keys on the keyboard. You could use the buttons on the remote to navigate round an Excel spreadsheet.

But what about the Play button? Well the cheap clone remotes will send a keystroke when you press Play, but it can be one of two different keystrokes. The class 2 remotes will send the MCE shortcut key control-shift-P and the class 3 remotes will send the multimedia play key VK_MEDIA_PLAY_PAUSE.

XBMC doesn't recognise the MCE shortcuts like control-shift-P, so the class 2 remotes are pretty useless for XBMC (without extra messing around; see below). The good news is that XBMC does recognise the multimedia keystrokes (or at least some of them) so the class 3 remotes will work with XBMC. The bad news is that it's impossible to know what keystrokes a cheap clone remote will send when you buy it so you don't know if it will work with XBMC or not. Also a popular cheap remote that I've just bought sends the multimedia keystrokes for most buttons but the MCE shortcuts control-shift-F and control-shift-B for the fast forward and reverse buttons. That makes it a mixture of class 2 and class 3, so some of the buttons work, but not all.

Given this uncertainty you might be better advised to go for an official MS remote, but these too have their problems.

The official MS remote

Microsoft seem to have stopped making the official MS remote. At least it's hard to buy one. Fortunately there are usually lots on eBay.

Windows 7, Vista and XP Media Center Edition have drivers for the MS remote built in and will detect and install the device when you plug it in. XP Pro SP2 also has the drivers built in. I haven't tested other versions of XP. Once the drivers are installed, if you open Device Manager and look under "Universal Serial Bus controllers" you'll see a new device called "eHome Infrared Receiver". Under Human Interface Devices you'll also see a HID keyboard device just like a cheap clone remote. This is because the MS remote can emulate a keyboard as well as operating as an IR device.

Having got your MS remote installed you'll find that it doesn't work with XBMC. This is because the Windows version of XBMC has no support for the Windows infra-red device driver so it is unable to detect the infra-red codes sent when you press, for example, the Play button. However you'll find that some of the keys, like the left, right, up and down keys, do work. This is because the MS remote sends keystrokes when you press these buttons just like the cheap clone remotes.

So how do you get the MS remote to work with XBMC? Well as I mentioned, the MS remote is a sophisticated device and you can change what it does when you press the buttons by editing the registry. A good summary is provided in http://forum.xbmc.org/showthread.php?tid=61571

The editing required is not for the faint hearted, but if you download MCERemote.zip from http://www.ratsauce.plus.com/xbmc.htm the zip includes two .reg files that will make the changes for you. There are two .reg files because you have two options for configuring the remote:

(a) Configure the remote to send the standard MCE shortcuts i.e. make it behave as a "class 2" remote

(b) Configure the remote to send the standard XBMC keys, e.g. "P" when you press the play button and "X" when you press the stop button.

If you want to use the remote with the Windows Media Center you have to choose option (a). If you don't care about Media Center and just want to use the remote with XBMC then option (b) will make the remote work perfectly with XBMC without any further fuss.

An alternative I should mention is to use external software like IR Server Suite, which can process the infra-red codes sent by the remote and convert them into keystrokes that XBMC can use. See for example http://forum.xbmc.org/showthread.php?tid=35910 though as the length of the thread will demonstrate this isn't an entirely trivial process.

Making class 2 remotes work with XBMC

Let's pause and summarise where we've got to. The official (class 1) MS remote can be configured to work with XBMC though it isn't much use out of the box, and if you configure it as a class 2 (to keep it working with Media Center) it won't work with XBMC. The class 3 remotes that send multimedia keystrokes will work out of the box with XBMC, but few remotes are pure class 3 and in any case you don't know in advance what you're buying. So the obvious tactic is to try and make the class 2 remotes work.

The problem with the class 2 remotes is that the XBMC keyboard.xml has no way of specifying keys like control-shift-P (for Play). The version of XBMC after 9.11 will probably have an enhanced keyboard.xml so you could make entries like:

<p mod="ctrl,shift">Play</p>

To configure control-shift-P to mean Play. The good news is that this makes it easy to make the class 2 remotes work just by editing keyboard.xml. The bad news is that you have to wait for this future version of XBMC, and in any case it isn't decided for certain that this feature will be in it. So what can you do at the moment? Well there are two options:

(a) Use an external helper app like EventGhost
(b) Modify the XBMC source code and compile it yourself

The most popular option is to use EventGhost and this generally works very well. The XBMC forums have lots of advice on the subject; just search the Windows specific forum for "EventGhost".

Option (b) isn't that attractive to non-nerds, but luckily a nerd near here has done it for you. From http://www.ratsauce.plus.com/xbmc.htm you can download a recompiled version of XBMC that works with the standard MCE shortcuts and therefore with class 2 remotes.

Summary

Well the simple summary is that life is complicated!

My recommendation is to try and buy an official MS remote because at least you know what you're getting. You'll still need some work to make it usable with XBMC. My preference would be to modify the registry to change the keys the buttons send, though you can use EventGhost or IR Server Suite.

If you can wait, the version of XBMC after 9.11 will probably make life simpler. If you can't wait you're welcome to download the customised version of XBMC from http://www.ratsauce.plus.com/xbmc.htm that enables XBMC to work with class 2 remotes.
(This post was last modified: 2009-12-09 10:42 by jhsrennie.)
find quote
dtviewer Offline
Fan
Posts: 664
Joined: Jul 2008
Reputation: 1
Post: #2
Great job on this!
Explains everything very well!
find quote
kiboy6 Offline
Fan
Posts: 632
Joined: Mar 2009
Reputation: 0
Post: #3
Thanks so much - perhaps this should be stickied Smile

I love it when people explain things assuming a lay-person's level of understanding - If there were more such guides for different aspects of XBMC these forums would be a lot less cluttered with the questions of confused people.

Despite how helpful everyone is here, the level of PC knowledge is so high that it can often be quite hard to find what turns out to be a relatively simple answer Smile So...thanks!
find quote
natethomas Offline
Team Kodi Community Manager
Posts: 3,645
Joined: Apr 2008
Reputation: 63
Location: Kansas
Post: #4
kiboy6 Wrote:Thanks so much - perhaps this should be stickied Smile

I love it when people explain things assuming a lay-person's level of understanding - If there were more such guides for different aspects of XBMC these forums would be a lot less cluttered with the questions of confused people.

Despite how helpful everyone is here, the level of PC knowledge is so high that it can often be quite hard to find what turns out to be a relatively simple answer Smile So...thanks!

Agreed. I haven't stickied this, but I did make it the first link on the Remote tutorial thread. With any luck, in the next six months all of this will become a thing of the past.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
taxigps Offline
Team-XBMC Python Developer
Posts: 446
Joined: Jan 2009
Reputation: 1
Post: #5
Good work! i have translate it into chinese.
http://bbs.htpc1.com/thread-75610-1-1.html
find quote
andredurao Offline
Junior Member
Posts: 4
Joined: Jan 2010
Reputation: 0
Post: #6
well, it seems there is custom builds of XBMC 9.11 like http://www.ratsauce.plus.com/xbmc.htm I'll check that..
find quote
aptalca Offline
The Dude
Posts: 912
Joined: Sep 2009
Reputation: 25
Post: #7
Hi JR, thanks for the numerous posts and articles you wrote about these remotes. I read through quite a few of them, and I have a couple of questions.

First of all, I have the original ms remote that I bought a couple of years ago on ebay. I was previously using it with bruno's replacement driver and I had mapped the signals to keyboard presses using girder.

I just switched to win 7 for dharma and dxva and I am doing the remote setup from scratch. I noticed that the ms remote works (mostly) out of the box in dharma. That is good news, however, the back key on the remote does not behave exactly the same as backspace on keyboard. For instance, in system info or movie info, the remote back does nothing whereas backspace exits the window.

I am guessing the out of the box ms remote keymaps should be handled by remote.xml and when I check the file, under "movie information" I can see that back is supposed to be mapped to "close", which makes me think it should have worked. Am I wrong in that assumption?


EDIT: Nevermind, I figured it out. Apparently out of the box ms remotes were handled by the keyboard.xml, not remote.xml
Also, the remote was sending the browser_back command, not backspace. That button I don't think is handled by the keyboard.xml (At least I didn't see any mention of it) That probably explains why that button did not cause a sound effect in my skin, anyway, I switched to rennie's custom reg and I am much happier :-)
(This post was last modified: 2010-08-06 04:30 by aptalca.)
find quote
methcat Offline
Junior Member
Posts: 36
Joined: Jul 2007
Reputation: 0
Post: #8
jhsrennie Wrote:The editing required is not for the faint hearted, but if you download MCERemote.zip from http://www.ratsauce.plus.com/xbmc.htm the zip includes two .reg files that will make the changes for you. There are two .reg files because you have two options for configuring the remote:

is there another source for the installers in MCERemote.zip? the site doesn't seem to be there anymore...
find quote
craftyza Offline
Junior Member
Posts: 7
Joined: Dec 2010
Reputation: 0
Post: #9
Yeah I would also like to get my hands on those files :-(
I'm Using the Dharma Stable release, and still none of my 2 remotes wants to work.
I've got the Verris Remote that comes with Antec Fusion, and a Harmony 600
All I want is to sit on my butt and NOT use a keyboard and mouse.
find quote
ashlar Offline
Donor
Posts: 2,114
Joined: Mar 2006
Reputation: 27
Post: #10
You should install the relevant MCERemote add-on. It's under Program add-ons if I'm not mistaken.

For troubleshooting and bug reporting please make sure you read this first.
find quote
magao Offline
Senior Member
Posts: 158
Joined: Sep 2008
Reputation: 2
Post: #11
The Hauppage USB MCE remote is a true RC6 MCE compatible remote. It even sends IR commands for the arrow buttons.

On thing to be aware of if using a class 2 remote is the order that the keyboard events occur. Only the actual keystroke is captured (I'll use Ctrl-Shift-P in my examples). Ideally, the remote only sends a Ctrl-Shift-P keypressed event which can be captured. In practice though it will send one of the following 4 sequences of keystrokes:

Ctrl (keydown ctrl)
Ctrl+Shift (keydown shift)
Ctrl+Shift+P (keydown p)
Ctrl+Shift (keyup p)
Ctrl (keyup shift)
(keyup ctrl)

Shift (keydown shift)
Shift+Ctrl (keydown ctrl)
Shift+Ctrl+P (keydown p)
Shift+Ctrl (keyup p)
Shift (keyup ctrl)
(keyup shift)

Ctrl (keydown ctrl)
Ctrl+Shift (keydown shift)
Ctrl+Shift+P (keydown p)
Shift+P (keyup ctrl)
P (keyup shift)
(keyup p)

Shift (keydown shift)
Shift+Ctrl (keydown ctrl)
Shift+Ctrl+P (keydown p)
Ctrl+P (keyup shift)
P (keyup ctrl)
(keyup p)

If either of the first 2 sequences are sent, then you're fine - you can just capture the Ctrl+Shift+P and the remaining combinations are ignored (modifier keys have no active effect).

If OTOH you get a remote that sends either of the second 2 sequences (I've had one before) you're in trouble. You capture Ctrl-Shift-P for XBMC ... and the next combination that's seen is either Ctrl-P or Shift-P. If you don't also capture this combination, it gets passed through to any other applications. Similarly with the following P. You can find some very strange things happening ...

The way I dealt with this (until I got a real MCE compatible remote - the Hauppage above) was to configure EventGhost to:

1. Capture the Ctrl-Shift-P and set a flag that we're capturing the event.
2. Capture Shift-P. Check if we're currently capturing Ctrl-Shift-P. If so, swallow it, otherwise pass it on.
3. Capture P. Check if we're currently capturing Ctrl-Shift-P. If so, swallow it, clear that we're capturing Ctrl-Shift-P and trigger the action for Ctrl-Shift-P, otherwise pass it on.

It worked, but was very very clunky. It's not something you could do with just XBMC since it needs decision-making logic.
find quote
MickMcGeough Offline
Junior Member
Posts: 1
Joined: Jan 2011
Reputation: 0
Post: #12
craftyza Wrote:Yeah I would also like to get my hands on those files :-(
I'm Using the Dharma Stable release, and still none of my 2 remotes wants to work.
I've got the Verris Remote that comes with Antec Fusion, and a Harmony 600
All I want is to sit on my butt and NOT use a keyboard and mouse.
Check out this thread (and post specifically):
http://forum.xbmc.org/showpost.php?p=228226&postcount=6

That'll get you most of the way. I ended up tweaking some of the buttons in the iMon program remote management software. Check here for the keys to bind: http://wiki.xbmc.org/index.php?title=Global_Keyboard
find quote
xinxilas Offline
Junior Member
Posts: 6
Joined: Jun 2011
Reputation: 0
Post: #13
Is it an outdated article?

"BMC doesn't recognise the MCE shortcuts like control-shift-P, so the class 2 remotes are pretty useless for XBMC "

Because on keyboard.xml it can be recognized right?

EDIT:
Yes it is but he told it on last item Big Grin
(This post was last modified: 2011-06-18 00:58 by xinxilas.)
find quote
kc2008ls Offline
Junior Member
Posts: 9
Joined: Jun 2011
Reputation: 0
Post: #14
Thank you! Very helpful and informative.
find quote