summaryrefslogtreecommitdiffstats
path: root/examples/crtc-detection
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-10 20:17:35 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-10 20:17:35 +0100
commit3af89b858c7d86cb23bb75a68a3643449a4b15c3 (patch)
treec6cc9f27b28fb92d8e4e34c18a88f055640a1062 /examples/crtc-detection
parentupdate todo (diff)
downloadblueshift-3af89b858c7d86cb23bb75a68a3643449a4b15c3.tar.gz
blueshift-3af89b858c7d86cb23bb75a68a3643449a4b15c3.tar.bz2
blueshift-3af89b858c7d86cb23bb75a68a3643449a4b15c3.tar.xz
add EDID support
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--examples/crtc-detection22
1 files changed, 16 insertions, 6 deletions
diff --git a/examples/crtc-detection b/examples/crtc-detection
index 5f60d6c..2da0e9d 100644
--- a/examples/crtc-detection
+++ b/examples/crtc-detection
@@ -10,24 +10,34 @@ temp = 6500
# List all connected outputs.
outputs = list_screens().find_by_connected(True)
+# EDID of the primary monitors
+edid_0 = '00ffffffffffff0010ac00504d5730372f0c01030e281e962b0cc9a057479b2712484ca44380a959a94f615971594559c28f31590101863d00c05100304040a013006c231100001e000000fd0030aa1e821d000a202020202020000000fc0044454c4c2050313133300a2020000000ff00364432353232424c3730574d0a00ea'
+
+# EDID of the secondary monitor
+edid_1 = '00ffffffffffff0010ac005045413035320c01030e281e962b0cc9a057479b2712484ca44380a959a94f615971594559c28f31590101863d00c05100304040a013006c231100001e000000fd0030aa1e821d000a202020202020000000fc0044454c4c2050313133300a2020000000ff003644323532324339353041450a0039'
+
+# Gamma of the monitors
+gammas = [(1.16, 1.15, 1.11), (1.10, 1.16, 1.10)]
+
# Configure each monitor.
for output in outputs:
# Data that identifies the monitor.
- monitor = (output.name, output.widthmm, output.heightmm)
+ edid = output.edid
+ monitor = (output.name, output.widthmm, output.heightmm, edid is not None)
# Default gamma settings.
- r_gamma, g_gamma, b_gamma = 1, 1, 1
+ monitor_gamma = (1, 1, 1)
# Get the correct gamma settings for the monitor.
- if monitor == ('DVI-0', 364, 291): r_gamma, g_gamma, b_gamma = 1.16, 1.15, 1.11
- elif monitor == ('VGA-0', 364, 291): r_gamma, g_gamma, b_gamma = 1.10, 1.16, 1.10
+ if (monitor == ('DVI-0', 364, 291, False)) or (edid == edid_0): monitor_gamma = gammas[0]
+ elif (monitor == ('VGA-0', 364, 291, False)) or (edid == edid_1): monitor_gamma = gammas[1]
else:
- print('Warning: unknown monitor at %s at size of %i mm by %i mm' % monitor)
+ print('Warning: unknown monitor at %s at size of %i mm by %i mm' % monitor[:3])
# Perform adjustments.
start_over()
temperature(temp, lambda t : divide_by_maximum(cmf_10deg(t)))
- gamma(r_gamma, g_gamma, b_gamma)
+ gamma(*monitor_gamma)
# Apply adjustments.
randr(output.crtc, screen = output.screen)