diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-07-07 17:55:12 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-07-07 17:55:12 +0000 |
commit | 17fc9d38c90a8d2abc1115b1b0ba2537baf679d0 (patch) | |
tree | 9f28b7a6e38bffecda9822466c274a515832098e | |
parent | 0db638a86a2533a60255ff92fb9a96d7d6224f70 (diff) | |
download | monitor-edid-17fc9d38c90a8d2abc1115b1b0ba2537baf679d0.tar monitor-edid-17fc9d38c90a8d2abc1115b1b0ba2537baf679d0.tar.gz monitor-edid-17fc9d38c90a8d2abc1115b1b0ba2537baf679d0.tar.bz2 monitor-edid-17fc9d38c90a8d2abc1115b1b0ba2537baf679d0.tar.xz monitor-edid-17fc9d38c90a8d2abc1115b1b0ba2537baf679d0.zip |
- monitor-parse-edid:
o compute and display the "dpi" of the preferred modelines
-rw-r--r-- | NEWS | 3 | ||||
-rwxr-xr-x | monitor-parse-edid | 19 |
2 files changed, 20 insertions, 2 deletions
@@ -1,3 +1,6 @@ +- monitor-parse-edid: + o compute and display the "dpi" of the preferred modelines + Version 2.0 - 8 April 2008 - change license from LGPLv2+ to GPLv3+ diff --git a/monitor-parse-edid b/monitor-parse-edid index d8b76b9..e976814 100755 --- a/monitor-parse-edid +++ b/monitor-parse-edid @@ -316,13 +316,28 @@ sub parse_edid { $h->{bad_ratio} = 1 if abs($edid{ratio} - $h->{horizontal_active} / $h->{vertical_active}) > ($edid{ratio_precision} eq 'mm' ? 0.02 : 0.2); + if ($edid{max_size_vertical}) { + $h->{vertical_dpi} = $h->{vertical_active} / $edid{max_size_vertical} * 2.54; + } + if ($edid{max_size_horizontal}) { + $h->{horizontal_dpi} = $h->{horizontal_active} / $edid{max_size_horizontal} * 2.54; + } + my $dpi_string = ''; + if ($h->{vertical_dpi} && $h->{horizontal_dpi}) { + $dpi_string = + abs($h->{vertical_dpi} / $h->{horizontal_dpi} - 1) < 0.05 ? + sprintf("%d dpi", $h->{horizontal_dpi}) : + sprintf("%dx%d dpi", $h->{horizontal_dpi}, $h->{vertical_dpi}); + } + my $horizontal_total = $h->{horizontal_active} + $h->{horizontal_blanking}; my $vertical_total = $h->{vertical_active} + $h->{vertical_blanking}; - $h->{ModeLine_comment} = sprintf qq(# Monitor preferred modeline (%.1f Hz vsync, %.1f kHz hsync, ratio %s)), + $h->{ModeLine_comment} = sprintf qq(# Monitor preferred modeline (%.1f Hz vsync, %.1f kHz hsync, ratio %s%s)), $h->{pixel_clock} / $horizontal_total / $vertical_total * 1000 * 1000, $h->{pixel_clock} / $horizontal_total * 1000, - nearest_ratio($h->{horizontal_active} / $h->{vertical_active}, 0.01) || sprintf("%.2f", $h->{horizontal_active} / $h->{vertical_active}); + nearest_ratio($h->{horizontal_active} / $h->{vertical_active}, 0.01) || sprintf("%.2f", $h->{horizontal_active} / $h->{vertical_active}), + $dpi_string ? ", $dpi_string" : ''; $h->{ModeLine} = sprintf qq("%dx%d" $h->{pixel_clock} %d %d %d %d %d %d %d %d %shsync %svsync), $h->{horizontal_active}, $h->{vertical_active}, |