Fix mnc detection cause sxmo_hook_mnc.sh has been simplified earlier
This commit is contained in:
@@ -44,6 +44,4 @@ sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
|
|||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
||||||
if [ -f /sys/power/wake_unlock ]; then
|
sxmo_wakelock.sh unlock not_screenoff
|
||||||
sxmo_wakelock.sh unlock not_screenoff
|
|
||||||
fi
|
|
||||||
|
@@ -8,24 +8,27 @@
|
|||||||
|
|
||||||
sxmo_log "going to suspend to crust"
|
sxmo_log "going to suspend to crust"
|
||||||
|
|
||||||
if suspend_time="$(sxmo_hook_mnc.sh)"; then
|
YEARS8_TO_SEC=268435455
|
||||||
sxmo_log "calling suspend with suspend_time <$suspend_time>"
|
suspend_time=99999999 # far away
|
||||||
|
|
||||||
start="$(date "+%s")"
|
mnc="$(sxmo_hook_mnc.sh)"
|
||||||
rtcwake -m mem -s "$suspend_time" || exit 1
|
if [ -n "$mnc" ] && [ "$mnc" -gt 0 ] && [ "$mnc" -lt "$YEARS8_TO_SEC" ]; then
|
||||||
|
if [ "$mnc" -le 15 ]; then # cronjob imminent
|
||||||
#We woke up again
|
sxmo_wakelock.sh lock waiting_cronjob infinite
|
||||||
time_spent="$(( $(date "+%s") - start ))"
|
exit 1
|
||||||
|
else
|
||||||
if [ "$suspend_time" -gt 0 ] && [ "$((time_spent + 10))" -ge "$suspend_time" ]; then
|
suspend_time=$((mnc - 10))
|
||||||
UNSUSPENDREASON="rtc"
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
sxmo_log "fake suspend (suspend_time ($suspend_time) less than zero)"
|
|
||||||
UNSUSPENDREASON=rtc # we fake the crust for those seconds
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$UNSUSPENDREASON" = "rtc" ]; then
|
sxmo_log "calling suspend with suspend_time <$suspend_time>"
|
||||||
|
|
||||||
|
start="$(date "+%s")"
|
||||||
|
rtcwake -m mem -s "$suspend_time" || exit 1
|
||||||
|
#We woke up again
|
||||||
|
time_spent="$(( $(date "+%s") - start ))"
|
||||||
|
|
||||||
|
if [ "$((time_spent + 15))" -ge "$suspend_time" ]; then
|
||||||
sxmo_wakelock.sh lock waiting_cronjob infinite
|
sxmo_wakelock.sh lock waiting_cronjob infinite
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user