diff --git a/src/main.cpp b/src/main.cpp index b93a450..fc7dbad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -72,6 +72,7 @@ int main(int argc, char *argv[]) QFile::remove("/tmp/gui_apps_stopped"); break; } + QThread::msleep(500); } writeFile("/opt/ibxd", "gui_apps_start\n"); while(true) { @@ -88,6 +89,7 @@ int main(int argc, char *argv[]) break; } } + QThread::msleep(500); } updateUserAppsMainJsonFile(); } diff --git a/src/splash/usbmsSplash.cpp b/src/splash/usbmsSplash.cpp index bddb89c..4a49587 100644 --- a/src/splash/usbmsSplash.cpp +++ b/src/splash/usbmsSplash.cpp @@ -77,17 +77,41 @@ void usbmsSplash::usbmsLaunch() if(checkconfig("/external_root/run/encfs_mounted") == true) { writeFile("/external_root/run/encfs_stop_cleanup", "true"); writeFile("/opt/ibxd", "encfs_stop\n"); - QThread::msleep(1500); + while(true) { + if(QFile::exists("/tmp/encfs_stopped")) { + QFile::remove("/tmp/encfs_stopped"); + break; + } + QThread::msleep(500); + } + } + + writeFile("/opt/ibxd", "gui_apps_stop\n"); + while(true) { + if(QFile::exists("/tmp/gui_apps_stopped")) { + QFile::remove("/tmp/gui_apps_stopped"); + break; + } + QThread::msleep(500); } writeFile("/opt/ibxd", "onboard_unmount\n"); - QThread::msleep(1000); + while(true) { + if(QFile::exists("/tmp/onboard_unmounted")) { + QFile::remove("/tmp/onboard_unmounted"); + break; + } + QThread::msleep(500); + } writeFile("/opt/ibxd", "usbnet_stop\n"); - QThread::msleep(1000); - - writeFile("/opt/ibxd", "gui_apps_stop\n"); - QThread::msleep(1000); + while(true) { + if(QFile::exists("/tmp/usbnet_stopped")) { + QFile::remove("/tmp/usbnet_stopped"); + break; + } + QThread::msleep(500); + } if(global::deviceID == "n306\n" or global::deviceID == "n249\n" or global::deviceID == "n873\n") { QProcess::execute("insmod", QStringList() << "/external_root/lib/modules/fs/configfs/configfs.ko"); @@ -200,13 +224,34 @@ void usbmsSplash::restartServices() { // Restarting USBNet // NOTE: USBNet is only started if required conditions are met (see https://github.com/Kobo-InkBox/rootfs/blob/master/etc/init.d/usbnet) writeFile("/opt/ibxd", "usbnet_start\n"); - QThread::msleep(5000); + while(true) { + if(QFile::exists("/tmp/usbnet_started")) { + QFile::remove("/tmp/usbnet_started"); + break; + } + QThread::msleep(500); + } + // Mounting onboard storage writeFile("/opt/ibxd", "onboard_mount\n"); - QThread::msleep(1000); + while(true) { + if(QFile::exists("/tmp/onboard_mounted")) { + QFile::remove("/tmp/onboard_mounted"); + break; + } + QThread::msleep(500); + } + // Checking for updates writeFile("/opt/ibxd", "update_inkbox_restart\n"); - QThread::msleep(2500); + while(true) { + if(QFile::exists("/tmp/update_inkbox_restarted")) { + QFile::remove("/tmp/update_inkbox_restarted"); + break; + } + QThread::msleep(500); + } + QFile::remove("/tmp/in_usbms"); // GUI apps: update main JSON file writeFile("/opt/ibxd", "gui_apps_start\n"); @@ -223,6 +268,7 @@ void usbmsSplash::restartServices() { break; } } + QThread::msleep(500); } // Remove macOS dotfiles { diff --git a/src/widgets/dialogs/generaldialog.cpp b/src/widgets/dialogs/generaldialog.cpp index 7d76043..3834ebb 100644 --- a/src/widgets/dialogs/generaldialog.cpp +++ b/src/widgets/dialogs/generaldialog.cpp @@ -786,6 +786,7 @@ void generalDialog::waitForGutenbergSearchDone() { break; } } + QThread::msleep(500); } } diff --git a/src/widgets/dialogs/library/bookinfodialog.cpp b/src/widgets/dialogs/library/bookinfodialog.cpp index 1196537..a85cb0e 100644 --- a/src/widgets/dialogs/library/bookinfodialog.cpp +++ b/src/widgets/dialogs/library/bookinfodialog.cpp @@ -179,5 +179,6 @@ void bookInfoDialog::waitForBookFetch() { break; } } + QThread::msleep(500); } }