From: Youngjae Cho Date: Tue, 18 Jan 2022 09:15:06 +0000 (+0900) Subject: battery: fix condition of update_online() X-Git-Tag: submit/tizen/20220208.052553~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=155d339001b0c9ec0c115f0f282354b1ab47186b;p=platform%2Fcore%2Fsystem%2Fdeviced.git battery: fix condition of update_online() Initialize online_status by -1 so that the update_online() shall process properly even when the device has turned on with charger disconnected. Change-Id: I25c51f0aa856c2b1190f148f650b674054f918f7 Signed-off-by: Youngjae Cho --- diff --git a/src/battery/power-supply.c b/src/battery/power-supply.c index e886782..cddbe9a 100644 --- a/src/battery/power-supply.c +++ b/src/battery/power-supply.c @@ -94,7 +94,7 @@ static const struct uevent_handler uh = { static struct battery_status battery; struct battery_status old_battery; static int noti_id; -static int online_status; +static int online_status = -1; static int abnormal_health_popup_timer; static bool launching_health_popup; @@ -571,7 +571,7 @@ static bool update_online(void) } if (battery.online > POWER_SUPPLY_TYPE_BATTERY && - online_status == VCONFKEY_SYSMAN_CHARGER_DISCONNECTED) { + online_status != VCONFKEY_SYSMAN_CHARGER_CONNECTED) { online_status = VCONFKEY_SYSMAN_CHARGER_CONNECTED; extcon_update_count(EXTCON_TA, 1); check_power_supply(online_status); @@ -581,7 +581,7 @@ static bool update_online(void) charger_state_send_system_event(battery.charge_status); broadcast = true; } else if (battery.online <= POWER_SUPPLY_TYPE_BATTERY && - online_status == VCONFKEY_SYSMAN_CHARGER_CONNECTED) { + online_status != VCONFKEY_SYSMAN_CHARGER_DISCONNECTED) { online_status = VCONFKEY_SYSMAN_CHARGER_DISCONNECTED; check_power_supply(online_status); if (old_battery.charge_status != battery.charge_status)