summaryrefslogtreecommitdiff
path: root/kvmd/plugins/hid/_mcu/__init__.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-12-25 11:08:56 +0300
committerDevaev Maxim <[email protected]>2020-12-25 11:08:56 +0300
commit0adfe17f70051f1061bcb0b40dcaa5593091a67e (patch)
treea69522e60103ff11f8c3d9ad662dbed0bd1b6939 /kvmd/plugins/hid/_mcu/__init__.py
parent4447e49abb518a4da83d6adc16ca1bb5dcba5fae (diff)
configurable gpio devices
Diffstat (limited to 'kvmd/plugins/hid/_mcu/__init__.py')
-rw-r--r--kvmd/plugins/hid/_mcu/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/kvmd/plugins/hid/_mcu/__init__.py b/kvmd/plugins/hid/_mcu/__init__.py
index 45302ba1..4846b90b 100644
--- a/kvmd/plugins/hid/_mcu/__init__.py
+++ b/kvmd/plugins/hid/_mcu/__init__.py
@@ -46,6 +46,7 @@ from ....validators.basic import valid_bool
from ....validators.basic import valid_int_f0
from ....validators.basic import valid_int_f1
from ....validators.basic import valid_float_f01
+from ....validators.os import valid_abs_path
from ....validators.hw import valid_gpio_pin_optional
from .. import BaseHid
@@ -113,6 +114,7 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many-
self,
phy: BasePhy,
+ gpio_device_path: str,
reset_pin: int,
reset_inverted: bool,
reset_delay: float,
@@ -133,7 +135,7 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many-
self.__noop = noop
self.__phy = phy
- self.__gpio = Gpio(reset_pin, reset_inverted, reset_delay)
+ self.__gpio = Gpio(gpio_device_path, reset_pin, reset_inverted, reset_delay)
self.__events_queue: "multiprocessing.Queue[BaseEvent]" = multiprocessing.Queue()
@@ -149,6 +151,7 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many-
@classmethod
def get_plugin_options(cls) -> Dict:
return {
+ "gpio_device": Option("/dev/gpiochip0", type=valid_abs_path, unpack_as="gpio_device_path"),
"reset_pin": Option(-1, type=valid_gpio_pin_optional),
"reset_inverted": Option(False, type=valid_bool),
"reset_delay": Option(0.1, type=valid_float_f01),