From bc76ae0e67ab47825c3879e1002df4c3b79ee82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 12 Nov 2003 17:11:05 +0000 Subject: Parse XFree86 install server log in last resort in case there is nothing valuable retrieved so far from ddcxinfos. --- perl-install/Xconfig/monitor.pm | 44 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/perl-install/Xconfig/monitor.pm b/perl-install/Xconfig/monitor.pm index 27475c0d1..eb6a7fc7e 100644 --- a/perl-install/Xconfig/monitor.pm +++ b/perl-install/Xconfig/monitor.pm @@ -156,8 +156,47 @@ 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 (/hsync range of ([.\d]+-[.\d]+) kHz/) { + $HorizSync = $1; + } + elsif (/vrefresh range of ([.\d]+-[.\d]+) Hz/) { + $VertRefresh = $1; + } + 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 $_; @@ -168,6 +207,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