Files
KVM_Switch/monitorcontrol_main.py

23 lines
597 B
Python

from monitorcontrol import get_monitors
TARGET_MODEL = "AW3423DWF"
DP2_CODE = 19
for monitor in get_monitors():
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.")