diff options
-rw-r--r-- | kvmd/plugins/hid/otg/device.py | 4 | ||||
-rw-r--r-- | kvmd/usb.py | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/kvmd/plugins/hid/otg/device.py b/kvmd/plugins/hid/otg/device.py index e76b7294..112d8bec 100644 --- a/kvmd/plugins/hid/otg/device.py +++ b/kvmd/plugins/hid/otg/device.py @@ -32,10 +32,10 @@ from typing import Generator from ....logging import get_logger -from .... import env from .... import tools from .... import aiomulti from .... import aioproc +from .... import usb from .events import BaseEvent @@ -74,7 +74,7 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in self.__stop_event = multiprocessing.Event() def start(self, udc: str) -> None: # type: ignore # pylint: disable=arguments-differ - self.__udc_state_path = os.path.join(f"{env.SYSFS_PREFIX}/sys/class/udc", udc, "state") + self.__udc_state_path = usb.get_udc_path(udc, usb.U_STATE) super().start() def run(self) -> None: # pylint: disable=too-many-branches diff --git a/kvmd/usb.py b/kvmd/usb.py index 4a5a130d..42156e44 100644 --- a/kvmd/usb.py +++ b/kvmd/usb.py @@ -38,6 +38,15 @@ def find_udc(udc: str) -> str: return udc # fe980000.usb +# ===== +U_STATE = "state" + + +def get_udc_path(udc: str, *parts: str) -> str: + return os.path.join(f"{env.SYSFS_PREFIX}/sys/class/udc", udc, *parts) + + +# ===== G_UDC = "UDC" G_FUNCTIONS = "functions" G_PROFILE_NAME = "c.1" |