`joystick.jstest` should actually run the parent `run` method but not extend `JoystickBackend`

This commit is contained in:
Fabio Manganiello 2021-05-15 23:48:17 +02:00
parent cee8f9f8e0
commit d767cafafe
1 changed files with 5 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import subprocess
import time import time
from typing import Optional, List from typing import Optional, List
from platypush.backend.joystick import JoystickBackend from platypush.backend import Backend
from platypush.message.event.joystick import JoystickConnectedEvent, JoystickDisconnectedEvent, JoystickStateEvent, \ from platypush.message.event.joystick import JoystickConnectedEvent, JoystickDisconnectedEvent, JoystickStateEvent, \
JoystickButtonPressedEvent, JoystickButtonReleasedEvent, JoystickAxisEvent JoystickButtonPressedEvent, JoystickButtonReleasedEvent, JoystickAxisEvent
@ -40,7 +40,7 @@ class JoystickState:
} }
class JoystickJstestBackend(JoystickBackend): class JoystickJstestBackend(Backend):
""" """
This backend can be used to intercept events from a joystick device if the device does not work with the standard This backend can be used to intercept events from a joystick device if the device does not work with the standard
:class:`platypush.backend.joystick.JoystickBackend` backend (this may especially happen with some Bluetooth :class:`platypush.backend.joystick.JoystickBackend` backend (this may especially happen with some Bluetooth
@ -89,6 +89,7 @@ class JoystickJstestBackend(JoystickBackend):
""" """
super().__init__(device=device, **kwargs) super().__init__(device=device, **kwargs)
self.device = device
self.jstest_path = jstest_path self.jstest_path = jstest_path
self._process: Optional[subprocess.Popen] = None self._process: Optional[subprocess.Popen] = None
self._state: Optional[JoystickState] = None self._state: Optional[JoystickState] = None
@ -235,6 +236,8 @@ class JoystickJstestBackend(JoystickBackend):
self._state = state self._state = state
def run(self): def run(self):
super().run()
try: try:
while not self.should_stop(): while not self.should_stop():
self._wait_ready() self._wait_ready()