It might not to change state if there is no defined ActionChangeState.
Change-Id: I16f6bd7992722787d2a95cc38c6764db81b67238
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
Enum=3001
BootReason=charger
ActionChangeState=start,sleep
+
+[EventAction]
+#INITIAL_STATE_BY_SILENT_REBOOT
+#Do no action. Stay in POWER_STATE_START on booting.
+Enum=3002
+BootReason=reboot
static struct trans_info init_ti = {
.reason = -1,
- .curr = POWER_STATE_START,
- .next = POWER_STATE_NORMAL,
+ .curr = 0,
+ .next = 0,
};
static guint sig_id[2] = {0, 0};
return 0;
}
-void do_initial_transition_by_bootreason(void)
+void initial_transition_by_bootreason(void)
{
int retval;
char bootreason[64] = "Unknown";
retval = hal_device_board_get_boot_reason(bootreason, sizeof(bootreason));
- if (retval == 0)
- libsys_config_parse_by_section(INIT_CONF_PATH, parse_matching_bootreason, bootreason);
+ if (retval != 0) {
+ _I("Failed to get BootReason, %d. Default change state to normal.", retval);
+ power_request_change_state_strict(POWER_STATE_START, POWER_STATE_NORMAL, 1, NULL);
+ return;
+ }
CRITICAL_LOG("BootReason=%s", bootreason);
+ libsys_config_parse_by_section(INIT_CONF_PATH, parse_matching_bootreason, bootreason);
+
power_request_change_state_strict(init_ti.curr, init_ti.next, init_ti.reason, NULL);
}
void add_delayed_init_done_handler(void *data);
void remove_delayed_init_done_handler(void *data);
-void do_initial_transition_by_bootreason(void);
+void initial_transition_by_bootreason(void);
extern int silent_boot;
#include <stdio.h>
#include <stdint.h>
+#include <inttypes.h>
#include <linux/input.h>
#include <libsyscommon/libgdbus.h>
#include <libsyscommon/list.h>
if (!ti)
return 0;
+ // check invalid next state
+ if (__builtin_popcountll(ti->next & POWER_STATE_ALL) != 1) {
+ _E("Invalid next state, curr=%"PRIx64", next=%"PRIx64", reason=%d", ti->curr, ti->next, ti->reason);
+ return 0;
+ }
+
// defer state transition until delayed_init_done unless it is transition to poweroff.
// poweroff shall be handled immediately regardless of the delayed_init_done.
if (!delayed_init_done && !is_poweroff_state(ti->next)) {
/* Take the first transition.
*
* It is determined by bootreason to which state to transition, POWER_STATE_NORMAL or POWER_STATE_SLEEP.
- * Normally, it will be transitioned to the POWER_STATE_NORMAL unless there is configuration for
- * the initial state in init.conf. */
- do_initial_transition_by_bootreason();
+ * Or it may stay in POWER_STATE_START if there is no defined action for the matching bootreason.
+ */
+ initial_transition_by_bootreason();
}
static const struct device_ops power_state_device_ops = {