From 4798717d9d7c982bf0bf7c44cf4316a0a08dbc82 Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sun, 25 Jul 2021 14:19:35 +0200 Subject: [PATCH] implemented a --strict mode for sxmo_rtcwake in which it only runs when coming from crust Signed-off-by: Stacy Harper --- scripts/core/sxmo_rtcwake.sh | 13 +++++++++++-- scripts/core/sxmo_screenlock.sh | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/core/sxmo_rtcwake.sh b/scripts/core/sxmo_rtcwake.sh index d99f9d4..0911032 100644 --- a/scripts/core/sxmo_rtcwake.sh +++ b/scripts/core/sxmo_rtcwake.sh @@ -17,13 +17,12 @@ finish() { echo "sxmo_rtcwake: going back to crust ($(date))" >&2 sxmo_screenlock.sh crust else - echo "sxmo_rtcwake: not returning to crust ($(date))" >&2 + echo "sxmo_rtcwake: returning without crust ($(date))" >&2 fi exit 0 } -trap 'finish' TERM INT EXIT blink() { while [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; do @@ -36,6 +35,16 @@ blink() { done } +if [ "$1" = "--strict" ]; then + shift + #don't run if we're not in crust or not waked by rtc + if ! grep -q crust "$LASTSTATE" || ! grep -q rtc "$UNSUSPENDREASONFILE"; then + exit 0 + fi +fi + +trap 'finish' TERM INT EXIT + blink & BLINKPID=$! diff --git a/scripts/core/sxmo_screenlock.sh b/scripts/core/sxmo_screenlock.sh index 978290e..b651aa8 100755 --- a/scripts/core/sxmo_screenlock.sh +++ b/scripts/core/sxmo_screenlock.sh @@ -72,7 +72,7 @@ updateLed() { esac } -if [ "$1" != "getCurState" ]; then +if [ "$1" != "getCurState" ] && [ "$1" != "updateLed" ]; then d=$(date) echo "sxmo_screenlock: transitioning to stage $1 ($d)" >&2 fi