+# BootMode= is optional. If it isn't specified then
+# it is regarded as BootMode=normal
+
[EventAction]
#INITIAL_STATE_BY_POWERKEY_BOOTING
Enum=3000
ActionChangeState=start,sleep
[EventAction]
-#INITIAL_STATE_BY_REBOOT
+#INITIAL_STATE_BY_REBOOT_NORMAL
Enum=3002
BootReason=reboot
ActionChangeState=start,normal
+
+[EventAction]
+#INITIAL_STATE_BY_REBOOT_SILENT
+Enum=3003
+BootReason=reboot
+BootMode=silent
+ActionChangeState=start,sleep
.next = 0,
};
+static struct boot_condition {
+ char reason[64];
+ char mode[64];
+} bc = { "unknown", "normal" };
+
static guint sig_id[2] = {0, 0};
void remove_delayed_init_done_handler(void *data)
}
}
-static int parse_matching_bootreason(const struct parse_result *result, void *data)
+static int parse_matching_boot_condition(const struct parse_result *result, void *data)
{
GList *elem;
struct section_property *prop;
- char *bootreason = (char *) data;
+ struct boot_condition config_bc = { "", "normal" };
if (!MATCH(result->section, "EventAction"))
return 0;
SYS_G_LIST_FOREACH(result->props, elem, prop) {
- if (MATCH(prop->key, "BootReason") && MATCH(prop->value, bootreason))
- parse_init_ti(result);
+ if (MATCH(prop->key, "BootReason"))
+ sscanf(prop->value, "%s", config_bc.reason);
+ else if (MATCH(prop->key, "BootMode"))
+ sscanf(prop->value, "%s", config_bc.mode);
}
+ if (MATCH(bc.reason, config_bc.reason) && MATCH(bc.mode, config_bc.mode))
+ parse_init_ti(result);
+
return 0;
}
-void initial_transition_by_bootreason(void)
+void initial_transition_by_boot_condition(void)
{
int retval;
- char bootreason[64] = "Unknown";
- retval = hal_device_board_get_boot_reason(bootreason, sizeof(bootreason));
+ retval = hal_device_board_get_boot_reason(bc.reason, sizeof(bc.reason));
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);
+ retval = hal_device_board_get_boot_mode(bc.mode, sizeof(bc.mode));
+ if (retval != 0)
+ _I("Failed to get BootMode, %d", retval);
+
+ CRITICAL_LOG("BootReason=%s, BootMode=%s", bc.reason, bc.mode);
+ libsys_config_parse_by_section(INIT_CONF_PATH, parse_matching_boot_condition, NULL);
power_request_change_state_strict(init_ti.curr, init_ti.next, init_ti.reason, NULL);
}
/* Take the first transition.
*
- * It is determined by bootreason to which state to transition, POWER_STATE_NORMAL or POWER_STATE_SLEEP.
- * Or it may stay in POWER_STATE_START if there is no defined action for the matching bootreason.
+ * It is determined by bootreason and bootmode to which state to transition, POWER_STATE_NORMAL
+ * or POWER_STATE_SLEEP. it may stay in POWER_STATE_START if there is no defined action for the
+ * matching bootreason and bootmode.
*/
- initial_transition_by_bootreason();
+ initial_transition_by_boot_condition();
}
static const struct device_ops power_state_device_ops = {