IR-KEYTABLE without LIRC / LIRCD in LibreELEC?
#1
Hi all,

Since Kodibuntu is no longer supported by the Kodi developers, I have made the move to LibreELEC and I am very happy with it so far... Quick to install, fast boot, available options that should have been in Kodibuntu (network configuration tool!) and overall a very impressive experience.

However, I am scratching my head when it comes to getting my remote control working. Previously in Kodibuntu, I would remove LIRC and rely on IR-KEYTABLE to deal with a bank of RC-5 commands from my Philips Pronto remote control. I had no issues with creating a keytable and configuring a "keyboard.xml" to map buttons to specific functions. Everything worked perfectly and whenever reinstalling, I could just drop my "pronto.cfg" (keytable) and "keyboard.xml" files in the relevant places, and it would just work.

I assumed the same was possible with LibreELEC since it has IR-KEYTABLE built in, but I am unable to get it to work fully. I am well versed in IR-KEYTABLE; I can assign protocols, write keytables, test commands, load on boot, etc, but I have two problems:

LIRCD interferes with IR-KEYTABLE

My IR receiver is working perfectly but before IR-KEYTABLE will accept IR codes, I have to stop the LIRCD service with "systemctl stop eventlircd.service". No problem, just write an "autostart.sh" script to run this script on boot... Except it doesn't work!

I have no use for LIRC / LIRCD since I am using the RC-5 IR codes to emulate a keyboard and as I understand it, only IR-KEYTABLE can emulate key presses. I have no interest in using LIRC / LIRCD so if it cannot be removed, can it be disabled on boot up?

Specific Keys are not recognised by Kodi

I have the "Guide" button on my Pronto mapped to an RC-5 IR code that prompts "KEY_C" in the keytable. After stopping LIRCD, "KEY_C" works when running "ir-keytable -t" and I can see the key is recognised by IR-KEYTABLE. However, Kodi does not react to this keypress! It should display the Context Menu, but nothing happens. I thought this could be an issue with my custom "keyboard.xml" so I deleted it, which reverts back to Kodi's defaults, and although pressing the "C" key on a USB keyboard works, "KEY_C" is not recognised!

I have tested with a few other keys as well, most notably "KEY_P" and this doesn't work to play a video either, even though "P" on a USB-connected keyboard works fine. Interestingly, I mapped the same RC-5 IR code to "KEY_PLAY" instead of "KEY_P", and it now works in Kodi.

This tells me that LIRC / LIRCD is interfering in the translation from IR-KEYTABLE to Kodi, and any keys it doesn't recognise, it just drops. What is the best way to completely disable LIRC / LIRCD so that I can just use IR-KEYTABLE? And also, where is the translation from IR-KEYTABLE names to Kodi commands done? There must be a file somewhere that takes the IR-KEYTABLE commands, translates to Kodi-recognised commands, and spits them out to Kodi.

If you need any further information please let me know and I'll try to supply it. Thanks for any help you can give!

EDIT: Here is an excerpt from my kodi.log. It looks like I was right; LIRC is intercepting IR signals and dropping those it doesn't understand!

11:49:01.937 T:140430158071040 DEBUG: LIRC: Update - NEW at 71096:6c 0 KEY_DOWN devinput (KEY_DOWN)
11:49:01.937 T:140430158071040 DEBUG: OnKey: 167 (0xa7, obc88) pressed, action is Down
11:49:02.186 T:140430158071040 DEBUG: LIRC: Update - NEW at 71345:6c 0 KEY_DOWN_UP devinput (KEY_DOWN_UP)
11:49:02.518 T:140430158071040 DEBUG: LIRC: Update - NEW at 71677:2e 0 KEY_C devinput (KEY_C)
11:49:02.767 T:140430158071040 DEBUG: LIRC: Update - NEW at 71926:2e 0 KEY_C_UP devinput (KEY_C_UP)
11:49:04.128 T:140430158071040 DEBUG: LIRC: Update - NEW at 73287:2e 0 KEY_C devinput (KEY_C)
11:49:04.394 T:140430158071040 DEBUG: LIRC: Update - NEW at 73553:2e 0 KEY_C_UP devinput (KEY_C_UP)
11:49:04.958 T:140430158071040 DEBUG: LIRC: Update - NEW at 74117:2e 0 KEY_C devinput (KEY_C)
11:49:05.224 T:140430158071040 DEBUG: LIRC: Update - NEW at 74383:2e 0 KEY_C_UP devinput (KEY_C_UP)
11:49:06.286 T:140430158071040 DEBUG: LIRC: Update - NEW at 75445:11 0 KEY_W devinput (KEY_W)
11:49:06.552 T:140430158071040 DEBUG: LIRC: Update - NEW at 75711:11 0 KEY_W_UP devinput (KEY_W_UP)
11:49:07.332 T:140430158071040 DEBUG: LIRC: Update - NEW at 76491:e 0 KEY_BACKSPACE devinput (KEY_BACKSPACE)

I have also posted more information on the LibreELEC forum here: https://forum.libreelec.tv/thread-4210-p...l#pid30501

Any help in disabling LIRC and getting Kodi to read the in-kernel IR-KEYTABLE commands would be much appreciated! If I can crack this then I will write a full guide on how to do it!
Reply
#2
I haven't done this for ages, but try this:

http://nucblog.net/2014/01/mapping-the-b...e-control/
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#3
I'm not super familiar with Openelec. Is the root filesystem writeable?

It looks like it isn't based on another distro, at least according to their homepage " (OpenELEC) is a small Linux based Just Enough Operating System (JeOS) built from scratch"

With most linux distributions, lircd is a service that is started with whatever rc/upstart/systemd service you use to start services, and you could just disable the startup of it.

This http://openelec.tv/forum/110-update-open...ages#73030 makes it sound like that is not the case.

http://openelec.tv/forum/124-raspberry-p...bling-lirc has someone else looking to do the same thing, and points toward using 'autostart.sh'
and http://wiki.openelec.tv/index.php?title=...O_Receiver gives an example of using autostart.sh
Reply
#4
(2017-01-28, 01:37)nickr Wrote: I haven't done this for ages, but try this:

http://nucblog.net/2014/01/mapping-the-b...e-control/

Thanks for the link but I have read through that guide before and since it is for an IR remote, it uses LIRC. I want to actively avoid using LIRC since it doesn't support keyboard keys. The lircmap.xml configuration is irrelevant to me as I need to use IR-KEYTABLE exclusively. This works fine in Kodibuntu, but since that is no longer supported, I need to move to an appliance such as LibreELEC.
Reply
#5
I found the following code on the OpenELEC forums:

Code:
ln -sf /dev/null /storage/.config/system.d/eventlircd.service
sync && reboot

This fixes my issue after the reboot! All keys on the IR keyboard (remote) start working again. However, once I reboot for a second time, it stops working again. It looks to me like the above code creates a symbolic link from /dev/null to the LIRCD service which basically stops LIRCD from working completely. This is fine as it allows IR-KEYTABLE to work but I cannot figure out how this code should be implemented to work on every boot in LibreELEC! Sad

At least I'm getting somewhere now and I know this is possible in LibreELEC.
Reply
#6
Place it in autostart.sh

http://wiki.openelec.tv/index.php/Autostart.sh

Pretty sure it is the same in libreELEC.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#7
(2017-01-29, 22:31)nickr Wrote: Place it in autostart.sh

http://wiki.openelec.tv/index.php/Autostart.sh

Pretty sure it is the same in libreELEC.

Placing in autostart.sh won't work for two reasons:

The first line alone is not enough to fix the issue.
The second line would cause a boot loop since it is telling the system to reboot.

I need another way of doing this. Something to put in my autostart.sh would be great but it can't be the exact code I quoted above as this won't work.
Reply
#8
Yes if you need to reboot it won't work, but I doubt you need to reboot. More likely restart a service. I'm at work now, will take a look when I am home this evening.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#9
Try putting the following in your autostart.sh

Code:
systemctl stop eventlircd

(to start with you could just boot as normal with your remote not working, then try that in ssh and see if your remote then works).
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#10
(2017-01-30, 01:15)nickr Wrote: Yes if you need to reboot it won't work, but I doubt you need to reboot. More likely restart a service. I'm at work now, will take a look when I am home this evening.

I will at some point need to reboot the system as my plan is to build a new custom HTPC to use for Kodi in my cinema room. This will not be an always-on device so I need the remote working at boot time so that I have a seamless experience.

(2017-01-30, 08:22)nickr Wrote: Try putting the following in your autostart.sh

Code:
systemctl stop eventlircd

(to start with you could just boot as normal with your remote not working, then try that in ssh and see if your remote then works).

I did use that script in my autostart.sh file (see my first post) but this doesn't fix it. I just need a way to permanently stop / break LIRC so that IR-KEYTABLE can take over and handle all key presses.

Any help you can provide is appreciated! Smile
Reply
#11
I believe you'll 'just' have to rebuild Openelec image, after changing the source, as one of the references in #3 call out for adding packages.

the link in that thread goes here.
http://wiki.openelec.tv/index.php?title=...rom_source


I'm fairly certain based on poking around some that, once you git clone the source code, you can go just remove the ./packages/sysutils/eventlircd directory, and that will keep the system builder from building and installing eventlircd into the image:


dylan@BigBox ~/tmp/OpenELEC.tv $ find -iname "*eventlircd*"
./packages/sysutils/eventlircd
./packages/sysutils/eventlircd/system.d/eventlircd.service
./packages/sysutils/eventlircd/tmpfiles.d/z_62_eventlircd.conf
./packages/sysutils/eventlircd/udev.d/98-eventlircd.rules
dylan@BigBox ~/tmp/OpenELEC.tv

more specifically, it looks like within that directory (./packages/sysutils/eventlircd) there is a file (package.mk) that tells the system builder how to build the service/software.
https://github.com/OpenELEC/OpenELEC.tv/...package.mk

Also note that there is also a normal 'lircd' package that is built and installed.
Reply
#12
(2017-01-30, 18:33)thenextdon13 Wrote: I believe you'll 'just' have to rebuild Openelec image, after changing the source, as one of the references in #3 call out for adding packages.

Thanks, but I think this may be a little overkill! I have never compiled from source before, so I think there might be a steep learning curve here...

There must be a simpler solution, like adding a command to autostart.sh... I just need to figure out what the code is!
Reply
#13
I'm compiling from source right now... It doesn't look as difficult as I thought it would be actually! Smile

I just removed the LIRC and LIRCD package folders so hopefully this will work!
Reply
#14
Excellent, how did it turn out?

BTW; I don't really think Kodi is the right place for OpenElec specific questions.. there is probably a forum you would have gotten a quicker response on.
I'm not really that involved in the community, so i'm not sure.

also, if you fix it- i think common protocol is to edit the initial posting and add [solved] as a prefix...
Reply
#15
Let's not get ahead of ourselves... Wink It's not fixed yet, so I'm not marking anything as [solved]! Tongue

The compile failed with error "makefile:12: recipe for target 'image' failed". I don't know the reason for this!

All I did was remove the LIRC and LIRCD folders from the packages and try the build. Anyway, I'm retrying it now so I'll see how it goes.

I know the Kodi forum isn't the best place to ask these questions; I had already posted on the LibreELEC forums before asking here. If I reach a wider audience, I'm more likely to find someone who knows the answer to my question.
Reply

Logout Mark Read Team Forum Stats Members Help
IR-KEYTABLE without LIRC / LIRCD in LibreELEC?0