answered
2020-01-04 15:56:41 +0200
Assuming you are atm interested in easy options rather than optimizing pm behavior, executing
mcetool --set-suspend-policy=early
-> Allows phone to power off display and touch, but cpu is kept alive -> a polling script should work without extra effort, but battery consumption increases significantly.
mcetool --set-suspend-policy=disable_on_charger
-> Disables suspending altogether, but only while phone is connected to charger. An attempt is also made to keep touch panel powered on (and hence display too to some extent) - which might cause touch issues on some device types.
Note that even if systemd timers / timed alarms are successfully used for waking up the device to trigger the script, the device might still suspend during script execution. This can be worked around by wrapping the script exec with keepalive-tool e.g. while something like "sleep 120" could end up getting suspended, "keepalive-tool sleep 120" ought not.