.warning = BATTERY_WARNING,
.critical = BATTERY_CRITICAL,
.poweroff = BATTERY_POWEROFF,
- .realoff = BATTERY_REALOFF,
};
static GList *lpe;
return 0;
}
-int battery_power_off_act(void *data)
+static int battery_power_off_act(void *data)
{
CRITICAL_LOG("Low battery power off.");
return power_execute(POWER_STATE_POWEROFF);
lowbat_add_scenario(battery_info.normal, battery_info.warning, battery_warning_low_act);
lowbat_add_scenario(battery_info.normal, battery_info.critical, battery_critical_low_act);
- lowbat_add_scenario(battery_info.normal, battery_info.poweroff, battery_critical_low_act);
- lowbat_add_scenario(battery_info.normal, battery_info.realoff, battery_power_off_act);
+ lowbat_add_scenario(battery_info.normal, battery_info.poweroff, battery_power_off_act);
lowbat_add_scenario(battery_info.warning, battery_info.warning, battery_warning_low_act);
lowbat_add_scenario(battery_info.warning, battery_info.critical, battery_critical_low_act);
- lowbat_add_scenario(battery_info.warning, battery_info.poweroff, battery_critical_low_act);
- lowbat_add_scenario(battery_info.warning, battery_info.realoff, battery_power_off_act);
+ lowbat_add_scenario(battery_info.warning, battery_info.poweroff, battery_power_off_act);
lowbat_add_scenario(battery_info.critical, battery_info.critical, battery_critical_low_act);
- lowbat_add_scenario(battery_info.critical, battery_info.realoff, battery_power_off_act);
- lowbat_add_scenario(battery_info.poweroff, battery_info.poweroff, battery_critical_low_act);
- lowbat_add_scenario(battery_info.poweroff, battery_info.realoff, battery_power_off_act);
- lowbat_add_scenario(battery_info.realoff, battery_info.realoff, battery_power_off_act);
+ lowbat_add_scenario(battery_info.poweroff, battery_info.poweroff, battery_power_off_act);
}
static void battery_level_send_system_event(int bat_percent)
return -EIO;
}
- if (new_bat_capacity <= battery_info.realoff) {
- if (battery->charge_now == CHARGER_CHARGING) {
- new_bat_state = battery_info.poweroff;
- if (vconf_state != VCONFKEY_SYSMAN_BAT_POWER_OFF)
- status = VCONFKEY_SYSMAN_BAT_POWER_OFF;
- } else {
- new_bat_state = battery_info.realoff;
- if (vconf_state != VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF)
- status = VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF;
- }
- } else if (new_bat_capacity <= battery_info.poweroff) {
+ if (new_bat_capacity <= battery_info.poweroff) {
new_bat_state = battery_info.poweroff;
if (vconf_state != VCONFKEY_SYSMAN_BAT_POWER_OFF)
status = VCONFKEY_SYSMAN_BAT_POWER_OFF;
/* If the battery continues to run out even though it is being charged
* for a certain period of time, turn off the device. */
- if (new_bat_capacity <= battery_info.realoff && battery->charge_now == CHARGER_CHARGING) {
+ if (new_bat_capacity <= battery_info.poweroff && battery->charge_now == CHARGER_CHARGING) {
if (low_bat_skip_cnt >= RETRY_MAX) {
- new_bat_state = battery_info.realoff;
- status = VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF;
_I("Go to real poweroff inspite of charging (c:%d charge:%d online:%d current_now:%d)",
battery->capacity, battery->charge_now, battery->charger_connected, battery->current_now);
- low_bat_skip_cnt = 0;
} else if (battery->current_now <= MIN_INOW_VALUE) {
low_bat_skip_cnt++;
} else {
return result;
if (cur_bat_state == new_bat_state && online == battery->charger_connected)
return result;
+ if (new_bat_state <= battery_info.poweroff && battery->charger_connected && low_bat_skip_cnt < RETRY_MAX)
+ return result;
- online = battery->charger_connected;
if (cur_bat_state == BATTERY_UNKNOWN)
cur_bat_state = battery_info.normal;
if (lowbat_scenario(cur_bat_state, new_bat_state, NULL))
_I("Cur(%d) new(%d) capacity(%d).", cur_bat_state, new_bat_state, bat_percent);
- cur_bat_state = new_bat_state;
+
+ online = battery->charger_connected;
+ cur_bat_state = new_bat_state;
return result;
}
/* load battery configuration file */
battery_config_load(&battery_info);
- _I("Battery conf: %d %d %d %d %d", battery_info.normal, battery_info.warning,
- battery_info.critical, battery_info.poweroff, battery_info.realoff);
+ _I("Battery conf: %d %d %d %d", battery_info.normal, battery_info.warning,
+ battery_info.critical, battery_info.poweroff);
lowbat_scenario_init();
check_lowbat_percent(&battery->capacity);
/* Do lowbat_process immediately rather deferring it when poweroff is needed.
* This prevents poweroff from being delayed infinitely when the uevent continues
- * to occur shorter than 1.5 seconds on realoff capacity */
- if (capacity <= battery_info.realoff || !uevent_buffering)
+ * to occur shorter than 1.5 seconds on poweroff capacity */
+ if (capacity <= battery_info.poweroff || !uevent_buffering)
low_battery_charging_status(data);
else
low_batt_sig_timer = g_timeout_add(1500, low_battery_charging_status, data);