From 7f77dbd5f00255d869f5f754c160c5b7220fa1bb Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 25 Feb 2005 12:11:33 +0000 Subject: - add option -v (unused at the moment, but need to be handled in -v is passed to monitor-get-edid) - in --perl format, remove the variable name, allowing simple eval() on the string in use strict "vars" mode - add {diagonal_size} - small modifications in {ModeLine} and {ModeLine_comment} --- monitor-parse-edid | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'monitor-parse-edid') diff --git a/monitor-parse-edid b/monitor-parse-edid index d582a0e..edf7623 100755 --- a/monitor-parse-edid +++ b/monitor-parse-edid @@ -192,18 +192,19 @@ sub parse_edid { $edid{HorizSync} = $edid{monitor_range}{horizontal_min} . '-' . $edid{monitor_range}{horizontal_max}; $edid{VertRefresh} = $edid{monitor_range}{vertical_min} . '-' . $edid{monitor_range}{vertical_max}; } + $edid{diagonal_size} = sqrt(sqr($edid{max_size_horizontal}) + + sqr($edid{max_size_vertical})) / 2.54; 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->{ModeLine_comment} = sprintf qq(# Monitor preferred modeline (%.1f Hz vsync, %.1f kHz hsync)), $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->{ModeLine} = sprintf qq("%dx%d" $h->{pixel_clock} %d %d %d %d %d %d %d %d), $h->{horizontal_active}, $h->{vertical_active}, $h->{horizontal_active}, @@ -222,12 +223,10 @@ sub parse_edid { sub print_edid { my ($edid) = @_; - my $diagonal_inches = sqrt(sqr($edid->{max_size_horizontal}) + - sqr($edid->{max_size_vertical})) / 2.54; print "Name: $edid->{monitor_name}\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; + printf "Screen size: %d cm x %d cm (%3.2f inches)\n", $edid->{max_size_horizontal}, $edid->{max_size_vertical}, $edid->{diagonal_size}; print "Gamma: ", $edid->{gamma} / 100 + 1, "\n"; printf "%s signal\n", $edid->{video_input_definition}{digital} ? 'Digital' : 'Analog'; @@ -242,16 +241,17 @@ sub print_edid { foreach my $h (@{$edid->{detailed_timings}}) { print "\n"; print "\t", $h->{ModeLine_comment}, "\n"; - print "\t", $h->{ModeLine}, "\n"; + print "\tModeLine ", $h->{ModeLine}, "\n"; } } sub usage() { - die "usage: monitor-parse-edid [--perl] []\n"; + die "usage: monitor-parse-edid [-v] [--perl] []\n"; } use Getopt::Long; GetOptions( + 'v' => \ (my $verbose), 'perl' => \ (my $raw_perl), ) or usage(); @@ -276,7 +276,9 @@ if (my $err = check_parsed_edid($edid)) { if ($raw_perl) { use Data::Dumper; $Data::Dumper::Sortkeys = 1; - print Dumper($edid); + my $s = Dumper($edid); + $s =~ s/.*? = {/+{/; # remove variable name we don't want + print $s; } else { print_edid($edid); } -- cgit v1.2.1