aboutsummaryrefslogtreecommitdiffstats
path: root/monitor-parse-edid
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-02-25 12:11:33 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-02-25 12:11:33 +0000
commit7f77dbd5f00255d869f5f754c160c5b7220fa1bb (patch)
tree7b37989667807a544a7817e1ff2e0aff2a3d3a1f /monitor-parse-edid
parent66f6e025bf89359b8260d32f84ea2eeb530b9343 (diff)
downloadmonitor-edid-7f77dbd5f00255d869f5f754c160c5b7220fa1bb.tar
monitor-edid-7f77dbd5f00255d869f5f754c160c5b7220fa1bb.tar.gz
monitor-edid-7f77dbd5f00255d869f5f754c160c5b7220fa1bb.tar.bz2
monitor-edid-7f77dbd5f00255d869f5f754c160c5b7220fa1bb.tar.xz
monitor-edid-7f77dbd5f00255d869f5f754c160c5b7220fa1bb.zip
- 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}
Diffstat (limited to 'monitor-parse-edid')
-rwxr-xr-xmonitor-parse-edid20
1 files changed, 11 insertions, 9 deletions
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] [<edid file>]\n";
+ die "usage: monitor-parse-edid [-v] [--perl] [<edid file>]\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);
}