execute shell scripts with LIRC using custom key names

  • Hi everybody,


    I'm trying to get LIRC working in LibreELEC. Actually the standard thing works (controlling Kodi with my universal remote control).


    What I additionally want to do with LIRC (I do the same stuff with LIRC on a x86 PC with Ubuntu) is to call shell-scripts on specific key-events.


    It seems that the LIRC version which comes with LibreELEC is limited to a fix set of keys like KEY_LEFT, KEY_PLAY, ... which are mapped on the corresponding Kodi commands. I'd like to use custom key-names in my .lircrc like KEY_SWITCH_LIGHT. I was able to introduce such key-names and

    irw /run/lirc/lircd-lirc0

    prints

    000000037ff00b99 00 KEY_SWITCH_LIGHT Xbox

    000000037ff00b99 00 KEY_SWITCH_LIGHT_LIRCUP Xbox

    when I press the corresponding button on my remote control. But in the system logs I can see the entry

    Jul 9 20:55:41 OpenELEC lircd_helper: lircd-0.9.4c[495]: Info: Dropping non-standard symbol KEY_SWITCH_LIGHT

    And irexec doesn't execute the command. Does anyone have an idea how I can execute a script with LIRC without triggering a Kodi command (this is done when I use one of the predefined LIRC keys)?

    Many thanks in advance!

  • Got it working finally. Here is a short description what I did (maybe this helps other people who want to execute shell commands with Lirc - even if my approach is a little bit hacky ;-)):

    • enable Lirc in Kodi
    • add to /storage/.config/autostart.sh:

    /usr/bin/irexec -d /storage/.config/lircrc &

    • create /storage/.config/lircrc and add your commands - e.g.:
    Code
    begin
      prog = irexec
      button = KEY_HOME
      config = /storage/bin/doSomething.sh
    end

    Be careful: If you are used to define your own Lirc-keys here - this won't work. Use one of the predefined Lirc-key names which you do not need otherwise. See for example xbmc/Lircmap.xml at master · xbmc/xbmc · GitHub for a (maybe not complete) list of possible Lirc-keys.

    • make sure Kodi doesn't react on (for example) the KEY_HOME key - create /storage/.kodi/userdata/Lircmap.xml:
    Code
    <lircmap>
           <remote device="devinput">
                   <dummy>KEY_HOME</dummy>
           </remote>
    </lircmap>