Fix bug preventing input after the first startup of the container

Xorg was starting before udev could finish the monitor command. This prevented the X server from having access to the input devices. For some reason, any subsequent starts would be fine.

Adding a small delay to the X server start and triggering a request for device events from the kernel after a delay seems to fix this issue.
This commit is contained in:
Josh.5
2022-10-06 22:26:50 +13:00
parent 93fb8f858c
commit 54911cb97b
12 changed files with 122 additions and 36 deletions

View File

@@ -9,11 +9,13 @@
# Modified By: Josh.5 (jsunnex@gmail.com)
###
source /usr/bin/common-functions.sh
# CATCH TERM SIGNAL:
_term() {
kill -TERM "$sunshine_pid" 2>/dev/null
}
trap _term SIGTERM
trap _term SIGTERM SIGINT
# CONFIGURE:
@@ -25,18 +27,9 @@ fi
# EXECUTE PROCESS:
# Wait for X server to start
# (Credit: https://gist.github.com/tullmann/476cc71169295d5c3fe6)
MAX=60 # About 30 seconds
CT=0
while ! xdpyinfo >/dev/null 2>&1; do
sleep 0.50s
CT=$(( CT + 1 ))
if [ "$CT" -ge "$MAX" ]; then
LOG "FATAL: $0: Gave up waiting for X server $DISPLAY"
exit 11
fi
done
# Wait for the X server to start
wait_for_x
# Start the sunshine server
sunshine min_log_level=info /home/${USER}/sunshine/sunshine.conf &
sunshine_pid=$!