diff --git a/packages/mediacenter/kodi/config/70-libinput-ignore-power-button.rules b/packages/mediacenter/kodi/config/70-libinput-ignore-power-button.rules new file mode 100644 index 0000000000..775d814c1f --- /dev/null +++ b/packages/mediacenter/kodi/config/70-libinput-ignore-power-button.rules @@ -0,0 +1,15 @@ +# Ignore power button input devices in libinput so logind can handle them +ACTION=="remove", GOTO="end" +SUBSYSTEM!="input", GOTO="end" +KERNEL!="event*", GOTO="end" + +IMPORT{parent}="KEY" + +# match devices that only generate KEY_POWER (code 116) events +ENV{KEY}=="10000000000000 0", ENV{LIBINPUT_IGNORE_DEVICE}="1" + +# 32bit systems report the bitmap in 32bit chunks +ENV{KEY}=="100000 0 0 0", ENV{LIBINPUT_IGNORE_DEVICE}="1" + +LABEL="end" + diff --git a/packages/mediacenter/kodi/package.mk b/packages/mediacenter/kodi/package.mk index 17f2d93bb2..41f834501d 100644 --- a/packages/mediacenter/kodi/package.mk +++ b/packages/mediacenter/kodi/package.mk @@ -408,6 +408,12 @@ post_makeinstall_target() { mkdir -p ${INSTALL}/usr/cache/libreelec cp ${PKG_DIR}/config/network_wait ${INSTALL}/usr/cache/libreelec + # GBM: install udev rule to ignore the power button in libinput/kodi so logind can handle it + if [ "${DISPLAYSERVER}" = "no" ]; then + mkdir -p ${INSTALL}/usr/lib/udev/rules.d/ + cp ${PKG_DIR}/config/70-libinput-ignore-power-button.rules ${INSTALL}/usr/lib/udev/rules.d/ + fi + # update addon manifest ADDON_MANIFEST=${INSTALL}/usr/share/kodi/system/addon-manifest.xml xmlstarlet ed -L -d "/addons/addon[text()='service.xbmc.versioncheck']" ${ADDON_MANIFEST} diff --git a/packages/mediacenter/kodi/patches/kodi-995.21-keymaps-change-remote-poweroff-action-to-show-shutdo.patch b/packages/mediacenter/kodi/patches/kodi-995.21-keymaps-change-remote-poweroff-action-to-show-shutdo.patch new file mode 100644 index 0000000000..fe611fb14f --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-995.21-keymaps-change-remote-poweroff-action-to-show-shutdo.patch @@ -0,0 +1,26 @@ +From 5604be6a6701e0bd68cb36fadb05cecba57f7887 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Fri, 22 Sep 2023 23:41:51 +0200 +Subject: [PATCH] keymaps: change remote poweroff action to show shutdown menu + +Signed-off-by: Matthias Reichl +--- + system/keymaps/remote.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/keymaps/remote.xml b/system/keymaps/remote.xml +index c122b99188..baebf679c0 100644 +--- a/system/keymaps/remote.xml ++++ b/system/keymaps/remote.xml +@@ -50,7 +50,7 @@ + VolumeUp + VolumeDown + Mute +- ShutDown() ++ ActivateWindow(ShutdownMenu) + ActivateWindow(Videos) + ActivateWindow(Music) + ActivateWindow(Pictures) +-- +2.39.2 + diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk index de418af024..50156db1c4 100644 --- a/packages/sysutils/systemd/package.mk +++ b/packages/sysutils/systemd/package.mk @@ -203,7 +203,11 @@ post_makeinstall_target() { # tune logind.conf sed -e "s,^.*HandleLidSwitch=.*$,HandleLidSwitch=ignore,g" -i ${INSTALL}/etc/systemd/logind.conf - sed -e "s,^.*HandlePowerKey=.*$,HandlePowerKey=ignore,g" -i ${INSTALL}/etc/systemd/logind.conf + if [ "${DISPLAYSERVER}" = "no" ]; then + sed -e "s,^.*HandlePowerKey=.*$,HandlePowerKey=poweroff,g" -i ${INSTALL}/etc/systemd/logind.conf + else + sed -e "s,^.*HandlePowerKey=.*$,HandlePowerKey=ignore,g" -i ${INSTALL}/etc/systemd/logind.conf + fi # replace systemd-machine-id-setup with ours safe_remove ${INSTALL}/usr/lib/systemd/system/systemd-machine-id-commit.service