在一个名为 tep2020gateway 的USB守护程序中,我有一个函数 swupdating (这正在更新我的应用程序: tep2020ihm ),通过使用通用工具 swupdate 。
在该更新守护程序 tep2020gateway 中:
- 首先,我停止应用程序 tep2020ihm
- 然后,我尝试启动一个名为 update_ivate_ihm 的小型QT应用程序,以显示进度栏我正在更新该应用程序。
- 最终,我启动 swupdate 来解决更新
问题: update_ihm 从未出现的进度栏从未出现,屏幕不会更改,好像没有启动update_ihm应用程序(或停止) 立即立即键入命令(
尽管我键入命令(nohup/usr/bin/update_ihm</dev/null),但 酒吧出现。一切都很好。但是它无法从系统命令中起作用。
这是我的(简短)函数,希望它足够可读:
static void swUpdating(void) {
syslog(LOG_INFO, "Stopping tep2020ihm and starting update_ihm");
int rc = std::system("bash -c 'systemctl stop tep2020ihm; echo >nohup.out; (nohup /usr/bin/update_ihm </dev/null)&'");
syslog(LOG_INFO, "%s %d : Starting Sw_update (stop tep2020ihm/start update_ihm returned rc=%d)", __PRETTY_FUNCTION__, __LINE__, rc);
rc = std::system("bash -c '" SW_UPDATE " -k " PUBLIC_KEY " -K " AES_KEY " -i " DATA_FILE " >" LOG_FILE " 2>&1'");
syslog(LOG_INFO, "%s %d : Sw_update starting returned code: %d", __PRETTY_FUNCTION__, __LINE__, rc);
<...>
unlink(DATA_FILE);
}
您可以看到该功能中有系统列表,我可以在日志中看到它们:
May 24 07:51:26 Tep2020-220 local1.info /usr/bin/tep2020gateway[187]: Stopping tep2020ihm and starting update_ihm
May 24 07:51:26 Tep2020-220 local1.notice /opt/pfd2020/tep2020ihm[207]: received signal #15
May 24 07:51:26 Tep2020-220 local1.notice /usr/bin/tep2020gateway[187]: received signal #17
May 24 07:51:26 Tep2020-220 local1.info /usr/bin/tep2020gateway[187]: void swUpdating() 72 : Starting Sw_update (stop tep2020ihm/start update_ihm returned rc=0)
May 24 07:51:26 Tep2020-220 user.debug swupdate: RUN [extract_sw_description] : Found file: filename sw-description size 596 checksum 0x88ce VERIFIED
May 24 07:51:26 Tep2020-220 user.debug swupdate: RUN [extract_sw_description] : Found file: filename sw-description.sig size 256 checksum 0x7604 VERIFIED
May 24 07:51:26 Tep2020-220 user.debug swupdate: RUN [swupdate_verify_file] : Verify signed image: Read 596 bytes
edit:通过将平台添加到命令中来修复。
当我将这个小的bargraph update_ihm 变成服务时,我收到了“丢失QT插件”的消息时,即平台缺少。这是修复的,我添加了它:
update_ihm-platform linuxfb:fb =/dev/fb0
Inside an USB daemon named tep2020gateway I've got a function swUPdating (that is updating my application: tep2020ihm) by using the generic tool swupdate.
Inside that updater daemon tep2020gateway :
- First I stop the application tep2020ihm
- Then I try to start a small Qt application named update_ihm to display a progress bar while I'm updating the app.
- Eventually I launch swupdate to do the updating
PROBLEM: the progress bar supplied by update_ihm never appears, the screen does not change, as if the update_ihm app was not started (or stopped immediately despite the nohup)
If I type the command (nohup /usr/bin/update_ihm </dev/null)& in a console, that works: the progress bar shows up. Everything works fine. But it does not work from the system command.
Here is my (short) function, I hope it's readable enough:
static void swUpdating(void) {
syslog(LOG_INFO, "Stopping tep2020ihm and starting update_ihm");
int rc = std::system("bash -c 'systemctl stop tep2020ihm; echo >nohup.out; (nohup /usr/bin/update_ihm </dev/null)&'");
syslog(LOG_INFO, "%s %d : Starting Sw_update (stop tep2020ihm/start update_ihm returned rc=%d)", __PRETTY_FUNCTION__, __LINE__, rc);
rc = std::system("bash -c '" SW_UPDATE " -k " PUBLIC_KEY " -K " AES_KEY " -i " DATA_FILE " >" LOG_FILE " 2>&1'");
syslog(LOG_INFO, "%s %d : Sw_update starting returned code: %d", __PRETTY_FUNCTION__, __LINE__, rc);
<...>
unlink(DATA_FILE);
}
You can see there are syslogs in the function, I can see them in the logs:
May 24 07:51:26 Tep2020-220 local1.info /usr/bin/tep2020gateway[187]: Stopping tep2020ihm and starting update_ihm
May 24 07:51:26 Tep2020-220 local1.notice /opt/pfd2020/tep2020ihm[207]: received signal #15
May 24 07:51:26 Tep2020-220 local1.notice /usr/bin/tep2020gateway[187]: received signal #17
May 24 07:51:26 Tep2020-220 local1.info /usr/bin/tep2020gateway[187]: void swUpdating() 72 : Starting Sw_update (stop tep2020ihm/start update_ihm returned rc=0)
May 24 07:51:26 Tep2020-220 user.debug swupdate: RUN [extract_sw_description] : Found file: filename sw-description size 596 checksum 0x88ce VERIFIED
May 24 07:51:26 Tep2020-220 user.debug swupdate: RUN [extract_sw_description] : Found file: filename sw-description.sig size 256 checksum 0x7604 VERIFIED
May 24 07:51:26 Tep2020-220 user.debug swupdate: RUN [swupdate_verify_file] : Verify signed image: Read 596 bytes
EDIT: this was fixed by adding the platform to the command.
When I turned this small bargraph update_ihm into a service I got the message "Missing Qt plugin", i.e. the platform was missing. This was fixed my adding it:
update_ihm --platform linuxfb:fb=/dev/fb0
发布评论
评论(1)
已解决:通过将平台添加到命令中来解决。
当我将这个小的Bargraph Update_ihm 变成服务时,我在Servie的日志中收到了一条错误消息:“缺少QT插件”(即缺少平台)。
当我添加它时,这是修复的: update_ihm -platform linuxfb:fb =/dev/fb0
SOLVED: this was fixed by adding the platform to the command.
When I turned this small bargraph update_ihm into a service I got an error message in the logs of the servie:"Missing Qt plugin" (i.e. the platform was missing).
This was fixed when I added it: update_ihm --platform linuxfb:fb=/dev/fb0