#include "power-state-wait.h"
#include "power-state-manager.h"
+#define POWER_CONF_FILE "/etc/deviced/power.conf"
#define MAX_WAIT_SECOND 5 /* second */
+static int max_wait_timeout = 5; /* second */
+
struct proc_info {
pid_t pid;
char comm[128];
__change_state_wait_done = callback;
_D("Expected number of wait confirm=%d", n_waiting);
- max_wait_timer = g_timeout_add_seconds(MAX_WAIT_SECOND, max_wait_expired_cb, NULL);
+ max_wait_timer = g_timeout_add_seconds(max_wait_timeout, max_wait_expired_cb, NULL);
return n_waiting;
}
+
+static int load_max_wait_timeout(struct parse_result *result, void *user_data)
+{
+ if (MATCH(result->section, "PowerState")
+ && MATCH(result->name, "ChangeStateMaxWaitSecond"))
+ max_wait_timeout = atoi(result->value);
+
+ return 0;
+}
+
+void power_state_wait_init(void)
+{
+ config_parse(POWER_CONF_FILE, load_max_wait_timeout, NULL);
+
+ CRITICAL_LOG("Change state max wait timeout=%ds", max_wait_timeout);
+}
void remove_change_state_wait(pid_t pid, guint64 state);
int confirm_change_state_wait(pid_t pid, guint64 id);
int update_change_state_wait(guint64 id, const struct trans_info *ti, change_state_wait_done_cb cb);
+void power_state_wait_init(void);
#endif //__POWER_STATE_WAIT_H__