summaryrefslogtreecommitdiff
path: root/kvmd
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-09-24 11:39:20 +0300
committerDevaev Maxim <[email protected]>2019-09-24 11:39:20 +0300
commit5d437c58e342bcb9847e419e46c751b3ed70e747 (patch)
tree91ecf988d1e149b1d9bcc413ce1ca4515f841b7f /kvmd
parentcfe0c0754317eeef46c003cf72fd0f72aebb25ce (diff)
otg: init_delay
Diffstat (limited to 'kvmd')
-rw-r--r--kvmd/apps/__init__.py7
-rw-r--r--kvmd/apps/otg/__init__.py19
2 files changed, 17 insertions, 9 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py
index 1f937241..048c2b9d 100644
--- a/kvmd/apps/__init__.py
+++ b/kvmd/apps/__init__.py
@@ -193,6 +193,7 @@ def _get_config_scheme() -> Dict:
"force_users": Option([], type=valid_users_list),
# Dynamic content
},
+
"external": {
"type": Option(""),
},
@@ -249,7 +250,11 @@ def _get_config_scheme() -> Dict:
"product": Option("Composite KVM Device"),
"serial_number": Option("CAFEBABE"),
"udc": Option(""),
- "acm": Option(True, type=valid_bool),
+ "init_delay": Option(3.0, type=valid_float_f01),
+
+ "acm": {
+ "enabled": Option(True, type=valid_bool),
+ },
},
"ipmi": {
diff --git a/kvmd/apps/otg/__init__.py b/kvmd/apps/otg/__init__.py
index 88e13470..79f66cc3 100644
--- a/kvmd/apps/otg/__init__.py
+++ b/kvmd/apps/otg/__init__.py
@@ -20,16 +20,16 @@
# ========================================================================== #
+import time
+import argparse
+
from os import listdir
from os import mkdir
-from os import makedirs
from os import symlink
from os import rmdir
from os import unlink
from os.path import join
-import argparse
-
from typing import List
from typing import Optional
@@ -59,7 +59,7 @@ def _find_udc(udc: str) -> str:
def _check_config(config: Section) -> None:
if (
- not config.otg.acm
+ not config.otg.acm.enabled
and config.kvmd.hid.type != "otg"
and config.kvmd.msd.type != "otg"
):
@@ -89,11 +89,12 @@ def _cmd_start(config: Section) -> None:
_write(join(lang_path, "serialnumber"), config.otg.serial_number)
config_path = join(gadget_path, "configs/c.1")
- makedirs(join(config_path, "strings/0x409"))
- _write(join(gadget_path, "configs/c.1/strings/0x409/configuration"), "Config 1: ECM network")
- _write(join(gadget_path, "configs/c.1/MaxPower"), "250")
+ mkdir(config_path)
+ mkdir(join(config_path, "strings/0x409"))
+ _write(join(config_path, "strings/0x409/configuration"), "Config 1: ECM network")
+ _write(join(config_path, "MaxPower"), "250")
- if config.otg.acm:
+ if config.otg.acm.enabled:
func_path = join(gadget_path, "functions/acm.usb0")
mkdir(func_path)
symlink(func_path, join(config_path, "acm.usb0"))
@@ -126,6 +127,8 @@ def _cmd_start(config: Section) -> None:
_write(join(gadget_path, "UDC"), udc)
+ time.sleep(config.otg.init_delay)
+
def _cmd_stop(config: Section) -> None:
# https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt