summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/detect_devices.pm8
-rw-r--r--perl-install/network/ethernet.pm5
-rw-r--r--perl-install/network/ndiswrapper.pm6
3 files changed, 14 insertions, 5 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 63297d78b..48b5bd7a1 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -579,6 +579,14 @@ sub is_wireless_interface {
c::isNetDeviceWirelessAware($interface) || -e "/sys/class/net/$interface/wireless";
}
+sub get_sysfs_device_id_map {
+ my ($dev_path) = @_;
+ my $is_usb = -f "$dev_path/bInterfaceNumber";
+ $is_usb ?
+ { id => '../idProduct', vendor => '../idVendor' } :
+ { id => "device", subid => "subsystem_device", vendor => "vendor", subvendor => "subsystem_vendor" };
+}
+
sub getNet() {
grep { is_lan_interface($_) }
uniq(
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm
index 298ced456..35e22308b 100644
--- a/perl-install/network/ethernet.pm
+++ b/perl-install/network/ethernet.pm
@@ -100,8 +100,9 @@ sub get_eth_cards {
if ($drv && $drv =~ s!.*/!!) {
$a = $drv unless $detected_through_ethtool;
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 $dev_path = "/sys/class/net/$interface/device";
+ my $sysfs_fields = detect_devices::get_sysfs_device_id_map($dev_path);
+ $l{$_} = hex(chomp_(cat_("$dev_path/" . $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 == 1;
}
diff --git a/perl-install/network/ndiswrapper.pm b/perl-install/network/ndiswrapper.pm
index 6adb1f1fa..8bbc731c9 100644
--- a/perl-install/network/ndiswrapper.pm
+++ b/perl-install/network/ndiswrapper.pm
@@ -55,9 +55,9 @@ sub find_matching_devices {
foreach my $interface (all($net_path)) {
my $dev_path = "$net_path/$interface/device";
-l $dev_path or next;
-
- my %map = (vendor => 'vendor', device => 'id');
- if (every { hex(chomp_(cat_("$dev_path/$_"))) eq $device->{$map{$_}} } keys %map) {
+ my $is_usb = -f "$dev_path/bInterfaceNumber";
+ my $map = detect_devices::get_sysfs_device_id_map($dev_path);
+ if (every { hex(chomp_(cat_("$dev_path/" . $map->{$_}))) eq $device->{$_} } keys %$map) {
my $driver = readlink("$net_path/$interface/driver");
$driver =~ s!.*/!!;
push @devices, [ $interface, $driver ];