-static int detectHardware() {
+int detectHardware(int delay) {
int child, rc, status;
int timeout = 0; /* FIXME: commandline option for this */
@@ -100,6 +100,13 @@ static int detectHardware() {
if (rc) {
return LOADER_ERROR;
}
+
+ /*
+ * if delay was requested, give kernel time to process everything
+ * (as an example: usb-storage has an internal delay we need to wait for..)
+ */
+ sleep(delay);
+
return LOADER_OK;
}
@@ -146,5 +154,5 @@ int busProbe(int justProbe) {
/* autodetect whatever we can */
if (justProbe)
return 0;
- return detectHardware();
+ return detectHardware(0);
}
diff --git a/loader/hardware.h b/loader/hardware.h
index 47c34d2..2158784 100644
--- a/loader/hardware.h
+++ b/loader/hardware.h
@@ -23,6 +23,13 @@
#include "modules.h"
int earlyModuleLoad(int justProbe);
+
+/* does explicit hardware detection with configurable delay after
+ udev finishes it's stuff */
+int detectHardware(int delay);
+
+/* legacy hardware detection, checks NO_PROBE flag and if not present
+ calls detectHardware(0); */
int busProbe(int justProbe);
/* hardware stuff */
@@ -2150,8 +2151,8 @@ int main(int argc, char ** argv) {
/* Save list of preloaded modules so we can restore the state */
moduleState = mlSaveModuleState();
- /* Load all known devices */
- busProbe(FL_NOPROBE(flags));
+ /* Load all known devices (allow 2s delay for kernel stuff) */
+ if (!FL_NOPROBE(flags)) detectHardware(2);
if (FL_AUTOMODDISK(flags)) {
/* Load all autodetected DDs */
@@ -2195,7 +2196,7 @@ int main(int argc, char ** argv) {
/* Unload all devices and load them again to use the updated modules */
mlRestoreModuleState(moduleState);
- busProbe(FL_NOPROBE(flags));
+ if (!FL_NOPROBE(flags)) detectHardware(2);
}
- /* Reset depmod & modprobe to normal mode and get the rest of drivers*/
+ /* Reset depmod & modprobe to normal mode and get the rest of drivers */
mlFreeModuleState(moduleState);
- busProbe(FL_NOPROBE(flags));
+ if (!FL_NOPROBE(flags)) detectHardware(2);
/* HAL daemon */
if (fork() == 0) {
--
1.7.4.4
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
10-05-2011, 10:15 AM
Ales Kozumplik
Wait after udev settles in DD code as usb has hardcoded timeout in kernel module
It seems to me it would be better to split this patch into two parts:
1) the first one gets rid of busProbe. It doesn't do much and the only
remaining places with it after your patch are two calls in driverdisc.c
2) add the timeout magic and use the new parameter as appropriate.
Ales
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
10-05-2011, 07:47 PM
Chris Lumens
Wait after udev settles in DD code as usb has hardcoded timeout in kernel module
> @@ -2150,8 +2151,8 @@ int main(int argc, char ** argv) {
> /* Save list of preloaded modules so we can restore the state */
> moduleState = mlSaveModuleState();
>
> - /* Load all known devices */
> - busProbe(FL_NOPROBE(flags));
> + /* Load all known devices (allow 2s delay for kernel stuff) */
> + if (!FL_NOPROBE(flags)) detectHardware(2);
>
> if (FL_AUTOMODDISK(flags)) {
> /* Load all autodetected DDs */
What assurance do we have that this delay will be long enough?
In general, I really dislike adding miscellaneous delays. It doesn't
really solve the underlying problems, just makes us take longer.
- Chris
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list