SWUpdate API with Qt

189 views Asked by At

I'm trying to update my application using SWUpdate tool for my embedded board. I already created my .swu pack, anche with ssh command line, it works fine. I need to launch the update from my Qt application. How can I do?

Maybe I can launch QProcess::execute("swupdate -i /run/media/AppUpdate.swu"), but it still not working.

How can I link with Qt the SWUpdate API installed?

Thanks.

1

There are 1 answers

1
markus-nm On

You did not state which Qt version you are using. The more recent ones deprecated the QProcess::execute call as you are using it (program name and arguments in one string).

Try this:

QProcess* proc = new QProcess;
proc->setProgram("swupdate");
proc->setArguments(QStringList({"-i", "path/to/your/update.swu"});
proc->start();
if (!proc->waitForStarted()) 
    qCritical() << "failed to start swupdate: " << proc->errorString();
/*optional: block/wait for swupdate to finish*/
proc->waitForFinished(-1);

I recommend to also implement and connect the readyRead signal and save/log swupdate's output in case something goes wrong during the update.