From 58d083b1760b387fea6ddcd12960a562baf4f0e1 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 5 Jul 2002 13:22:43 +0000 Subject: - remove uneeded stuff for modules ("#!/..", "use lib..", "use standalone", ...) - simplify bttv options managment: - use if_, thanks MDK::Common - s/mapn/map by using a hash at first - s/mapn{if}/map{if_} - don't read/write modules.conf here, drakx take care of that for us thus, the test program became: #!/usr/bin/perl use strict; use lib qw(/usr/lib/libDrakX); use standalone; use bttv; use interactive; use modules; modules::read_conf; bttv::config('interactive'->vnew()); modules::write_conf; --- perl-install/harddrake/bttv.pm | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'perl-install/harddrake') diff --git a/perl-install/harddrake/bttv.pm b/perl-install/harddrake/bttv.pm index bedd4eda9..d1f0f4f87 100644 --- a/perl-install/harddrake/bttv.pm +++ b/perl-install/harddrake/bttv.pm @@ -1,11 +1,6 @@ -#!/usr/bin/perl -w - package bttv; use strict; -use lib qw(/usr/lib/libDrakX); - -use standalone; use interactive; use detect_devices; @@ -154,24 +149,23 @@ my %pll_lst = sub config { my ($in) = @_; - my ($card, $tuner, $radio, $pll) = (-1, -1, 0, -1); + my %conf = (card => -1, tuner => -1, radio => 0, pll => -1); # return unless (grep { $_->{media_type} eq 'MULTIMEDIA_VIDEO' } detect_devices::probeall(1)); if ($in->ask_from("BTTV configuration", _("Please,\nselect your tv card parameters if needed"), [ - { label => _("Card model :"), val => \$card, list => [keys %cards_lst], format => sub { $cards_lst{$_[0]} }, type => 'combo', default => -1, sort =>1}, - { label => _("PLL type :"), val => \$pll, list => [keys %pll_lst], format => sub { $pll_lst{$_[0]} }, sort => 1, default => 0, advanced =>1}, - { label => _("Tuner type :"), val => \$tuner, list => [keys %tuners_lst], format => sub { $tuners_lst{$_[0]} }, sort => 1}, - { label => _("Radio support :"), val => \$radio, type => "bool", text => _("enable radio support")}, + { label => _("Card model :"), val => \$conf{card}, list => [keys %cards_lst], format => sub { $cards_lst{$_[0]} }, type => 'combo', default => -1, sort =>1}, + { label => _("PLL type :"), val => \$conf{pll}, list => [keys %pll_lst], format => sub { $pll_lst{$_[0]} }, sort => 1, default => 0, advanced =>1}, + { label => _("Tuner type :"), val => \$conf{tuner}, list => [keys %tuners_lst], format => sub { $tuners_lst{$_[0]} }, sort => 1}, + { label => _("Radio support :"), val => \$conf{radio}, type => "bool", text => _("enable radio support")}, ] )) { - my $options = join ' ', mapn {if ($_[0] ne "-1") { $_[1]."=".$_[0]} else {} } [$card, $pll, $tuner], ["card", "pll", "tuner"]; - print "@",$options,"@\n"; + my $options = + 'radio=' . ($conf{radio} ? 1 : 0) . ' '. + join(' ', map { if_($conf{$_} ne -1, "$_=$conf{$_}") } qw(card pll tuner)); log::l("[harddrake::tv] $options"); standalone::explanations("modified file /etc/modules.conf ($options)"); - modules::read_conf("/etc/modules.conf"); - modules::set_options("bttv",$options) if ($options ne ""); - modules::write_conf(); + modules::set_options("bttv", $options) if $options; } } -- cgit v1.2.1