Implemented soft reset option

This commit is contained in:
Nicolas Mailloux 2021-04-01 17:36:42 -04:00
parent 22a3cb25ae
commit 27444a8d88
2 changed files with 19 additions and 12 deletions

View file

@ -70,8 +70,15 @@ void generalDialog::on_cancelBtn_clicked()
void generalDialog::on_okBtn_clicked()
{
if(resetDialog == true) {
// Reset the device ... some code to come
;
// Soft-reset the device
// We set a custom boot flag and reboot silently in Diagnostics
string_writeconfig("/external_root/boot/flags/DIAGS_BOOT", "true");
string_writeconfig("/external_root/boot/flags/DO_SOFT_RESET", "true");
QString prog ("reboot");
QStringList args;
QProcess *proc = new QProcess();
proc->start(prog, args);
proc->waitForFinished();
}
if(updateDialog == true) {
string_writeconfig("/mnt/onboard/onboard/.inkbox/can_really_update", "true");

View file

@ -208,16 +208,6 @@ MainWindow::MainWindow(QWidget *parent)
QFile::copy("/mnt/onboard/onboard/.inkbox/rootfs-internal.sh", "/tmp/rootfs-internal.sh");
// First script
QString rootfs_prog ("chroot");
QStringList rootfs_args;
rootfs_args << "/external_root" << "/tmp/rootfs.sh";
// Removing script
QFile::remove("/mnt/onboard/onboard/.inkbox/rootfs.sh");
QProcess *rootfs_proc = new QProcess();
rootfs_proc->start(rootfs_prog, rootfs_args);
rootfs_proc->waitForFinished();
// Second script
QString rootfs_internal_prog ("sh");
QStringList rootfs_internal_args;
rootfs_internal_args << "/tmp/rootfs-internal.sh";
@ -227,6 +217,16 @@ MainWindow::MainWindow(QWidget *parent)
rootfs_internal_proc->start(rootfs_internal_prog, rootfs_internal_args);
rootfs_internal_proc->waitForFinished();
// Second script
QString rootfs_prog ("chroot");
QStringList rootfs_args;
rootfs_args << "/external_root" << "/tmp/rootfs.sh";
// Removing script
QFile::remove("/mnt/onboard/onboard/.inkbox/rootfs.sh");
QProcess *rootfs_proc = new QProcess();
rootfs_proc->start(rootfs_prog, rootfs_args);
rootfs_proc->waitForFinished();
// Rebooting if needed
if(reboot_after_update == true) {
QString rebootProg("busybox");