简体   繁体   English

Qt-如何从待机和内存状态检测恢复

[英]Qt - How to detect Resume from Standby & Mem states

We are currently developing an embedded device based on the am335x sdk from ti (based on Arago project ) 我们目前正在开发基于ti的am335x sdk的嵌入式设备(基于Arago项目

The main application on the device is being developed using Qt4.8 设备上的主要应用程序正在使用Qt4.8开发

We want to detect when the device is entering Standby / Mem states so that we can save data and suspend our main application 我们想检测设备何时进入待机/内存状态,以便我们可以保存数据并挂起主应用程序

We also want to detect when the device is resuming from these states so that the main application can be resumed correctly 我们还希望检测设备何时从这些状态中恢复,以便可以正确恢复主应用程序

Does anyone have experience / information / links to how this may be achieved? 是否有人有经验/信息/链接以实现此目标?

I've found a solution to my issue above. 我在上面找到了解决我问题的方法。

On our system the Standby / Mem state can be invoked via a script /usr/bin/pm_suspend.sh which in turn calls echo mem > /sys/power/state to suspend the device to memory. 在我们的系统上,可以通过脚本/usr/bin/pm_suspend.sh调用Standby / Mem状态,然后调用echo mem > /sys/power/state将设备挂起到内存。

I've added kill -USR2 {App.pid} before the call to suspend and kill -USR1 {App.pid} after. 我在调用挂起之前添加了kill -USR2 {App.pid}并在调用之后添加了kill -USR1 {App.pid}

My application understands that USR2 is a signal to save our data and delete our main form and that USR1 is a signal to spawn a new instance of our main form. 我的应用程序知道USR2是保存我们的数据并删除我们的主窗体的信号,而USR1是发出我们主窗体的新实例的信号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM