<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<HidHandler version="1">
  <HidUsageAction UsagePage="Consumer" UsageCollection="ConsumerControl" HandleHidEventsWhileInBackground="true">

    <button code="AppCtrlBack">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="10" sound="back.wav" />
    </button>

    <!-- Place holders so that they show up in the configure mapping customization UI -->
    <button code="AppCtrlForward" />
    <button code="AppCtrlRefresh" />
    <button code="AppCtrlStop" />
    <button code="AppCtrlSearch" />
    <button code="AppCtrlBookmarks" />
    <button code="AppCtrlHome" />
    <button code="AppCtrlFind" />
    <button code="AppCtrlNew" />
    <button code="AppCtrlOpen" />
    <button code="AppCtrlClose" />
    <button code="AppCtrlSave" />
    <button code="AppCtrlUndo" />
    <button code="AppCtrlCopy" />
    <button code="AppCtrlCut" />
    <button code="AppCtrlPaste" />
    <button code="AppCtrlRedoRepeat" />
    <button code="AppCtrlForwardMsg" />
    <button code="AppCtrlSend" />
    <button code="AppCtrlReply" />
    <button code="AppLaunchEmailReader" />
    <button code="AppLaunchSpellCheck" />
    <button code="BassIncrement" />
    <button code="BassDecrement" />
    <button code="TrebleIncrement" />
    <button code="TrebleDecrement" />
    <button code="BassBoost" />
    <button code="Help" />
    <!-- Let the OS deal with volume control-->
    <button code="Mute" />
    <button code="VolumeDecrement" />
    <button code="VolumeIncrement" />
    
    <!-- Define exit commands -->
    <button code="AppCtrlExit">
      <action layer="0" condition="*" conproperty="-1" command="POWER" cmdproperty="EXIT" sound="back.wav" />
    </button>

    <!-- Define actions for our "More Info" button, alternatively showing as "i", "Info" or "Menu" on some remotes -->
    <button code="AppCtrlProperties">
      <action layer="0" condition="FULLSCREEN" conproperty="TRUE" command="ACTION" cmdproperty="24" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="106" sound="click.wav" />
    </button>

    <!-- Define actions for our "Guide" button (EPG) -->
    <button code="MediaSelectProgramGuide">
      <action layer="0" condition="WINDOW" conproperty="600" command="ACTION" cmdproperty="10" sound="back.wav" />
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="600" sound="click.wav" />
    </button>

    <button code="Play" background="true" >
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="105" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="68" sound="click.wav" />
    </button>

    <button code="Pause" background="true" >
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="105" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="12" sound="click.wav" />
    </button>

    <button code="PlayPause" background="true" >
      <action layer="0" condition="PLAYER" conproperty="MEDIA" command="ACTION" cmdproperty="12" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="68" sound="click.wav" />
    </button>

    <button code="Stop" background="true">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="13" sound="click.wav" />
    </button>

    <button code="Record">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="89" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="501" command="ACTION" cmdproperty="113" sound="click.wav" />
    </button>

    <button code="FastForward" background="true">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="16" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="600" command="ACTION" cmdproperty="86" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="28" sound="cursor.wav" />
    </button>

    <button code="Rewind" background="true">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="17" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="600" command="ACTION" cmdproperty="87" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="29" sound="cursor.wav" />
    </button>

    <button code="ChannelIncrement" repeat="true">
      <action layer="0" condition="FULLSCREEN" conproperty="true" command="ACTION" cmdproperty="95" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="7701" command="ACTION" cmdproperty="9979" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="7700" command="ACTION" cmdproperty="9979" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="31" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="1" command="ACTION" cmdproperty="95" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="602" command="ACTION" cmdproperty="95" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="3003" command="ACTION" cmdproperty="95" sound="cursor.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="5" sound="cursor.wav" />
    </button>

    <button code="ChannelDecrement" repeat="true">
      <action layer="0" condition="FULLSCREEN" conproperty="true" command="ACTION" cmdproperty="94" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="7701" command="ACTION" cmdproperty="9980" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="7700" command="ACTION" cmdproperty="9980" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="30" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="1" command="ACTION" cmdproperty="94" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="602" command="ACTION" cmdproperty="94" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="3003" command="ACTION" cmdproperty="94" sound="cursor.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="6" sound="cursor.wav" />
    </button>

    <button code="ScanNextTrack" background="true">
      <action layer="0" condition="PLAYER" conproperty="DVD" command="ACTION" cmdproperty="91" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="600" command="ACTION" cmdproperty="5" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="28" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="2005" command="ACTION" cmdproperty="91" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="14" sound="cursor.wav" />
    </button>

    <button code="ScanPreviousTrack" background="true">
      <action layer="0" condition="PLAYER" conproperty="DVD" command="ACTION" cmdproperty="92" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="600" command="ACTION" cmdproperty="6" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="29" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="2005" command="ACTION" cmdproperty="92" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="15" sound="cursor.wav" />
    </button>

    <button code="AppCtrlPrint">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="19" sound="click.wav" />
    </button>

<!--

    <button name="16 LaunchMediaSelect" code="16" />
    <button name="17 LaunchApp1" code="17" />
    <button name="18 LaunchApp2" code="18" />

    <button name="24 MicrophoneVolumeMute" code="24" />
    <button name="25 MicrophoneVolumeDown" code="25" />
    <button name="26 MicrophoneVolumeUp" code="26" />

    <button name="43 DictateOrCommandControlToggle" code="43" />
    <button name="44 MicrophoneOnOffToggle" code="44" />
    <button name="45 CorrectionList" code="45" />
-->

  </HidUsageAction>


  <HidUsageAction UsagePage="WindowsMediaCenterRemoteControl" UsageCollection="WindowsMediaCenterRemoteControl" HandleHidEventsWhileInBackground="false">

    <button code="GreenStart">
      <!-- Go back to home screen. Note for further dev 0 is the first home screen and 35 is the second home screen. -->
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="0" sound="click.wav" focus="True" />
    </button>

    <!-- TV Power button closes MediaPortal, applies also if MP is not in the foreground -->
    <button code="TvPower" background="true">
      <action layer="0" condition="*" conproperty="-1" command="POWER" cmdproperty="EXIT" sound="back.wav" />
    </button>

    <!-- Extension 11 button closes MediaPortal too, applies also if MP is not in the foreground  -->
    <button code="Ext11" background="true">
      <action layer="0" condition="*" conproperty="-1" command="POWER" cmdproperty="EXIT" sound="back.wav" />
    </button>

    <button code="RecordedTv">
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="603" sound="click.wav" />
    </button>

    <button code="Tv">
      <action layer="0" condition="WINDOW" conproperty="7701" command="WINDOW" cmdproperty="602" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="1" command="ACTION" cmdproperty="18" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="602" command="ACTION" cmdproperty="18" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="7700" command="ACTION" cmdproperty="18" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="1" sound="click.wav" />
    </button>

    <button code="LiveTv">
      <action layer="0" condition="WINDOW" conproperty="7701" command="WINDOW" cmdproperty="602" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="1" command="ACTION" cmdproperty="18" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="602" command="ACTION" cmdproperty="18" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="7700" command="ACTION" cmdproperty="18" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="1" sound="click.wav" />
    </button>

    <button code="DvdMenu">
      <action layer="0" condition="PLAYER" conproperty="DVD" command="ACTION" cmdproperty="90" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="3001" sound="click.wav" />
    </button>

    <button code="Teletext">
      <action layer="0" condition="WINDOW" conproperty="602" command="WINDOW" cmdproperty="7701" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="1" command="WINDOW" cmdproperty="7700" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="7701" command="WINDOW" cmdproperty="7700" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="7700" command="WINDOW" cmdproperty="7701" sound="click.wav" />
    </button>

    <button code="TeletextRed">
      <action layer="0" condition="WINDOW" conproperty="7701" command="ACTION" cmdproperty="9975" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="7700" command="ACTION" cmdproperty="9975" sound="click.wav" />
      <!-- Toggle GUI -->
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="18" sound="click.wav" />
    </button>

    <button code="TeletextGreen">
      <action layer="0" condition="WINDOW" conproperty="7701" command="ACTION" cmdproperty="9976" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="7700" command="ACTION" cmdproperty="9976" sound="click.wav" />
      <!-- Switch to next possible audio stream -->
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="26" sound="click.wav" />
    </button>

    <button code="TeletextYellow">
      <action layer="0" condition="WINDOW" conproperty="7701" command="ACTION" cmdproperty="9977" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="7700" command="ACTION" cmdproperty="9977" sound="click.wav" />
      <!-- Next subtitle -->
      <action layer="0" condition="FULLSCREEN" conproperty="true" command="ACTION" cmdproperty="119" sound="click.wav" />
      <!-- Show info -->
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="11" sound="click.wav" />
    </button>

    <button code="TeletextBlue">
      <action layer="0" condition="WINDOW" conproperty="7701" command="ACTION" cmdproperty="9978" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="7700" command="ACTION" cmdproperty="9978" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="602" command="ACTION" cmdproperty="122" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="511" command="ACTION" cmdproperty="9886" />
      <!-- Change Aspect Ratio -->
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="19" sound="click.wav" />
    </button>

    <button code="Music">
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="501" sound="click.wav" />
    </button>

    <button code="Pictures">
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="2" sound="click.wav" />
    </button>

    <button code="Videos">
      <action layer="0" condition="WINDOW" conproperty="6" command="ACTION" cmdproperty="18" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="2005" command="ACTION" cmdproperty="18" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="6" sound="click.wav" />
    </button>

    <button code="FmRadio">
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="30" sound="click.wav" />
    </button>

    <button name="Aspect Ratio" code="Zoom">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="19" sound="click.wav" />
    </button>

    <button code="DvdAudio">
      <!-- Switch to next possible audio stream -->
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="26" sound="click.wav" />
    </button>

    <button code="DvdSubtitle">
      <!-- Next subtitle -->
      <action layer="0" condition="FULLSCREEN" conproperty="true" command="ACTION" cmdproperty="119" sound="click.wav" />
    </button>

    <button code="ClosedCaptioning">
      <!-- Next subtitle -->
      <action layer="0" condition="FULLSCREEN" conproperty="true" command="ACTION" cmdproperty="119" sound="click.wav" />
    </button>

    <!-- Providing empty buttons so that they can be customized through our UI -->    
    <button code="Extras" />
    <button code="ExtrasApp" />
    <button code="DvdAngle" />    
    <button code="Eject" />
    <button code="DvdTopMenu" />
    <button name="Visualization" code="Ext0" />
    <button name="SlideShow" code="Ext1" />
    <button name="HpEject" code="Ext2" />
    <button name="InputSelection" code="Ext3" />
    <button code="Ext4" />
    <button code="Ext5" />
    <button code="Ext6" />
    <button code="Ext7" />
    <button code="Ext8" />
    <button code="Ext9" />
    <button code="Ext10" />
    <button code="Ext11" />
    <button code="ChannelInput" />
    <button code="SubAudio" />
    <button code="Channel10" />
    <button code="Channel11" />
    <button code="Channel12" />
    <button code="Display" />
    <button code="Kiosk" />
    <button code="NetworkSelection" />
    <button code="BlueRayTool" />
    <button code="ChannelInfo" />
    <button code="VideoSelection" />

  </HidUsageAction>

  <!--GamePad setup-->
  <HidUsageAction UsagePage="GenericDesktopControls" UsageCollection="GamePad" HandleHidEventsWhileInBackground="false">
    <!--D-pad uses special codes from 1000/Up to 1007/Up-Left going clockwise-->
    <button name="Left" code="1006" repeat="true">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="1" sound="cursor.wav"/>
    </button>
    <button name="Down" code="1004" repeat="true">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="4" sound="cursor.wav"/>
    </button>
    <button name="Right" code="1002" repeat="true">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="2" sound="cursor.wav"/>
    </button>
    <button name="Up" code="1000" repeat="true">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="3" sound="cursor.wav"/>
    </button>

    <!--
    Now we setup our buttons with X-Box controller in mind.
    Works just fine with Logitech Wireless Gamepad F710 and other X-Box like controllers.
    This should work as well with older DirectInput devices such as Logitech Cordless Rumblepad 2.
    Note however that the physical position of the logical buttons is different between X-Box and DirectInput hardware. 
    -->

    <!-- Enter for button One/A/Green-->
    <button name="Enter" code="1">
      <action layer="0" condition="WINDOW" conproperty="11" command="ACTION" cmdproperty="47" sound="click.wav"/>
      <action layer="0" condition="WINDOW" conproperty="10" command="ACTION" cmdproperty="10" sound="back.wav"/>
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="7" sound="click.wav"/>
    </button>

    <!-- Back for button Two/B/Red-->
    <button name="Back" code="2">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="10" sound="back.wav"/>
    </button>

    <!-- AppCtrlProperties for button Four/X/Blue-->
    <button name="AppCtrlProperties" code="3">
      <action layer="0" condition="FULLSCREEN" conproperty="TRUE" command="ACTION" cmdproperty="24" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="106" sound="click.wav" />
    </button>

    <!-- TV EPG for button Three/Y/Yellow-->
    <button name="MediaSelectProgramGuide" code="4">
      <action layer="0" condition="WINDOW" conproperty="600" command="ACTION" cmdproperty="10" sound="back.wav" />
      <action layer="0" condition="*" conproperty="-1" command="WINDOW" cmdproperty="600" sound="click.wav" />
    </button>

    <!-- ScanPreviousTrack for button Five/LB -->
    <button name="ScanPreviousTrack" code="5">
      <action layer="0" condition="PLAYER" conproperty="DVD" command="ACTION" cmdproperty="92" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="600" command="ACTION" cmdproperty="6" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="29" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="2005" command="ACTION" cmdproperty="92" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="15" sound="cursor.wav" />
    </button>

    <!-- ScanNextTrack for button Six/RB -->
    <button name="ScanNextTrack" code="6">
      <action layer="0" condition="PLAYER" conproperty="DVD" command="ACTION" cmdproperty="91" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="600" command="ACTION" cmdproperty="5" sound="cursor.wav" />
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="28" sound="click.wav" />
      <action layer="0" condition="WINDOW" conproperty="2005" command="ACTION" cmdproperty="91" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="14" sound="cursor.wav" />
    </button>

    <!-- Pause/Stop for button Seven/Back -->
    <button name="Pause" code="7" >
      <action layer="0" condition="WINDOW" conproperty="2007" command="ACTION" cmdproperty="105" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="12" sound="click.wav" />
    </button>

    <!-- Play for button Height/Start -->
    <button name="PlayPause" code="8">
      <action layer="0" condition="PLAYER" conproperty="MEDIA" command="ACTION" cmdproperty="12" sound="click.wav" />
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="68" sound="click.wav" />
    </button>

    <!-- VolumeDecrement for button Nine/Left Joystick Button/Back -->
    <button name="VolumeDecrement" code="09" repeat="true">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="102" sound="cursor.wav" />
    </button>

    <!-- VolumeIncrement for button Ten/Right Joystick Button/Back -->
    <button name="VolumeIncrement" code="10" repeat="true">
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="103" sound="cursor.wav" />
    </button>

    <!-- Mute for button Eleven/None/Left Joystick Button (Not on X-Box) -->
    <button name="Mute" code="11" >
      <action layer="0" condition="*" conproperty="-1" command="ACTION" cmdproperty="9982" sound="click.wav" />
    </button>

  </HidUsageAction>

</HidHandler>