Why is my remote keybinds alternating between two actions?

  • I'm trying to map a some extra buttons using the XML keymap method, but it's not working correctly.

    I'm running LibreELEC 19.5 on a Raspberry Pi 3B.

    I'm starting with just trying to get two buttons working. I want the 1 and 3 on my IR remote to do a seek(-15) and seek(15) respectively. I have managed to achieve this, but every alternate button press it registers as a Number1 or Number3 action, so you have to press the button twice each time. And I can't find where this is coming from. When I mapped button 4 whilst I've been testing this all day, it alternated that one with JumpSMS action. Maybe that can help diagnose what's causing this to happen.

    I know for this example, I probably can do this in a simpler way. But this is only a simple test for me to learn how to do it. I eventually want to map more complex keymaps which will require this keymapping method.

    I'm using an IR receiver which might be where my issue stems from.

    To begin, I've set up my IR and have my IR codes mapped in /storage/.config/rc_keymaps/samsung_remote and looks like this:

    Code
    # table samsung_remote, type: nec
    
    0x70704 KEY_1
    0x70706 KEY_3

    I'm leaving out the other key binds that work fine. The problem is caused by what I must have done incorrectly later.

    Then I created Lircmap.xml in ~/.kodi/userdata which looks like so:

    XML
    <?xml version="1.0" encoding="UTF-8"?>
    <lircmap>
      <remote device="devinput">
        <one>KEY_1</one>
        <three>KEY_3</three>
      </remote>
    </lircmap>

    And I also create a file called remote.xml in ~/.kodi/userdata/keymaps which looks like this:

    XML
    <?xml version="1.0" encoding="UTF-8"?>
    <keymap>
      <global>
        <remote>
          <one>seek(-15)</one>
          <three>seek(15)</three>
        </remote>
      </global>
    </keymap>

    I rebooted to apply the changes.

    When I run irw I get

    2 0 KEY_1 devinput

    4 0 KEY_3 devinput

    for the two keys.

    I have my kodi in debug mode and can see when I press the 1 button, I get:

    2023-02-03 02:20:32.936 T:625     DEBUG <general>: LIRC: - NEW 2 0 KEY_1 devinput (KEY_1)

    2023-02-03 02:20:32.943 T:614     DEBUG <general>: HandleKey: 206 (0xce, obc49) pressed, action is Number1

    2023-02-03 02:20:33.409 T:625     DEBUG <general>: LIRC: - NEW 2 0 KEY_1 devinput (KEY_1)

    2023-02-03 02:20:33.410 T:614     DEBUG <general>: HandleKey: 206 (0xce, obc49) pressed, action is seek(-15)


    And for the 3 button:

    2023-02-03 02:11:30.639 T:625     DEBUG <general>: LIRC: - NEW 4 0 KEY_3 devinput (KEY_3)

    2023-02-03 02:11:30.643 T:614     DEBUG <general>: HandleKey: 204 (0xcc, obc51) pressed, action is Number3

    2023-02-03 02:11:31.186 T:625     DEBUG <general>: LIRC: - NEW 4 0 KEY_3 devinput (KEY_3)

    2023-02-03 02:11:31.193 T:614     DEBUG <general>: HandleKey: 204 (0xcc, obc51) pressed, action is seek(15)

    As you can see the button alternates between the two actions. But I can't understand what's mapping it to Number 1 or Number 3.

    I have Keybind Editor installed and the ~/.kodi/userdata/keymaps/gen.xml looks like this:

    So I'm sure it's not coming from there. Those are the 'exit' and 'red' buttons on my remote.

    As a final test, I've removed both the remote.xml and the Lircmap.xml and the action is only the Number 1 / Number 3. So it must be coming from somewhere else. I don't really know why I explained everything I did because maybe I didn't do anything wrong in what I added, I just need to find what I didn't change that I should have.

    There is the Lircmap.xml in /usr/share/kodi/system but this is unwritable and I thought that creating the one I created was meant to override that one. I don't know why I'm suggesting things, I haven't got a clue.

    What is causing the two actions to be mapped to same key?

    If anyone knows how I can fix this, that would be much appreciated.

  • OK. Remove your Lircmap.xml. This is an overwrite / customization of the default version at system folder.

    Already did that too today. I even created an empty xml like this <lircmap></lircmap> and rebooted in case it needed to forcibly be reset.

    I've also seen in the Lircmap.xml there is both KEY_1 and KEY_NUMERIC_1, I mapped both of these in my rc_keybinds file and it didn't fix it.

    At the moment I have a remote.xml but no Lircmap.xml (so hopefully I'm just using the default). What I've noticed is that it seems to be only the numeric keys that have this problem. When I have bind IR codes to red/green/yellow/blue buttons but leave the remote.xml for them empty they do shortcuts to pictures/videos in the file manager, but when I map them in remote.xml the do exactly what I want and don't have this alternating between two functions; it seems the number keys are the only ones that do this.

    Also, KEY_3 changed and now does JumpSMS3 and not Number3 in the log. So I have no idea what it's doing.

    I've even made a fresh install on a new microSD card and the same thing happens. Number1 and JumpSMS3 is what they alternate between there.

    I tried to make a new Lircmap.xml and try a universal remote setup, and that didn't work. Nothing in when I ran irw and pressed buttons. I assume I'm meant to use the key names I gave in the Lircmap and put them with the IR codes in my rc_keymaps file? I wasn't sure.

    I'm guessing maybe this problem is because I'm using an IR sensor as my TV doesn't have CEC. The tutorials I've found don't actually explain how I input the codes. But I think I'm doing it right because, as I say, it works until I try to map the numeric keys to something. Then it does both alternately.

  • As you can see at /usr/share/kodi/system/Lircmap.xml, there is more than just one device tag.

    I suggest to copy that complete Lircmap.xml into /storage/.kodi/userdata.

    Then edit content inside different device tags, and check the results. Maybe device tags other than "devinput" also have effects.

  • As you can see at /usr/share/kodi/system/Lircmap.xml, there is more than just one device tag.

    I suggest to copy that complete Lircmap.xml into /storage/.kodi/userdata.

    Then edit content inside different device tags, and check the results. Maybe device tags other than "devinput" also have effects.

    I created a Lircmap.xml which was a complete copy of the original. Then I edited the tags for everything other than devinput by appending 'NULL'. First like this: <one>KEY_1_NULL</one> and then the other way <one_NULL>KEY_1<one_NULL> . Nothing changed. Should this have worked if it was using other device tags?

  • Should this have worked if it was using other device tags?

    I don't know. My idea was to remove <one> and <three> from all devices at Lircmap.xml.

    Different approach: Remove remote.xml, and just use this Lircmap.xml:

    XML
    <?xml version="1.0" encoding="UTF-8"?>
    <lircmap>
        <remote device="devinput">
            <one>seek(-15)</one>
            <three>seek(15)</three>
        </remote>
    </lircmap>
  • I don't know. My idea was to remove <one> and <three> from all devices at Lircmap.xml.

    Different approach: Remove remote.xml, and just use this Lircmap.xml:

    XML
    <?xml version="1.0" encoding="UTF-8"?>
    <lircmap>
        <remote device="devinput">
            <one>seek(-15)</one>
            <three>seek(15)</three>
        </remote>
    </lircmap>

    Thanks for your reply. And for keeping suggesting things I can try. Neither of those methods worked. Removing the lines from the complete Lircmap.xml had no change. But removing the remote.xml and replacing it with your suggested code, made the buttons function only as Numeric 1 and JumpSMS3, and did not do the seeking action.

    I just don't get it. Where do the default actions come from? When I enter the IR keys for the up down left and right buttons in /storage/.config/rc_keymaps/samsung_remote, what tells it what KEY_LEFT or KEY_OK should do?

  • Hi,

    I have 3 RPi3B's, all with IR receiver connected to GPIO pins, and old HP Media center remote (RC6 protocol as MCE remote).

    I'm using some buttons remapped, the "Power" to send the specific "Power" IR code for my TV (GPIO IR Diode), "Pause" remapped to "Stop", and the "subtitle" remapped to "PlayerProcessInfo" in case of playing media and to "ContextMenu" for anything else. And all is done using this remote.xml file in userdata\keymaps:

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

    <keymap>

    <global>

    <remote>

    <pause>Stop</pause>

    <power>System.Exec("/storage/.kodi/userdata/TV_Pwr.sh")</power>

    <subtitle>ContextMenu</subtitle>

    </remote>

    </global>

    <FullscreenVideo>

    <remote>

    <subtitle>PlayerProcessInfo</subtitle>

    </remote>

    </FullscreenVideo>

    </keymap>

    The "TV_Pwr.sh" is for sending to Kodi a player-stop command (kodi-send --action="Stop") and send the IR code for TV (ir-ctl -S nec:0x408 -S nec:0x408 -S nec:0x408 -S nec:0x408 -S nec:0x408 for my LG).

    If your remote codes is recognized (as standard protocol: nec), did you tried to use only your remote.xml (...<one>seek(-15)</one>...) without anything else?