diff options
Diffstat (limited to 'monitor-parse-edid')
-rwxr-xr-x | monitor-parse-edid | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/monitor-parse-edid b/monitor-parse-edid index d1933fd..bd90b5d 100755 --- a/monitor-parse-edid +++ b/monitor-parse-edid @@ -184,7 +184,36 @@ sub parse_edid { $edid{$field} = $v if $field && $field !~ /^_/; } - $edid{EISA} = $edid{manufacturer_name} . sprintf('%x', $edid{product_code}); + $edid{EISA_ID} = $edid{manufacturer_name} . sprintf('%x', $edid{product_code}); + + if ($edid{monitor_range}) { + $edid{HorizSync} = $edid{monitor_range}{horizontal_min} . '-' . $edid{monitor_range}{horizontal_max}; + $edid{VertRefresh} = $edid{monitor_range}{vertical_min} . '-' . $edid{monitor_range}{vertical_max}; + } + + foreach my $h (@{$edid{detailed_timings}}) { + + my $horizontal_total = $h->{horizontal_active} + $h->{horizontal_blanking}; + my $vertical_total = $h->{vertical_active} + $h->{vertical_blanking}; + + $h->{ModeLine_comment} = sprintf qq(# %dx%d @ %.1f Hz, %.1f kHz hsync), + $h->{horizontal_active}, $h->{vertical_active}, + $h->{pixel_clock} / $horizontal_total / $vertical_total * 1000 * 1000, + $h->{pixel_clock} / $horizontal_total * 1000; + + $h->{ModeLine} = sprintf qq(ModeLine "%dx%d" $h->{pixel_clock} %d %d %d %d %d %d %d %d), + $h->{horizontal_active}, $h->{vertical_active}, + + $h->{horizontal_active}, + $h->{horizontal_active} + $h->{horizontal_sync_offset}, + $h->{horizontal_active} + $h->{horizontal_sync_offset} + $h->{horizontal_sync_pulse_width}, + $horizontal_total, + + $h->{vertical_active}, + $h->{vertical_active} + $h->{vertical_sync_offset}, + $h->{vertical_active} + $h->{vertical_sync_offset} + $h->{vertical_sync_pulse_width}, + $vertical_total; + } \%edid; } @@ -195,7 +224,7 @@ sub print_edid { sqr($edid->{max_size_vertical})) / 2.54; print "Name: $edid->{monitor_name}\n"; - print "EISA ID: $edid->{EISA}\n"; + print "EISA ID: $edid->{EISA_ID}\n"; printf "Screen size: %d cm x %d cm (%3.2f inches)\n", $edid->{max_size_horizontal}, $edid->{max_size_vertical}, $diagonal_inches * 1.08; print "Gamma: ", $edid->{gamma} / 100 + 1, "\n"; @@ -209,27 +238,9 @@ sub print_edid { } foreach my $h (@{$edid->{detailed_timings}}) { - my $horizontal_total = $h->{horizontal_active} + $h->{horizontal_blanking}; - my $vertical_total = $h->{vertical_active} + $h->{vertical_blanking}; - print "\n"; - printf qq(\t# %dx%d @ %.1f Hz, %.1f kHz hsync\n), - $h->{horizontal_active}, $h->{vertical_active}, - $h->{pixel_clock} / $horizontal_total / $vertical_total * 1000 * 1000, - $h->{pixel_clock} / $horizontal_total * 1000; - - printf qq(\tModeLine "%dx%d" $h->{pixel_clock} %d %d %d %d %d %d %d %d\n), - $h->{horizontal_active}, $h->{vertical_active}, - - $h->{horizontal_active}, - $h->{horizontal_active} + $h->{horizontal_sync_offset}, - $h->{horizontal_active} + $h->{horizontal_sync_offset} + $h->{horizontal_sync_pulse_width}, - $h->{horizontal_total}, - - $h->{vertical_active}, - $h->{vertical_active} + $h->{vertical_sync_offset}, - $h->{vertical_active} + $h->{vertical_sync_offset} + $h->{vertical_sync_pulse_width}, - $h->{vertical_total}; + print "\t", $h->{ModeLine_comment}, "\n"; + print "\t", $h->{ModeLine}, "\n"; } } |