Posts by NinjaMonkeyUK

    XORG! :@

    It's xorg causing the issue. If I boot LibreELEC and the IR keyboard keys don't work, I run:

    Code
    systemctl restart xorg.service

    After that the additional keys magically work! This looks to be consistent behaviour so I believe this is the cause of my issue. I think the reason for the keys working sporadically is because on boot, sometimes my IR-KEYTABLE startup command in autostart.sh is getting loaded after xorg, meaning xorg doesn't recognise the new key names.

    Trust me to finally figure this out after I have ordered a Flirc! :rolleyes:

    So now I just need to figure out how to delay xorg on startup... preferably in autostart.sh but I guess this will have to be done in a udev rule. Any ideas? :)

    OK so after further investigation, I have managed to create a complete list of key names that IR-KEYTABLE recognises. I ran a command to pull a list of current key names from IRRECORD:

    Code
    irrecord -l

    This gave me a list of 549 possible names, covering "KEY_" and "BTN_". Since I won't be using "BTN_" as this seems to refer to buttons on a controller, I removed these from the list and individually tested the remaining 435 "KEY_" names. Of these 435, 18 were not recognised at all by IR-KEYTABLE so I am left with 417 key names that I can use:

    List of 417 key names compatible with IR-KEYTABLE

    I tested these in blocks of 100 with a different keytable each time, in case you are wondering how I tested 400+ names.

    Now I know IR-KEYTABLE can receive IR signals and map them to these key names without issue, I need to know how and where these key names are translated into Kodi. Where does Kodi look when trying to match an IR signal to a key name?

    One thing I have noticed is that the output of IR-KEYTABLE changes sometimes:

    Code
    Found /sys/class/rc/rc0/ (/dev/input/event7) with:
            Driver mceusb, table rc-rc6-mce
            Supported protocols: unknown other lirc rc-5 jvc sony nec sanyo mce-kbd rc-6 sharp xmp
            Enabled protocols: lirc rc-5
            Name: Media Center Ed. eHome Infrared
            bus: 3, vendor/product: 147a:e03e, version: 0x1001
            Repeat delay = 1000 ms, repeat period = 1000 ms

    "event7" sometimes appears as "event11" but I'm not sure this is related to my issue as sometimes all keys work when it is pointing to "event7" and other times they do not.

    This is so frustrating! I had it working for all keys on first boot this morning, but after a reboot only specific keys are working again! I KNOW it is possible for Kodi under LibreELEC to work with all IR keyboard commands because I've had it working. I just don't understand what is breaking it on reboot!
    [hr]
    Here are my Kodi logs:

    Kodi Log when full IR keyboard works (you can see on line 522 that key "c" has been recognised and processed to launch the context menu in Kodi)

    Kodi Log when only some IR controls work

    I have compared both files in NotePad++ with the Compare addon and can barely see any difference in the logs; certainly nothing standing out as the reason for the failures. This leads me to believe it is definitely NOT a Kodi issue, but more likely something behind the scenes.

    I'm still convinced it's an issue with key presses being intercepted by something in between IR-KEYTABLE and Kodi.

    LibreELEC developers, do you know what I could be alluding to?

    I'd like to see an option under LibreELEC > Services, similar to the enable / disable LIRC option, for enable / disable eventlircd and any other service that interferes with IR-KEYTABLE.

    I am asking for this is as I would like to be able to use IR-KEYTABLE exclusively for forwarding IR commands to Kodi, so that KEY_C, KEY_KPENTER, etc will work. At the moment, those keys are recognised by IR-KEYTABLE, but something intercepts the key presses before they reach Kodi so they are unusable.

    This feature would be a great help to those of us that are trying to use IR keyboards, rather than IR remotes.


    So another possibility to (logically) disable eventlircd is to create an empty udev rule file - the button-presses should then show up as input/keyboard events in kodi instead of lirc events.

    Code
    : > /storage/.config/udev.rules.d/98-eventlircd.rules

    OK from my experimentation, this code creates a blank 98-eventlircd.rules file but it does absolutely nothing to prevent eventlircd from working. :(
    [hr]

    I agree, initial setup is pretty simple, and I am able to get it working for IR remote control keys. BUT, IR keyboard keys such as KEY_C don't work!


    I'd also like to see this. And from the logic point of view the "Disable LIRC" button should also be linked to disabling eventlircd as well altogether.

    Your eventlircd discovery explains now why I wasn't able to use ir-keytable last week, when I first tried it. There seemed to be some kind of interference in keypresses and I didn't know how that could be, as I thought LIRC was disabled.

    I'm also looking forward to test this somehow as soon as it is solved.

    Yes, I think those of us with IR keyboards should be given the option to disable both LIRC and EVENTLIRCD to enable us to exclusively use IR-KEYTABLE in-kernel.

    For me, running the command "systemctl stop eventlircd.service" allows me to see IR remote output in "ir-keytable -t".

    I am just installing Ubuntu on a spare PC and then I will attempt to compile my own copy of LibreELEC without the LIRC and EVENTLIRCD pacakges. If this builds successfully and subsequently works for my IR keyboard, I will put in a formal request for a feature to allow disabling EVENTLIRCD from the LibreELEC setup menu, similar to the option to disable LIRC.

    When I said I'm not too sure about what any of that means, I was referring to your previous post that I had quoted.

    I am aware that the code I posted disables the eventlircd service, but it does not do it on subsequent boots unfortunately :(

    I need to find a way to permanently override the eventlircd service and stop it running. This is the last step in getting IR-KEYTABLE to handle all keyboard events!

    Maybe the developers would consider adding an option in the LibreELEC settings to allow the user to disable eventlircd as well as LIRC... Who do I need to contact to request this?

    I'm using GPIO IR receiver for recording IR remote buttons but I am facing inconsistency to record and execute remote key using LIRC. My question is if we can use remote key operation in my code via IR keytable approach, if yes kindly help and provide steps to perform same.

    Referring approach mentioned here

    Hi, please don't hijack my thread as your questions have nothing to do with it. You are wanting to use a GPIO IR receiver with LIRC. I am trying to use a USB receiver without LIRC, so your questions are totally irrelevant to this subject. Please create your own thread and ask your questions there.

    Do not know if it helps but you can disable the udev lirc rules with

    Code
    : >/storage/.config/udev.rules.d/98-lircd.rules

    and/or mask the lirc systemd units with

    Code
    : > /storage/.config/system.d/[email protected]
    : > /storage/.config/system.d/[email protected]

    and reboot

    I'm not too sure what any of that means but I did find the following code from 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! :(

    At least I'm getting somewhere now and I know this is possible in LibreELEC.


    In the newest beta you can disable lirc from the LibreELEC settings add-on. You can't disable eventlircd though. You would have to override the udev rule for that.

    I don't know how I missed this!

    Anyway, I tried disabling it but it didn't seem to actually do anything...
    [hr]


    Once you get angry enough with all the lirc nonsense you'll get a Flirc and be done with it.

    That's the thing though... Flirc costs about £20 in the UK and I shouldn't even need it as this should be possible in-kernel... If Flirc can translate my IR codes into usable Kodi commands, then there is no reason why it cannot be done in-kernel.
    [hr]


    You can map unknown lirc keys to kodi remote keys using Lircmap.xml.

    Code
    cp /usr/share/kodi/system/Lircmap.xml /storage/.kodi/userdata/

    Edit the devinput section (in your case), i.e.:

    Code
    ...
    <remote device="devinput">
    <menu>KEY_C</menu>
    ...

    See LIRC - Official Kodi Wiki

    Thanks, but I think you're missing the point of my post. IR-KEYTABLE can process key presses from an IR keyboard. As far as I am aware, LIRC is not capable of this and is ONLY for IR remote control commands.

    I don't want to map "KEY_C" to <menu> because I want to map it to "C" so that it emulates pressing the "C" key on an actual keyboard. This way, I can have an on-screen keyboard on my Pronto's screen that I can use to type directly into Kodi. I know this is possible because I use it this way with Kodibuntu!

    My point is, LIRC / LIRCD is handling these "KEY_C", "KEY_A", etc events and since it doesn't recognise them, it drops them, so Kodi doesn't ever receive them. I want to fully disable LIRC / LIRCD so that only IR-KEYTABLE processes the IR transmissions. This will allow it to translate the IR codes to actual keyboard keys. LIRC is only working to map remote control keys and ignores the rest.

    I shouldn't need to edit lircmap.xml because I have no use for it. There must be a way to permanently disable LIRC / LIRCD so that only IR-KEYTABLE processes IR commands in-kernel.

    Yes I think LIRC is still part of the kernel but IR-KEYTABLE is being prepared to phase LIRC out...

    I realise comparing LibreELEC with Kodibuntu is a little like comparing oranges and apples, but there are similarities between them. Trouble is, I need IR-KEYTABLE rather than LIRC as it gives much more flexibility than LIRC. Essentially it allows me to use my remote as a keyboard, rather than just a remote.

    Still scratching my head!

    It seems other people are running into a similar issue whereby they don't have working return, Context Menu, etc, buttons, but the guides and hints to fix those all point to using LIRC. Surely somebody out there must be wanting to use IR-KEYTABLE like me!

    I am using the very latest LibreELEC which is Kodi 17.0-RC3 Git 4d93228, compiled Jan 16 2017. I have literally just done a clean installation in the last 10 minutes. So far I have run this command (ignore the LibreLaptop name; I'm just using a laptop to test while at work):

    Code
    LibreLaptop:~ # ir-keytable
    Found /sys/class/rc/rc0/ (/dev/input/event11) with:
            Driver mceusb, table rc-rc6-mce
            Supported protocols: unknown other lirc rc-5 jvc sony nec sanyo mce-kbd rc-6 sharp xmp
            Enabled protocols: lirc nec rc-6
            Name: Media Center Ed. eHome Infrared
            bus: 3, vendor/product: 147a:e03e, version: 0x1001
            Repeat delay = 1000 ms, repeat period = 125 ms

    LIRC, NEC and RC-6 are clearly the only enabled protocols. Since I just need RC-5, I can run this command:

    Code
    ir-keytable -p rc-5
    Protocols changed to rc-5

    Now on Kodibuntu this command literally enables RC-5 and NOTHING else. But on LibreELEC, if I query IR-KEYTABLE now I get:

    Code
    LibreLaptop:~ # ir-keytable
    Found /sys/class/rc/rc0/ (/dev/input/event11) with:
            Driver mceusb, table rc-rc6-mce
            Supported protocols: unknown other lirc rc-5 jvc sony nec sanyo mce-kbd rc-6 sharp xmp
            Enabled protocols: lirc rc-5
            Name: Media Center Ed. eHome Infrared
            bus: 3, vendor/product: 147a:e03e, version: 0x1001
            Repeat delay = 1000 ms, repeat period = 125 ms
    LibreLaptop:~ #

    Clearly, LIRC is still being used and I think this is the reason why my IR keyboard commands are being dropped. If I check the Kodi log file, I can see key presses from the laptop's keyboard.

    At this point, since I haven't yet run "systemctl stop eventlircd.service", if I try to test for key presses in IR-KEYTABLE, it doesn't see anything. If I then run the command to stop the LIRCD service, I see this in the Kodi log:

    Code
    LibreLaptop:~ # ir-keytable
    Found /sys/class/rc/rc0/ (/dev/input/event11) with:
            Driver mceusb, table rc-rc6-mce
            Supported protocols: unknown other lirc rc-5 jvc sony nec sanyo mce-kbd rc-6 sharp xmp
            Enabled protocols: lirc rc-5
            Name: Media Center Ed. eHome Infrared
            bus: 3, vendor/product: 147a:e03e, version: 0x1001
            Repeat delay = 1000 ms, repeat period = 125 ms

    This is what makes me think LIRC and LIRCD are completely separate, and stopping the LIRC service (even though it says LIRC disconnected in Kodi's log) does not actually shut down LIRC. After this, IR-KEYTABLE starts responding to IR commands:

    Code
    LibreLaptop:~ # ir-keytable -t
    Testing events. Please, press CTRL-C to abort.
    1485446427.304544: event type EV_MSC(0x04): scancode = 0x1b46
    1485446427.304544: event type EV_SYN(0x00).
    1485446428.055559: event type EV_MSC(0x04): scancode = 0x1b46
    1485446428.055559: event type EV_SYN(0x00).
    1485446428.823524: event type EV_MSC(0x04): scancode = 0x1b47
    1485446428.823524: event type EV_SYN(0x00).
    1485446429.304563: event type EV_MSC(0x04): scancode = 0x1b47
    1485446429.304563: event type EV_SYN(0x00).

    Since I haven't created / loaded a keytable in this fresh install of LibreELEC, clearly the scancodes are not mapped to any key presses. I can quickly write a keytable for the most common commands (/storage/.kodi/userdata/keymaps/prontotest.cfg):

    Code
    #table pronto, type: rc-5
    
    
    0x1b46 KEY_UP
    0x1b47 KEY_DOWN
    0x1b48 KEY_LEFT
    0x1b49 KEY_RIGHT
    0x1b3a KEY_ENTER
    0x1b1a KEY_C
    0x1b5c KEY_BACKSPACE

    Now if I load this keytable into IR-KEYTABLE:

    Code
    LibreLaptop:~ # ir-keytable -c -w /storage/.kodi/userdata/keymaps/prontotest.cfg
    Read pronto table
    Old keytable cleared
    Wrote 7 keycode(s) to driver
    Protocols changed to rc-5

    The keys are successfully written to the table, and a test proves they work under IR-KEYTABLE:

    Here is where I am stuck. The above keys clearly work in IR-KEYTABLE and all except KEY_C are passed to Kodi without issue. I can navigate up, down, left and right through menus, select options, and return (KEY_BACKSPACE) to the previous menu. I just can't launch the Context Menu on KEY_C. Kodi logs the keys like this:

    As you can see, the KEY_C scancode is ignored by Kodi. I am convinced LIRC is the cause of this.

    I think LIRC is translating the navigation keys as they are a common standard, but since LIRC is not designed for use with keyboards, it doesn't know what KEY_C (or KEY_A, KEY_W, etc) is so it can't map it to a command that it understands, to then pass to Kodi... Therefor it just drops the command so Kodi doesn't see anything.

    There must be a way of completely disabling LIRC either at LibreELEC boot time or by issuing a command to IR-KEYTABLE to tell it not to listen to LIRC!


    Try "systemctl stop eventlircd" rather than "systemctl stop eventlircd.service".

    Hi Troggy, thanks for the suggestion but unfortunately your command appears to be no different to the one I was using. It still behaves in the same way. :rolleyes:

    I'm convinced LIRC is the culprit, due to what I found in the kodi.log file (in my post above). However, if I try to stop LIRC with "systemctl stop lirc", I just get this error message:

    "Failed to stop lirc.service: Unit lirc.service not loaded."

    If LIRC isn't loaded, how can it be intercepting the keystrokes?

    It's interesting that I don't seem to be able to stop IR-KEYTABLE from using the LIRC protocol. In Kodibuntu, if I specify just the RC-5 protocol, that is the only one that becomes available. In LibreELEC, it doesn't work the same; no matter which protocol I specify, LIRC is always enabled as well! I believe this is the sticking point.

    Does anyone know how to get IR-KEYTABLE to force OFF the LIRC protocol in LibreELEC? :s


    If you are using a GPIO IR receiver. You should only need to edit the /flash/config.txt so that dtoverlay=lirc-rpi is not commented out. Then un install lirc if you installed it. Then put your RC-5 lircd.conf in the /storage/.config directory.

    Forget about all of that old fashioned stuff.

    I'm actually using a USB IR receiver on a vanilla install of the generic Intel / nVidia / AMD build of LibreELEC, on a Zotac ZBox, not a Raspberry Pi. Saying that, I have tested this on my Raspberry Pi and seen similar results.

    I have not installed LIRC. In fact that's the first thing I used to purge from my Kodibuntu installations to get IR-KEYTABLE set up and working. Your comment on uninstalling LIRC, then using lircd.conf seems contradictory; are LIRC and LIRCD completely separate entities?

    How do I uninstall / disable LIRC and LIRCD in LibreELEC? I cannot find any documentation that gives any hints how to do this.

    I'm not sure what you mean about "old fashioned stuff", as I was under the impression that the move from LIRC to in-kernal IR-KEYTABLE was a good thing and a move in the right direction, not a regression.

    I need to use IR-KEYTABLE independently so that I have access to the full array of 120+ keys that are available on a keyboard, rather than the limited set available in LIRC. This then enables me to create an on-screen keyboard on my remote which I can use to type in Kodi. This works and has done for years under Kodibuntu... It's just LibreELEC doesn't seem to want me to shut off LIRC / LIRCD!

    Interestingly, when I switch IR protocols in IR-KEYTABLE using "ir-keytable -p rc-5", IR-KEYTABLE reports that the enabled protocols are RC-5 and LIRC. On Kodibuntu, if I switch to RC-5 (or any other protocol), then that is the only one that becomes enabled. How come IR-KEYTABLE on LibreELEC essentially forces the LIRC protocol?

    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)