summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-10-05 17:43:07 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-10-05 17:43:07 +0000
commit837e99171e20798228ce71d01cfe5bea971a222c (patch)
tree5c0f3443a456d46f49939077c902cd834ae0078e /perl-install
parent051a74ba990a24ed21cd6003c80e66a7e6fe09c8 (diff)
downloaddrakx-837e99171e20798228ce71d01cfe5bea971a222c.tar
drakx-837e99171e20798228ce71d01cfe5bea971a222c.tar.gz
drakx-837e99171e20798228ce71d01cfe5bea971a222c.tar.bz2
drakx-837e99171e20798228ce71d01cfe5bea971a222c.tar.xz
drakx-837e99171e20798228ce71d01cfe5bea971a222c.zip
(get_sysfs_usbpath_for_block) introduce it in order to factorize code
(complete_usb_storage_info) use sane way for handling multiple USB disks of the same vendor (aka compare hosts)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/detect_devices.pm19
1 files changed, 16 insertions, 3 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 41ae7181f..44e0dff8b 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -141,8 +141,15 @@ sub complete_usb_storage_info {
foreach my $usb (usb_probe()) {
if (my $e = find { !$_->{found} && $_->{usb_vendor} == $usb->{vendor} && $_->{usb_id} == $usb->{id} } @usb) {
+ my $host = get_sysfs_usbpath_for_block($e->{device});
+ if ($host) {
+ $e->{info} = chomp_(cat_("/sys/block/$e->{device}/$host/../serial"));
+ $e->{usb_description} = join('|',
+ chomp_(cat_("/sys/block/$e->{device}/$host/../manufacturer")),
+ chomp_(cat_("/sys/block/$e->{device}/$host/../product")));
+ }
local $e->{found} = 1;
- $e->{"usb_$_"} = $usb->{$_} foreach keys %$usb;
+ $e->{"usb_$_"} ||= $usb->{$_} foreach keys %$usb;
}
}
}
@@ -192,13 +199,19 @@ sub may_be_a_hd {
);
}
+sub get_sysfs_usbpath_for_block {
+ my ($device) = @_;
+ my $host = readlink("/sys/block/$device/device");
+ $host =~ s!/host.*!!;
+ $host;
+}
+
sub get_scsi_driver {
my (@l) = @_;
# find driver of host controller from sysfs:
foreach (@l) {
next if $_->{driver};
- my $host = readlink("/sys/block/$_->{device}/device");
- $host =~ s!/host.*!!;
+ my $host = get_sysfs_usbpath_for_block($_->{device});
$_->{driver} = readlink("/sys/block/$_->{device}/$host/driver");
$_->{driver} =~ s!.*/!!;
}