From f7006595faca97de1042f86b460ac03058daef29 Mon Sep 17 00:00:00 2001 From: Dom Cobley Date: Wed, 17 Nov 2021 14:21:07 +0000 Subject: [PATCH] kodi.sh.in: Strip down and simplify Matrix doesn't support legacy (no /dev/dri so no gbm) so strip that out. unset DISPLAY and kodi gbm explicity rejects that I belive openvt is cleaner that doing chvt twice --- tools/Linux/kodi.sh.in | 85 ++---------------------------------------- 1 file changed, 3 insertions(+), 82 deletions(-) diff --git a/tools/Linux/kodi.sh.in b/tools/Linux/kodi.sh.in index 8a3db04828199..78117b5314903 100644 --- a/tools/Linux/kodi.sh.in +++ b/tools/Linux/kodi.sh.in @@ -30,62 +30,11 @@ CRASHLOG_DIR=${CRASHLOG_DIR:-$HOME} KODI_DATA=${KODI_DATA:-"${HOME}/.${bin_name}"} # mapped to special://home/ WINDOWING=${WINDOWING:-"auto"} -# Black Screen on exit fix -ORIGINAL_DEPTH=`fbset | head -3 | tail -1 | cut -d " " -f 10` - # PiPplware fixes -if pgrep "fbi" > /dev/null -then - sudo killall fbi >/dev/null 2>&1 -fi -if pgrep "cec-client" > /dev/null -then +if pgrep "cec-client" > /dev/null; then sudo service cec stop >/dev/null 2>&1 fi -is_legacy() { - ! grep -q okay /proc/device-tree/soc/v3d@7ec00000/status 2> /dev/null && ! grep -q okay /proc/device-tree/v3dbus/v3d@7ec04000/status 2> /dev/null -} - -is_fkms() { - ! is_legacy && grep -q okay /proc/device-tree/soc/firmwarekms@7e600000/status 2> /dev/null -} - -is_kms() { - ! is_legacy && ! grep -q okay /proc/device-tree/soc/firmwarekms@7e600000/status 2> /dev/null -} - -# EmulationStation screen resolution fix -save_screen_mode() { - local status="$(tvservice -s)" - if echo "$status" | grep -qE "(PAL|NTSC)"; then - MODE_TYPE=$(echo "$status" | grep -oE "(PAL|NTSC)") - MODE_INFO=$(echo "$status" | grep -oE "([0-9]+\:[0-9]+)") - else - MODE_TYPE=$(echo "$status" | grep -oE "(CEA|DMT)") - MODE_INFO=$(echo "$status" | grep -oE "\([0-9]+\)" | tr -d '()') - fi -} - -restore_screen_mode() { - if [ "$MODE_TYPE" = "PAL" ] || [ "$MODE_TYPE" = "NTSC" ]; then - tvservice -c "$MODE_TYPE $MODE_INFO" >/dev/null - else - tvservice -e "$MODE_TYPE $MODE_INFO" >/dev/null - fi - sleep 1 -} - -if is_legacy ; then - save_screen_mode -else - # if not legacy and running X11 change VT - if pgrep "X" > /dev/null; then - vt=$(sudo /bin/fgconsole) - sudo /bin/chvt 8 - fi -fi - # Workaround for high CPU load with nvidia GFX export __GL_YIELD=USLEEP @@ -141,18 +90,6 @@ fi APPORT_CORE="/var/crash/$(echo -n ${KODI_BINARY}${postfix}|tr / _).$(id -u).crash" -migrate_home() -{ - [ "$(basename $0)" = "xbmc" ] && echo "WARNING: Running ${bin_name} as "xbmc" is deprecated and will be removed in later versions, please switch to using the ${bin_name} binary" - - #check if data migration is needed - if [ -d "${HOME}/.xbmc" ] && [ ! -d "${KODI_DATA}" ]; then - echo "INFO: migrating userdata folder. Renaming ${HOME}/.xbmc to $KODI_DATA" - mv ${HOME}/.xbmc $KODI_DATA - touch ${KODI_DATA}/.kodi_data_was_migrated - fi -} - command_exists() { command -pv $1 >/dev/null 2>&1 @@ -252,7 +189,6 @@ print_crash_report() echo "Crash report available at $FILE" } -migrate_home propagate_sigterm() { kill -TERM "$CHILD" 2>/dev/null } @@ -272,7 +208,7 @@ while [ $(( $LOOP )) = "1" ] do [ -f "${APPORT_CORE}" ] && rm -f "${APPORT_CORE}" LOOP=0 - ${KODI_BINARY}${postfix} $SAVED_ARGS & + unset DISPLAY; sudo openvt -sw -- su -c "${KODI_BINARY}${postfix} $SAVED_ARGS" $USER & CHILD=$! wait "${CHILD}" RET=$? @@ -286,22 +222,7 @@ do done # Raspberry Pi fixes -if is_legacy ; then - restore_screen_mode - fbset -depth 8 > /dev/null 2>&1 - fbset -depth $ORIGINAL_DEPTH > /dev/null 2>&1 - if pgrep "X" > /dev/null - then - xrefresh >/dev/null 2>&1 - fi -else - # if not legacy and running X11 change VT - if pgrep "X" > /dev/null; then - sudo /bin/chvt $vt - fi -fi -if [ -f "/usr/bin/cec-daemon" ] -then +if [ -f "/usr/bin/cec-daemon" ]; then sudo service cec start >/dev/null 2>&1 fi