tuxbox: 3.0.1 -> 3.1.0 (#499363)

This commit is contained in:
Sandro
2026-03-23 17:15:03 +00:00
committed by GitHub
2 changed files with 16 additions and 92 deletions
@@ -1,86 +0,0 @@
From db2e25602339253c12ed65720bae7c793c044bdc Mon Sep 17 00:00:00 2001
From: Scott Bowman <scott@bowmans.org>
Date: Thu, 19 Feb 2026 16:58:03 -0600
Subject: [PATCH] Broaden pgrep patterns to detect driver on NixOS and pip
entry points
Use multiple pgrep patterns to find running driver processes,
covering python -m invocation, pip console_scripts entry points,
and NixOS wrapped executables.
---
tuxbox/gui/driver_manager.py | 50 ++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/tuxbox/gui/driver_manager.py b/tuxbox/gui/driver_manager.py
index accb457..384c00e 100644
--- a/tuxbox/gui/driver_manager.py
+++ b/tuxbox/gui/driver_manager.py
@@ -82,6 +82,17 @@ class DriverManager:
DriverManager._systemctl_available = shutil.which('systemctl') is not None
return DriverManager._systemctl_available
+ # Patterns to match driver processes via pgrep -f (full command line match).
+ # Multiple patterns cover different invocation methods:
+ # - "python -m tuxbox [args]" (standard / systemd service)
+ # - "/path/to/tuxbox [args]" (pip entry point)
+ # - "/path/to/.tuxbox-wrapped [args]" (NixOS wrapper)
+ # The patterns intentionally exclude GUI processes (tuxbox-gui, tuxbox.gui).
+ DRIVER_PGREP_PATTERNS = [
+ r'python.*-m\s+tuxbox(\s|$)',
+ r'[/.]tuxbox(-wrapped)?(\s|$)',
+ ]
+
@staticmethod
def _get_driver_pids() -> list:
"""Get PIDs of running driver processes
@@ -89,27 +100,28 @@ class DriverManager:
Returns:
List of PID strings for running tuxbox processes
"""
- try:
- # Use pgrep to find Python processes running tuxbox
- # -f matches against full command line
- result = subprocess.run(
- ['pgrep', '-f', f'python.*-m.*{DriverManager.DRIVER_MODULE}'],
- capture_output=True,
- text=True,
- timeout=5
- )
+ all_pids = set()
+ our_pid = str(os.getpid())
+ parent_pid = str(os.getppid())
- if result.returncode == 0 and result.stdout.strip():
- pids = result.stdout.strip().split('\n')
- # Filter out our own process (the GUI)
- our_pid = str(os.getpid())
- parent_pid = str(os.getppid())
- return [pid for pid in pids if pid and pid != our_pid and pid != parent_pid]
- return []
+ for pattern in DriverManager.DRIVER_PGREP_PATTERNS:
+ try:
+ result = subprocess.run(
+ ['pgrep', '-f', pattern],
+ capture_output=True,
+ text=True,
+ timeout=5
+ )
- except Exception as e:
- logger.debug(f"pgrep failed: {e}")
- return []
+ if result.returncode == 0 and result.stdout.strip():
+ for pid in result.stdout.strip().split('\n'):
+ if pid and pid != our_pid and pid != parent_pid:
+ all_pids.add(pid)
+
+ except Exception as e:
+ logger.debug(f"pgrep failed for pattern '{pattern}': {e}")
+
+ return list(all_pids)
@staticmethod
def stop_driver() -> Tuple[bool, str]:
--
2.52.0
+16 -6
View File
@@ -5,20 +5,16 @@
}:
python3Packages.buildPythonApplication (finalAttrs: {
pname = "tuxbox";
version = "3.0.1";
version = "3.1.0";
pyproject = true;
src = fetchFromGitHub {
owner = "AndyCappDev";
repo = "tuxbox";
tag = "v${finalAttrs.version}";
hash = "sha256-hBk4KhLNMgk8bFCZPQMtQlJ1/RB9qcL4kiF+eb3n4LU=";
hash = "sha256-jPPjGumArcnsRKQm3HKhoTGh913WEB5MUs7Y7eCHXNY=";
};
patches = [
./Broaden-pgrep-patterns-to-detect-driver-on-NixOS.patch
];
build-system = [ python3Packages.setuptools ];
dependencies = with python3Packages; [
@@ -28,6 +24,20 @@ python3Packages.buildPythonApplication (finalAttrs: {
pyside6
];
postInstall = ''
# Copy .desktop file to output
mkdir -p $out/share/applications/
cp ./tuxbox-gui.desktop $out/share/applications/
substituteInPlace $out/share/applications/tuxbox-gui.desktop \
--replace-fail "/usr/local/bin/tuxbox-gui" "$out/bin/tuxbox-gui"
# Install uinput udev rules
mkdir -p $out/lib/udev/rules.d/
echo 'KERNEL=="uinput", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput"' > $out/lib/udev/rules.d/99-tuxbox-uinput.rules
chmod 0744 $out/lib/udev/rules.d/99-tuxbox-uinput.rules
'';
meta = {
changelog = "https://github.com/AndyCappDev/tuxbox/releases/tag/${finalAttrs.version}";
description = "Linux driver for all TourBox models - Native feel with USB, Bluetooth, haptics and graphical configuration GUI";