Petter Holt Juliussen • Mail | Mastodon | GitHub | Letterboxd

for later reference.

Keymaps

2019-04-04

Buttons

There are two type of XBMC_buttons in XBMC: * Predefined buttons are labelled using their button title such as: <left>, <right>, <menu>. These buttons are predefined in keymap.xml and handle all functions needed for a working system. For a complete list of buttons see keymap.xml#Remote_Buttons. * Customized buttons are used when more buttons than required are defined by default, for example: <obc1>BUTTON1</obc1>. To map Universal Remote buttons using the RCA infrared protocol, you may add <universalremote> sections to keymap.xml. In this case, the tags used are <obc#> where # is the original button code (OBC) of the button. You would put it inside a <universalremote> section in the <window> or <global> sections.

/storage/.kodi/userdata/keymaps/remote.xml

<?xml version="1.0" encoding="UTF-8"?>

<keymap>
  <!-- Global -->
  <Global>
    <keyboard>
      <f4>RunScript(/storage/scripts/blue_button.py)</f4>        <!-- N2QA: ZOOM | HARMONY: BLUE -->
      <f5>toggledebug</f5>                                       <!-- N2QA: AV ENHANCER | HARMONY: E -->
      <f6>reloadkeymaps</f6>                                     <!-- N2QA: ANGLE / PAGE | HARMONY: E (hold) -->
      <f7>ActivateWindow(favourites)</f7>                        <!-- N2QA: REPEAT | HARMONY: GUIDE -->
      <f12>XBMC.Suspend()</f12>                                  <!-- N2QA: AUDIO | HARMONY: POWER OFF -->
    </keyboard>
    <universalremote>
      <obc4>RunScript(/storage/scripts/blue_button.py)</obc4>    <!-- N2QA: ZOOM | HARMONY: BLUE -->
      <obc6>ActivateWindow(favourites)</obc6>                    <!-- N2QA: REPEAT | HARMONY: GUIDE -->
      <obc7>toggledebug</obc7>                                   <!-- N2QA: AV ENHANCER | HARMONY: E -->
      <obc8>reloadkeymaps</obc8>                                 <!-- N2QA: ANGLE / PAGE | HARMONY: E (hold) -->
      <obc11>ActivateWindow(Home)</obc11>                        <!-- N2QA: DIRECT NAVIGATOR / TOP MENU | HARMONY: EXIT -->
    </universalremote>
  </Global>

  <!-- Home -->
  <Home>
   <remote>
    <play>RunScript(/storage/scripts/kodi.py,PARTY_MODE)</play> <!-- N2QA: PLAY | HARMONY: PLAY -->
   </remote>
  </Home>

  <!-- Fullscreen video -->
  <FullscreenVideo>
    <keyboard>
      <f1>Action(ShowSubtitles)</f1>                             <!-- N2QA: GROUP | HARMONY: RED -->
      <f2>ActivateWindow(SubtitleSearch)</f2>                    <!-- N2QA: QUICK REPLAY | HARMONY: GREEN -->
      <f3>Action(subtitledelay)</f3>                             <!-- N2QA: PLAY MODE | HARMONY: YELLOW -->
    </keyboard>
    <universalremote>
      <obc1>Action(ShowSubtitles)</obc1>                         <!-- N2QA: GROUP | HARMONY: RED -->
      <obc2>ActivateWindow(SubtitleSearch)</obc2>                <!-- N2QA: QUICK REPLAY | HARMONY: GREEN -->
      <obc3>Action(subtitledelay)</obc3>                         <!-- N2QA: PLAY MODE | HARMONY: YELLOW -->
      <obc8>reloadkeymaps</obc8>                                 <!-- N2QA: ANGLE / PAGE | HARMONY: E (hold) -->
    </universalremote>
  </FullscreenVideo>
</keymap>
<?xml version="1.0" encoding="UTF-8"?>

<keymap>
  <!-- Global -->
  <Global>
    <universalremote>
      <obc3>Action(ToggleWatched)</obc3>                        <!-- KEY_PROG3            = ? -->
      <obc5>RunScript(/storage/scripts/blue_button.py)</obc5>   <!-- KEY_GROUP            = BLUE -->
      <obc6>Action(Screenshot)</obc6>                           <!-- KEY_AV_ENHANCER      = ? -->
      <obc7>toggledebug</obc7>                                  <!-- KEY_ANGLE            = ? -->
      <obc8>reloadkeymaps</obc8>                                <!-- KEY_FL_SELECT        = ? -->
      <obc9>ActivateWindow(favourites)</obc9>                   <!-- KEY_PICTURE_MODE     = GUIDE -->
      <obc100>ContextMenu</obc100>                              <!-- KEY_MENU             = MENU -->
      <obc101>ActivateWindow(Home)</obc101>                     <!-- KEY_MOVE             = EXIT -->
      <obc102>FullScreen</obc102>                               <!-- KEY_CANCEL           = ? -->
    </universalremote>
  </Global>

  <!-- Home -->
  <Home>
   <remote>
    <play>RunScript(/storage/scripts/kodi.py,PARTY_MODE)</play> <!-- KEY_PLAY             = PLAY -->
   </remote>
  </Home>

  <!-- Fullscreen video -->
  <FullscreenVideo>
    <universalremote>
      <obc1>ActivateWindow(SubtitleSearch)</obc1>               <!-- KEY_ZOOM             = RED -->
      <obc2>Action(subtitledelay)</obc2>                        <!-- KEY_PLAY_MODE        = GREEN -->
      <obc4>Action(ShowSubtitles)</obc4>                        <!-- KEY_QUICK_REPLAY     = YELLOW -->
      <obc5>RunScript(/storage/scripts/blue_button.py)</obc5>   <!-- KEY_GROUP            = BLUE -->
      <obc100>OSD</obc100>                                      <!-- KEY_MENU             = MENU -->
    </universalremote>
    <remote>
      <zero>toggledebug</zero>
      <one>Number1</one>
      <two>Number2</two>
      <three>Number3</three>
      <four>Number4</four>
      <five>Number5</five>
      <six>Number6</six>
      <seven>Number7</seven>
      <eight>Number8</eight>
      <nine>Number9</nine>


      <!-- <fastforward>toggledebug</fastforward> -->
      <!-- <red>toggledebug</red> -->
      <!-- <forward>toggledebug</forward> -->

    </remote>
  </FullscreenVideo>


  <!-- Window: Video OSD -->
  <window12901>
    <universalremote>
      <obc100>OSD</obc100>                                      <!-- KEY_MENU             = MENU -->
    </universalremote>
  </window12901>
  <!-- Window: CU-lyrics -->
  <window12006>
    <universalremote>
      <obc100>toggledebug</obc100>
    </universalremote>
    <remote>
      <fastforward>toggledebug</fastforward>
      <red>toggledebug</red>
      <forward>toggledebug</forward>
    </remote>
  </window12006>
  <!-- Window: Audio visualisation -->
  <window13001></window13001>
</keymap>
<keymap>
  <global>
    <keyboard>
      <g mod="ctrl">RunScript(/path/to/testscript.py)</g>
      <r mod="ctrl">XBMC.Action(reloadkeymaps)</r>
    </keyboard>
  </global>
</keymap>

FLIRC

N2QA HARMONY KEY GLOBAL VIDEO MUSIC
UP UP UP UP SEEK NEXT
DOWN DOWN DOWN DOWN SEEK PREVIOUS
RIGHT RIGHT RIGHT RIGHT SEEK SEEK
LEFT LEFT LEFT LEFT SEEK SEEK
ENTER ENTER ENTER SELECT OSD OSD
RETURN RETURN BACKSPA. BACK
DIRECT NAV. / TOP MENU EXIT ESC PREV. MENU / HOME EXIT FULLSCREEN
PLAYLIST / MENU C CONTEXT MENU
DISPLAY I INFO
PLAY SPACE PLAY / PAUSE PLAY / PAUSE
STOP X STOP STOP
PLAY SPEED UP + VOLUME UP
PLAY SPEED DOWN - VOLUME DOWN
Z ZOOM / ASPECT
T TOGGLE SUBTITLES
CTRL + S SCREENSHOT
W TOGGLE WATCHED
SLOW / SEARCH FORWARD FORWARD FAST FORWARD FAST FORWARD
SLOW / SEARCH BACKWARD REWIND REWIND REWIND
SKIP FORWARD NEXT SEEK STEP FORWARD SEEK STEP FORWARD
SKIP BACKWARD PREVIOUS SEEK STEP BACKWARD SEEK STEP BACKWARD
S SHUTDOWN MENU
1-9 1-9 1-9 1-9
GROUP RED F1 TOGGLE SUBTITLES
QUICK REPLAY GREEN F2 SUBTITLE SEARCH
PLAY MODE YELLOW F3 SUBTITLE DELAY
ZOOM BLUE F4 BLUE BTN SCRIPT
AV ENHANCER E F5 TOGGLE DEBUG
ANGLE / PAGE E (hold) F6 RELOAD KEYMAPS
REPEAT GUIDE F7 FAVOURITES
FL SELECT F8 MUTE
CANCEL F9 VOLUME DOWN
ADVANCED SURROUND F10 VOLUME UP
POSITION MEMORY F11
AUDIO POW.OFF F12 SUSPEND

LIRC

Remote

Remote key definitions. See more on LIRC configuration.

/storage/.config/lircd.conf

Lircmap

Defines the translation, bridging a LIRC_button (what your lircd.conf calls the physical button on your remote control) to a XBMC_button (an Kodi internal button title).

/storage/.kodi/userdata/Lircmap.xml

<lircmap>
  <remote device="devinput">
    <power>KEY_POWER</power>
    <eject>KEY_EJECTCD</eject>

    <!-- Navigation -->
    <up>KEY_UP</up>
    <down>KEY_DOWN</down>
    <right>KEY_RIGHT</right>
    <left>KEY_LEFT</left>                       
    <select>KEY_ENTER</select>
    <menu>KEY_MENU</menu>                       <!-- N2QA: PLAYLIST / MENU | HARMONY: MENU -->
    <info>KEY_VIDEO</info>                      <!-- N2QA: DISPLAY | HARMONY: INFO -->
    <back>KEY_BACK</back>                       <!-- N2QA: RETURN | HARMONY: BACK -->

    <!-- Playback -->
    <play>KEY_PLAY</play>
    <pause>KEY_PAUSE</pause>
    <stop>KEY_STOP</stop>
    <forward>KEY_FORWARD</forward>              <!-- N2QA: SKIP FORWARD -->
    <reverse>KEY_REWIND</reverse>               <!-- N2QA: SKIP BACKWARD -->
    <skipplus>KEY_NEXT</skipplus>               <!-- N2QA: SLOW/SEARCH FORWARD -->
    <skipminus>KEY_PREVIOUS</skipminus>         <!-- N2QA: SLOW/SEARCH BACKWARD -->

    <volumeplus>KEY_PAGEUP</volumeplus>         <!-- N2QA: PLAY SPEED UP -->
    <volumeminus>KEY_PAGEDOWN</volumeminus>     <!-- N2QA: PLAY SPEED DOWN -->
    <mute>KEY_MEMO</mute>                       <!-- N2QA: POSITION MEMORY -->

    <!-- Functions -->
    <obc1>KEY_PROG4</obc1>                      <!-- N2QA: GROUP | HARMONY: RED -->
    <obc2>KEY_REPLY</obc2>                      <!-- N2QA: QUICK REPLAY | HARMONY: GREEN -->
    <obc3>KEY_PLAYER</obc3>                     <!-- N2QA: PLAY MODE | HARMONY: YELLOW -->
    <obc4>KEY_ZOOM</obc4>                       <!-- N2QA: ZOOM | HARMONY: BLUE -->

    <obc5>KEY_SUBTITLE</obc5>                   <!-- N2QA: SUBTITLE | HARMONY: ????? -->
    <obc6>KEY_PROG3</obc6>                      <!-- N2QA: REPEAT | HARMONY: GUIDE -->
    <obc7>KEY_PROG1</obc7>                      <!-- N2QA: AV ENHANCER | HARMONY: E -->
    <obc8>KEY_ANGLE</obc8>                      <!-- N2QA: ANGLE / PAGE | HARMONY: E (hold) -->
    <obc9>KEY_SELECT</obc9>                     <!-- N2QA: FL SELECT | HARMONY: ????? -->
    <obc10>KEY_MODE</obc10>                     <!-- N2QA: PICTURE MODE | HARMONY: ????? -->
    <obc11>KEY_MOVE</obc11>                     <!-- N2QA: DIRECT NAVIGATOR / TOP MENU | HARMONY: EXIT -->

    <!-- Numpad -->
    <zero>KEY_0</zero>
    <one>KEY_1</one>
    <two>KEY_2</two>
    <three>KEY_3</three>
    <four>KEY_4</four>
    <five>KEY_5</five>
    <six>KEY_6</six>
    <seven>KEY_7</seven>
    <eight>KEY_8</eight>
    <nine>KEY_9</nine>

  </remote>
</lircmap>

Debugging

tail -f /storage/.kodi/temp/kodi.log | egrep 'HandleKey' tail -f /storage/.kodi/temp/kodi.log | egrep 'OnKey|LIRC'