Enhance Samsung monitor detection logic and add unit tests for trigger candidate selection
This commit is contained in:
+6
-27
@@ -1,28 +1,7 @@
|
||||
from monitorcontrol import get_monitors
|
||||
from monitorcontrol import get_monitors, InputSource
|
||||
|
||||
def get_monitor_info():
|
||||
results = []
|
||||
for monitor in get_monitors():
|
||||
# Set a breakpoint here to see each monitor object as it's found
|
||||
m_data = {"name": "Unknown/Internal", "input": "N/A", "caps": ""}
|
||||
try:
|
||||
with monitor:
|
||||
# This is the line that was crashing; now it's protected
|
||||
m_data["caps"] = monitor.get_vcp_capabilities()
|
||||
m_data["input"] = str(monitor.get_input_source())
|
||||
|
||||
if "AW34" in m_data["caps"]:
|
||||
m_data["name"] = "ALIENWARE (Target)"
|
||||
elif "SAM" in m_data["caps"]:
|
||||
m_data["name"] = "SAMSUNG (Trigger)"
|
||||
except Exception:
|
||||
# If a monitor (like the laptop screen) fails, we just skip it
|
||||
continue
|
||||
|
||||
results.append(m_data)
|
||||
return results
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Searching for DDC/CI compatible monitors...")
|
||||
for m in get_monitor_info():
|
||||
print(f"Detected: {m['name']} | Current Input: {m['input']}")
|
||||
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)
|
||||
Reference in New Issue
Block a user