Can't map LIRC-Buttons

  • I finally got my Remote, which only works with lirc, to function.

    For the most parts like navigattion starting, a video, pausing it, mute the sound or change the volume it works.

    Simply by having stuff like this in my /storage/.config/lircd.conf

    But now there are several other buttons which I'd like to match to some useful functions.

    For examle the Button labeled "AV" on my remote should be mapped to runScript(script.audio.profiles,0).

    So I added a button KEY_B, because it's the button B on my bluetooth keyboard which also runs that script.

    And then I added to my keymap /storage/.kodi/userdata/keymaps/bluetoothaudio.xml

    Code
    <keymap>
        <global>
           <keyboard>
               <key id="61506">runScript(script.audio.profiles,0)</key>
               <key id="9">runScript(script.audio.profiles,0)</key>
               <KEY_B>runScript(script.audio.profiles,0)<KEY_B>
        </global>
    </keymap>

    But it didn't work.

    When I compare the debug output of a working key with that of my AV key, I can see a clear difference.

    Code
    2025-10-25 00:39:36.207 T:941     debug <general>: LIRC: - NEW 6a 0 KEY_RIGHT devinput (KEY_RIGHT)
    2025-10-25 00:39:36.215 T:935     debug <general>: HandleKey: 168 (0xa8, obc87) pressed, window 10000, action is Right
    
    2025-10-25 00:39:42.557 T:941     debug <general>: LIRC: - NEW 30 0 KEY_B devinput (KEY_B)
    2025-10-25 00:39:42.962 T:935     debug <general>: HandleKey: 0 (0x0, obc255) pressed, window 10000, action is

    So the key is correctly registered as "KEY_B", but there seems to be no mapping applied.

    What am I doing wrong?

  • Code
    <KEY_B>runScript(script.audio.profiles,0)<KEY_B>   <= two opening tags
    <KEY_B>runScript(script.audio.profiles,0)</KEY_B>  <= one opening, one closing tag

    In the xml snippet you posted, KEY_B has no closing tag ^

  • Sorry. Copy & Paste error. My current map is


    The log is the same as posted above. :(

  • There is no KEY_B in Lircmap.xml of kodi.

    Yes… Thank you.

    I just noticed as well :(

    Will try other keys.


    Okay… As mglae pointed out correctly, there is no "KEY_B". So I tried "KEY_RED".

    This is the keymap I used:

    And this is the log:

    Code
    2025-10-25 10:36:03.654 T:1120    debug <general>: LIRC: - NEW 18e 0 KEY_RED devinput (KEY_RED)
    2025-10-25 10:36:03.687 T:1076    debug <general>: HandleKey: 251 (0xfb, obc4) pressed, window 10000, action is ActivateWindow(TVChannels)

    So it seems to be mapped somewhere else and not in my keymap.

    Edited once, last by Skeeve: Ein Beitrag von Skeeve mit diesem Beitrag zusammengefügt. (October 25, 2025 at 9:37 AM).

  • You have to use the remote section of the keymap and map kodi remote button codes, not keycodes, to actions.

    See the devinput section of /usr/share/kodi/system/Lircmap.xml to see how input key codes are mapped to button codes

    so long,

    Hias

  • Fantastic! Thanks again HiassofT

    Code
            <remote>
               <red>runScript(script.audio.profiles,0)</red>
           </remote>


    Code
    2025-10-25 12:48:34.206 T:996     debug <general>: LIRC: - NEW 18e 0 KEY_RED devinput (KEY_RED)
    2025-10-25 12:48:34.226 T:953     debug <general>: HandleKey: 251 (0xfb, obc4) pressed, window 10000, action is runScript(script.audio.profiles,0)


    Out of curiosity: Is there any way to define new keys?

    I mean <red> is not a very descriptive name ;)

  • Unfortunately no, kodi uses a hardcoded set of button codes.

    There is/was an attempt to improve kodi input handling and support remotes via keyboard input handling but it wasn't finished and hasn't been updated for quite a while now...

    [input] fallback to direct libinput mapping by oliver · Pull Request #26039 · xbmc/xbmc
    Description This is a possible fix for #16834 when using the GBM system. This approach adds a fallback mapping table, which is used when XKB cannot map a key…
    github.com

    so long,

    Hias

  • Unfortunately no, kodi uses a hardcoded set of button codes.

    Another question: Is it possible to replace the Lircmap.xml?

    Currently there are some duplicates, meaning: Two keys mapped to the same kodi remote button.

    Maybe it's possible to use other kodi remote button instead to be able to map them to scripts or actions?

  • Yes, just put it in .kodi/userdata/Lircmap.xml. You only need to list the entries you want to change, eg

    Code
    <lircmap>
    	<remote device="devinput">
    		<guide>KEY_EPG</guide>
    		<livetv>KEY_TV</livetv>
    	</remote>
    </lircmap>

    so long,

    Hias