From 0c3d1cf48a07863e91b35c93e489a050710a7ca4 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Fri, 22 Sep 2023 23:50:58 +0200 Subject: [PATCH 1/4] kodi: add patch to change remote power button behaviour to show shutdown menu Signed-off-by: Matthias Reichl --- ...emote-poweroff-action-to-show-shutdo.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/mediacenter/kodi/patches/kodi-995.21-keymaps-change-remote-poweroff-action-to-show-shutdo.patch 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 + From f1b8be5f7f7f62dd7c503b235381b84bf469db8e Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 24 Sep 2023 14:04:00 +0200 Subject: [PATCH 2/4] systemd: let logind handle the power key on GBM Signed-off-by: Matthias Reichl --- packages/sysutils/systemd/package.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 From 630d542ea90aeb817857ebf311fafa90f0834a92 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 24 Sep 2023 14:20:50 +0200 Subject: [PATCH 3/4] kodi: configure libinput to ignore power button input devices on GBM Signed-off-by: Matthias Reichl --- .../config/70-libinput-ignore-power-button.rules | 12 ++++++++++++ packages/mediacenter/kodi/package.mk | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 packages/mediacenter/kodi/config/70-libinput-ignore-power-button.rules 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..bdd4cfc29d --- /dev/null +++ b/packages/mediacenter/kodi/config/70-libinput-ignore-power-button.rules @@ -0,0 +1,12 @@ +# 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" + +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} From 92e02633783ee6ea99a8bf7b3bdfbd6de78262d0 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Fri, 29 Sep 2023 01:36:53 +0200 Subject: [PATCH 4/4] kodi: extend power button udev rule to match on 32bit systems as well Signed-off-by: Matthias Reichl --- .../kodi/config/70-libinput-ignore-power-button.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/mediacenter/kodi/config/70-libinput-ignore-power-button.rules b/packages/mediacenter/kodi/config/70-libinput-ignore-power-button.rules index bdd4cfc29d..775d814c1f 100644 --- a/packages/mediacenter/kodi/config/70-libinput-ignore-power-button.rules +++ b/packages/mediacenter/kodi/config/70-libinput-ignore-power-button.rules @@ -8,5 +8,8 @@ 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"