aboutsummaryrefslogtreecommitdiffstats
path: root/monitor-parse-edid
diff options
context:
space:
mode:
Diffstat (limited to 'monitor-parse-edid')
-rwxr-xr-xmonitor-parse-edid11
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};
}
}