From e35814cc09c4c0feda92caefa03ebb77807a7ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 25 Aug 2004 05:31:38 +0000 Subject: Parse XFree86.log in last resort in case we have not got any valuable information at this stage from ddcxinfos. --- perl-install/Xconfig/monitor.pm | 48 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'perl-install/Xconfig') diff --git a/perl-install/Xconfig/monitor.pm b/perl-install/Xconfig/monitor.pm index 00e8271c8..07e228e34 100644 --- a/perl-install/Xconfig/monitor.pm +++ b/perl-install/Xconfig/monitor.pm @@ -163,8 +163,51 @@ sub configure_automatic { return $monitor->{HorizSync} && $monitor->{VertRefresh}; } +# Parse XFree86 log in case with got not valuable information from +# ddcxinfos. NOTE: this is only safe at install stage. +sub getinfoFromXFree() { + my $xf86log = "/var/log/XFree86.0.log"; + $::isInstall && -r $xf86log or return; + + my ($VideoRAM, $HorizSync, $VertRefresh, $VendorName, $EISA_ID, $size); + for (cat_($xf86log)) { + if (/(VideoRAM|Total Mem): (\d+) kB/) { + $VideoRAM = $2; + } + elsif (/Ranges:\s+V min: (\d+)\s+V max: (\d+) ?Hz,\s+H min: (\d+)\s+H max: (\d+) ?kHz/) { + $HorizSync = "$3-$4"; + $VertRefresh = "$1-$2"; + } + elsif (/hsync range of ([.\d]+-[.\d]+) ?kHz/) { + $HorizSync = $1 if !$HorizSync; + } + elsif (/vrefresh range of ([.\d]+-[.\d]+) ?Hz/) { + $VertRefresh = $1 if !$VertRefresh; + } + elsif (/(Display dimensions|Image Size):\s+\(?(\d+)[,x\s]+(\d+)\)? mm/) { + my ($x, $y) = (($2+9)/10, ($3+9)/10); # round up + $size = sqrt($x*$x + $y*$y) / 2.54 * 1.08; + } + elsif (/Monitor name: (.+)/) { + $VendorName = $1; + } + elsif (/Manufacturer: (\w+)\s+Model: (\w+)/) { + $EISA_ID = "$1$2"; + } + } + + { + VideoRam_probed => $VideoRAM, + HorizSync => $HorizSync, + VertRefresh => $VertRefresh, + size => $size, + if_($EISA_ID, EISA_ID => lc($EISA_ID)), + VendorName => $VendorName || "Plug'n Play", + } +} + sub getinfoFromDDC() { - my ($VideoRam, @l) = any::ddcxinfos() or return; + my ($VideoRam, @l) = any::ddcxinfos() or return getinfoFromXFree(); my @Modes; local $_; @@ -175,6 +218,9 @@ sub getinfoFromDDC() { push @Modes, [ $x, $y, $depth ]; } + # last chance to get some useful information + return getinfoFromXFree() if ! @l; + my ($h, $v, $size, @_modes) = @l; { VideoRam_probed => to_int($VideoRam), -- cgit v1.2.1