用QT扫描API

发布于 2025-01-21 02:51:16 字数 229 浏览 3 评论 0原文

我正在尝试使用嵌入式板的 SWUpdate 工具更新我的应用程序。 我已经创建了我的 .swu 包,并使用 ssh 命令行,它工作正常。 我需要从 Qt 应用程序启动更新。 我该怎么办?

也许我可以启动 QProcess::execute("swupdate -i /run/media/AppUpdate.swu"),但它仍然不起作用。

如何与已安装的 Qt SWUpdate API 链接?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魔法唧唧 2025-01-28 02:51:16

您没有说明您正在使用哪个 Qt 版本。较新的版本在您使用 QProcess::execute 调用时弃用了它(程序名称和参数在一个字符串中)。

尝试一下:

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);

我建议还实现并连接 readyRead 信号并保存/记录 swupdate 的输出,以防更新期间出现问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文