fix: use monitor.vcp.set_vcp_feature (monitorcontrol v4 API), fix monitor indices 1+2
This commit is contained in:
@@ -29,7 +29,7 @@ class MonitorSwitcher:
|
||||
continue
|
||||
try:
|
||||
with monitors[idx] as monitor:
|
||||
monitor.set_vcp_feature(VCP_INPUT_SOURCE, vcp_value)
|
||||
monitor.vcp.set_vcp_feature(VCP_INPUT_SOURCE, vcp_value)
|
||||
logger.info("Monitor %d -> VCP input %d", idx, vcp_value)
|
||||
except Exception as exc:
|
||||
logger.warning("Monitor %d DDC/CI error: %s", idx, exc)
|
||||
@@ -46,8 +46,8 @@ class MonitorSwitcher:
|
||||
for idx, monitor_handle in enumerate(get_monitors()):
|
||||
try:
|
||||
with monitor_handle as monitor:
|
||||
current = monitor.get_vcp_feature(VCP_INPUT_SOURCE)
|
||||
result.append({"index": idx, "current_vcp": current.value})
|
||||
current = monitor.vcp.get_vcp_feature(VCP_INPUT_SOURCE)
|
||||
result.append({"index": idx, "current_vcp": current[0]})
|
||||
except Exception as exc:
|
||||
logger.warning("Cannot query monitor %d: %s", idx, exc)
|
||||
result.append({"index": idx, "current_vcp": None})
|
||||
|
||||
Reference in New Issue
Block a user