aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@mandriva.org>2010-01-03 04:34:01 +0000
committerAnssi Hannula <anssi@mandriva.org>2010-01-03 04:34:01 +0000
commit41650393e8037493532fdcb18f793696af2d2e6a (patch)
tree44b4c4188c4d08f0b74bf9dc12677bbe0addcd7d
parent2b87cc62cd0f1defe8e0d653ced91c1678d3c0bf (diff)
downloadmonitor-edid-41650393e8037493532fdcb18f793696af2d2e6a.tar
monitor-edid-41650393e8037493532fdcb18f793696af2d2e6a.tar.gz
monitor-edid-41650393e8037493532fdcb18f793696af2d2e6a.tar.bz2
monitor-edid-41650393e8037493532fdcb18f793696af2d2e6a.tar.xz
monitor-edid-41650393e8037493532fdcb18f793696af2d2e6a.zip
move standard timing mode parsing into its own function
-rwxr-xr-xmonitor-parse-edid39
1 files changed, 23 insertions, 16 deletions
diff --git a/monitor-parse-edid b/monitor-parse-edid
index 73fc264..dacc8ad 100755
--- a/monitor-parse-edid
+++ b/monitor-parse-edid
@@ -662,6 +662,28 @@ sub build_detailed_timing {
$h;
}
+sub add_standard_timing_modes {
+ my ($edid, $v) = @_;
+
+ my @aspect2ratio = (
+ $edid->{edid_version} > 1 || $edid->{edid_revision} > 2 ? '16/10' : '1/1',
+ '4/3', '5/4', '16/9',
+ );
+ $v = [ map {
+ my $h = get_many_bits($_, 'standard_timing');
+ $h->{X} = ($h->{X} + 31) * 8;
+ if ($_ ne "\x20\x20" && $h->{X} > 256) { # cf VALID_TIMING in Xorg edid.h
+ $h->{vfreq} += 60;
+ if ($h->{ratio} = $aspect2ratio[$h->{aspect}]) {
+ delete $h->{aspect};
+ $h->{Y} = $h->{X} / eval($h->{ratio});
+ }
+ $h;
+ } else { () }
+ } unpack('a2' x 8, $v) ];
+ $v;
+}
+
sub parse_edid {
my ($raw_edid, $verbose) = @_;
@@ -688,22 +710,7 @@ sub parse_edid {
map { /(\d+)x(\d+)_(\d+)(i?)/ ? { X => $1, Y => $2, vfreq => $3, $4 ? (interlace => 1) : () } : () }
grep { $h->{$_} } keys %$h ];
} elsif ($field eq 'standard_timings') {
- my @aspect2ratio = (
- $edid{edid_version} > 1 || $edid{edid_revision} > 2 ? '16/10' : '1/1',
- '4/3', '5/4', '16/9',
- );
- $v = [ map {
- my $h = get_many_bits($_, 'standard_timing');
- $h->{X} = ($h->{X} + 31) * 8;
- if ($_ ne "\x20\x20" && $h->{X} > 256) { # cf VALID_TIMING in Xorg edid.h
- $h->{vfreq} += 60;
- if ($h->{ratio} = $aspect2ratio[$h->{aspect}]) {
- delete $h->{aspect};
- $h->{Y} = $h->{X} / eval($h->{ratio});
- }
- $h;
- } else { () }
- } unpack('a2' x 8, $v) ];
+ $v = add_standard_timing_modes(\%edid, $v);
} elsif ($field eq 'monitor_details') {
while ($v) {
(my $pixel_clock, my $vv, $v) = unpack("v a16 a*", $v);