Crash when monitor do not support input_source
centy opened this issue · 1 comments
My monitor do not retrun Input sources. I guess it is not supported. This cause crashe in monitor_obj.get_input_source() because code = vcp.VCPCode("input_select") return 0.
So in main.py extra if should be added
elif args.get_monitors:
for monitor_index, monitor_obj in enumerate(get_monitors(), 0):
with monitor_obj:
monitors_dict = monitor_obj.get_vcp_capabilities()
if (len(monitors_dict["inputs"])>0):
current_input = monitor_obj.get_input_source()
model = monitors_dict["model"]
inputs = monitors_dict["inputs"]
sys.stdout.write(f"Monitor {monitor_index + 1}: {model}" + "\n")
sys.stdout.write("Available Inputs:\n")
for i in inputs:
sys.stdout.write(f"\t{i}")
if i == current_input:
sys.stdout.write("*\n")
else:
sys.stdout.write("\n")
return