Libreelec,openelec,kodi

From roonics
Jump to navigation Jump to search

No audio after resume from standby/suspend and logoff current user on resume

Tested on Intel Nuc i3. I was getting no audio after resuming from suspend, I also wanted the script to logoff the current user as I ran multiple profiles.

1. SSH To Libreelec

2. CD to:

cd .config/sleep.d

3. Create a file:

 vi 99-toggle_rate.power

4. Paste this in the file:

#!/bin/sh
case "$1" in
pre)
;;
post)
kodi-send --action=System.LogOff
sleep 2
xrandr -display :0 --output HDMI1 --mode 1920x1080 --rate 59.94
sleep 2
xrandr -display :0 --output HDMI1 --mode 1920x1080 --rate 60
;;
esac

5. Make the file executable

 chmod a+x 99-toggle_rate.power

6. CD to:

/.config/system.d

7. Create a file:

vi kodiresume.service

8. Paste this in the file:

[Unit]
Description=Kodi actions for resuming from suspend
After=suspend.target
Requires=kodi.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c "exec sh /storage/.config/sleep.d/99-toggle_rate.power post"

[Install]
WantedBy=suspend.target

9. Register the service:

systemctl enable kodiresume.service