summaryrefslogtreecommitdiff
path: root/kvmd/plugins/hid
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-13 18:23:28 +0300
committerDevaev Maxim <[email protected]>2020-09-13 18:23:28 +0300
commit1e6ab4672f0980f073ab7e1c6f48fb9bf43b0856 (patch)
treee2b1253063d813ca6119097ce0cdfea576a2f8fa /kvmd/plugins/hid
parent41223fa8b24be7978f320781c4b0e3d7b2347c75 (diff)
refactoring and reuse gpio pulse code
Diffstat (limited to 'kvmd/plugins/hid')
-rw-r--r--kvmd/plugins/hid/serial.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/kvmd/plugins/hid/serial.py b/kvmd/plugins/hid/serial.py
index ff018826..27218323 100644
--- a/kvmd/plugins/hid/serial.py
+++ b/kvmd/plugins/hid/serial.py
@@ -21,7 +21,6 @@
import os
-import asyncio
import multiprocessing
import multiprocessing.queues
import dataclasses
@@ -47,6 +46,7 @@ from ...keyboard.mappings import KEYMAP
from ... import aiotools
from ... import aiomulti
from ... import aioproc
+from ... import aiogp
from ...yamlconf import Option
@@ -186,16 +186,11 @@ class _Gpio:
if self.__reset_pin >= 0:
assert self.__reset_line
if not self.__reset_wip:
+ self.__reset_wip = True
try:
- self.__reset_wip = True
- self.__reset_line.set_value(1)
- await asyncio.sleep(self.__reset_delay)
+ await aiogp.pulse(self.__reset_line, self.__reset_delay, 1)
finally:
- try:
- self.__reset_line.set_value(0)
- await asyncio.sleep(1)
- finally:
- self.__reset_wip = False
+ self.__reset_wip = False
get_logger(0).info("Reset HID performed")
else:
get_logger(0).info("Another reset HID in progress")