Quantcast
Channel: MobileRead Forums - Kobo Developer's Corner
Viewing all articles
Browse latest Browse all 1574

Glo HD How to exit a "suspended" script (loop)?

$
0
0
Hi there,

if one is running a script without user interaction (e.g. picture frame, dashboard, weather-display ...) what is the best way to return to the ebook reader application without resetting the device?

Example "picture frame":
Current implementation is to have a "while true" loop that updates the image and then sends the reader to "suspend to ram" via rtcwake (e.g. for half an hour - so essentially the reader is in suspend to ram most of the time). What I noticed is that the reader wakes up from suspend to ram when the power button is pressed. I could use this to trigger the script to exit but I am not sure wether the wake up was due to power button press or just at the scheduled time.

I came up with the following ideas:
  • remember the scheduled wake-up-time, compare to actual-wake-up-time. If it differs by more than say 5s assume wake up was due to press of power button -> exit script, restart nickel etc.
  • Monitor /dev/input/event0 in some way
    Code:

    cat /dev/input/event0 | hexdump
    E.g. pipe to file and evaluate if file is empty or not (Was not able to use output of evtest). If file is not empty -> exit script, restart nickel etc.


Which would be the recommended way to implement this? Any other ideas to implement this - is there a way to detect the reason for wake up (i.e. scheduled time reached or power button)?


To restart nickel could this script be used? https://github.com/koreader/koreader...kobo/nickel.sh

Kind regards
KristianR

Viewing all articles
Browse latest Browse all 1574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>