diff options
author | Anssi Hannula <anssi@mandriva.org> | 2009-09-20 21:15:48 +0000 |
---|---|---|
committer | Anssi Hannula <anssi@mandriva.org> | 2009-09-20 21:15:48 +0000 |
commit | 23fa34d007f6492d58d8c1f00039eccd57302986 (patch) | |
tree | 0c465a875155a2777b9cdefdc8dd8465f20973a2 /monitor-parse-edid | |
parent | 745f728c31e37eff847385da1b73244921251c97 (diff) | |
download | monitor-edid-23fa34d007f6492d58d8c1f00039eccd57302986.tar monitor-edid-23fa34d007f6492d58d8c1f00039eccd57302986.tar.gz monitor-edid-23fa34d007f6492d58d8c1f00039eccd57302986.tar.bz2 monitor-edid-23fa34d007f6492d58d8c1f00039eccd57302986.tar.xz monitor-edid-23fa34d007f6492d58d8c1f00039eccd57302986.zip |
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)
Diffstat (limited to 'monitor-parse-edid')
-rwxr-xr-x | monitor-parse-edid | 11 |
1 files changed, 10 insertions, 1 deletions
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}; } } |