From 346f66b662f402fa2a82afdb0639892784321f5a Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Sep 2024 00:18:19 +0200 Subject: [PATCH] Fix SCC OSD daemon crashing, fix USB DS4 (the rest is probably broken too?) --- scc/drivers/ds4drv.py | 6 +++--- scc/mapper.py | 2 +- scc/x11/scc-osd-daemon.py | 19 ++++++++++--------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/scc/drivers/ds4drv.py b/scc/drivers/ds4drv.py index 3575b526..8486da24 100644 --- a/scc/drivers/ds4drv.py +++ b/scc/drivers/ds4drv.py @@ -147,10 +147,10 @@ def _load_hid_descriptor(self, config, max_size, vid, pid, test_mode): self._packet_size = 64 - - def input(self, endpoint: bytearray, data: int) -> None: +# TODO: Which commit made data switch from bytes to bytearray? + def input(self, endpoint: int, data: bytearray) -> None: # Special override for CPAD touch button - if _lib.decode(ctypes.byref(self._decoder), data): + if _lib.decode(ctypes.byref(self._decoder), bytes(data)): if self.mapper: if data[35] >> 7: # cpad is not touched diff --git a/scc/mapper.py b/scc/mapper.py index 72328c02..a6b62bc7 100644 --- a/scc/mapper.py +++ b/scc/mapper.py @@ -2,7 +2,6 @@ import os import time import traceback -from collections import deque from scc.actions import ButtonAction, GyroAbsAction from scc.aliases import ALL_AXES, ALL_BUTTONS @@ -395,6 +394,7 @@ def reset_gyros(self): def input(self, controller, old_state, state): +# print(type(controller), type(old_state), type(state)) # Store states self.old_state = old_state self.old_buttons = self.buttons diff --git a/scc/x11/scc-osd-daemon.py b/scc/x11/scc-osd-daemon.py index d9f9a024..f3e2afb0 100755 --- a/scc/x11/scc-osd-daemon.py +++ b/scc/x11/scc-osd-daemon.py @@ -17,23 +17,24 @@ gi.require_version('Gtk', '3.0') gi.require_version('Rsvg', '2.0') gi.require_version('GdkX11', '3.0') -from gi.repository import Gdk, GdkX11, GLib, Gtk +from gi.repository import Gtk, Gdk, GdkX11, GLib -from scc.config import Config from scc.gui.daemon_manager import DaemonManager -from scc.osd import OSDWindow -from scc.osd.area import Area -from scc.osd.dialog import Dialog from scc.osd.gesture_display import GestureDisplay -from scc.osd.grid_menu import GridMenu +from scc.osd.radial_menu import RadialMenu from scc.osd.hmenu import HorizontalMenu +from scc.osd.quick_menu import QuickMenu +from scc.osd.grid_menu import GridMenu from scc.osd.keyboard import Keyboard -from scc.osd.menu import Menu from scc.osd.message import Message -from scc.osd.quick_menu import QuickMenu -from scc.osd.radial_menu import RadialMenu +from scc.osd.dialog import Dialog +from scc.osd import OSDWindow +from scc.osd.menu import Menu +from scc.osd.area import Area from scc.special_actions import OSDAction from scc.tools import shsplit +from scc.config import Config + log = logging.getLogger("osd.daemon")