diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-05-02 08:56:10 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-05-02 08:56:10 +0000 |
commit | d7b672aeb285a54570198714812b3ecf610b40f4 (patch) | |
tree | 89fcf16758a71bf60f1bad0133f6491f46a777d7 | |
parent | 8547eaa3c667ab5761786cfe95c66dc4f9bba8a9 (diff) | |
download | drakx-d7b672aeb285a54570198714812b3ecf610b40f4.tar drakx-d7b672aeb285a54570198714812b3ecf610b40f4.tar.gz drakx-d7b672aeb285a54570198714812b3ecf610b40f4.tar.bz2 drakx-d7b672aeb285a54570198714812b3ecf610b40f4.tar.xz drakx-d7b672aeb285a54570198714812b3ecf610b40f4.zip |
fix USB devices detection for ndiswrapper
-rw-r--r-- | perl-install/detect_devices.pm | 8 | ||||
-rw-r--r-- | perl-install/network/ethernet.pm | 5 | ||||
-rw-r--r-- | perl-install/network/ndiswrapper.pm | 6 |
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 ]; |