summaryrefslogtreecommitdiff
path: root/kvmd/plugins
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-08-07 19:35:08 +0300
committerMaxim Devaev <[email protected]>2022-08-07 19:35:08 +0300
commite37a7254d5cf7e4cfa5dcfbbaf5b0e9d7474d154 (patch)
treec25210abfceb0da0725798105a389c5598694ff7 /kvmd/plugins
parentfdc3edfa799b21f04a83676459bab7a4e67b056f (diff)
using shield_fg() in atomic (now atomic_fg)
Diffstat (limited to 'kvmd/plugins')
-rw-r--r--kvmd/plugins/atx/gpio.py4
-rw-r--r--kvmd/plugins/hid/_mcu/__init__.py2
-rw-r--r--kvmd/plugins/hid/bt/__init__.py2
-rw-r--r--kvmd/plugins/msd/otg/__init__.py10
-rw-r--r--kvmd/plugins/msd/relay/__init__.py12
5 files changed, 15 insertions, 15 deletions
diff --git a/kvmd/plugins/atx/gpio.py b/kvmd/plugins/atx/gpio.py
index a4dabdfc..8d41e53d 100644
--- a/kvmd/plugins/atx/gpio.py
+++ b/kvmd/plugins/atx/gpio.py
@@ -185,7 +185,7 @@ class Plugin(BaseAtx): # pylint: disable=too-many-instance-attributes
async def __get_power(self) -> bool:
return (await self.get_state())["leds"]["power"]
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __click(self, name: str, line: gpiod.Line, delay: float, wait: bool) -> None:
if wait:
async with self.__region:
@@ -196,7 +196,7 @@ class Plugin(BaseAtx): # pylint: disable=too-many-instance-attributes
self.__region, self.__inner_click, name, line, delay,
)
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __inner_click(self, name: str, line: gpiod.Line, delay: float) -> None:
await aiogp.pulse(line, delay, 1)
get_logger(0).info("Clicked ATX button %r", name)
diff --git a/kvmd/plugins/hid/_mcu/__init__.py b/kvmd/plugins/hid/_mcu/__init__.py
index 595abbc4..0de017df 100644
--- a/kvmd/plugins/hid/_mcu/__init__.py
+++ b/kvmd/plugins/hid/_mcu/__init__.py
@@ -234,7 +234,7 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many-
async def reset(self) -> None:
self.__reset_required_event.set()
- @aiotools.atomic
+ @aiotools.atomic_fg
async def cleanup(self) -> None:
if self.is_alive():
get_logger(0).info("Stopping HID daemon ...")
diff --git a/kvmd/plugins/hid/bt/__init__.py b/kvmd/plugins/hid/bt/__init__.py
index 5b6a9fc7..ce33fd26 100644
--- a/kvmd/plugins/hid/bt/__init__.py
+++ b/kvmd/plugins/hid/bt/__init__.py
@@ -164,7 +164,7 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
self.clear_events()
self.__server.queue_event(ResetEvent())
- @aiotools.atomic
+ @aiotools.atomic_fg
async def cleanup(self) -> None:
if self.__proc is not None:
if self.__proc.is_alive():
diff --git a/kvmd/plugins/msd/otg/__init__.py b/kvmd/plugins/msd/otg/__init__.py
index cb781fae..5a8b86a6 100644
--- a/kvmd/plugins/msd/otg/__init__.py
+++ b/kvmd/plugins/msd/otg/__init__.py
@@ -246,7 +246,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
async def systask(self) -> None:
await self.__watch_inotify()
- @aiotools.atomic
+ @aiotools.atomic_fg
async def reset(self) -> None:
async with self.__state.busy(check_online=False):
try:
@@ -257,14 +257,14 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
except Exception:
get_logger(0).exception("Can't reset MSD properly")
- @aiotools.atomic
+ @aiotools.atomic_fg
async def cleanup(self) -> None:
await self.__close_reader()
await self.__close_writer()
# =====
- @aiotools.atomic
+ @aiotools.atomic_fg
async def set_params(
self,
name: Optional[str]=None,
@@ -299,7 +299,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
if rw:
self.__state.vd.cdrom = False
- @aiotools.atomic
+ @aiotools.atomic_fg
async def set_connected(self, connected: bool) -> None:
async with self.__state.busy():
assert self.__state.vd
@@ -407,7 +407,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
# так что форсим обновление вручную, чтобы получить актуальное состояние.
await aiotools.shield_fg(self.__reload_state())
- @aiotools.atomic
+ @aiotools.atomic_fg
async def remove(self, name: str) -> None:
async with self.__state.busy():
assert self.__state.storage
diff --git a/kvmd/plugins/msd/relay/__init__.py b/kvmd/plugins/msd/relay/__init__.py
index febc3750..d80cd410 100644
--- a/kvmd/plugins/msd/relay/__init__.py
+++ b/kvmd/plugins/msd/relay/__init__.py
@@ -156,14 +156,14 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
prev_state = state
await self.__notifier.wait()
- @aiotools.atomic
+ @aiotools.atomic_fg
async def reset(self) -> None:
await aiotools.run_region_task(
"Can't reset MSD or operation was not completed",
self.__region, self.__inner_reset,
)
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __inner_reset(self) -> None:
await self.__gpio.reset()
self.__gpio.switch_to_local()
@@ -171,7 +171,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
await self.__load_device_info()
get_logger(0).info("MSD reset has been successful")
- @aiotools.atomic
+ @aiotools.atomic_fg
async def cleanup(self) -> None:
try:
await self.__close_device_writer()
@@ -180,7 +180,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
# =====
- @aiotools.atomic
+ @aiotools.atomic_fg
async def set_params(
self,
name: Optional[str]=None,
@@ -196,7 +196,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
if rw is not None:
raise MsdRwNotSupported()
- @aiotools.atomic
+ @aiotools.atomic_fg
async def set_connected(self, connected: bool) -> None:
async with self.__working():
async with self.__region:
@@ -254,7 +254,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
finally:
await aiotools.shield_fg(self.__load_device_info())
- @aiotools.atomic
+ @aiotools.atomic_fg
async def remove(self, name: str) -> None:
async with self.__working():
raise MsdMultiNotSupported()