diff options
author | Mystery Man <unknown@mandriva.org> | 2005-10-20 14:05:54 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2005-10-20 14:05:54 +0000 |
commit | 9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5 (patch) | |
tree | f3ef7ada2ce82dafb6d41cc087b0cc7fdfc40a46 /perl-install/network/ethernet.pm | |
parent | 3e4ad5e1b687f262a1d7cc39a0b905a595ac7f95 (diff) | |
download | drakx-backup-do-not-use-10736c53ca91aed19de81858bf3358c6b2c9ab13.tar drakx-backup-do-not-use-10736c53ca91aed19de81858bf3358c6b2c9ab13.tar.gz drakx-backup-do-not-use-10736c53ca91aed19de81858bf3358c6b2c9ab13.tar.bz2 drakx-backup-do-not-use-10736c53ca91aed19de81858bf3358c6b2c9ab13.tar.xz drakx-backup-do-not-use-10736c53ca91aed19de81858bf3358c6b2c9ab13.zip |
This commit was manufactured by cvs2svn to create tagV10_34_11_100mdk
'V10_34_11_100mdk'.
Diffstat (limited to 'perl-install/network/ethernet.pm')
-rw-r--r-- | perl-install/network/ethernet.pm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 845d7b3d8..a6e58df1b 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -39,7 +39,8 @@ sub mapIntfToDevice { my ($interface) = @_; my $hw_addr = c::getHwIDs($interface); my ($bus, $slot, $func) = map { hex($_) } ($hw_addr =~ /([0-9a-f]+):([0-9a-f]+)\.([0-9a-f]+)/); - $hw_addr ? grep { $_->{pci_bus} == $bus && $_->{pci_device} == $slot && $_->{pci_function} == $func } detect_devices::probeall() : {}; + $hw_addr && (every { defined $_ } $bus, $slot, $func) ? + grep { $_->{pci_bus} == $bus && $_->{pci_device} == $slot && $_->{pci_function} == $func } detect_devices::probeall() : {}; } @@ -62,8 +63,19 @@ sub get_eth_cards() { ($description) = (mapIntfToDevice($interface))[0]->{description}; } if (!$description) { + my $drv = readlink("/sys/class/net/$interface/driver"); + if ($drv and $drv =~ s!.*/!!) { + $a = $drv; + my %l; + my %sysfs_fields = (id => "device", subid => "subsystem_device", vendor => "vendor", subvendor => "subsystem_vendor"); + $l{$_} = hex(chomp_(cat_("/sys/class/net/$interface/device/" . $sysfs_fields{$_}))) foreach keys %sysfs_fields; + my @cards = grep { my $dev = $_; every { $dev->{$_} eq $l{$_} } keys %l } detect_devices::probeall(); + $description = $cards[0]{description} if $#cards == 0; + } + } + if (!$description) { my @cards = grep { $_->{driver} eq ($a || $saved_driver) } detect_devices::probeall(); - $description = $cards[0]{descripxtion} if @cards == 1; + $description = $cards[0]->{description} if $#cards == 0; } $a and $saved_driver = $a; # handle multiple cards managed by the same driver [ $interface, $saved_driver, if_($description, $description) ] |