PDA

View Full Version : Detect Resume from Standby / Mem



evanol
15th June 2015, 09:23
Hi,

We are currently developing an embedded device based on the am335x sdk from ti (based on arago-project.org)

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?

Thank

evanol
19th June 2015, 09:23
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.