summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-03-20 09:16:13 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-03-20 09:16:13 +0000
commit6281ab42aaff28145861cad2f512c2ffe37aa956 (patch)
tree1b67e67194bcd0a3105e2878629cc2e27ee41b62
parent03e77f0e4d1eda3c8179b5ddaeb59581feb15c5e (diff)
downloaddrakx-6281ab42aaff28145861cad2f512c2ffe37aa956.tar
drakx-6281ab42aaff28145861cad2f512c2ffe37aa956.tar.gz
drakx-6281ab42aaff28145861cad2f512c2ffe37aa956.tar.bz2
drakx-6281ab42aaff28145861cad2f512c2ffe37aa956.tar.xz
drakx-6281ab42aaff28145861cad2f512c2ffe37aa956.zip
(config) read current configuration (Scott Mazur <scott@littlefish.ca>)
-rw-r--r--perl-install/harddrake/v4l.pm31
1 files changed, 28 insertions, 3 deletions
diff --git a/perl-install/harddrake/v4l.pm b/perl-install/harddrake/v4l.pm
index e7dbf7baa..aaa891c6d 100644
--- a/perl-install/harddrake/v4l.pm
+++ b/perl-install/harddrake/v4l.pm
@@ -241,20 +241,45 @@ my %pll_lst =
sub config {
my ($in, $driver) = @_;
+
+ my $min_gbuffers = 2;
+ my $max_gbuffers = 32;
+
my %conf = (gbuffers => 4, card => $default, tuner => -1, radio => 0, pll => -1);
+
+ my %cards_list = %{$cards_lst->{$driver}};
+ my %rvs_cards_list = reverse %cards_list;
+
+ # get the existing options (if there are any)
+ my $current = modules::get_options($driver);
+
+ foreach (split(/\s+/,$current)) {
+ $conf{$1} = $2 if /^(gbuffers|tuner|radio|pll)=(.+)/;
+ $conf{$1} = $rvs_cards_list{$2} if /^(card)=(.+)/;
+ }
+
+ #Sanity checks on defaults
+ $conf{gbuffers} = max($min_gbuffers, $conf{gbuffers});
+ $conf{gbuffers} = min($max_gbuffers, $conf{gbuffers});
+ $conf{card} = $default if !defined $cards_list{$conf{card}};
+ $conf{tuner} = -1 if !defined $tuners_lst{$conf{tuner}};
+ $conf{pll} = -1 if !defined $pll_lst{$conf{tuner}};
+ $conf{radio} = 0 if $conf{radio} !~ /(0|1)/;
+
+
if ($in->ask_from("BTTV configuration", N("For most modern TV cards, the bttv module of the GNU/Linux kernel just auto-detect the rights parameters.
If your card is misdetected, you can force the right tuner and card types here. Just select your tv card parameters if needed."),
[
- { label => N("Card model:"), val => \$conf{card}, list => [keys %{$cards_lst->{$driver}}], type => 'combo', default => -1, sort =>1, separator => '|' },
+ { label => N("Card model:"), val => \$conf{card}, list => [ keys %cards_list ], type => 'combo', default => -1, sort =>1, separator => '|' },
{ label => N("Tuner type:"), val => \$conf{tuner}, list => [keys %tuners_lst], format => sub { $tuners_lst{$_[0]} }, sort => 1, separator => '|' },
- { label => N("Number of capture buffers:"), val => \$conf{gbuffers}, min => 2, max => 32, sort => 1, default => 0, type => 'range', advanced => 1, help => N("number of capture buffers for mmap'ed capture") },
+ { label => N("Number of capture buffers:"), val => \$conf{gbuffers}, min => $min_gbuffers, max => $max_gbuffers, sort => 1, default => 0, type => 'range', advanced => 1, help => N("number of capture buffers for mmap'ed capture") },
if_($driver eq 'bttv',
{ label => N("PLL setting:"), val => \$conf{pll}, list => [keys %pll_lst], format => sub { $pll_lst{$_[0]} }, sort => 1, default => 0, advanced =>1 },
{ label => N("Radio support:"), val => \$conf{radio}, type => "bool", text => N("enable radio support") }),
]
))
{
- $conf{card} = $cards_lst->{$driver}{$conf{card}};
+ $conf{card} = $cards_list{$conf{card}};
my $options =
'radio=' . ($conf{radio} ? 1 : 0) . ' ' .