summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig
diff options
context:
space:
mode:
authorGwenolé Beauchesne <gbeauchesne@mandriva.org>2004-08-25 05:31:38 +0000
committerGwenolé Beauchesne <gbeauchesne@mandriva.org>2004-08-25 05:31:38 +0000
commite35814cc09c4c0feda92caefa03ebb77807a7ae2 (patch)
tree91b314494afb6f9debe7892de88698a565d8792d /perl-install/Xconfig
parent381579dcee2446eca206eed653cc7046e5e9991d (diff)
downloaddrakx-backup-do-not-use-e35814cc09c4c0feda92caefa03ebb77807a7ae2.tar
drakx-backup-do-not-use-e35814cc09c4c0feda92caefa03ebb77807a7ae2.tar.gz
drakx-backup-do-not-use-e35814cc09c4c0feda92caefa03ebb77807a7ae2.tar.bz2
drakx-backup-do-not-use-e35814cc09c4c0feda92caefa03ebb77807a7ae2.tar.xz
drakx-backup-do-not-use-e35814cc09c4c0feda92caefa03ebb77807a7ae2.zip
Parse XFree86.log in last resort in case we have not got any valuable
information at this stage from ddcxinfos.
Diffstat (limited to 'perl-install/Xconfig')
-rw-r--r--perl-install/Xconfig/monitor.pm48
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),