From cf0b9eafb33ad56b5b0a29cb4d9f74b9006fbb45 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Oct 09 2024 19:56:31 +0000 Subject: Start hidpipe-server manually Signed-off-by: Alyssa Rosenzweig --- diff --git a/shim.py b/shim.py index 8e1cb92..c6b1423 100644 --- a/shim.py +++ b/shim.py @@ -112,19 +112,16 @@ def watch_steam(path): steam = None -# Obnoxious hack to workaround hidpipe race condition -# XXX: FIXME -def warm_gamepad(): - import socket - - with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock: - path = BaseDirectory.get_runtime_dir() + '/hidpipe' - try: - sock.connect(path) - except FileNotFoundError: - return - time.sleep(2) - sock.close() +# Start hidpipe-server and give it long enough to warm up. This is a bit of a +# hack. TODO: We'll move this into muvm +def start_hidpipe(): + import subprocess + try: + hidpipe = subprocess.Popen(["hidpipe-server"]) + time.sleep(1) + return hidpipe + except OSError: + return None def launch_steam(path): global steam @@ -134,7 +131,7 @@ def launch_steam(path): if not is_latest_installed(path): download(URL, path) - warm_gamepad() + hidpipe = start_hidpipe() # Launch steam steam_arg_string = ' '.join(STEAM_ARGS) @@ -159,6 +156,9 @@ def launch_steam(path): except pexpect.exceptions.TIMEOUT: pass + if hidpipe is not None: + hidpipe.kill() + # Here is where we learn Alyssa doesn't know how to write GUIs def splash(path): from PyQt6.QtWidgets import QApplication, QLabel, QWidget, QMainWindow diff --git a/steam.spec b/steam.spec index bc45ca0..1e8eff8 100644 --- a/steam.spec +++ b/steam.spec @@ -1,6 +1,6 @@ Name: steam Version: 0 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Steam wrapper for Fedora Asahi Remix License: MIT @@ -68,6 +68,9 @@ appstream-util validate-relax --nonet \ %{_metainfodir}/io.pagure.fedora_asahi.steam.metainfo.xml %changelog +* Wed Oct 10 2024 Alyssa Rosenzweig - 0-9 +- Start hidpipe-server manually + * Wed Oct 09 2024 Janne Grunau - 0-8 - hidpipe: Fail gracefully if hidpipe is not running