diff options
author | Devaev Maxim <[email protected]> | 2020-12-29 16:14:38 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-12-29 16:14:38 +0300 |
commit | 06040c8da969ff83af3cc0f3bd77ced61f5a4627 (patch) | |
tree | ea8773e3273be1a7b7a5dfd9ed6cfcc1acdb8774 /kvmd/plugins/msd/relay/gpio.py | |
parent | 440f71d5a0198fbdcd55b5f2d8d9f09508d1ebd6 (diff) |
relay msd fixes
Diffstat (limited to 'kvmd/plugins/msd/relay/gpio.py')
-rw-r--r-- | kvmd/plugins/msd/relay/gpio.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kvmd/plugins/msd/relay/gpio.py b/kvmd/plugins/msd/relay/gpio.py index cca13d07..c84965fe 100644 --- a/kvmd/plugins/msd/relay/gpio.py +++ b/kvmd/plugins/msd/relay/gpio.py @@ -28,18 +28,20 @@ from .... import aiogp # ===== -class Gpio: +class Gpio: # pylint: disable=too-many-instance-attributes def __init__( self, device_path: str, target_pin: int, reset_pin: int, + reset_inverted: bool, reset_delay: float, ) -> None: self.__device_path = device_path self.__target_pin = target_pin self.__reset_pin = reset_pin + self.__reset_inverted = reset_inverted self.__reset_delay = reset_delay self.__chip: Optional[gpiod.Chip] = None @@ -57,7 +59,7 @@ class Gpio: self.__target_line.request("kvmd::msd::target", gpiod.LINE_REQ_DIR_OUT, default_vals=[0]) self.__reset_line = self.__chip.get_line(self.__reset_pin) - self.__reset_line.request("kvmd::msd::reset", gpiod.LINE_REQ_DIR_OUT, default_vals=[0]) + self.__reset_line.request("kvmd::msd::reset", gpiod.LINE_REQ_DIR_OUT, default_vals=[int(self.__reset_inverted)]) def close(self) -> None: if self.__chip: @@ -76,4 +78,4 @@ class Gpio: async def reset(self) -> None: assert self.__reset_line - await aiogp.pulse(self.__reset_line, self.__reset_delay, 0) + await aiogp.pulse(self.__reset_line, self.__reset_delay, 0, self.__reset_inverted) |