From a94dd3f38209eaf519ef49709e12cd7db2f74444 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 19 Sep 2005 09:48:15 +0000 Subject: ugly hack: wait for usb-storage devices to appear (bugzilla #13395) --- perl-install/modules.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'perl-install/modules.pm') diff --git a/perl-install/modules.pm b/perl-install/modules.pm index aa1358498..e34f16fd1 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -65,7 +65,19 @@ sub load_raw { or !run_program::run('/sbin/modprobe', '-n', $_) #- ignore missing modules or die "insmod'ing module $_ failed" foreach @$l; } - sleep 2 if any { /^(usb-storage|mousedev|printer)$/ } @$l; + if (any { /^(mousedev|printer)$/ } @$l) { + sleep 2; + } elsif (member('usb-storage', @$l)) { + #- usb-storage is only modprobed when we know there is some scsi devices + #- so trying hard to wait for devices to be detected + my $retry = 10; + sleep 1; #- TOREMOVE for compatibility with previous behaviour: wait at least 2 seconds + do { + sleep 1; + last if all('/sys/bus/scsi/devices'); + log::l("waiting for usb-storage devices to appear (retry = $retry)"); + } until !$retry--; + } } sub load_with_options { my ($l, $h_options) = @_; -- cgit v1.2.1