From 9bd129f70b1837517cf16f14e104e59d6f4fe12c Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Mon, 5 Oct 2020 07:13:08 +0300 Subject: configurable maxpower --- kvmd/apps/__init__.py | 1 + kvmd/apps/otg/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'kvmd') diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index 20d2d4da..b65a5775 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -382,6 +382,7 @@ def _get_config_scheme() -> Dict: "manufacturer": Option("Pi-KVM"), "product": Option("Composite KVM Device"), "serial": Option("CAFEBABE"), + "max_power": Option(250, type=functools.partial(valid_number, min=0, max=500)), "gadget": Option("kvmd", type=valid_otg_gadget), "udc": Option("", type=valid_stripped_string), diff --git a/kvmd/apps/otg/__init__.py b/kvmd/apps/otg/__init__.py index ce731823..e14dd895 100644 --- a/kvmd/apps/otg/__init__.py +++ b/kvmd/apps/otg/__init__.py @@ -190,7 +190,7 @@ def _cmd_start(config: Section) -> None: _mkdir(config_path) _mkdir(join(config_path, "strings/0x409")) _write(join(config_path, "strings/0x409/configuration"), "Config 1: Pi-KVM device") - _write(join(config_path, "MaxPower"), "250") + _write(join(config_path, "MaxPower"), str(config.otg.max_power)) if config.otg.devices.serial.enabled: logger.info("===== Required Serial =====") -- cgit v1.2.3