Global linux/libreelec keyboard hotkey

  • Hi,

    Being using IR remote with libreelec for ages, trying to "move" to a Bluetooth universal remote.

    While using the IR remote i used irexec as daemon with a simple config file to map the "red" key to execute a forced kill of Kodi :


    Code
    begin
    prog = irexec
    button = key_red
    config = killall -9 kodi.bin
    end

    This allows me to restart Kodi by a single click of remote button for those rare cases Kodi just hung.

    Now , my new Bluetooth remote does not use IR and thus i looking for other solution.

    Tried the option to use Kodi internal keymap and calling a python script :

    Code
    <keymap>
    <global>
    <keyboard>
    <F3>RunScript(/storage/.config/killkodi.py)</F3>
    </keyboard>
    </global>
    </keymap>

    This does actually works fine , But on hard cases when Kodi just hung it is not working (which makes sense since Kodi stops responding).

    So i am looking for internal option in libreelec to map a keyboard key to execute a shell command.

    Any pointers would be appreciated.

  • You could auto-start a Python script with a "try" loop to check a key event. I'm no Python expert, so I can't tell you more.

    When Kodi hangs next time, login by SSH, and give us a log file...

    Please provide a full debug log.

    How to post a log (wiki)

    1. Enable debugging in Settings>System Settings>Logging
    2. Restart Kodi
    3. Replicate the problem
    4. Generate a log URL (do not post/upload logs to the forum)

    use "Settings > LibreELEC > System > Paste system logs" or run "pastekodi" over SSH, then post the URL link
  • Hi

    Part 3 (Replicate the problem) is the hard part since its not easy to reproduce and sometimes it happens like only 2-3 times a month.

    Normally its related to EPG viewer actions (I have 250+ channels with EPG setup) , which also get "released" by itself after 30-40 seconds.

    Sometimes its just a bad internet stream source which result in a 30-60 seconds timeout wait.

    So i doubt i a can easily reproduce the issue.

    Anyhow, In both cases i just got used to press my "Restart Kodi" special remote button which kills kodi and brings back everything after 5 seconds. :)

  • Then I would activate log level 1 at advancedsettings.xml, and look at kodi.old.log after reboot due to Kodi hanging.

    You can upload that file to PasteBin, and post the URL. If the log is long, you eventually have to split it, and share multiple URLs.

    If you prefer to write a Python script, please share your code.

  • I tried the python way , saw examples that uses keyboard library so i downloaded it to the the libreelec box and tried to run a simple code :

    The result :

    dumpkeys is missing on libreelec i guess, from quick googling did not find way to add it , any help would be appreciated.

    Other option is to make irexec with same as above config to work for a global keyboard event and not just for IR remotes.

  • dumpkeys is missing on libreelec i guess, from quick googling did not find way to add it , any help would be appreciated.

    I can only guess that dumpkeys is needed by the script to create a keymap.

    You have to read, what dumpkeys (click the link) does, and find a workaround.

    Our Wiki has instructions, how to create a keymap manually. Maybe that's your workaround for dumpkeys.

    You still haven't described your used hardware and LE version, so I'm not wondering that little help is coming in.

  • Thanks for the pointers, i'll check them out.

    About my setup , I am quite sure my question applies to all platforms , but you are right, It is better to include as much information as possible.

    I am using LE 10.0.4 on RPI 4.