From 34644c0e005db1265884ef05306285e2eb609243 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 24 Nov 2003 11:42:43 +0000 Subject: fix isdn detection: detect all isdn cards, not only the first one --- perl-install/network/isdn.pm | 23 ++++++++++++++++------- perl-install/network/netconnect.pm | 7 +++---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm index 89161e78e..d0e083fef 100644 --- a/perl-install/network/isdn.pm +++ b/perl-install/network/isdn.pm @@ -17,9 +17,14 @@ use MDK::Common::File; @EXPORT = qw(isdn_write_config isdn_write_config_backend get_info_providers_backend isdn_ask_info isdn_ask_protocol isdn_ask isdn_detect isdn_detect_backend isdn_get_list isdn_get_info); sub configure { - my ($netcnx, $netc, $_isdn) = @_; + my ($netcnx, $netc) = @_; + configure_device($netcnx, $netc, $_) foreach values %{$netc->{autodetect}{isdn}}; +} + +sub configure_device { + my ($netcnx, $netc, $isdn) = @_; isdn_step_1: - defined $netc->{autodetect}{isdn}{id} and goto intern_pci; + defined $isdn->{id} and goto intern_pci; my $e = $in->ask_from_list_(N("Network Configuration Wizard"), N("What kind is your ISDN connection?"), [ N_("Internal ISDN card"), N_("External ISDN modem") ] @@ -28,7 +33,7 @@ sub configure { if ($e =~ /card/) { intern_pci: $netc->{isdntype} = 'isdn_internal'; - $netcnx->{isdn_internal}{$_} = $netc->{autodetect}{isdn}{$_} foreach 'description', 'vendor', 'id', 'driver', 'card_type', 'type'; + $netcnx->{isdn_internal} = $isdn; $netcnx->{isdn_internal} = isdn_read_config($netcnx->{isdn_internal}); isdn_detect($netcnx->{isdn_internal}, $netc) or goto isdn_step_1; } else { @@ -85,7 +90,7 @@ defaultroute substInFile { s/^FIRMWARE.*\n//; $_ .= qq(FIRMWARE="$isdn->{firmware}"\n) if eof } "$prefix/etc/sysconfig/network-scripts/ifcfg-ippp0"; # we start the virtual interface at boot (we dial only on demand. - substInFile { s/^ONBOOT.*\n//; $_ .= qq(ONBOOT=yes\n) if eof } "$prefix/etc/sysconfig/network-scripts/ifcfg-ippp0"; + substInFile { s/^ONBOOT.*\n//; $_ .= qq(ONBOOT=yes\n) if eof } "$prefix/etc/sysconfig/network-scripts/ifcfg-ippp$isdn->{intf_id}"; write_secret_backend($isdn->{login}, $isdn->{passwd}); @@ -246,17 +251,21 @@ sub isdn_detect { sub isdn_detect_backend() { my $isdn = { }; - if (my ($c) = modules::probe_category('network/isdn')) { - $isdn = { map { $_ => $c->{$_} } qw(description vendor id driver card_type type) }; + each_index { + my $c = $_; + $isdn->{$::i} = { map { $_ => $c->{$_} } qw(description vendor id driver card_type type) }; + my $isdn = $isdn->{$::i}; + $isdn->{intf_id} = $::i; $isdn->{$_} = sprintf("%0x", $isdn->{$_}) foreach 'vendor', 'id'; $isdn->{card_type} = $c->{bus} eq 'USB' ? 'usb' : 'pci'; ($isdn->{type}) = $isdn->{options} =~ /type=(\d+)/; + $isdn->{description} =~ s/.*\|//; # $c->{options} !~ /id=HiSax/ && $isdn->{driver} eq "hisax" and $c->{options} .= " id=HiSax"; if ($c->{options} !~ /protocol=/ && $isdn->{protocol} =~ /\d/) { modules::set_options($c->{driver}, $c->{options} . " protocol=" . $isdn->{protocol}); } $c->{options} =~ /protocol=(\d)/ and $isdn->{protocol} = $1; - } + } modules::probe_category('network/isdn'); $isdn; } diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 9faf60002..1f3149ffd 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -18,7 +18,6 @@ sub detect { my ($auto_detect) = @_; require network::isdn; $auto_detect->{isdn} = network::isdn::isdn_detect_backend(); - $auto_detect->{isdn}{description} =~ s/.*\|//; modules::load_category('network/main|gigabit|usb'); require network::ethernet; @@ -107,7 +106,7 @@ If you don't want to use the auto detection, deselect the checkbox. my %net_conf_callbacks = (adsl => sub { require network::adsl; network::adsl::configure($netcnx, $netc, $intf, $first_time) }, cable => sub { require network::ethernet; network::ethernet::configure_cable($netcnx, $netc, $intf, $first_time) }, - isdn => sub { require network::isdn; network::isdn::configure($netcnx, $netc, undef) }, + isdn => sub { require network::isdn; network::isdn::configure($netcnx, $netc) }, lan => sub { require network::ethernet; network::ethernet::configure_lan($netcnx, $netc, $intf, $first_time) }, modem => sub { require network::modem; network::modem::configure($in, $netcnx, $mouse, $netc) }, winmodem => sub { require network::modem; network::modem::winmodemConfigure($in, $netcnx, $mouse, $netc) }, @@ -116,13 +115,13 @@ If you don't want to use the auto detection, deselect the checkbox. $conf{$_} = values %{$netc->{autodetect}{$_}} ? 1 : 0 foreach 'lan'; $conf{$_} = $netc->{autodetect}{$_} ? 1 : 0 foreach qw(adsl cable modem winmodem); - $conf{isdn} = $netc->{autodetect}{isdn}{driver} ? 1 : 0; + $conf{isdn} = any { $_->{driver} } values %{$netc->{autodetect}{isdn}}; step_2: my @l = ( [ join('', N("Normal modem connection"), if_($conf{modem}, " - " . N("detected on port %s", $netc->{autodetect}{modem}))), \$conf{modem} ], [ join('', N("Winmodem connection"), if_($conf{winmodem}, " - " . N("detected"))), \$conf{winmodem} ], - [ join('', N("ISDN connection"), if_($conf{isdn}, " - " . N("detected %s", $netc->{autodetect}{isdn}{description}))), \$conf{isdn} ], + [ join('', N("ISDN connection"), if_($conf{isdn}, " - " . N("detected %s", join(', ', map { $_->{description} } values %{$netc->{autodetect}{isdn}})))), \$conf{isdn} ], [ join('', N("ADSL connection"), if_($conf{adsl}, " - " . N("detected"))), \$conf{adsl} ], [ join('', N("Cable connection"), if_($conf{cable}, " - " . N("cable connection detected"))), \$conf{cable} ], [ join('', N("LAN connection"), if_($conf{lan}, " - " . N("ethernet card(s) detected"))), \$conf{lan} ] -- cgit v1.2.1