diff options
author | Maxim Devaev <[email protected]> | 2021-09-08 05:43:36 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2021-09-08 05:43:36 +0300 |
commit | 98ad1145a8782d3b82516dd9f81c86d9e80391c5 (patch) | |
tree | b8f348f0815e8ee72236bf9879af779c95727755 /kvmd/plugins/ugpio/otgbind.py | |
parent | 939c63fe7daf2ddc9a05c9e0fbeab63cb5c6f0c1 (diff) |
string pins
Diffstat (limited to 'kvmd/plugins/ugpio/otgbind.py')
-rw-r--r-- | kvmd/plugins/ugpio/otgbind.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kvmd/plugins/ugpio/otgbind.py b/kvmd/plugins/ugpio/otgbind.py index 6dec46c9..600c8488 100644 --- a/kvmd/plugins/ugpio/otgbind.py +++ b/kvmd/plugins/ugpio/otgbind.py @@ -23,6 +23,9 @@ import os import asyncio +from typing import Callable +from typing import Any + from ...logging import get_logger from ...inotify import InotifyMask @@ -50,6 +53,10 @@ class Plugin(BaseUserGpioDriver): self.__udc = udc self.__driver = "" + @classmethod + def get_pin_validator(cls) -> Callable[[Any], str]: + return str + def prepare(self) -> None: (self.__udc, self.__driver) = usb.find_udc(self.__udc) get_logger().info("Using UDC %s", self.__udc) @@ -83,11 +90,11 @@ class Plugin(BaseUserGpioDriver): except Exception: logger.exception("Unexpected OTG-bind watcher error") - async def read(self, pin: int) -> bool: + async def read(self, pin: str) -> bool: _ = pin return os.path.islink(self.__get_driver_path(self.__udc)) - async def write(self, pin: int, state: bool) -> None: + async def write(self, pin: str, state: bool) -> None: _ = pin with open(self.__get_driver_path("bind" if state else "unbind"), "w") as ctl_file: ctl_file.write(f"{self.__udc}\n") |