Using a Microsoft remote control in Windows: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Jhsrennie
>Jhsrennie
Line 729: Line 729:


<table border="1">
<table border="1">
   <tr><td><b>Button</b></td><td><b>Code</b></td><td><b>Action</b></td><td><b>XBMC key name</b></td></tr>
   <tr><td><b>Button</b></td><td><b>Code</b></td><td><b>Action</b></td></tr>
   <tr><td>Play</td><td>00B0</td><td>sends WM_APPCOMMAND 46 - play</td><td></td></tr>
   <tr><td>Play</td><td>00B0</td><td>sends WM_APPCOMMAND 46 - play</td></tr>
   <tr><td>Pause</td><td>00B1</td><td>sends WM_APPCOMMAND 47 - pause</td><td></td></tr>
   <tr><td>Pause</td><td>00B1</td><td>sends WM_APPCOMMAND 47 - pause</td></tr>
   <tr><td>Record</td><td>00B2</td><td>sends WM_APPCOMMAND 48 - record</td><td></td></tr>
   <tr><td>Record</td><td>00B2</td><td>sends WM_APPCOMMAND 48 - record</td></tr>
   <tr><td>Fast forward</td><td>00B3</td><td>sends WM_APPCOMMAND 49 - fast forward</td><td></td></tr>
   <tr><td>Fast forward</td><td>00B3</td><td>sends WM_APPCOMMAND 49 - fast forward</td></tr>
   <tr><td>Rewind</td><td>00B4</td><td>sends WM_APPCOMMAND 50 - rewind</td><td></td></tr>
   <tr><td>Rewind</td><td>00B4</td><td>sends WM_APPCOMMAND 50 - rewind</td></tr>
   <tr><td>Scan Next Track</td><td>00B5</td><td>sends keypress VK_MEDIA_NEXT_TRACK</td><td></td></tr>
   <tr><td>Scan Next Track</td><td>00B5</td><td>sends keypress VK_MEDIA_NEXT_TRACK</td></tr>
   <tr><td>Scan Previous Track </td><td>00B6</td><td>sends keypress VK_MEDIA_PREV_TRACK</td><td></td></tr>
   <tr><td>Scan Previous Track </td><td>00B6</td><td>sends keypress VK_MEDIA_PREV_TRACK</td></tr>
   <tr><td>Stop </td><td>00B7</td><td>sends keypress VK_MEDIA_STOP</td><td></td></tr>
   <tr><td>Stop </td><td>00B7</td><td>sends keypress VK_MEDIA_STOP</td></tr>
   <tr><td>Play/Pause</td><td>00CD</td><td>sends keypress VK_MEDIA_PLAY_PAUSE</td><td></td></tr>
   <tr><td>Play/Pause</td><td>00CD</td><td>sends keypress VK_MEDIA_PLAY_PAUSE</td></tr>
   <tr><td>Mute</td><td>00E2</td><td>sends keypress VK_VOLUME_MUTE</td><td></td></tr>
   <tr><td>Mute</td><td>00E2</td><td>sends keypress VK_VOLUME_MUTE</td></tr>
   <tr><td>Bass Boost </td><td>00E5</td><td>sends WM_APPCOMMAND 20 - toggle bass boost</td><td></td></tr>
   <tr><td>Bass Boost </td><td>00E5</td><td>sends WM_APPCOMMAND 20 - toggle bass boost</td></tr>
   <tr><td>Loudness </td><td>00E7</td><td>not known</td><td></td></tr>
   <tr><td>Loudness </td><td>00E7</td><td>not known</td></tr>
   <tr><td>Volume Up </td><td>00E9</td><td>sends keypress VK_VOLUME_UP</td><td></td></tr>
   <tr><td>Volume Up </td><td>00E9</td><td>sends keypress VK_VOLUME_UP</td></tr>
   <tr><td>Volume Down </td><td>00EA</td><td>sends keypress VK_VOLUME_DOWN</td><td></td></tr>
   <tr><td>Volume Down </td><td>00EA</td><td>sends keypress VK_VOLUME_DOWN</td></tr>
   <tr><td>Bass Up</td><td>0152</td><td>sends WM_APPCOMMAND 21 - increase bass</td><td></td></tr>
   <tr><td>Bass Up</td><td>0152</td><td>sends WM_APPCOMMAND 21 - increase bass</td></tr>
   <tr><td>Bass Down</td><td>0153</td><td>sends WM_APPCOMMAND 19 - decrease bass</td><td></td></tr>
   <tr><td>Bass Down</td><td>0153</td><td>sends WM_APPCOMMAND 19 - decrease bass</td></tr>
   <tr><td>Treble Up</td><td>0154</td><td>sends WM_APPCOMMAND 23 - increase treble</td><td></td></tr>
   <tr><td>Treble Up</td><td>0154</td><td>sends WM_APPCOMMAND 23 - increase treble</td></tr>
   <tr><td>Treble Down</td><td>0155</td><td>sends WM_APPCOMMAND 22 - decrease treble</td><td></td></tr>
   <tr><td>Treble Down</td><td>0155</td><td>sends WM_APPCOMMAND 22 - decrease treble</td></tr>
   <tr><td>Media Select</td><td>0183</td><td>sends keypress VK_LAUNCH_MEDIA_SELECT</td><td></td></tr>
   <tr><td>Media Select</td><td>0183</td><td>sends keypress VK_LAUNCH_MEDIA_SELECT</td></tr>
   <tr><td>Mail</td><td>018A</td><td>sends keypress VK_LAUNCH_MAIL</td><td></td></tr>
   <tr><td>Mail</td><td>018A</td><td>sends keypress VK_LAUNCH_MAIL</td></tr>
   <tr><td>Calculator</td><td>0192</td><td>sends keypress VK_LAUNCH_APP2</td><td></td></tr>
   <tr><td>Calculator</td><td>0192</td><td>sends keypress VK_LAUNCH_APP2</td></tr>
   <tr><td>My Computer</td><td>0194</td><td>sends keypress VK_LAUNCH_APP1</td><td></td></tr>
   <tr><td>My Computer</td><td>0194</td><td>sends keypress VK_LAUNCH_APP1</td></tr>
   <tr><td>Info</td><td>0209</td><td>not known</td><td></td></tr>
   <tr><td>Info</td><td>0209</td><td>not known</td></tr>
   <tr><td>WWW Search</td><td>0221</td><td>sends keypress VK_BROWSER_SEARCH</td><td>browser_search</td></tr>
   <tr><td>WWW Search</td><td>0221</td><td>sends keypress VK_BROWSER_SEARCH</td></tr>
   <tr><td>WWW Home</td><td>0223</td><td>sends keypress VK_BROWSER_HOME</td><td>browser_home</td></tr>
   <tr><td>WWW Home</td><td>0223</td><td>sends keypress VK_BROWSER_HOME</td></tr>
   <tr><td>WWW Back</td><td>0224</td><td>sends keypress VK_BROWSER_BACK</td><td></td></tr>
   <tr><td>WWW Back</td><td>0224</td><td>sends keypress VK_BROWSER_BACK</td></tr>
   <tr><td>WWW Forward</td><td>0225</td><td>sends keypress VK_BROWSER_FORWARD</td><td></td></tr>
   <tr><td>WWW Forward</td><td>0225</td><td>sends keypress VK_BROWSER_FORWARD</td></tr>
   <tr><td>WWW Stop</td><td>0226</td><td>sends keypress VK_BROWSER_STOP</td><td></td></tr>
   <tr><td>WWW Stop</td><td>0226</td><td>sends keypress VK_BROWSER_STOP</td></tr>
   <tr><td>WWW Refresh </td><td>0227</td><td>sends keypress VK_BROWSER_REFRESH</td><td>browser_refresh</td></tr>
   <tr><td>WWW Refresh </td><td>0227</td><td>sends keypress VK_BROWSER_REFRESH</td></tr>
   <tr><td>WWW Favorites </td><td>022A</td><td>sends keypress VK_BROWSER_FAVORITES</td><td>browser_favorites</td></tr>
   <tr><td>WWW Favorites </td><td>022A</td><td>sends keypress VK_BROWSER_FAVORITES</td></tr>
</table>
</table>


[[category:Remote]]
[[category:Remote]]

Revision as of 17:30, 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.

EHome Remote Button IDs 1.jpg

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:

ByteAction
0button number (see below)
1always 0
2always 0
3always 0
404 and 01 send keystrokes; 03 sends an IR signal
5Key modifier or low byte of multimedia command (see below)
6Key modifier or high byte of multimedia command (see below)

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 and if byte 4 is 0x04 this will cause the button to send a keypress i.e. Windows will react as if a key had been pressed on the keyboard. If byte 4 is 0x01 the eHome driver will either send either a multimedia keypress or an APPCOMMAND message.

Byte 4 = 0x03: Raw Input messages

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 = 0x04: Normal keypresses

If byte 4 is set to 0x04 then byte 5 contains modifiers like control, shift, alt, etc and byte 6 contains the key code.

The value of byte 5, the key modifier, can be:

ByteAction
0No modifier
1Control
2Shift
3Control-Shift
4Alt
5Control-Alt
6Shift-Alt
7Control-Shift-Alt
8Windows
9Control-Windows
aShift-Windows
bControl-Shift-Windows
cAlt-Windows
dControl-Alt-Windows
eShift-Alt-Windows
fControl-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 key code 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.

To give a specific example, suppose you want to configure the Play button to send the Media Center keyboard shortcut for "Play", the 7 bytes would be:

16,00,00,00,04,03,13
ByteValueNotes
Byte 016The number of the Play button is 0x16 (see table below)
Byte 100Bytes 1 to 3 are always zero
Byte 200
Byte 300
Byte 404The value 0x04 means send a normal keypress
Byte 503Ctrl = 2 and Shift = 1 so 3 = 2 + 1 mean ctrl-shift
Byte 6130x13 is the key code for "P"

Byte 4 = 0x01: Multimedia key or APPCOMMAND message

The Microsoft Multimedia Keyboard and various clones have keys for functions like "Play" and "Stop". If byte 4 is set to 0x01 the eHome driver may generate a multimedia keyboard keypress. Alternatively, and with no onbvious logic, it may generate the Windows message WM_APPCOMMAND instead. The WM_APPCOMMAND message is used to send commands like "Play", 2Pause", "Stop", etc. See http://msdn.microsoft.com/en-us/library/ms647591(v=vs.85).aspx for details.

The multimedia keys have key codes that can be greater than 255 (0xFF) so they need two bytes to represnt them. Byte 5 is used for the low byte and byte 6 is used for the high byte, though in most cases the high byte will be zero. This means that there is no byte available to specify the key modifiers, so you cannot combine a multimedia keypress with ctrl, shift, alt, etc.

Following on from the example above, suppose you want to configure the Play button to send the Multimedia Play/Pause keypress i.e. Play then Pause the media on alternate presses. The 7 bytes would be:

16,00,00,00,01,cd,00
ByteValueNotes
Byte 016The number of the Play button is 0x16 (see table below)
Byte 100Bytes 1 to 3 are always zero
Byte 200
Byte 300
Byte 401The value 0x01 means send a multimedia keypress
Byte 5cdThe code for the play/pause key is 0x00CD so put cd as the l,ow byte
Byte 600and 00 as the high byte

The key codes for the multimedia keys are also listed in http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf. They are the keys with the "HID usage page" set to 0C. The normal keys have the "HID usage page" set to 07.

Table of remote button codes

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 Print 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

Table of key codes

This data is taken from http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf. The data has been reproduced here just in case Microsoft ever remove the link to the tranlate.pdf file:

KeyCode
aA04
bB05
cC06
dD07
eE08
fF09
gG0A
hH0B
iI0C
jJ0D
kK0E
lL0F
mM10
nN11
oO12
pP13
qQ14
rR15
sS16
tT17
uU18
vV19
wW1A
xX1B
yY1C
zZ1D
1!1E
2@1F
3#20
4$21
5%22
6^23
7&24
8*25
9(26
0)27
Return28
Escape29
Backspace2A
Tab2B
Space2C
-_2D
=+2E
[{2F
]}30
\|31
Europe 132
;:33
'"34
`~35
,<36
.>37
/?38
Caps Lock39
F13A
F23B
F33C
F43D
F53E
F63F
F740
F841
F942
F1043
F1144
F1245
Print Screen46
Scroll Lock47
Break (Ctrl-Pause)48
Pause48
Insert49
Home4A
Page Up4B
Delete4C
End4D
Page Down4E
Right Arrow4F
Left Arrow50
Down Arrow51
Up Arrow52
Num Lock53
Keypad /54
Keypad *55
Keypad -56
Keypad +57
Keypad Enter58
Keypad 1 End59
Keypad 2 Down5A
Keypad 3 PageDn5B
Keypad 4 Left5C
Keypad 55D
Keypad 6 Right5E
Keypad 7 Home5F
Keypad 8 Up60
Keypad 9 PageUp61
Keypad 0 Insert62
Keypad . Delete63
Europe 264
App65
Keyboard Power66
Keypad =67
F1368
F1469
F156A
F166B
F176C
F186D
F196E
F206F
F2170
F2271
F2372
F2473
Keyboard Execute74
Keyboard Help75
Keyboard Menu76
Keyboard Select77
Keyboard Stop78
Keyboard Again79
Keyboard Undo7A
Keyboard Cut7B
Keyboard Copy7C
Keyboard Paste7D
Keyboard Find7E
Keyboard Mute7F
Keyboard Volume Up80
Keyboard Volume Dn81
Caps Lock82
Num Lock83
Scroll Lock84
Keypad , Brazilian Keypad .85
Keyboard Equal Sign86
Keyboard Int'l 187
Keyboard Int'l 288
Keyboard Int'l 289
Keyboard Int'l 48A
Keyboard Int'l 58B
Keyboard Int'l 68C
Keyboard Int'l 78D
Keyboard Int'l 88E
Keyboard Int'l 98F
Keyboard Lang 190
Keyboard Lang 291
Keyboard Lang 392
Keyboard Lang 493
Keyboard Lang 594
Keyboard Lang 695
Keyboard Lang 796
Keyboard Lang 897
Keyboard Alternate98
Erase99
SysReq/Attention9A
Keyboard Cancel9B
Keyboard Clear9C
Keyboard Prior9D
Keyboard Return9E
Keyboard Separator9F
Keyboard OutA0
Keyboard OperA1
Keyboard Clear/AgainA2
Keyboard CrSel/PropsA3
Keyboard ExSelA4
Left ControlE0
Left ShiftE1
Left AltE2
Left GUIE3
Right ControlE4
Right ShiftE5
Right AltE6
Right GUIE7

Multimedia keys

ButtonCodeAction
Play00B0sends WM_APPCOMMAND 46 - play
Pause00B1sends WM_APPCOMMAND 47 - pause
Record00B2sends WM_APPCOMMAND 48 - record
Fast forward00B3sends WM_APPCOMMAND 49 - fast forward
Rewind00B4sends WM_APPCOMMAND 50 - rewind
Scan Next Track00B5sends keypress VK_MEDIA_NEXT_TRACK
Scan Previous Track 00B6sends keypress VK_MEDIA_PREV_TRACK
Stop 00B7sends keypress VK_MEDIA_STOP
Play/Pause00CDsends keypress VK_MEDIA_PLAY_PAUSE
Mute00E2sends keypress VK_VOLUME_MUTE
Bass Boost 00E5sends WM_APPCOMMAND 20 - toggle bass boost
Loudness 00E7not known
Volume Up 00E9sends keypress VK_VOLUME_UP
Volume Down 00EAsends keypress VK_VOLUME_DOWN
Bass Up0152sends WM_APPCOMMAND 21 - increase bass
Bass Down0153sends WM_APPCOMMAND 19 - decrease bass
Treble Up0154sends WM_APPCOMMAND 23 - increase treble
Treble Down0155sends WM_APPCOMMAND 22 - decrease treble
Media Select0183sends keypress VK_LAUNCH_MEDIA_SELECT
Mail018Asends keypress VK_LAUNCH_MAIL
Calculator0192sends keypress VK_LAUNCH_APP2
My Computer0194sends keypress VK_LAUNCH_APP1
Info0209not known
WWW Search0221sends keypress VK_BROWSER_SEARCH
WWW Home0223sends keypress VK_BROWSER_HOME
WWW Back0224sends keypress VK_BROWSER_BACK
WWW Forward0225sends keypress VK_BROWSER_FORWARD
WWW Stop0226sends keypress VK_BROWSER_STOP
WWW Refresh 0227sends keypress VK_BROWSER_REFRESH
WWW Favorites 022Asends keypress VK_BROWSER_FAVORITES