Qt - How to detect Resume from Standby & Mem states

394 views Asked by At

We are currently developing an embedded device based on the am335x sdk from ti (based on Arago project)

The main application on the device is being developed using 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?

1

There are 1 answers

0
evanol On

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.

I've added kill -USR2 {App.pid} before the call to suspend and kill -USR1 {App.pid} after.

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.