diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-03-03 11:45:48 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-03-03 11:45:48 +0000 |
commit | 96229f24bfb9732c377f650bb1c5c2fd31f36fad (patch) | |
tree | bdd4475c6a07665f4aae9c31c8a3382eeff13827 /perl-install/detect_devices.pm | |
parent | 2e874f7ba0ecafe32de081da72eaab51dd20a920 (diff) | |
download | drakx-backup-do-not-use-96229f24bfb9732c377f650bb1c5c2fd31f36fad.tar drakx-backup-do-not-use-96229f24bfb9732c377f650bb1c5c2fd31f36fad.tar.gz drakx-backup-do-not-use-96229f24bfb9732c377f650bb1c5c2fd31f36fad.tar.bz2 drakx-backup-do-not-use-96229f24bfb9732c377f650bb1c5c2fd31f36fad.tar.xz drakx-backup-do-not-use-96229f24bfb9732c377f650bb1c5c2fd31f36fad.zip |
fix get_usb_storage_info() on kernel 2.6
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r-- | perl-install/detect_devices.pm | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index a78b395f6..8dd0d958f 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -102,7 +102,26 @@ sub get_sys_cdrom_info { } } -sub get_usb_storage_info { +sub get_usb_storage_info_26 { + my (@l) = @_; + + my @entries = glob_("/sys/bus/usb/devices/*:*") or return; + + my @informed; + foreach my $scsi (@l) { + my $usb_dir = find { -d "$_/host$scsi->{host}" } @entries or next; + $usb_dir =~ s/:[^:]*$//; + if (-e "$usb_dir/idVendor") { + add2hash($scsi, { usb_vendor => hex(chomp_(cat_("$usb_dir/idVendor"))), usb_id => hex(chomp_(cat_("$usb_dir/idProduct"))) }); + push @informed, $scsi; + } else { + log::l("weird in get_usb_storage_info_26 for host $scsi->{host}, usb_dir $usb_dir"); + } + } + @informed; +} + +sub get_usb_storage_info_24 { my (@l) = @_; my %usbs = map { @@ -128,7 +147,13 @@ sub get_usb_storage_info { add2hash($choices[0], $usbs{$host}); push @informed, $choices[0]; } - @informed or return; + @informed; +} + +sub get_usb_storage_info { + my (@l) = @_; + + my @informed = c::kernel_version() =~ /^\Q2.6/ ? get_usb_storage_info_26(@l) : get_usb_storage_info_24(@l) or return; foreach my $usb (usb_probe()) { if (my $e = find { $_->{usb_vendor} == $usb->{vendor} && $_->{usb_id} == $usb->{id} } @informed) { |