Last active
February 23, 2021 19:00
-
-
Save aperezm-vlex/75d7481afff0db8f5894 to your computer and use it in GitHub Desktop.
Raspbian: Avoid black screen on kodi exit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOG_FILE=$HOME/.kodi/temp/kodi.log | |
rm $LOG_FILE 2> /dev/null | |
/usr/lib/kodi/kodi.bin --standalone & | |
while [[ ! -f $LOG_FILE ]] ; do | |
sleep 1s | |
done | |
while read line ; do | |
if [[ ${line} =~ "application stopped" ]] ; then | |
echo "Killing kodi" | |
break | |
fi | |
done < <(tail --pid=$$ -f -n0 $LOG_FILE) | |
killall kodi.bin | |
fbset -depth 8 && fbset -depth 16 |
none of the scripts posted work for me. I need to reboot. After using xrefresh ill get an error:
unable to open display ''
This one however worked for me:
#!/bin/bash
fbset_bin=`which fbset`
xset_bin=`which xset`
xrefresh_bin=`which xrefresh`
if [ ! -z $fbset_bin ]; then
DEPTH2=`$fbset_bin | head -3 | tail -1 | cut -d " " -f 10`
echo "found depth2: $DEPTH2"
fi
echo "kodi params: $@"
kodi
sleep 2
if [ ! -z $fbset_bin ]; then
if [ "$DEPTH2" == "8" ]; then
DEPTH1=16
else
DEPTH1=8
fi
echo "switching from $DEPTH1 to $DEPTH2"
$fbset_bin -depth $DEPTH1 > /dev/null 2>&1
sleep 2
$fbset_bin -depth $DEPTH2 > /dev/null 2>&1
sleep 2
fi
if [ ! -z $xset_bin ] && [ ! -z $xrefresh_bin ]; then
if [ -z $DISPLAY ]; then
DISPLAY=":0"
fi
$xset_bin -display $DISPLAY -q > /dev/null 2>&1
echo "display check for $DISPLAY is $?"
if [ "$?" == "0" ]; then
echo "refreshing"
$xrefresh_bin -display $DISPLAY > /dev/null 2>&1
fi
fi
This one work for Raspberry Pi 4 4GB (mine):
#!/bin/bash
LOG_FILE=$HOME/.kodi/temp/kodi.log
rm $LOG_FILE 2> /dev/null
/usr/lib/kodi/kodi.bin --standalone &
while [[ ! -f $LOG_FILE ]] ; do
sleep 1s
done
while read line ; do
if [[ ${line} =~ "application stopped" ]] ; then
echo "Killing kodi"
break
fi
done < <(tail --pid=$$ -f -n0 $LOG_FILE)
killall kodi.bin
fbset -depth 8 && fbset -depth 16
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@aperezm-vlex's script works, makes the desktop functional but leaves black blocks.
@GeorgeBrendanDoyle's script doesn't work for me, but I have used the last few lines of his script to make one that does work for me.