mnc goal is to display when will occurs the next cron job. We drop the "sxmo_screenlock.sh rtc" command and the SXMO_RTCWAKEINTERVAL variable. We will now only use "sxmo_screenlock.sh crust" which mean suspend until next cron job (-2 seconds). To replicate the old behavior of the blinking phone then returning to suspension (if needed) we now use a new script. By example: */15 * * * * DISPLAY=:0 sxmo_rtcwake.sh sleep 10 This will trigger a 10s sleep task every 15 minutes (the old default rtcwake hook). Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>master
parent
02a37c9dea
commit
0ed27f8538
6 changed files with 54 additions and 107 deletions
@ -1,39 +0,0 @@ |
||||
#!/usr/bin/env sh |
||||
|
||||
. "$(which sxmo_common.sh)" |
||||
|
||||
REDLED_PATH="/sys/class/leds/red:indicator/brightness" |
||||
BLUELED_PATH="/sys/class/leds/blue:indicator/brightness" |
||||
|
||||
finish() { |
||||
kill $BLINKPID |
||||
|
||||
echo 0 > "$REDLED_PATH" |
||||
echo 0 > "$BLUELED_PATH" |
||||
|
||||
# Going back to crust |
||||
if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then |
||||
sxmo_screenlock.sh rtc "$SXMO_RTCWAKEINTERVAL" |
||||
fi |
||||
|
||||
exit 0 |
||||
} |
||||
|
||||
trap 'finish' TERM INT EXIT |
||||
|
||||
blink() { |
||||
while [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; do |
||||
echo 1 > "$REDLED_PATH" |
||||
echo 0 > "$BLUELED_PATH" |
||||
sleep 0.5 |
||||
echo 0 > "$REDLED_PATH" |
||||
echo 1 > "$BLUELED_PATH" |
||||
sleep 0.5 |
||||
done |
||||
} |
||||
|
||||
blink & |
||||
BLINKPID=$! |
||||
|
||||
# Replace this by wathever you want to do |
||||
sleep 10 |
@ -1,11 +1,40 @@ |
||||
#!/usr/bin/env sh |
||||
|
||||
# This script (and anything it calls) should return as quickly as possible |
||||
# as it blocks the system from suspending (and processing input) until done |
||||
# shellcheck disable=SC1090 |
||||
. "$(which sxmo_common.sh)" |
||||
|
||||
# If this script returns a non-zero exit code, the system will wake up |
||||
REDLED_PATH="/sys/class/leds/red:indicator/brightness" |
||||
BLUELED_PATH="/sys/class/leds/blue:indicator/brightness" |
||||
|
||||
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/rtcwake" ]; then |
||||
"$XDG_CONFIG_HOME/sxmo/hooks/rtcwake" |
||||
exit $? |
||||
finish() { |
||||
kill $BLINKPID |
||||
|
||||
sxmo_screenlock.sh updateLed |
||||
|
||||
if grep -q rtc "$UNSUSPENDREASONFILE"; then |
||||
# Going back to crust |
||||
if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then |
||||
sxmo_screenlock.sh crust |
||||
fi |
||||
fi |
||||
|
||||
exit 0 |
||||
} |
||||
|
||||
trap 'finish' TERM INT EXIT |
||||
|
||||
blink() { |
||||
while [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; do |
||||
echo 1 > "$REDLED_PATH" |
||||
echo 0 > "$BLUELED_PATH" |
||||
sleep 0.25 |
||||
echo 0 > "$REDLED_PATH" |
||||
echo 1 > "$BLUELED_PATH" |
||||
sleep 0.25 |
||||
done |
||||
} |
||||
|
||||
blink & |
||||
BLINKPID=$! |
||||
|
||||
"$@" |
||||
|
Loading…
Reference in new issue