improved outout puf kvmd-otgconf --make-gpio-config

This commit is contained in:
Maxim Devaev 2023-08-09 22:54:49 +03:00
parent dab9924096
commit e140b4f29d
2 changed files with 20 additions and 1 deletions

View File

@ -85,6 +85,23 @@ class _GadgetControl:
print(f"{'+' if enabled else '-'} {meta['func']} # {meta['name']}")
def make_gpio_config(self) -> None:
class Dumper(yaml.Dumper):
def increase_indent(self, flow: bool=False, indentless: bool=False) -> None:
_ = indentless
super().increase_indent(flow, False)
def ignore_aliases(self, data) -> bool: # type: ignore
_ = data
return True
class InlineList(list):
pass
def represent_inline_list(dumper: yaml.Dumper, data): # type: ignore
return dumper.represent_sequence("tag:yaml.org,2002:seq", data, flow_style=True)
Dumper.add_representer(InlineList, represent_inline_list)
config = {
"drivers": {"otgconf": {"type": "otgconf"}},
"scheme": {},
@ -102,7 +119,7 @@ class _GadgetControl:
"#" + meta["func"],
meta["func"],
])
print(yaml.dump({"kvmd": {"gpio": config}}, indent=4))
print(yaml.dump({"kvmd": {"gpio": config}}, indent=4, Dumper=Dumper))
def reset(self) -> None:
with self.__udc_stopped():

View File

@ -52,5 +52,7 @@ _Edid.set_serial
_Edid.set_monitor_name
_Edid.set_audio
Dumper.ignore_aliases
_auth_server_port_fixture
_test_user