Files
sxmo-utils/scripts/core/sxmo_debug_suspend.sh
Aren Moynihan 6638fc402b Add logging to sxmo_hook_block_suspend
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-10-31 11:27:44 +01:00

31 lines
552 B
Bash

#! /bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2023 Sxmo Contributors
log() {
# Copied from sxmo_common.sh for consistent formatting
printf "%s: %s\n" "$(date +%H:%M:%S)" "$*"
}
finish() {
if [ -n "$pid" ]; then
kill "$pid"
fi
exit 0
}
trap 'finish' INT TERM EXIT
tail -f "${XDG_STATE_HOME:-$HOME}"/sxmo.log | grep sxmo_hook_block_suspend.sh &
pid=$!
while true; do
locks="$(cat /sys/power/wake_lock 2>/dev/null)"
if [ "$locks" != "$oldlocks" ]; then
log "wakelocks: $locks"
oldlocks="$locks"
fi
sleep 1;
done
wait