Merge pull request #8165 from HiassofT/le12-kodi-poweroff2

kodi GBM: shut down kodi when case power button is pressed
This commit is contained in:
CvH 2023-09-26 18:38:51 +02:00 committed by GitHub
commit 198cbf75a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View File

@ -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"

View File

@ -407,6 +407,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}

View File

@ -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