Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Script to launch the Steam Link app on Raspberry Pi
- TOP=$(cd "$(dirname "$0")" && pwd)
- # Set up the temporary directory
- export TMPDIR="$TOP/.tmp"
- rm -rf "$TMPDIR"
- mkdir -p "$TMPDIR"
- # Restore the display when we're done
- cleanup()
- {
- pulseaudio -k
- kill $CEC_PID 2>/dev/null
- screenblank -k
- }
- trap cleanup 2 3 15
- # stop kodi
- if [ ! -z "$(pidof kodi.bin)" ]; then
- echo 'stopping kodi'
- systemctl stop kodi
- fi
- # setup udev
- #if [ ! -f /lib/udev/rules.d/60-steam-input.rules ]; then
- if [ ! -f /lib/udev/rules.d/56-steamlink.rules ]; then
- echo 'adding udev overlay'
- mount -t overlay overlay -o lowerdir=/lib/udev/rules.d,upperdir=/storage/steamlink/udev/rules.d/,workdir=/storage/steamlink/overlay_work /lib/udev/rules.d
- udevadm trigger
- fi
- # Run the shell application and launch streaming
- QT_VERSION=5.14.1
- export HOME="/storage"
- export PATH="$TOP/bin:$PATH"
- export QTDIR="$TOP/Qt-$QT_VERSION"
- export QT_PLUGIN_PATH="$QTDIR/plugins"
- #export QT_QPA_PLATFORM="eglfs"
- #export QT_QPA_PLATFORM_PLUGIN_PATH="$QT_PLUGIN_PATH/platforms"
- export LD_LIBRARY_PATH="$TOP/lib:$QTDIR/lib:$LD_LIBRARY_PATH"
- export SDL_GAMECONTROLLERCONFIG_FILE="${XDG_DATA_HOME:-$HOME/.local/share}/Valve Corporation/SteamLink/controller_map.txt"
- #export SDL_GAMECONTROLLERCONFIG_FILE="$TOP/SteamLinkcontroller_map.txt"
- export QT_QPA_PLATFORM="eglfs"
- #elif [ -f /opt/vc/lib/libbrcmGLESv2.so ]; then # from steam launcher
- export QT_QPA_EGLFS_INTEGRATION=eglfs_brcm
- export QT_QPA_EGLFS_PRELOAD="/opt/vc/lib/libbrcmGLESv2.so"
- #
- export QT_QPA_EGLFS_FORCE888=1
- export QT_QPA_EGLFS_ALWAYS_SET_MODE=1
- #export QT_DEBUG_PLUGINS=1
- echo 'starting pulseaudio'
- pulseaudio -k 2>/dev/null
- cat /etc/pulse/default.pa | sed 's/^\(load-module module-udev-detect\|load-module module-detect\)/\1 tsched=0/' > /storage/steamlink/pulse_default.pa
- pulseaudio -D -n -F "$TOP/pulse_default.pa"
- echo 'starting cec'
- cec-client </dev/null | steamlink-cec &
- CEC_PID="$(jobs -p) $!"
- echo 'starting steamlink'
- while true; do
- LD_PRELOAD=$QT_QPA_EGLFS_PRELOAD shell "$@"
- # See if the shell wanted to launch anything
- cmdline_file="$TMPDIR/launch_cmdline.txt"
- if [ -f "$cmdline_file" ]; then
- cmd=`cat "$cmdline_file"`
- eval $cmd
- rm -f "$cmdline_file"
- else
- # We're all done...
- break
- fi
- done
- cleanup
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement