diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-06-17 08:00:45 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-06-17 08:00:45 +0000 |
commit | bd420a538e45ef90f51ee319e75e549f3266d0cc (patch) | |
tree | 77d1c49ed4d384708e346cf72be95c4828280d18 | |
parent | dd6d12d2901a835b9389083829c68fb099d0b0e0 (diff) | |
download | monitor-edid-bd420a538e45ef90f51ee319e75e549f3266d0cc.tar monitor-edid-bd420a538e45ef90f51ee319e75e549f3266d0cc.tar.gz monitor-edid-bd420a538e45ef90f51ee319e75e549f3266d0cc.tar.bz2 monitor-edid-bd420a538e45ef90f51ee319e75e549f3266d0cc.tar.xz monitor-edid-bd420a538e45ef90f51ee319e75e549f3266d0cc.zip |
add option to output using MonitorsDB format
-rwxr-xr-x | monitor-parse-edid | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/monitor-parse-edid b/monitor-parse-edid index 53e7d50..e35516a 100755 --- a/monitor-parse-edid +++ b/monitor-parse-edid @@ -375,6 +375,26 @@ sub ratio_name { } } +sub to_MonitorsDB { + my ($edid) = @_; + + $edid->{monitor_range} && $edid->{EISA_ID} or return; + + my $detailed_timings = $edid->{detailed_timings} || []; + my @preferred_resolutions = map { + join('x', $_->{horizontal_active}, $_->{vertical_active}); + } grep { !$_->{bad_ratio} } @$detailed_timings; + + join('; ', + $edid->{monitor_name} =~ /(\S+)/ ? $1 : $edid->{EISA_ID} =~ /(...)/ && $1, + $edid->{monitor_name} ? $edid->{monitor_name} : $edid->{EISA_ID} =~ /...(.*)/ && $1, + $edid->{EISA_ID}, + sprintf("%u-%u", $edid->{monitor_range}{horizontal_min}, $edid->{monitor_range}{horizontal_max}), + sprintf("%u-%u", $edid->{monitor_range}{vertical_min}, $edid->{monitor_range}{vertical_max}), + @$detailed_timings == 1 ? @preferred_resolutions : (), + ); +} + sub print_edid { my ($edid, $verbose) = @_; @@ -423,6 +443,7 @@ use Getopt::Long; GetOptions( 'v' => \ (my $verbose), 'perl' => \ (my $raw_perl), + 'MonitorsDB' => \ (my $MonitorsDB), ) or usage(); my $F; @@ -449,6 +470,9 @@ if ($raw_perl) { my $s = Dumper($edid); $s =~ s/.*? = {/+{/; # remove variable name we don't want print $s; +} elsif ($MonitorsDB) { + my $s = to_MonitorsDB($edid); + print "$s\n" if $s; } else { print_edid($edid, $verbose); } |