diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/Xconfig/monitor.pm | 48 |
1 files changed, 47 insertions, 1 deletions
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), |