diff options
author | Maxim Devaev <[email protected]> | 2024-02-15 23:45:10 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-02-15 23:47:24 +0200 |
commit | 1533545c8724ad29758f754c1bda16c01cd98be2 (patch) | |
tree | 45a647c8530699efb27a6aae9fc056ec7430d6d3 /kvmd | |
parent | 61be1e29315e1f5bc6b2a21687de99292d6d3f1c (diff) |
edidconf: --restore-default option
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/edidconf/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kvmd/apps/edidconf/__init__.py b/kvmd/apps/edidconf/__init__.py index 4f0a4341..d08bdffa 100644 --- a/kvmd/apps/edidconf/__init__.py +++ b/kvmd/apps/edidconf/__init__.py @@ -284,7 +284,7 @@ def _make_format_hex(size: int) -> Callable[[int], str]: # ===== -def main(argv: (list[str] | None)=None) -> None: # pylint: disable=too-many-branches +def main(argv: (list[str] | None)=None) -> None: # pylint: disable=too-many-branches,too-many-statements # (parent_parser, argv, _) = init( # add_help=False, # argv=argv, @@ -304,6 +304,8 @@ def main(argv: (list[str] | None)=None) -> None: # pylint: disable=too-many-bra help="Export [--edid] file to the new file as a bin data", metavar="<file>") parser.add_argument("--import", dest="imp", help="Import the specified bin/hex EDID to the [--edid] file as a hex text", metavar="<file>") + parser.add_argument("--restore-default", choices=["v0", "v1", "v2", "v3", "v4mini", "v4plus"], + help="Restore default edid for the given PiKVM build") parser.add_argument("--set-audio", type=valid_bool, help="Enable or disable audio", metavar="<yes|no>") parser.add_argument("--set-mfc-id", @@ -324,6 +326,9 @@ def main(argv: (list[str] | None)=None) -> None: # pylint: disable=too-many-bra help="The video device", metavar="<device>") options = parser.parse_args(argv[1:]) + if options.restore_default: + options.imp = f"/usr/share/kvmd/configs.default/kvmd/edid/{options.restore_default}-hdmi.hex" + orig_edid_path = options.edid_path if options.imp: options.export_hex = options.edid_path |