diff options
author | Devaev Maxim <[email protected]> | 2020-12-25 11:08:56 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-12-25 11:08:56 +0300 |
commit | 0adfe17f70051f1061bcb0b40dcaa5593091a67e (patch) | |
tree | a69522e60103ff11f8c3d9ad662dbed0bd1b6939 /kvmd/plugins/msd/relay/__init__.py | |
parent | 4447e49abb518a4da83d6adc16ca1bb5dcba5fae (diff) |
configurable gpio devices
Diffstat (limited to 'kvmd/plugins/msd/relay/__init__.py')
-rw-r--r-- | kvmd/plugins/msd/relay/__init__.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kvmd/plugins/msd/relay/__init__.py b/kvmd/plugins/msd/relay/__init__.py index bbb2b647..3d735a1c 100644 --- a/kvmd/plugins/msd/relay/__init__.py +++ b/kvmd/plugins/msd/relay/__init__.py @@ -62,6 +62,7 @@ from .drive import DeviceInfo class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes def __init__( # pylint: disable=super-init-not-called self, + gpio_device_path: str, target_pin: int, reset_pin: int, @@ -75,7 +76,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes self.__init_delay = init_delay self.__init_retries = init_retries - self.__gpio = Gpio(target_pin, reset_pin, reset_delay) + self.__gpio = Gpio(gpio_device_path, target_pin, reset_pin, reset_delay) self.__device_info: Optional[DeviceInfo] = None self.__connected = False @@ -97,8 +98,9 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes @classmethod def get_plugin_options(cls) -> Dict: return { - "target_pin": Option(-1, type=valid_gpio_pin), - "reset_pin": Option(-1, type=valid_gpio_pin), + "gpio_device": Option("/dev/gpiochip0", type=valid_abs_path, unpack_as="gpio_device_path"), + "target_pin": Option(-1, type=valid_gpio_pin), + "reset_pin": Option(-1, type=valid_gpio_pin), "device": Option("", type=valid_abs_path, unpack_as="device_path"), "init_delay": Option(1.0, type=valid_float_f01), |