Related: rhbz#732496 --- loader/hardware.c | 12 ++++++++++-- loader/hardware.h | 7 +++++++ loader/loader.c | 11 ++++++----- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/loader/hardware.c b/loader/hardware.c index 0b19986..0f402bc 100644 --- a/loader/hardware.c +++ b/loader/hardware.c @@ -45,7 +45,7 @@ /* boot flags */ extern uint64_t flags; -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; } @@ -139,6 +146,7 @@ int earlyModuleLoad(int justProbe) { mlLoadModuleSet(argv[i] + 11); } } + return 0; } @@ -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); #endif diff --git a/loader/loader.c b/loader/loader.c index 33f76ad..c217068 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -78,6 +78,7 @@ #include "modules.h" #include "moduleinfo.h" +#include "hardware.h" #include "driverdisk.h" /* 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); } ddcontinue: @@ -2224,9 +2225,9 @@ int main(int argc, char ** argv) { getDDFromSource(&loaderData, "path:/dd.img", moduleState); } - /* 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@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list