diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-08-19 20:21:23 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-08-19 20:21:23 +0000 |
commit | d4883872a8d7ec2e4955c8f7b6ddba7ba21af901 (patch) | |
tree | a5dcda8e112de5729ec377c0bf0732860f89ae1a | |
parent | f336f32b526e7d74d7b7c0fd51ee95a165dd2f85 (diff) | |
download | drakx-d4883872a8d7ec2e4955c8f7b6ddba7ba21af901.tar drakx-d4883872a8d7ec2e4955c8f7b6ddba7ba21af901.tar.gz drakx-d4883872a8d7ec2e4955c8f7b6ddba7ba21af901.tar.bz2 drakx-d4883872a8d7ec2e4955c8f7b6ddba7ba21af901.tar.xz drakx-d4883872a8d7ec2e4955c8f7b6ddba7ba21af901.zip |
(readMonitorsDB): now return a list instead of a hash to handle same name entries with different EISA_ID
(configure_automatic): handle EISA_ID but no VertRefresh/HorizSync (happens for some hardware)
(choose): handle user asking for "Plug'n Play" monitor and ddcxinfos failing
-rw-r--r-- | perl-install/Xconfig/monitor.pm | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/perl-install/Xconfig/monitor.pm b/perl-install/Xconfig/monitor.pm index d648a2d54..3aab9fe6e 100644 --- a/perl-install/Xconfig/monitor.pm +++ b/perl-install/Xconfig/monitor.pm @@ -71,6 +71,9 @@ sub choose { configure_automatic($monitor, $monitors) and $auto and return 1; + my %h_monitors = map { ; "$_->{VendorName}|$_->{ModelName}" => $_ } @$monitors; + + ask_monitor: my $merged_name = do { if ($monitor->{VendorName} eq "Plug'n Play") { $monitor->{VendorName}; @@ -87,7 +90,7 @@ sub choose { $in->ask_from(_("Monitor"), _("Choose a monitor"), [ { val => \$merged_name, separator => '|', - list => ['Custom', "Plug'n Play", sort keys %$monitors], + list => ['Custom', "Plug'n Play", sort keys %h_monitors], format => sub { $_[0] eq 'Custom' ? _("Custom") : $_[0] eq "Plug'n Play" ? _("Plug'n Play") . " ($monitor->{ModelName})" : $_[0] =~ /^Generic\|(.*)/ ? _("Generic") . "|$1" : @@ -97,8 +100,13 @@ sub choose { if ($merged_name eq "Plug'n Play") { local $::noauto = 0; #- hey, you asked for plug'n play, so i do probe! put_in_hash($monitor, getinfoFromDDC()); - configure_automatic($monitor, $monitors); - $monitor->{VendorName} = "Plug'n Play"; + if (configure_automatic($monitor, $monitors)) { + $monitor->{VendorName} = "Plug'n Play"; + } else { + delete $monitor->{VendorName}; + $in->ask_warn('', _("Plug'n Play probing failed. Please choose a precise monitor")); + goto ask_monitor; + } } elsif ($merged_name eq 'Custom') { $in->ask_from('', _("The two critical parameters are the vertical refresh rate, which is the rate @@ -112,7 +120,7 @@ that is beyond the capabilities of your monitor: you may damage your monitor. { val => \$monitor->{VertRefresh}, list => \@VertRefresh_ranges, label => _("Vertical refresh rate"), not_edit => 0 } ]) or goto &choose; delete @$monitor{'VendorName', 'ModelName', 'EISA_ID'}; } else { - put_in_hash($monitor, $monitors->{$merged_name}); + put_in_hash($monitor, $h_monitors{$merged_name}); } $monitor->{manually_chosen} = 1; 1; @@ -123,14 +131,18 @@ sub configure_automatic { if ($monitor->{EISA_ID}) { log::l("EISA_ID: $monitor->{EISA_ID}"); - if (my ($mon) = grep { lc($_->{EISA_ID}) eq $monitor->{EISA_ID} } values %$monitors) { + if (my ($mon) = grep { lc($_->{EISA_ID}) eq $monitor->{EISA_ID} } @$monitors) { add2hash($monitor, $mon); log::l("EISA_ID corresponds to: $monitor->{ModelName}"); + } elsif (!$monitor->{HorizSync} || !$monitor->{VertRefresh}) { + log::l("unknown EISA_ID and partial DDC probe, so unknown monitor"); + delete @$monitor{'VendorName', 'ModelName', 'EISA_ID'}; + } + } else { + if (my ($mon) = grep { $_->{VendorName} eq $monitor->{VendorName} && $_->{ModelName} eq $monitor->{ModelName} } @$monitors) { + put_in_hash($monitor, $mon); } } - my $merged_name = $monitor->{VendorName} . '|' . $monitor->{ModelName}; - - put_in_hash($monitor, $monitors->{$merged_name}); return $monitor->{HorizSync} && $monitor->{VertRefresh}; } @@ -165,8 +177,7 @@ sub monitors { sub readMonitorsDB { my ($file) = @_; - my (%monitors, %standard_monitors); - + my @monitors; my $F = common::openFileMaybeCompressed($file); local $_; my $lineno = 0; while (<$F>) { @@ -176,16 +187,10 @@ sub readMonitorsDB { /^$/ and next; my @fields = qw(VendorName ModelName EISA_ID HorizSync VertRefresh dpms); - my @l = split /\s*;\s*/; - - my %l; @l{@fields} = @l; - if ($monitors{$l{ModelName}}) { - my $i; for ($i = 0; $monitors{"$l{ModelName} ($i)"}; $i++) {} - $l{ModelName} = "$l{ModelName} ($i)"; - } - $monitors{"$l{VendorName}|$l{ModelName}"} = \%l; + my %l; @l{@fields} = split /\s*;\s*/; + push @monitors, \%l; } - \%monitors; + \@monitors; } |