diff options
author | Devaev Maxim <[email protected]> | 2020-12-02 15:35:11 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-12-02 15:35:11 +0300 |
commit | 7debaa677663fa22d00df1decd932f53b97786e9 (patch) | |
tree | caf3123cc90167699852080e4c3d82d599dc13b4 /kvmd/plugins/hid | |
parent | 5bc868662a7ef2b8959a04e6678c512797ebd7be (diff) |
refactoring
Diffstat (limited to 'kvmd/plugins/hid')
-rw-r--r-- | kvmd/plugins/hid/_mcu/__init__.py | 8 | ||||
-rw-r--r-- | kvmd/plugins/hid/bt/__init__.py | 8 | ||||
-rw-r--r-- | kvmd/plugins/hid/otg/device.py | 7 |
3 files changed, 3 insertions, 20 deletions
diff --git a/kvmd/plugins/hid/_mcu/__init__.py b/kvmd/plugins/hid/_mcu/__init__.py index e3234880..424f0913 100644 --- a/kvmd/plugins/hid/_mcu/__init__.py +++ b/kvmd/plugins/hid/_mcu/__init__.py @@ -20,7 +20,6 @@ # ========================================================================== # -import os import multiprocessing import contextlib import queue @@ -270,12 +269,7 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many- self.__events_queue.put_nowait(event) def run(self) -> None: # pylint: disable=too-many-branches - logger = get_logger(0) - - logger.info("Started HID pid=%d", os.getpid()) - os.setpgrp() - aioproc.rename_process("hid") - + logger = aioproc.settle("HID", "hid") while not self.__stop_event.is_set(): try: with self.__gpio: diff --git a/kvmd/plugins/hid/bt/__init__.py b/kvmd/plugins/hid/bt/__init__.py index 25c3b823..72830d4f 100644 --- a/kvmd/plugins/hid/bt/__init__.py +++ b/kvmd/plugins/hid/bt/__init__.py @@ -20,7 +20,6 @@ # ========================================================================== # -import os import multiprocessing import time @@ -194,12 +193,7 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes # ===== def __server_worker(self) -> None: # pylint: disable=too-many-branches - logger = get_logger(0) - - logger.info("Started HID pid=%d", os.getpid()) - os.setpgrp() - aioproc.rename_process("hid") - + logger = aioproc.settle("HID", "hid") while not self.__stop_event.is_set(): try: self.__server.run() diff --git a/kvmd/plugins/hid/otg/device.py b/kvmd/plugins/hid/otg/device.py index 8845d9e1..73526bcf 100644 --- a/kvmd/plugins/hid/otg/device.py +++ b/kvmd/plugins/hid/otg/device.py @@ -78,12 +78,7 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in self.__stop_event = multiprocessing.Event() def run(self) -> None: - logger = get_logger(0) - - logger.info("Started HID-%s pid=%d", self.__name, os.getpid()) - os.setpgrp() - aioproc.rename_process(f"hid-{self.__name}") - + logger = aioproc.settle(f"HID-{self.__name}", f"hid-{self.__name}") while not self.__stop_event.is_set(): try: while not self.__stop_event.is_set(): |