Guide:Using an Infrared Remote with CoreELEC

Using an Infrared Remote Control with CoreELEC

This tutorial explains how to configure any infrared remote control with Kodi on CoreELEC, using the box’s built-in IR receiver. It works regardless of the remote’s model or brand.
It does not directly apply to Bluetooth, RF, or other types of remotes.
Since recent CoreELEC versions, some buttons could not be mapped (for example “Power”, etc.).
The method relies on the rc_keymaps, rc_maps.cfg, keymaps, and Lircmap.xml files.

A) Configure data transfer between PC and CoreELEC box
Remote configuration on the CoreELEC box will be done from a computer.

**

1. Enable SAMBA

**
FROM Kodi:
Settings > System > Note the CoreELEC IP address
(I recommend configuring a static IP from your router/box interface)

Settings > Services > SMB client >
WINS server = 0.0.0.0 (leave as is)
Minimum protocol version = SMB2
Maximum protocol version = SMB3
WS Discovery = enable

Settings > Add-ons > Program add-ons > CoreELEC config:
Enable SMB 2 and 3
Password authentication = choose a password

FROM PC (Windows 11):
SMB v1 is a vulnerable version and should be avoided.

  • Disable SMBv1:
    Windows > Control Panel > Programs and Features

    Turn Windows features on or off
    In the list, uncheck “SMB 1.0/CIFS File Sharing Support”

  • Enable SMB Direct:

    In the list, check “SMB Direct”
    OK > Restart LATER.

Control Panel > Network and Internet >

  • Ethernet > Check “Public networks”

  • Ethernet > Authentication settings (Change) > Add IEEE authentication > Change >
    Add a trusted server name = COREELEC

  • Advanced network settings > Advanced sharing settings

    Private networks:

    • Network discovery enabled

    • File and printer sharing enabled

      Public networks:

      1. Network discovery enabled
      2. File and printer sharing enabled

      2. Enable SSH

    CoreELEC > Settings > Add-ons > Program add-ons > CoreELEC > Services:

    • Enable SSH = On

    • Disable SSH password = Off

    • SSH password: choose a password
      Default SSH server port: 22
      Default username: root
      Default password: coreelec
      IP address is listed under Connections

    • Install PuTTY

    • Host Name (or IP address): enter the CoreELEC box IP

    • Port: 22

    • Saved Sessions: choose a name for the connection

    • Click SAVE.

    Connection procedure:

    • Select the previously configured session > Load > Open
    • Choose “Yes” to accept the host key (only needs to be done once)
    • In the terminal window:
      username: root
      password: the SSH password chosen in CoreELEC

    B) CONFIGURING REMOTE FILES

    1. Disable CEC in CoreELEC:

    • CoreELEC Settings > Hardware > CEC wakeup option
    • Kodi > Peripherals options

    2. Get the new remote’s scancodes:

    • Open PuTTY and connect to CoreELEC.
      Paste:
systemctl stop kodi
systemctl stop eventlircd
ir-keytable -p NEC,RC-5,RC-6,JVC,SONY -t
  • Press all buttons on the remote (from left to right and top to bottom).

  • This will generate scancodes in the PC terminal, like this:

500.027674: event type EV_MSC(0x04): scancode = 0x70702
500.027674: event type EV_SYN(0x00).

etc… and so on…

The generated scancode above is therefore:
0x70702

  • When finished, copy all the content generated in the terminal (Ctrl+C) and paste it into an AI.
    Ask it to generate a simplified page in the ORDER given, with the following header and formatted as:
\[\[protocols\]\]
name = "mecool"
protocol = "nec"
\[protocols.scancodes\]
0x70702 = ""
0x70701 = ""
0x70704 = ""

etc..
etc..

Copy the result into a text file and save it as “remote_name.toml”

3. Create the remote configuration file

Since you previously generated the scancode mapping by pressing the keys in the indicated order,
you will now enter the corresponding key name between the quotes according to your remote:

Example for a Samsung remote:

[[protocols]]
name = “mecool”
protocol = “nec”

[protocols.scancodes]
0x70702 = "KEY_MENU"
0x70701 = "KEY_ROOT_MENU"
0x70704 = "KEY_1"
0x70705 = "KEY_2"
0x70706 = "KEY_3"
0x70708 = "KEY_4"
0x70709 = "KEY_5"
0x7070a = "KEY_6"
0x7070c = "KEY_7"
0x7070d = "KEY_8"
0x7070e = "KEY_9"
0x7072c = "KEY_TEXT"
0x70711 = "KEY_0"
0x70713 = "KEY_CONTEXT_MENU"
0x70707 = "KEY_VOLUMEUP"
0x7070b = "KEY_VOLUMEDOWN"
0x7070f = "KEY_MUTE"
0x7076b = "KEY_FAVORITES"
0x70712 = "KEY_CHANNELUP"
0x70710 = "KEY_CHANNELDOWN"
0x7071a = "KEY_F13"
0x70779 = "KEY_HOME"
0x7074f = "KEY_EPG"
0x7073f = "UNKNOWN e-manual"
0x70760 = "KEY_UP"
0x7071f = "KEY_INFO"
0x70765 = "KEY_LEFT"
0x70768 = "KEY_ENTER"
0x70762 = "KEY_RIGHT"
0x70758 = "KEY_BACK"
0x70761 = "KEY_DOWN"
0x7072d = "UNKNOWN exit"
0x7076c = "KEY_RED"
0x70714 = "KEY_GREEN"
0x70715 = "KEY_YELLOW"
0x70716 = "KEY_BLUE"
0x7073e = "UNKNOWN pic size"
0x70728 = "UNKNOWN picture"
0x70725 = "KEY_SUBTITLE"
0x70746 = "KEY_STOP"
0x70745 = "KEY_PREVIOUSSONG"
0x70747 = "KEY_PLAY"
0x7074a = "KEY_PAUSE"
0x70748 = "KEY_NEXTSONG"

You can notice that 0x70728 = "UNKNOWN picture"
means that no KEY was found for this picture button scancode.
You have the choice to let it stay like this or erase the line code.

Save in CoreELEC (via SMB file sharing) in:
“COREELEC\Configfiles\rc_keymaps\remote_name.toml”

4. Create the remote association file
“COREELEC\Configfiles\rc_maps.cfg”

which will contain:

meson-ir \* remote_name.toml

5. Configure keys
To map to a key using this method, you must:

Example to assign the Shutdown menu to the remote’s POWER button:

In "remote_name.toml”, remote touch key is
0x70702 = "KEY_MENU"
(KEY_MENU will be the action corresponding to the POWER button’s scancode on the remote).

  • CREATE: “\Userdata\keymaps\remote_name.xml”
  • PASTE INSIDE:
<?xml version="1.0" encoding="UTF-8"?>
<keymap>
<global>
<remote>
</remote>
<universalremote>
<obc1>ActivateWindow(shutdownmenu)</obc1>
</universalremote>
</global>
</keymap>

You will notice ActivateWindow(shutdownmenu) where ActivateWindow(shutdownmenu) asks Kodi to open the shutdownmenu windows .
And <obc1></obc1> is the button identifier.
You can choose obc1, obc2, etc., as the logical identifier without it corresponding to a physical key.
So for each other remote key will use:

<obc1>ActivateWindow(shutdownmenu)</obc1>
<obc2>other command..</obc2>
<obc3>other command..</obc3>

6. CREATE: COREELEC\Userdata\Lircmap.xml

  • PASTE INSIDE:
<lircmap>
<remote device="devinput">
<obc1>KEY_MENU</obc1>
</remote>
</lircmap>

7. RESTART & TEST
From PC via SSH:

systemctl restart eventlircd
systemctl restart kodi

Test the keys & enjoy

if it doesn’t work Check first that the files code is properly formatted and free of junk.

My goal was to revisit the standard mapping method from scratch and then explain how to map keys that cannot be mapped using that method—something that is not covered anywhere in the threads, or is only partially explained.