From e03470ec0f8379608130397ae766d73cac6061a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kay=20T=C3=BCrtscher?= Date: Tue, 30 Jun 2026 19:06:34 +0200 Subject: [PATCH] fix: Razer Naga Swap - Daemonisierung entfernt (systemd managed) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Doppeltes fork/setsid raus (systemd Type=simple daemonisiert selbst) - Debug-Test-Code entfernt (war nur für initiale Fehlersuche) - PID-File entfernt (nicht nötig bei systemd) - Script läuft jetzt sauber als foreground-Prozess --- tools/razer-naga-swap.py | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/tools/razer-naga-swap.py b/tools/razer-naga-swap.py index dafa641..39512ac 100644 --- a/tools/razer-naga-swap.py +++ b/tools/razer-naga-swap.py @@ -1,12 +1,12 @@ #!/usr/bin/env python3 """ Razer Naga Left Handed Edition - Button Swapper -Debug version - shows which code fails. +Swaps left/right mouse buttons via evdev/uinput. +Runs as a systemd service (Type=simple) — no daemonization. """ import evdev from evdev import UInput, ecodes as e import sys -import os VENDOR = 0x1532 PRODUCT = 0x008d @@ -38,29 +38,6 @@ def main(): naga = evdev.InputDevice(naga_path) naga.grab() - # Try each code individually to find the bad one - test_caps = { - e.EV_KEY: [e.BTN_LEFT, e.BTN_RIGHT], - e.EV_REL: [e.REL_X, e.REL_Y], - } - - for etype, codes in test_caps.items(): - for code in codes: - try: - ui = UInput( - name=UINPUT_NAME, - vendor=VENDOR, - product=PRODUCT, - version=1, - bustype=0x03, - events={etype: [code]}, - ) - ui.close() - print(f"OK: type={etype} code={code}", file=sys.stderr) - except Exception as ex: - print(f"FAIL: type={etype} code={code}: {ex}", file=sys.stderr) - - # Now create the real one with only working codes caps = { e.EV_KEY: [e.BTN_LEFT, e.BTN_RIGHT], e.EV_REL: [e.REL_X, e.REL_Y], @@ -75,17 +52,7 @@ def main(): events=caps, ) - # Fork to background - if os.fork() > 0: - sys.exit(0) - os.setsid() - if os.fork() > 0: - sys.exit(0) - try: - with open("/var/run/razer-naga-swap.pid", "w") as f: - f.write(str(os.getpid())) - for event in naga.read_loop(): if event.type == e.EV_KEY: if event.code == e.BTN_LEFT: