Refactor DDM backend to use monitorcontrol for input switching and update error messages for clarity

This commit is contained in:
Lago
2026-03-27 15:31:44 +01:00
parent c06799f7b9
commit 208ad243a7
5 changed files with 65 additions and 149 deletions
+4 -4
View File
@@ -122,9 +122,9 @@ class KvmSwitcherService:
ddm_slot is not None or supports_monitor_targeting
)
if not self.ddm_backend.is_available():
errors.append("DDM.exe was not found.")
errors.append("Alienware monitorcontrol backend is not ready.")
elif ddm_slot is None and not supports_monitor_targeting:
errors.append("Alienware DDM slot could not be resolved.")
errors.append("Alienware monitorcontrol target could not be resolved.")
trigger_target_port = self._port_name_for_input_code(scan.trigger_input_code)
desired_port = self._resolve_desired_port(config, scan)
@@ -279,7 +279,7 @@ class KvmSwitcherService:
return "waiting_for_trigger_match", last_switch_at, scan, errors
if verify_scan.alienware_input_code is None:
errors.append(
"Alienware input could not be read after switch; assuming success because DDM command completed."
"Alienware input could not be read after switch; assuming success because switch command completed."
)
self._samsung_session_successful = True
return "switched_unverified", last_switch_at, scan, errors
@@ -307,7 +307,7 @@ def _is_blocking_error(error: str) -> bool:
normalized = error.strip()
non_blocking_prefixes = (
"Unable to read Alienware target monitor input source:",
"Alienware input could not be read after switch; assuming success because DDM command completed.",
"Alienware input could not be read after switch; assuming success because switch command completed.",
"Samsung trigger monitor did not expose a Samsung model in DDC/CI; using the only non-Alienware DDC monitor as trigger.",
)
return not any(normalized.startswith(prefix) for prefix in non_blocking_prefixes)