From 1d445950582373c6240ce59f70f63837121131aa Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 28 May 2004 10:09:12 +0000 Subject: (get_eth_cards) fallback on sysfs in order to get driver and card description when ethtool is not supported (eg: ipw2100 driver for intel centrino) --- perl-install/network/ethernet.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'perl-install') diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 193bbf539..a6e58df1b 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -62,6 +62,17 @@ sub get_eth_cards() { } else { ($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]->{description} if $#cards == 0; -- cgit v1.2.1