Skip to content

4.1 Meson IR: Creating a keycode file from scratch

betatester3016 edited this page Jul 5, 2021 · 1 revision

Abstract

The Meson IR remote receiver driver is part of Linus Thorvalds Linux Kernel and allows the use of compatible infrared remote controllers on a Linux distribution with the driver enabled.

Two configuration files are required to control the IR remotes behaviour: a keycode file (KEYMAP), containing a map of the remote codes, and the file rc_maps.cfg, containing a table with an association between the codes in the keycode file, and a kernel KEY_MAP event.

Basic instructions

  1. Connecting to CoreELEC

SSH into CoreELEC with default username and password (root/coreelec)

ssh root@ip_address

  1. Creating required files

touch KEYMAP

touch rc_maps.cfg

  1. Stopping services

systemctl stop kodi

systemctl stop eventlircd

  1. Scanning for IR Codes

Press a button on the remote control, then run in SSH:

dmesg -c

If the remote control is compatible there should be a message:

[ 9087.000717@0] meson-remote ff808040.meson-remote: invalid custom:0xae517f80

If there is no message, the remote is most likely incompatible.

  1. Finding the namespaces

run irrecord --list-namespace

  1. Entering the data into the KEYMAP file

run vi KEYMAP

the first line of the KEYMAP file should read:

 # table KEYMAP, type: PROTOCOL

followed by each IR code with its corresponding namespace separated by a space in a separate line.

Format: 0x0000 KEY_MAP # COMMENT

Next create a rc_maps.cfg file with the following contents:

  meson-ir * KEYMAP
  1. Storage locations

The KEYMAP file is stored in:

  /storage/.config/rc_keymaps/KEYMAP

The rc_maps.cfg file is stored in:

  /storage/.config/ 
  1. Testing the configuration

Finish by loading the keycode file and starting Kodi and eventlircd back up to test the changes.

  ir-keytable -a /storage/.config/rc_maps.cfg -s rc0
  systemctl start eventlircd
  systemctl start kodi

NOTE: The configuration will be loaded automatically when rebooting/powering on the device.

How to get the codes

run ir-keytable -t

 Testing events. Please, press CTRL-C to abort.

Push the buttons on the remote to view the scan codes and namespaces:

 2088.166794: event type EV_MSC(0x04): scancode = 0xdf1c
 2088.166794: event type EV_KEY(0x01) key_down: KEY_POWER(0x0003)
 2092.916069: event type EV_MSC(0x04): scancode = 0xdf18
 2092.916069: event type EV_KEY(0x01) key_down: KEY_MENU(0x008b)
 2090.058875: event type EV_MSC(0x04): scancode = 0xdff3
 2090.058875: event type EV_KEY(0x01) key_down: KEY_MUTE(0x0004)

Enter the data into the KEYMAP file:

 # table A95XF2, type: NEC
 0xdf1c KEY_POWER
 0xdf18 KEY_MENU
 0xdff3 KEY_MUTE

Samples

KEYMAP
rc_maps

Clone this wiki locally