Using a Microsoft remote control in Windows: Difference between revisions
>Jhsrennie |
>Jhsrennie |
||
Line 87: | Line 87: | ||
<tr><td>5</td><td>If byte 4 is 0x04:key modifier. If byte 4 is 0x01:low byte of key code</td></tr> | <tr><td>5</td><td>If byte 4 is 0x04:key modifier. If byte 4 is 0x01:low byte of key code</td></tr> | ||
<tr><td>6</td><td>If byte 4 is 0x04:key code. If byte 4 is 0x01:high byte of key code</td></tr> | <tr><td>6</td><td>If byte 4 is 0x04:key code. If byte 4 is 0x01:high byte of key code</td></tr> | ||
</table> | |||
Byte 4 determines what the eHome driver will do when the button is pressed. If byte 4 is set to 0x03 the eHome driver will generate a "Raw Input" message, see http://msdn.microsoft.com/en-us/library/ms645536(v=vs.85).aspx. The only raw input messages likely to be useful are: | |||
<table> | |||
<tr> | |||
<td><button>,00,00,00,03,81,00</td> | |||
<td>System Power: will cause Windows to shut down</td> | |||
</tr> | |||
<tr> | |||
<td><button>,00,00,00,03,82,00</td> | |||
<td>System Sleep: will cause Windows to hibernate</td> | |||
</tr> | |||
<tr> | |||
<td><button>,00,00,00,03,83,00</td> | |||
<td>System Wake: will cause Windows to wake from hibernation</td> | |||
</tr> | |||
</table> | </table> | ||
Revision as of 11:22, 20 December 2010
This article applies to remote controls that use the Microsoft eHome device driver. If you are unsure whether your remote is an eHome remote look in the Device Manager under Human Interface Devices and see if there is a device called "Microsoft eHome Infrared Transceiver" or something similar.
The above example is from Windows 7. If the eHome device does not appear you aren't using the eHome driver and you should read no further. For MCE remotes see Using an MCE remote control in Windows and for general notes on remote controllers see Remote Controls.
Introduction
The simplest way to use an eHome remote with XBMC is to configure it to emulate a keyboard. The eHome driver can be configured by modifying the registry (details below). The details are rather involved, but there are various resources you can use that make it all very simple.
EliteGamer360 has written a registry config file and associated keyboard.xml and these are available from http://xbmccustomregis.sourceforge.net/.
jhsrennie has written an add-on to configure MS remotes. To install it run XBMC and go to Settings, Add-ons, Get Add-ons, XBMC.org Add-ons, Program Add-ons and select MCERemote. Once installed, you can open the add-on by selecting Programs from the home page then MCERemote. The addon includes an option to display the instructions.
Default eHome configuration
Any version of Windows from Windows XP onwards will automatically detect and install a Microsoft remote as soon as you connect it. With versions of XBMC from v10.0 Dharma onwards most of the buttons on the Microsoft remote will work immediately. The exceptions I know about are:
- The Info button; sometimes labelled More or just i.
- The volume buttons will control the Windows volume setting not the XBMC volume
- The four coloured buttons (not all MS remotes have these) won't do anything
- With Vista/Windows 7 the Live TV, Recorded TV and Guide buttons will start Windows Media Center. With Windows XP (non-Media Center Edition) these buttons won't do anything
- The Green/Windows button will start Windows Media Center
For most people this will be fine, and in that case you don't need to do anything further. The only reason for continuing with this article is if you want to customise the Microsoft remote to change the actions of any of the buttons or to make the Info and coloured buttons work.
Useful resources
http://xbmcmce.sourceforge.net/ has various utilities to help with tweaking the button mapping. ShowKey will show you what keypresses or AppCommand messages are being sent, and KeyMapEdit is a utility for editing the keyboard.xml file.
The remainder of this article describes the gory details of configuring the Microsoft remote. This probably looks frighteningly complicated to most of us, but very few people need to read further as EliteGamer360's scripts and/or the MCERemote add-on should do everything you need. Only the curious and determined need read further.
How the MS remote works
The Microsoft remote, or more accurately the eHome device driver, keeps the button configuration in the registry value ReportMappingTable in the key:
HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services \HidIr \Remotes \745a17a0-74d3-11d0-b6fe-00a0c90f57da
This is a binary array consisting of rows of 7 bytes. Each row defines one button. The seven bytes in the row are:
Byte | Action |
0 | button number (see below) |
1 | always 0 |
2 | always 0 |
3 | always 0 |
4 | 04 and 01 send keystrokes; 03 sends an IR signal |
5 | If byte 4 is 0x04:key modifier. If byte 4 is 0x01:low byte of key code |
6 | If byte 4 is 0x04:key code. If byte 4 is 0x01:high byte of key code |
Byte 4 determines what the eHome driver will do when the button is pressed. If byte 4 is set to 0x03 the eHome driver will generate a "Raw Input" message, see http://msdn.microsoft.com/en-us/library/ms645536(v=vs.85).aspx. The only raw input messages likely to be useful are:
<button>,00,00,00,03,81,00 | System Power: will cause Windows to shut down |
<button>,00,00,00,03,82,00 | System Sleep: will cause Windows to hibernate |
<button>,00,00,00,03,83,00 | System Wake: will cause Windows to wake from hibernation |
Byte 4 can be 01 or 03. These sends IR codes not keystrokes and I'm ignoring these values in this article. I'm only interested in setting byte 4 to "04" to indicate a keystroke.
Byte 5, the key modifier, specifies if control, shift etc are down when the key is sent. The value can be:
Byte | Action |
0 | No modifier |
1 | Control |
2 | Shift |
3 | Control-Shift |
4 | Alt |
5 | Control-Alt |
6 | Shift-Alt |
7 | Control-Shift-Alt |
8 | Windows |
9 | Control-Windows |
a | Shift-Windows |
b | Control-Shift-Windows |
c | Alt-Windows |
d | Control-Alt-Windows |
e | Shift-Alt-Windows |
f | Control-Shift-Alt-Windows |
If you're happy with binary numbers you've probably spotted that bit 0 specifies Control, bit 1 specifies Shift, bit 2 specifies Alt and bit 3 specifies the Windows key.
The keystroke is not an ACSII code or a scan code. It's an arbitrary code selected by MS. You can find a list of the codes in
http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf
The button numbers obey no obvious logic. The following table lists all the known button numbers. Thanks to the many people who put effort into discovering these numbers.
Button no. | Button name | Comments |
00 | 0 | Standard MS remote |
01 | 1 | Standard MS remote |
02 | 2 | Standard MS remote |
03 | 3 | Standard MS remote |
04 | 4 | Standard MS remote |
05 | 5 | Standard MS remote |
06 | 6 | Standard MS remote |
07 | 7 | Standard MS remote |
08 | 8 | Standard MS remote |
09 | 9 | Standard MS remote |
0A | Clear | Standard MS remote |
0B | Enter | Standard MS remote |
0C | Main Power | Standard MS remote |
0D | Windows | Standard MS remote |
0E | Mute | Standard MS remote. This button does not work on the 360 universal remote. |
0F | Info/More | Standard MS remote |
10 | Volume Up | Standard MS remote. This button does not work on the 360 universal remote. |
11 | Volume Down | Standard MS remote. This button does not work on the 360 universal remote. |
12 | Channel Up | Standard MS remote |
13 | Channel Down | Standard MS remote |
14 | Fast Forward | Standard MS remote |
15 | Rewind | Standard MS remote |
16 | Play | Standard MS remote |
17 | Record | Standard MS remote |
18 | Pause | Standard MS remote |
19 | Stop | Standard MS remote |
1A | Next/Skip | Standard MS remote |
1B | Previous/Replay | Standard MS remote |
1C | #/Refresh | Labelled with a curved arrow (meaning refresh) on the 360 universal remote. |
1D | */100 | Labelled "100" on the 360 universal remote. |
1E | Up | Standard MS remote |
1F | Down | Standard MS remote |
20 | Left | Standard MS remote |
21 | Right | Standard MS remote |
22 | OK | Standard MS remote |
23 | Back | Standard MS remote |
24 | DVD Menu | Standard MS remote |
25 | Live TV, Red (B) | Red button labelled "B" on the 360 universal remote |
26 | TV Guide, Yellow (Y) | Yellow button labelled "Y" on the 360 universal remote |
27 | Zoom/Aspect Ratio | Top left button on the Asrock and Mediagate remotes |
28 | Open/Close | Only on XBox 360 universal remote |
29 | Discrete Power On | Present on the Harmony universal remote |
2A | Discrete Power Off | Present on the Harmony universal remote |
32 | Visualisation | |
33 | Slideshow | |
34 | Eject | |
3B | Close App | |
46 | My TV | |
47 | Music Library | Present on the Asrock remote |
48 | Recorded TV | Standard MS remote |
49 | Picture Library | Present on the Asrock remote |
4A | Video Library | Present on the Asrock remote |
4B | DVD Angle | Present on the Mediagate MG-IR02BK remote |
4C | DVD Audio | Present on the Mediagate MG-IR02BK remote |
4D | Subtitles | Present on the Mediagate MG-IR02BK remote |
4E | Labelled "Print" on the HP remote | |
4F | Display | Labelled "Display" on the 360 universal remote |
50 | Radio | Present on the Asrock remote |
51 | Title | Labelled "Title" on the 360 universal remote |
5A | Teletext | On some, but not all, models of the MS remote and many compatibles |
5B | Red teletext button | On the v2 Microsoft remote |
5C | Green teletext button | On the v2 Microsoft remote |
5D | Yellow teletext button | On the v2 Microsoft remote |
5E | Blue teletext button | On the v2 Microsoft remote |
64 | XBox button | Large "X" button on the 360 universal remote |
66 | Green (A) | Green button labelled "A" on the 360 universal remote |
68 | Blue (X) | Blue button labelled "X" on the 360 universal remote |
6C | Channel Up | Channel up button on the 360 universal remote. Note that the standard MS remote uses number 12 for this button. |
6D | Channel Down | Channel down button on the 360 universal remote. Note that the standard MS remote uses number 13 for this button. |
6E | Play/Pause | You can configure the button to send VK_MEDIA_PLAY_PAUSE using 6e,00,00,00,01,cd,00 |