summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-04-19 16:04:10 +0000
committerOlivier Blin <oblin@mandriva.org>2005-04-19 16:04:10 +0000
commite0f4d280b956d5a21e58094d1ff3550881a35dee (patch)
tree501bdd7bb26a4a6410a4cfc797de6af306cb313e /perl-install/network
parente88b5cff26aeeb3b83344d8b5ef393e046978bf8 (diff)
downloaddrakx-e0f4d280b956d5a21e58094d1ff3550881a35dee.tar
drakx-e0f4d280b956d5a21e58094d1ff3550881a35dee.tar.gz
drakx-e0f4d280b956d5a21e58094d1ff3550881a35dee.tar.bz2
drakx-e0f4d280b956d5a21e58094d1ff3550881a35dee.tar.xz
drakx-e0f4d280b956d5a21e58094d1ff3550881a35dee.zip
do not show empty ndiswrapper devices list
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/netconnect.pm36
-rw-r--r--perl-install/network/tools.pm17
2 files changed, 31 insertions, 22 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index d6a790966..a71423b9c 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -1133,7 +1133,15 @@ notation (for example, 1.2.3.4).")),
return 1;
}
},
- next => 'ndiswrapper_intf',
+ post => sub {
+ if (keys %eth_intf ) {
+ return 'ndiswrapper_intf';
+ } else {
+ $ntf_name = network::tools::ndiswrapper_setup();
+ $ethntf = $intf->{$ntf_name} ||= { DEVICE => $ntf_name };
+ return 'lan_protocol';
+ }
+ }
},
ndiswrapper_intf =>
@@ -1143,29 +1151,13 @@ notation (for example, 1.2.3.4).")),
},
data => sub {
[ { label => N("Net Device"), type => "list", val => \$ntf_name, list => [ sort keys %eth_intf ],
- format => sub { translate($eth_intf{$_[0]}) }, allow_empty_list => 1 } ];
+ format => sub { translate($eth_intf{$_[0]}) } } ];
},
post => sub {
- if ($ntf_name) {
- #- if another module is loaded for the wireless interface, unload it before using ndiswrapper
- my $eth = find { $_->[0] eq $ntf_name } @all_cards;
- $ntf_name and modules::unload($eth->[1]);
- }
- modules::unload("ndiswrapper");
- #- unload ndiswrapper first so that the newly installed .inf files will be read
- modules::load("ndiswrapper");
-
- #- FIXME: move this somewhere in get_eth_cards, so that configure_eth_aliases correctly writes ndiswrapper
- #- find the first interface matching an ndiswrapper driver, try ethtool then sysfs
- my @available_drivers = network::tools::ndiswrapper_available_drivers();
- $ntf_name = find {
- my $drv = c::getNetDriver($_) || readlink("/sys/class/net/$_/driver");
- $drv =~ s!.*/!!;
- member($drv, @available_drivers);
- } detect_devices::getNet();
- #- fallback on wlan0
- $ntf_name ||= "wlan0";
-
+ #- if another module is loaded for the wireless interface, unload it before using ndiswrapper
+ my $eth = find { $_->[0] eq $ntf_name } @all_cards;
+ $eth and modules::unload($eth->[1]);
+ $ntf_name = network::tools::ndiswrapper_setup();
$ethntf = $intf->{$ntf_name} ||= { DEVICE => $ntf_name };
return 'lan_protocol';
},
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index de3f8a4b5..9c5ea152c 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -304,4 +304,21 @@ sub ndiswrapper_available_drivers() {
`ndiswrapper -l` =~ /(\w+)\s+driver present, hardware present/mg;
}
+sub ndiswrapper_setup() {
+ modules::unload("ndiswrapper");
+ #- unload ndiswrapper first so that the newly installed .inf files will be read
+ modules::load("ndiswrapper");
+
+ #- FIXME: move this somewhere in get_eth_cards, so that configure_eth_aliases correctly writes ndiswrapper
+ #- find the first interface matching an ndiswrapper driver, try ethtool then sysfs
+ my @available_drivers = network::tools::ndiswrapper_available_drivers();
+ my $ntf_name = find {
+ my $drv = c::getNetDriver($_) || readlink("/sys/class/net/$_/driver");
+ $drv =~ s!.*/!!;
+ member($drv, @available_drivers);
+ } detect_devices::getNet();
+ #- fallback on wlan0
+ return $ntf_name || "wlan0";
+}
+
1;