<!-- This file contains the mapping of keys (gamepad,remote and keyboard) to actions within XBMC -->
<!-- The <global> section is a fall through - they will only be used if the button is not        -->
<!-- used in the current window's section.  Note that there is only handling                     -->
<!-- for a single action per button at this stage.                                               -->
<!-- For joystick/gamepad configuration under linux/win32, see below as it differs from xbox     -->
<!-- gamepads.                                                                                   -->

<!-- The format is:                                                                              -->
<!--    <device>                                                                                 -->
<!--      <button id="#">xbmc action</button>                                                    -->
<!--    </device>                                                                                -->

<!-- To map keys from other remotes using the RCA protocol, you may add <universalremote> blocks -->
<!-- In this case, the tags used are <obc#> where # is the original button code (OBC) of the key -->
<!-- You set it up by adding a <universalremote> block to the window or <global> section:        -->
<!--    <universalremote>                                                                        -->
<!--       <obc45>Stop</obc45>                                                                   -->
<!--    </universalremote>                                                                       -->

<!-- Note that the action can be a built-in function.                                            -->
<!--            eg <button id="6">XBMC.ActivateWindow(Favourites)</button>                       -->
<!-- would bring up Favourites when the button with the id of 6 is press. In this case, "Menu"   -->

<!--                                                                                             -->
<!--  Button Ids:                                                                                -->
<!--  'id' is the button ID used by SDL. The button ids recognized from your remote appears      -->
<!--  in /var/log/syslog on the ATV2 for each button pressed and when debug mode is enabled      -->
<!--  Use your log to discover and map custom buttons to actions.                                -->

<keymap>
  <global>
    <joystick name="AppleRemote">
      <!-- plus       -->      <button id="1">Up</button>
      <!-- minus      -->      <button id="2">Down</button>
      <!-- left       -->      <button id="3">Left</button>
      <!-- right      -->      <button id="4">Right</button>
      <!-- center     -->      <button id="5">Select</button>
      <!-- menu       -->      <button id="6">PreviousMenu</button>
      <!-- hold center-->      <button id="7">Fullscreen</button>
      <!-- hold menu  -->      <button id="8">ContextMenu</button>

      <!-- old buttons for ATV1 <2.2, used on OSX  -->
      <!-- hold left  -->      <button id="9">Left</button>
      <!-- hold right -->      <button id="10">Right</button>

      <!-- new aluminium remote buttons  -->
      <!-- play/pause -->      <button id="12">Play</button>

      <!-- Additional buttons via Harmony Apple TV remote profile - these are also the learned buttons on Apple TV 2gen-->
      <!-- pageup     -->      <button id="13">PageUp</button>
      <!-- pagedown   -->      <button id="14">PageDown</button>
      <!-- pause      -->      <button id="15">Pause</button><!-- work? -->
      <!-- play2      -->      <button id="16">Play</button>
      <!-- stop       -->      <button id="17">Stop</button>
      <!-- fast fwd   -->      <button id="18">FastForward</button><!-- work? -->
      <!-- rewind     -->      <button id="19">Rewind</button>
      <!-- skip fwd   -->      <button id="20">SkipNext</button>
      <!-- skip back  -->      <button id="21">SkipPrevious</button>

      <!-- Learned remote buttons (ATV1 >2.3) -->
      <!-- Play       -->      <button id="70">Play</button>
      <!-- Pause      -->      <button id="71">Pause</button>
      <!-- Stop       -->      <button id="72">Stop</button>
      <!-- Previous   -->      <button id="73">SkipPrevious</button>
      <!-- Next       -->      <button id="74">SkipNext</button>
      <!-- Rewind     -->      <button id="75">Rewind</button>
      <!-- Forward    -->      <button id="76">FastForward</button>
      <!-- Return     -->      <button id="77">OSD</button>
      <!-- Enter      -->      <button id="78">ShowVideoMenu</button>

      <!-- few gestures from Apple's iPhone Remote (ATV1 > 2.3 ?) -->
      <!-- SwipeLeft  -->      <button id="80">Left</button>
      <!-- SwipeRight -->      <button id="81">Right</button>
      <!-- SwipeUp    -->      <button id="82">Up</button>
      <!-- SwipeDown  -->      <button id="83">Down</button>

      <!-- FlickLeft  -->      <button id="85">Left</button>
      <!-- FlickRight -->      <button id="86">Right</button>
      <!-- FlickUp    -->      <button id="87">Up</button>
      <!-- FlickDown  -->      <button id="88">Down</button>

    </joystick>
  </global>
  <Favourites>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </Favourites>
  <MyPictures>
    <joystick name="AppleRemote">
      <button id="6">ParentDir</button>
    </joystick>
  </MyPictures>
  <MyMusicPlaylist>
    <joystick name="AppleRemote">
      <button id="6">Playlist</button>
    </joystick>
  </MyMusicPlaylist>
  <MyMusicPlaylistEditor>
    <joystick name="AppleRemote">
      <button id="6">ParentDir</button>
    </joystick>
  </MyMusicPlaylistEditor>
  <MyMusicFiles>
    <joystick name="AppleRemote">
      <button id="6">ParentDir</button>
    </joystick>
  </MyMusicFiles>
  <MyMusicLibrary>
    <joystick name="AppleRemote">
      <button id="6">ParentDir</button>
    </joystick>
  </MyMusicLibrary>
  <FullscreenVideo>
    <joystick name="AppleRemote">
      <button id="1">VolumeUp</button>
      <button id="2">VolumeDown</button>
      <button id="3">StepBack</button>
      <button id="4">StepForward</button>
      <button id="5">Pause</button>
      <button id="6">OSD</button>
      <button id="7">PreviousMenu</button>
      <button id="8">Stop</button>
      <button id="9">BigStepBack</button>
      <button id="10">BigStepForward</button>
      <button id="12">Pause</button>
      <!-- pageup     -->      <button id="13">BigStepForward</button>
      <!-- pagedown   -->      <button id="14">BigStepBack</button>
      <!-- SwipeLeft  -->      <button id="80">StepBack</button>
      <!-- SwipeRight -->      <button id="81">StepForward</button>
      <!-- SwipeUp    -->      <button id="82">BigStepForward</button>
      <!-- SwipeDown  -->      <button id="83">BigStepBack</button>
      <!-- FlickLeft  -->      <button id="85">Rewind</button>
      <!-- FlickRight -->      <button id="86">FastForward</button>
      <!-- FlickUp    -->      <button id="87">BigStepForward</button>
      <!-- FlickDown  -->      <button id="88">BigStepBack</button>
    </joystick>
  </FullscreenVideo>
  <FullscreenInfo>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </FullscreenInfo>
  <PlayerControls>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </PlayerControls>
  <FullscreenLiveTV>
    <joystick name="AppleRemote">
      <button id="3">ChannelDown</button>
      <button id="4">ChannelUp</button>
      <!-- pageup     -->      <button id="13">ChannelUp</button>
      <!-- pagedown   -->      <button id="14">ChannelDown</button>
    </joystick>
  </FullscreenLiveTV>
  <Visualisation>
    <joystick name="AppleRemote">
      <button id="1">VolumeUp</button>
      <button id="2">VolumeDown</button>
      <button id="3">SkipPrevious</button>
      <button id="4">SkipNext</button>
      <button id="5">Pause</button>
      <button id="6">Fullscreen</button>
      <button id="7">OSD</button>
      <button id="8">Stop</button>
      <!-- SwipeLeft  -->      <button id="80">SkipPrevious</button>
      <!-- SwipeRight -->      <button id="81">SkipNext</button>
      <!-- FlickLeft  -->      <button id="85">SkipPrevious</button>
      <!-- FlickRight -->      <button id="86">SkipNext</button>
    </joystick>
  </Visualisation>
  <MusicOSD>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </MusicOSD>
  <VisualisationSettings>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </VisualisationSettings>
  <VisualisationPresetList>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </VisualisationPresetList>
  <SlideShow>
    <joystick name="AppleRemote">
      <button id="1">ZoomIn</button>
      <button id="2">ZoomOut</button>
      <button id="3">PreviousPicture</button>
      <button id="4">NextPicture</button>
      <button id="6">Stop</button>
      <button id="7">Info</button>
      <button id="8">Rotate</button>
      <!-- SwipeLeft  -->      <button id="80">PreviousPicture</button>
      <!-- SwipeRight -->      <button id="81">NextPicture</button>
      <!-- FlickLeft  -->      <button id="85">PreviousPicture</button>
      <!-- FlickRight -->      <button id="86">NextPicture</button>
    </joystick>
  </SlideShow>
  <ScreenCalibration>
    <joystick name="AppleRemote">
      <button id="5">NextCalibration</button>
    </joystick>
  </ScreenCalibration>
  <SelectDialog>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </SelectDialog>
  <VideoOSD>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
      <button id="8">Stop</button>
    </joystick>
  </VideoOSD>
  <VideoMenu>
    <joystick name="AppleRemote">
      <button id="5">Select</button>
      <button id="6">Stop</button>
      <button id="7">OSD</button>
      <button id="8"/>
    </joystick>
  </VideoMenu>
  <OSDVideoSettings>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </OSDVideoSettings>
  <OSDAudioSettings>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </OSDAudioSettings>
  <VideoBookmarks>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </VideoBookmarks>
  <MyVideoLibrary>
    <joystick name="AppleRemote">
      <button id="6">ParentDir</button>
      <button id="7">Info</button>
    </joystick>
  </MyVideoLibrary>
  <MyVideoFiles>
    <joystick name="AppleRemote">
      <button id="6">ParentDir</button>
      <button id="7">Info</button>
    </joystick>
  </MyVideoFiles>
  <MyVideoPlaylist>
    <joystick name="AppleRemote">
      <button id="6">Playlist</button>
    </joystick>
  </MyVideoPlaylist>
  <VirtualKeyboard>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </VirtualKeyboard>
  <ContextMenu>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </ContextMenu>
  <FileStackingDialog>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </FileStackingDialog>
  <MusicInformation>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </MusicInformation>
  <MovieInformation>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </MovieInformation>
  <PictureInfo>
    <joystick name="AppleRemote">
      <button id="3">Left</button>
      <button id="4">Right</button>
      <button id="6">Close</button>
      <!-- SwipeLeft  -->      <button id="80">Left</button>
      <!-- SwipeRight -->      <button id="81">Right</button>
      <!-- FlickLeft  -->      <button id="85">Left</button>
      <!-- FlickRight -->      <button id="86">Right</button>
    </joystick>
  </PictureInfo>
  <AddonBrowser>
    <joystick name="AppleRemote">
      <button id="6">ParentDir</button>
    </joystick>
  </AddonBrowser>
  <AddonInformation>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </AddonInformation>
  <AddonSettings>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </AddonSettings>
  <TextViewer>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </TextViewer>
  <NumericInput>
    <joystick name="AppleRemote">
      <button id="6">Close</button>
    </joystick>
  </NumericInput>
  <NowPlaying>
    <joystick name="AppleRemote">
      <button id="8">Stop</button>
    </joystick>
  </NowPlaying>
</keymap>
