From 23fa34d007f6492d58d8c1f00039eccd57302986 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sun, 20 Sep 2009 21:15:48 +0000 Subject: monitor-parse-edid: ignore the Manufacturer Specified Range Timing descriptor if the first detailed timing descriptor appears to violate it (this probably means that the descriptor is actually something else or in a different format; this fixes Lenovo W500 detection, reported by Udo Rader) --- NEWS | 7 +++++++ monitor-parse-edid | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 94a99df..f5259d8 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +- monitor-parse-edid: + o ignore the Manufacturer Specified Range Timing descriptor if the + first detailed timing descriptor appears to violate it (this probably + means that the descriptor is actually something else or in a + different format; this fixes Lenovo W500 detection, reported by Udo + Rader) + Version 2.3 - 6 September 2009 - monitor-get-edid-using-vbe: diff --git a/monitor-parse-edid b/monitor-parse-edid index c6e158c..f559136 100755 --- a/monitor-parse-edid +++ b/monitor-parse-edid @@ -140,6 +140,11 @@ my %subfields = ( ) ], ); +sub within_limit { + my ($value, $type, $limit) = @_; + $type eq 'min' ? $value >= $limit : $value <= $limit; +} + sub get_many_bits { my ($s, $field_name) = @_; my @bits = split('', unpack('B*', $s)); @@ -250,7 +255,11 @@ sub parse_edid { $range->{$dir . '_sync_pulse_width_' . $m} *= 2; $range->{$dir . '_back_porch_' . $m} *= 2; $range->{$dir . '_blanking_' . $m} *= 2; - if ($e && $e->{$dir . '_active'}) { + if ($e && $e->{$dir . '_active'} + && within_limit($e->{$dir . '_blanking'}, $m, $range->{$dir . '_blanking_' . $m}) + && within_limit($e->{$dir . '_sync_pulse_width'}, $m, $range->{$dir . '_sync_pulse_width_' . $m}) + && within_limit($e->{$dir . '_blanking'} - $e->{$dir . '_sync_offset'} - $e->{$dir . '_sync_pulse_width'}, + $m, $range->{$dir . '_back_porch_' . $m})) { $total{$dir} = $e->{$dir . '_active'} + $range->{$dir . '_blanking_' . $m}; } } -- cgit v1.2.1