{
sys_set_str("/sys/power/state", "mem");
- device_notify(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, NULL);
-
// resume
update_wakeup_reason();
+
+ device_notify(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, NULL);
power_request_change_state(DEVICED_POWER_STATE_NORMAL, (int) wakeup_reason);
+ /*
+ * FIXME: If the wakeup reason lingers after wakeup, a transition triggered from other
+ * than the above line would take the lingering wakeup reason as a transition reason,
+ * which might not be correct for that transition. Therefore reset the wakeup reason by UNKNOWN.
+ *
+ * To address this problem, it is necessary to decide transition reason at the time when
+ * the transition is requested, not the time when it is executed. If then, the below resetting
+ * line can be removed.
+ */
+ wakeup_reason = HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN;
}
static void resume_echo_mem(void)