insert direct power off routine to support lowbat power off
authorgiyeol.ok <giyeol.ok@samsung.com>
Mon, 25 Feb 2013 06:33:02 +0000 (15:33 +0900)
committerjy910.yun <jy910.yun@samsung.com>
Tue, 4 Jun 2013 12:50:43 +0000 (21:50 +0900)
Signed-off-by: giyeol.ok <giyeol.ok@samsung.com>
ss_device_change_handler.c
ss_predefine.c

index 91b2747..178f126 100755 (executable)
@@ -341,7 +341,7 @@ static void charge_cb(struct ss_main_data *ad)
                PRT_TRACE_ERR("fail to get battery node value");
        if (charge_now == 0 && capacity == 0) {
                PRT_TRACE_ERR("target will be shut down");
-               powerdown_ap_by_force(NULL);
+               ss_action_entry_call_internal(PREDEF_LOWBAT, 1, POWER_OFF_BAT_ACT);
                return;
        }
 
index 89a67f4..7e57841 100644 (file)
@@ -85,6 +85,7 @@ static int lowbat_popup_option = 0;
 static struct timeval tv_start_poweroff;
 static void powerdown_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
 static void poweroff_control_cb(keynode_t *in_key, struct ss_main_data *ad);
+int internal_poweroff_def_predefine_action(int argc, char **argv);
 
 static int ss_flags = 0;
 
@@ -365,14 +366,22 @@ int lowbat_popup(void *data)
 int predefine_control_launch(char *name, bundle *b)
 {
        int pid;
+       static int launched_poweroff = 0;
        //lowbat-popup
        if (strncmp(name, LOWBAT_POPUP_NAME, strlen(LOWBAT_POPUP_NAME)) == 0) {
-               if (lowbat_popup_option == LOWBAT_OPT_POWEROFF) {
-                       pid = __predefine_get_pid(LOWBAT_EXEC_PATH);
-                       if (pid > 0) {
-                               PRT_TRACE_ERR("pre launched %s destroy", LOWBAT_EXEC_PATH);
-                               kill(pid, SIGTERM);
-                       }
+               if (launched_poweroff == 1) {
+                       PRT_TRACE_ERR("will be foreced power off");
+                       internal_poweroff_def_predefine_action(0,NULL);
+                       return 0;
+               }
+
+               if (lowbat_popup_option == LOWBAT_OPT_POWEROFF)
+                       launched_poweroff = 1;
+
+               pid = __predefine_get_pid(LOWBAT_EXEC_PATH);
+               if (pid > 0) {
+                       PRT_TRACE_ERR("pre launched %s destroy", LOWBAT_EXEC_PATH);
+                       kill(pid, SIGTERM);
                }
                if (syspopup_launch(name, b) < 0)
                        return -1;