Using a Microsoft remote control in Windows: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Jhsrennie
No edit summary
>Kentyman
No edit summary
Line 277: Line 277:
   5D,00,00,00,04,01,06,\ ; Yellow - sends ctrl-C
   5D,00,00,00,04,01,06,\ ; Yellow - sends ctrl-C
   5E,00,00,00,04,01,07  ; Blue  - sends ctrl-D</pre>
   5E,00,00,00,04,01,07  ; Blue  - sends ctrl-D</pre>
[[category:Remote]]

Revision as of 18:24, 20 September 2010

See Using a remote control with XBMC for general notes on remote controllers.

If you are using Windows then the official Microsoft MCE remote is very easy to use with XBMC because it can be configured to send any keystrokes you want. The only decision you have to make is whether you want it to remain compatible with Windows Media Center. If you do not need compatibility with Windows Media Center then you can configure it to send the standard XBMC keypresses like P for Play and X for Stop and it will work with any version of XBMC; even old ones. If you do need compatibility with Windows Media Center you can configure the remote to send the standard MCE keyboard shortcuts, in which case you will need XBMC build 26407 or later.

Start by downloading mceremote.zip from http://xbmcmce.sourceforge.net/. This contains detailed instructions for configuring the Microsoft remote, and some .reg files that you can just double-click to apply a suitable configuration.

There are various remotes around that claim to be fully MS compatible and have the same registry keys as the MS remote. The config files in mceremote.zip should work with these remotes, but I have had occasional reports of remotes that stop working after applying the .reg files. It would be worth creating a restore point before meddling with the registry. Then if the remote stops working you can go back to that restore point.

The following is from the mceremote.zip file described above.

Configuring the MS remote

If you have a standard Microsoft MCE remote control you can configure it to send whatever keystrokes you want by modifying the registry.

Why would you want to do this? Well if you use an app like XBMC it's easier to configure it to accept input from the remote if the remote sends keystrokes.

To install the config

First back up your existing config so you can put it back if things go wrong. Open Registry Editor and navigate to the key:

HKEY_LOCAL_MACHINE
 \SYSTEM
  \CurrentControlSet
   \Services
    \HidIr
     \Remotes
      \745a17a0-74d3-11d0-b6fe-00a0c90f57da

If this key doesn't exist stop right now because this config won't work. The only reason I know why you might not have this key in the registry is if your remote is not a standard MS remote or you're not using the standard MS driver.

Assuming the key exists, right click on it and choose Export. Save the key to a .reg file and make sure you keep this file safe. If anything goes wrong you can double-click your exported .reg file and it will restore the key back to the default state.

Now just double-click MSRemote.reg and answer yes when it asks if you're sure. Now reboot your PC and the remote should now be sending keystrokes.

I've written an applet, Showkey.exe, for testing the remote. You will need to download mceremote.zip to get a copy of the app. If you run this applet then press buttons on the remote the applet will show what keystroks it's receiving. The keystrokes should be:

play      - ctrl-shift-P
pause     - ctrl-P
stop      - ctrl-shift-S
ff        - ctrl-shift-F
rew       - ctrl-shift-B
next      - ctrl-F
prev      - ctrl-B

The boring details

The registry mod changes the value "ReportMappingTable". 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 sends a keystroke
  5   key modifier (see below)
  6   keystroke (see below)

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

Button number

This is a list of all the button numbers you can use in the registry config. In mceremote.zip I've included a picture of the standard MS remote with the button numbers superimposed.

The button numbers are:

Number  Button
  00     0
  01     1
  02     2
  03     3
  04     4
  05     5
  06     6
  07     7
  08     8
  09     9
  0a     Clear
  0b     Enter
  0c     Power
  0d     Windows
  0e     Mute
  0f     Info
  10     vol up
  11     vol down
  12     chan up
  13     chan down
  14     ff
  15     rew
  16     play
  17     record
  18     pause
  19     stop
  1a     next
  1b     prev
  1c     #
  1d     *
  1e     up
  1f     down
  20     left
  21     right
  22     OK (return)
  23     back
  24     DVD menu
  25     Live TV
  26     Guide
  48     Recorded TV
  5B     Red
  5C     Green
  5D     Yellow
  5E     Blue

Remote-Sendkeys.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HidIr\Remotes\745a17a0-74d3-11d0-b6fe-00a0c90f57da]
"ReportMappingTable"=hex:\
  00,00,00,00,04,00,27,\ ; 0
  01,00,00,00,04,00,1e,\ ; 1
  02,00,00,00,04,00,1f,\ ; 2
  03,00,00,00,04,00,20,\ ; 3
  04,00,00,00,04,00,21,\ ; 4
  05,00,00,00,04,00,22,\ ; 5
  06,00,00,00,04,00,23,\ ; 6
  07,00,00,00,04,00,24,\ ; 7
  08,00,00,00,04,00,25,\ ; 8
  09,00,00,00,04,00,26,\ ; 9
  0a,00,00,00,04,00,29,\ ; Clear - sends escape
  0b,00,00,00,04,00,28,\ ; Enter - sends return
  0c,00,00,00,04,04,3d,\ ; Power     - was "03,82,00" sends alt-F4
  0e,00,00,00,04,00,41,\ ; Mute      - was "01,e2,00" sends F8
  0f,00,00,00,01,09,02,\ ; Info
  10,00,00,00,04,00,43,\ ; vol up    - was "01,e9,00" sends F10
  11,00,00,00,04,00,42,\ ; vol down  - was "01,ea,00" sends F9
  12,00,00,00,04,01,2e,\ ; chan up   - was "01,9c,00" sends ctrl-equals(plus)
  13,00,00,00,04,01,2d,\ ; chan down - was "01,9d,00" sends ctrl-hyphen(minus)
  14,00,00,00,04,03,09,\ ; ff        - was "01,b3,00" sends ctrl-shift-F
  15,00,00,00,04,03,05,\ ; rew       - was "01,b4,00" sends ctrl-shift-B
  16,00,00,00,04,03,13,\ ; play      - was "01,b0,00" sends ctrl-shift-P
  17,00,00,00,01,b2,00,\ ; record
  18,00,00,00,04,01,13,\ ; pause     - was "01,b1,00" sends ctrl-P
  19,00,00,00,04,03,16,\ ; stop      - was "01,b7,00" sends ctrl-shift-S
  1a,00,00,00,04,01,09,\ ; next      - was "01,b5,00" sends ctrl-F
  1b,00,00,00,04,01,05,\ ; prev      - was "01,b6,00" sends ctrl-B
  1c,00,00,00,04,02,20,\ ; # (shift-3)
  1d,00,00,00,04,02,25,\ ; * (shift-8)
  1e,00,00,00,04,00,52,\ ; up
  1f,00,00,00,04,00,51,\ ; down
  20,00,00,00,04,00,50,\ ; left
  21,00,00,00,04,00,4f,\ ; right
  22,00,00,00,04,00,28,\ ; OK (return)
  23,00,00,00,04,00,2a,\ ; back      - was "01,24,02" sends Backspace
  24,00,00,00,04,03,10,\ ; DVD menu - sends ctrl-shift-M
  25,00,00,00,04,03,17,\ ; Live TV - sends ctrl-shift-T
  26,00,00,00,04,01,0a,\ ; Guide - was "01,8d,00" sends ctrl-G
  48,00,00,00,04,01,12   ; Recorded TV - sends ctl-O

Remote-XBMC.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HidIr\Remotes\745a17a0-74d3-11d0-b6fe-00a0c90f57da]
"ReportMappingTable"=hex:\
  00,00,00,00,04,00,27,\ ; 0
  01,00,00,00,04,00,1e,\ ; 1
  02,00,00,00,04,00,1f,\ ; 2
  03,00,00,00,04,00,20,\ ; 3
  04,00,00,00,04,00,21,\ ; 4
  05,00,00,00,04,00,22,\ ; 5
  06,00,00,00,04,00,23,\ ; 6
  07,00,00,00,04,00,24,\ ; 7
  08,00,00,00,04,00,25,\ ; 8
  09,00,00,00,04,00,26,\ ; 9
  0a,00,00,00,04,00,29,\ ; Clear - sends escape
  0b,00,00,00,04,00,28,\ ; Enter - sends return
  0c,00,00,00,04,04,3d,\ ; Power - was "03,82,00" sends alt-F4
  0d,00,00,00,04,03,1b,\ ; Windows - sends ctrl-shift-X
  0e,00,00,00,01,e2,00,\ ; Mute - doesn't send a key
  0f,00,00,00,04,00,06,\ ; Info - was "01,09,02" sends C (context menu)
  10,00,00,00,04,00,57,\ ; vol up    - was "01,e9,00" sends Keypad +
  11,00,00,00,04,00,56,\ ; vol down  - was "01,ea,00" sends Keypad -
  12,00,00,00,04,00,37,\ ; chan up   - was "01,9c,00" sends .
  13,00,00,00,04,00,36,\ ; chan down - was "01,9d,00" sends ,
  14,00,00,00,04,00,09,\ ; ff        - was "01,b3,00" sends F
  15,00,00,00,04,00,15,\ ; rew       - was "01,b4,00" sends R
  16,00,00,00,04,00,13,\ ; play      - was "01,b0,00" sends P
  17,00,00,00,04,01,15,\ ; record    - was "01,b2,00" sends ctrl-R
  18,00,00,00,04,00,2c,\ ; pause     - was "01,b1,00" sends space
  19,00,00,00,04,00,1b,\ ; stop      - was "01,b7,00" sends X
  1a,00,00,00,04,00,37,\ ; next      - was "01,b5,00" sends .
  1b,00,00,00,04,00,36,\ ; prev      - was "01,b6,00" sends ,
  1c,00,00,00,04,02,20,\ ; # (shift-3)
  1d,00,00,00,04,02,25,\ ; * (shift-8)
  1e,00,00,00,04,00,52,\ ; up
  1f,00,00,00,04,00,51,\ ; down
  20,00,00,00,04,00,50,\ ; left
  21,00,00,00,04,00,4f,\ ; right
  22,00,00,00,04,00,28,\ ; OK (return)
  23,00,00,00,04,00,2a,\ ; back - was "01,24,02" sends Backspace
  24,00,00,00,04,03,10,\ ; DVD menu - sends ctrl-shift-M
  25,00,00,00,04,03,17,\ ; Live TV - sends ctrl-shift-T
  26,00,00,00,04,01,0a,\ ; Guide - was "01,8d,00" sends ctrl-G
  48,00,00,00,04,01,12,\ ; Recorded TV - sends ctl-O
  5B,00,00,00,04,01,04,\ ; Red    - sends ctrl-A
  5C,00,00,00,04,01,05,\ ; Green  - sends ctrl-B
  5D,00,00,00,04,01,06,\ ; Yellow - sends ctrl-C
  5E,00,00,00,04,01,07   ; Blue   - sends ctrl-D