Reset switch session on trigger changes and add DP2 force helper

This commit is contained in:
Lago
2026-03-27 15:53:16 +01:00
parent a4837c1172
commit 3f7c5a0677
3 changed files with 129 additions and 19 deletions
+20 -5
View File
@@ -1,7 +1,22 @@
from monitorcontrol import get_monitors, InputSource
from monitorcontrol import get_monitors
TARGET_MODEL = "AW3423DWF"
DP2_CODE = 19
for monitor in get_monitors():
with monitor:
print(monitor.vcp.description)
input_source_raw: int = monitor.get_input_source()
print(InputSource(input_source_raw).name)
description = str(getattr(getattr(monitor, "vcp", None), "description", "") or str(monitor))
if TARGET_MODEL not in description.upper():
continue
try:
with monitor:
monitor.set_input_source(DP2_CODE)
print(f"Target: {description}")
print(f"Forced DP2 code {DP2_CODE}.")
except Exception as exc:
print(f"Failed forcing DP2 on {description}: {exc}")
break
else:
print(f"Monitor {TARGET_MODEL} not found.")