Confusion regarding LIRC configuration

I see a few misunderstandings in your post so I’ll attempt to explain how lirc should be working in OSMC and where you’re probably going wrong.

While it may not be causing your problems, you shouldn’t be editing /boot/config.txt directly anymore, rather putting your custom lines in the included file /boot/config-user.txt otherwise a future update is likely to wipe out your custom lirc dtoverlay settings.

If you still have a copy of the original config file, why not just use it ? I don’t understand why you’re using irrecord again, unless you changed remote control or lost the file… the lircd.conf file that you generate on any OSMC system using irrecord is compatible with any version of OSMC on any platform that supports lircd - so you could record on a Pi and use on a Vero4k or vica-versa…

You shouldn’t be directly editing /etc/lirc/lircd.conf - it’s a symlink which points to the profile “selected” by MyOSMC.

for example:

osmc@vero3:/etc/lirc$ ls -al
total 1516
drwxr-xr-x   2 root root   4096 Sep 19 23:22 .
drwxr-xr-x 125 root root  12288 Oct 22 07:00 ..
-rw-r--r--   1 root root   1089 May 27 01:24 apple-silver-A1294-lircd.conf
-rw-r--r--   1 root root  26870 May 27 01:24 apple-silver-A1294-lircd.png
-rw-r--r--   1 root root   1038 May 27 01:24 apple-white-A1156-lircd.conf
-rw-r--r--   1 root root  39796 May 27 01:24 apple-white-A1156-lircd.png
-rw-r--r--   1 root root  23092 May 27 01:24 atilibusb-lircd.conf
-rw-r--r--   1 root root 169574 May 27 01:24 atilibusb-lircd.png
-rw-r--r--   1 root root   1586 May 27 01:24 dell-travel-remote-nu851.lircd.conf
-rw-r--r--   1 root root 157000 May 27 01:24 dell-travel-remote-nu851.lircd.png
-rw-r--r--   1 root root      0 May 27 01:24 dvicoo-lircd.conf
-rw-r--r--   1 root root  42554 May 27 01:24 dvicoo-lircd.png
-rw-r--r--   1 root root   4394 May 27 01:24 hauppage45-pvr350-lircd.conf
-rw-r--r--   1 root root  39180 May 27 01:24 hauppage45-pvr350-lircd.png
-rw-r--r--   1 root root   2013 May 27 01:24 kls-1.6-lircd.conf
-rw-r--r--   1 root root  54790 May 27 01:24 lircd-full.conf
lrwxrwxrwx   1 root root     38 May  4  2020 lircd.conf -> /etc/lirc/apple-white-A1156-lircd.conf
-rw-r--r--   1 root root   1175 May 27 01:24 osmc-remote-lircd.conf
-rw-r--r--   1 root root 142537 May 27 01:24 osmc-remote-lircd.png
-rw-r--r--   1 root root   2717 May 27 01:24 philips-srm-7500-lircd.conf
-rw-r--r--   1 root root  59276 May 27 01:24 philips-srm-7500-lircd.png
-rw-r--r--   1 root root  11197 May 27 01:24 rc6-mce-lircd.conf
-rw-r--r--   1 root root  29164 May 27 01:24 rc6-mce-lircd.png
-rw-r--r--   1 root root   5450 May 27 01:24 samsung-lircd.conf
-rw-r--r--   1 root root 131181 May 27 01:24 samsung-lircd.png
-rw-r--r--   1 root root  10146 May 27 01:24 ttusbir-lircd.conf
-rw-r--r--   1 root root   1470 May 27 01:24 wdtvlive-remote-lircd.conf
-rw-r--r--   1 root root 113255 May 27 01:24 wdtvlive-remote-lircd.png
-rw-r--r--   1 root root    992 May 27 01:24 xbox-lircd.conf
-rw-r--r--   1 root root 157549 May 27 01:24 xbox-lircd.png
-rw-r--r--   1 root root   1670 May 27 01:24 xbox-one-lircd.conf
-rw-r--r--   1 root root 120143 May 27 01:24 xbox-one-lircd.png
-rw-r--r--   1 root root   2698 May 27 01:24 xbox360-lircd.conf
-rw-r--r--   1 root root 109895 May 27 01:24 xbox360-lircd.png
-rw-r--r--   1 root root   1045 May 27 01:24 yausbirv2_frontswitch.conf

If you save a file directly as /etc/lirc/lircd.conf it will be overwritten and lost if you ever change remotes in MyOSMC. And if you “edit” the symlink you will actually be editing and overwriting one of the built in profiles - whichever one the symlink currently points to.

The right way to do it is to save your custom lircd.conf file in /etc/lirc under a different name then update the symlink to point at it, as is done with all the bundled profiles. This is compatible with the way MyOSMC changes remote profile. (It just updates the symlink and restarts the services)

This looks OK so far,

The lirc socket /var/run/lirc/lircd-lirc0 is only there for debug purposes as it is useful for running irw with it as you have done, however Eventlircd does not make use of it.

What actually happens is lircd is run with the --uinput option which causes it to output uinput (dev/input) events to the linux kernel.

You can see this /dev/input device created by lirc below with evtest, event device 6 on my system: (I ran this on a Vero4k so it will have some additional devices you won’t see on a Pi)

osmc@vero3:~$ sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      gpio_keypad
/dev/input/event1:      aml_vkeypad
/dev/input/event2:      cec_input
/dev/input/event3:      input_btrcu
/dev/input/event4:      flirc.tv flirc
/dev/input/event5:      meson-ir
/dev/input/event6:      lircd

Eventlircd then intercepts these events from Lircd, processes them and then outputs them on its own lirc socket at /var/run/lirc/lircd which is the Lirc socket that Kodi connects to.

A udev rule (can’t remember it’s location off hand) is responsible for recognising lircd’s /dev/input device and causing eventlircd to “grab” it in exclusive mode to prevent other software like Kodi from directly recognising it as a /dev/input device, which would cause duplicate button presses and incorrect button mappings.

It’s hard to say what might be wrong on your system because your testing is based on some incorrect assumptions about how it should be working, so I would suggest the following:

If you want to use irrecord you should do this first:

sudo systemctl stop lircd_helper@lirc0.service eventlircd.service

This will stop both the lircd instance and eventlircd. Then use irrecord. When you’re finished and have symlinked your file do:

sudo systemctl restart lircd_helper@lirc0.service eventlircd.service
sudo systemctl restart mediacenter.service

It’s important for Kodi to be restarted after eventlircd is restarted, otherwise Kodi will receive /dev/input events directly from lircd which will cause problems with repeats and incorrect button mappings, (since the /dev/input mappings and lircd mappings in Kodi are completely separate)

Kodi must always start after eventlircd not before, otherwise eventlircd cannot gain exclusive access to the /dev/input device belonging to lircd.

1 Like