From 31f4502a6bfc4f15263c7d7df4c14fbddfbaeca2 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 15 Mar 2005 19:23:30 +0000 Subject: allow drakconnect to display multiple instances of the same adsl device --- perl-install/network/adsl.pm | 8 ++++---- perl-install/network/netconnect.pm | 41 +++++++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 20 deletions(-) (limited to 'perl-install') diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm index 3f7b44a1a..2863a215f 100644 --- a/perl-install/network/adsl.pm +++ b/perl-install/network/adsl.pm @@ -86,10 +86,10 @@ sub adsl_probe_info { sub adsl_detect() { my $adsl = {}; require detect_devices; - ($adsl->{bewan}) = detect_devices::getBewan(); - ($adsl->{speedtouch}) = detect_devices::getSpeedtouch(); - ($adsl->{sagem}) = detect_devices::getSagem(); - ($adsl->{eci}) = detect_devices::getECI(); + @{$adsl->{bewan}} = detect_devices::getBewan(); + @{$adsl->{speedtouch}} = detect_devices::getSpeedtouch(); + @{$adsl->{sagem}} = detect_devices::getSagem(); + @{$adsl->{eci}} = detect_devices::getECI(); return $adsl; } diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 2ccd5ab42..51f4a24f0 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -84,7 +84,7 @@ sub real_main { my (%connections, @connection_list, $is_wireless); my ($modem, $modem_name, $modem_conf_read, $modem_dyn_dns, $modem_dyn_ip); my $cable_no_auth; - my ($adsl_type, @adsl_devices, $adsl_failed, $adsl_answer, %adsl_data, $adsl_data, $adsl_provider, $adsl_old_provider); + my ($adsl_type, @adsl_devices, $adsl_failed, $adsl_answer, %adsl_cards, %adsl_data, $adsl_data, $adsl_provider, $adsl_old_provider); my ($ntf_name, $gateway_ex, $up, $need_restart_network); my ($isdn, $isdn_name, $isdn_type, %isdn_cards, @isdn_dial_methods); my $my_isdn = join('', N("Manual choice"), " (", N("Internal ISDN card"), ")"); @@ -149,7 +149,7 @@ sub real_main { find { $_->{device} eq $ntf_name } detect_devices::pcmcia_probe()); }; - my %adsl_devices = ( + my %adsl_descriptions = ( speedtouch => N("Alcatel speedtouch USB modem"), sagem => N("Sagem USB modem"), bewan => N("Bewan modem"), @@ -707,9 +707,14 @@ Take a look at http://www.linmodems.org"), @adsl_devices = keys %eth_intf; detect($modules_conf, $netc->{autodetect}, 'adsl'); - foreach my $modem (keys %adsl_devices) { - push @adsl_devices, $modem if $netc->{autodetect}{adsl}{$modem}; + %adsl_cards = (); + foreach my $modem_type (keys %{$netc->{autodetect}{adsl}}) { + foreach my $modem (@{$netc->{autodetect}{adsl}{$modem_type}}) { + my $name = join(': ', $adsl_descriptions{$modem_type}, $modem->{description}); + $adsl_cards{$name} = [ $modem_type, $modem ]; + } } + push @adsl_devices, keys %adsl_cards; detect($modules_conf, $netc->{autodetect}, 'isdn'); if (my @isdn_modems = @{$netc->{autodetect}{isdn}}) { @@ -720,7 +725,7 @@ Take a look at http://www.linmodems.org"), }, name => N("ADSL configuration") . "\n\n" . N("Select the network interface to configure:"), data => [ { label => N("Net Device"), type => "list", val => \$ntf_name, allow_empty_list => 1, - list => \@adsl_devices, format => sub { $eth_intf{$_[0]} || $adsl_devices{$_[0]} || $_[0] } } ], + list => \@adsl_devices, format => sub { $eth_intf{$_[0]} || $_[0] } } ], post => sub { my %packages = ( 'eci' => [ 'eciadsl', 'missing' ], @@ -728,16 +733,20 @@ Take a look at http://www.linmodems.org"), 'speedtouch' => [ 'speedtouch', "/usr/sbin/modem_run" ], ); return 'adsl_unsupported_eci' if $ntf_name eq 'eci'; - # FIXME: check that the package installation succeeds, else retry or abort - $in->do_pkgs->ensure_is_installed(@{$packages{$ntf_name}}) if $packages{$ntf_name}; - if ($ntf_name eq 'speedtouch') { - $in->do_pkgs->ensure_is_installed_if_available('speedtouch_mgmt', "/usr/share/speedtouch/mgmt.o"); - return 'adsl_speedtouch_firmware' if ! -e "$::prefix/usr/share/speedtouch/mgmt.o"; - } - $netcnx->{bus} = $netc->{autodetect}{adsl}{bewan}{bus} if $ntf_name eq 'bewan'; - if ($ntf_name eq 'bewan' && !$::testing) { - if (my $unicorn_packages = $in->do_pkgs->check_kernel_module_packages('unicorn-kernel', 'unicorn')) { - $in->do_pkgs->install(@$unicorn_packages); + if (exists $adsl_cards{$ntf_name}) { + my $modem; + ($ntf_name, $modem) = @{$adsl_cards{$ntf_name}}; + # FIXME: check that the package installation succeeds, else retry or abort + $in->do_pkgs->ensure_is_installed(@{$packages{$ntf_name}}) if $packages{$ntf_name}; + if ($ntf_name eq 'speedtouch') { + $in->do_pkgs->ensure_is_installed_if_available('speedtouch_mgmt', "/usr/share/speedtouch/mgmt.o"); + return 'adsl_speedtouch_firmware' if ! -e "$::prefix/usr/share/speedtouch/mgmt.o"; + } + $netcnx->{bus} = $modem->{bus} if $ntf_name eq 'bewan'; + if ($ntf_name eq 'bewan' && !$::testing) { + if (my $unicorn_packages = $in->do_pkgs->check_kernel_module_packages('unicorn-kernel', 'unicorn')) { + $in->do_pkgs->install(@$unicorn_packages); + } } } if (exists($isdn_cards{$ntf_name})) { @@ -836,7 +845,7 @@ and copy the mgmt.o in /usr/share/speedtouch", 'http://prdownloads.sourceforge.n { pre => sub { # preselect right protocol for ethernet though connections: - if (!exists $adsl_devices{$ntf_name}) { + if (!exists $adsl_descriptions{$ntf_name}) { $ethntf = $intf->{$ntf_name} ||= { DEVICE => $ntf_name }; $adsl_type ||= $ethntf->{BOOTPROTO} || "dhcp"; #- FIXME: use static instead of manual as key in %adsl_types -- cgit v1.2.1