[solved] Disable PowerOff via Remote?

  • Hello,

    how can i disable PowerOff/Shutdown via IR-Remote?

    I like to use only the Shutdown Menu within Kodi, to prevent accidentally shutdowns. This can be a problem with Power ON/OFF Task with Logitech Harmony.

    Thanks :).

  • Can you give me further instructions?

    I have a remote.xml in my keymaps folder.

    content:

    Code
    <keymap>
      <global>
        <remote>
          <power>NOOP</power>
        </remote>
      <global>
    </keymap>

    thanks

  • or

    Code
    <keymap>
      <global>
        <remote>
          <power>ActivateWindow(shutdownmenu)</power>
        </remote>
      <global>
    </keymap>

    which will bring up the shutdown menu when you pres the power button

  • my keymap doesnt work, he still shutdown.

    bring up the menu with power button will not work, i use a logitech harmony which shutdown all devices together . so the tv will be off beforce i can use the shutdow menu.

    i prefer to bring up the shutdown menu with another button on my harmony and shutdown the pc, this works already. then shutdown the rest of the devices with one press on power button on harmony.

    background: if i start the pc first and then all the other devices with harmony (which will send power signal) the pc will turn off and i had to start him again.

    sadly i cant edit the power on/off the sequences on the logitech harmony. if i remove the pc from the sequence, then i lost the possibility to control the pc with logitech harmony.

    please give me futher help

    thanks

  • The CIR likely has a real power button function that is handled by eventlircd. Disabling it needs some effort.

    To disable power button handling in eventlircd:

    cp /usr/lib/udev/rules.d/98-eventlircd.rules /storage/.config/udev.rules.d

    Find the following three lines in the copied file and delete them.

    Code
    SUBSYSTEMS=="acpi", ATTRS{hid}=="LNXPWRBN", \
      ENV{eventlircd_enable}="true", \
      ENV{eventlircd_evmap}="default.evmap"

    After reboot eventlircd handling is disabled but systemd takes over and still powers off the machine.

    To disable power button handling in systemd create or extend /storage/.config/autostart.sh with the following line and reboot.

    Code
    systemd-inhibit --what=handle-power-key sleep 1000d &

    Now the power event reaches kodi and can be handled with a custom keymap.

    Please take a note to update the modified 98-eventlircd.rules file on every LibreELEC update.

  • mglae, thank you very much for the information.

    i have found a better solution, sadly I didn't have this idea much earlier.

    Logitech has a own profile for zotac zbox for the logitech harmony. this profile works perfect out of the box. starting or shutdown my system is not a problem anymore.

    before:

    - starting pc with pressing his power button at front or use wake on lan

    - then start all other devices (av-receive with correct input and tv with correct input) with the harmony, this must be done a few seconds later after starting the pc

    - if too late, the pc was already done, gets the power signal from remote and turns off, or he didnt get hdmi signal from av-receiver and this turns into audio/video issues

    > solution, turn on av-receiver/tv first, then start pc > all ok

    - but this was not a solution for my girlfriend, one time she makes the correct sequence sometimes not > result in several on/off cycles for the devices (thats why i search for disabling power off the pc with remote)

    NOW:

    - simplye ONE button press on the logitech harmony, all devices start in correct sequence > HAPPPY :)

    - beforce i know the zotac logitech profile, starting pc with remote was not possible

  • I am trying to achieve the same thing, I have a usb air mouse remote and the power button shuts down the system immediately, despite having done the suggested edits already.

    Any other suggestions?

  • This makes a bunch of other stuff not work properly, I would not recommend doing this. After I reversed this change sudden the second suggestion above kicked in, now the power button just brings up the power menu

  • These modifications are only needed to disable a real power button like the case power switch.

    Most remotes do not have the feature, then the <power> key is mapped to Shutdown() in the Kodi keymap.

  • This makes a bunch of other stuff not work properly, I would not recommend doing this. After I reversed this change sudden the second suggestion above kicked in, now the power button just brings up the power menu

    Actually I was confused as to what actually solved the problem. It was not the keymap but it was the autostart.sh code that actually fixed it. Just confirmed this on a second PC.