summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2021-07-21 23:59:22 +0300
committerMaxim Devaev <[email protected]>2021-07-21 23:59:22 +0300
commit1ded926b02c03867aa6ae8bd5b71414ce42cc233 (patch)
tree1ff1bb92ff9a415d7939900cd5cfc22675e4cd24 /kvmd/apps
parent04312babb1fbbd0dd9713c0078375e827183790b (diff)
optional no_out_endpoint
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/otg/__init__.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/kvmd/apps/otg/__init__.py b/kvmd/apps/otg/__init__.py
index 48e8273d..456f35dd 100644
--- a/kvmd/apps/otg/__init__.py
+++ b/kvmd/apps/otg/__init__.py
@@ -72,8 +72,12 @@ def _unlink(path: str) -> None:
os.unlink(path)
-def _write(path: str, text: str) -> None:
- get_logger().info("WRITE --- %s", path)
+def _write(path: str, text: str, optional: bool=False) -> None:
+ logger = get_logger()
+ if optional and not os.access(path, os.F_OK):
+ logger.info("SKIP ---- %s", path)
+ return
+ logger.info("WRITE --- %s", path)
with open(path, "w") as param_file:
param_file.write(text)
@@ -128,6 +132,7 @@ def _create_ethernet(gadget_path: str, config_path: str, driver: str, host_mac:
def _create_hid(gadget_path: str, config_path: str, instance: int, hid: Hid) -> None:
func_path = join(gadget_path, f"functions/hid.usb{instance}")
_mkdir(func_path)
+ _write(join(func_path, "no_out_endpoint"), "1", optional=True)
_write(join(func_path, "protocol"), str(hid.protocol))
_write(join(func_path, "subclass"), str(hid.subclass))
_write(join(func_path, "report_length"), str(hid.report_length))