4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
24 #include <device-node.h>
25 #include <journal/system.h>
27 #include "device-handler.h"
28 #include "device-notifier.h"
31 #include "display/poll.h"
32 #include "display/setting.h"
33 #include "proc/proc-handler.h"
34 #include "config-parser.h"
35 #include "power-supply.h"
36 #include "sleep/sleep.h"
39 #define POPUP_KEY_CONTENT "_SYSPOPUP_CONTENT_"
41 #define SIGNAL_CHARGEERR_RESPONSE "ChargeErrResponse"
42 #define SIGNAL_TEMP_GOOD "TempGood"
44 #define ABNORMAL_CHECK_TIMER_INTERVAL 60
46 #define METHOD_FULL_NOTI_ON "BatteryFullNotiOn"
47 #define METHOD_FULL_NOTI_OFF "BatteryFullNotiOff"
48 #define METHOD_CHARGE_NOTI_ON "BatteryChargeNotiOn"
50 #define SIOP_DISABLE "memory/private/sysman/siop_disable"
53 #define BATTERY_CHECK_TIMER_INTERVAL (0.5)
56 #define DEVICE_NOTIFIER "/usr/bin/sys_device_noti"
57 #define BATT_CHARGE_NOTI "0"
58 #define BATT_FULL_NOTI "2"
61 enum power_supply_init_type {
62 POWER_SUPPLY_NOT_READY = 0,
63 POWER_SUPPLY_INITIALIZED = 1,
72 static int alert_popup = 0;
73 static Ecore_Timer *power_timer = NULL;
74 static Ecore_Timer *abnormal_timer = NULL;
75 extern int battery_power_off_act(void *data);
77 static void pm_check_and_change(int bInserted)
80 if (old != bInserted) {
82 internal_pm_change_state(LCD_NORMAL);
86 int check_lowbat_charge_device(int bInserted)
88 static int bChargeDeviceInserted = 0;
93 struct popup_data *params;
94 static const struct device_ops *apps = NULL;
96 pm_check_and_change(bInserted);
98 if (battery.charge_now)
99 bChargeDeviceInserted = 1;
101 } else if (bInserted == 0) {
102 if (!battery.charge_now && bChargeDeviceInserted == 1) {
103 bChargeDeviceInserted = 0;
104 //low bat popup during charging device removing
105 if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state) == 0) {
106 if(bat_state < VCONFKEY_SYSMAN_BAT_NORMAL
107 || bat_state == VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF) {
108 FIND_DEVICE_INT(apps, "apps");
110 if(bat_state == VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF)
114 params = malloc(sizeof(struct popup_data));
115 if (params == NULL) {
119 params->name = "lowbat-syspopup";
120 params->key = POPUP_KEY_CONTENT;
121 params->value = value;
122 _I("%s %s %s(%x)", params->name, params->key, params->value, params);
124 apps->init((void *)params);
128 _E("failed to get vconf key");
137 static int changed_battery_cf(enum present_type status)
139 struct popup_data *params;
140 static const struct device_ops *apps = NULL;
142 FIND_DEVICE_INT(apps, "apps");
143 params = malloc(sizeof(struct popup_data));
144 if (params == NULL) {
148 params->name = "lowbat-syspopup";
149 params->key = POPUP_KEY_CONTENT;
150 params->value = "battdisconnect";
151 if (apps->init == NULL || apps->exit == NULL)
153 if (status == PRESENT_ABNORMAL)
154 apps->init((void *)params);
156 apps->exit((void *)params);
162 int check_abnormal_popup(void)
164 int ret = HEALTH_BAD;
171 static void abnormal_popup_timer_init(void)
173 if (abnormal_timer == NULL)
175 ecore_timer_del(abnormal_timer);
176 abnormal_timer = NULL;
177 _I("delete health timer");
180 static void health_status_broadcast(void)
182 broadcast_edbus_signal(DEVICED_PATH_BATTERY, DEVICED_INTERFACE_BATTERY,
183 SIGNAL_TEMP_GOOD, NULL, NULL);
186 static int clean_health_popup(void)
188 struct popup_data *params;
189 static const struct device_ops *apps = NULL;
191 FIND_DEVICE_INT(apps, "apps");
192 params = malloc(sizeof(struct popup_data));
193 if (params == NULL) {
197 params->name = "lowbat-syspopup";
198 params->key = POPUP_KEY_CONTENT;
200 apps->exit((void *)params);
201 health_status_broadcast();
208 static void health_timer_reset(void)
210 abnormal_timer = NULL;
213 static Eina_Bool health_timer_cb(void *data)
215 health_timer_reset();
217 if (battery.health == HEALTH_GOOD)
220 _I("popup - Battery health status is not good");
221 vconf_set_int(SIOP_DISABLE, 1);
222 device_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)HEALTH_BAD);
223 pm_change_internal(getpid(), LCD_NORMAL);
224 pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0);
225 if (battery.temp == TEMP_LOW)
226 battery_charge_err_low_act(NULL);
227 else if (battery.temp == TEMP_HIGH)
228 battery_charge_err_high_act(NULL);
232 static void abnormal_popup_edbus_signal_handler(void *data, DBusMessage *msg)
234 if (battery.health == HEALTH_GOOD)
236 _I("restart health timer");
237 abnormal_timer = ecore_timer_add(ABNORMAL_CHECK_TIMER_INTERVAL,
238 health_timer_cb, NULL);
239 if (abnormal_timer == NULL)
240 _E("Fail to add abnormal check timer");
245 static void full_noti_cb(void *data, DBusMessage *msg, DBusError *err)
253 dbus_error_init(&r_err);
254 ret = dbus_message_get_args(msg, &r_err, DBUS_TYPE_INT32, &id, DBUS_TYPE_INVALID);
256 _E("no message [%s:%s]", r_err.name, r_err.message);
257 dbus_error_free(&r_err);
262 _D("Inserted battery full noti : %d", noti_id);
265 static int check_noti(void)
268 int r_disturb, s_disturb, r_block, s_block;
269 r_disturb = vconf_get_int("memory/shealth/sleep/do_not_disturb", &s_disturb);
270 r_block = vconf_get_bool("db/setting/blockmode_wearable", &s_block);
271 if ((r_disturb != 0 && r_block != 0) ||
272 (s_disturb == 0 && s_block == 0)) {
281 static int send_full_noti(enum charge_full_type state)
296 for (retry = RETRY_MAX; retry > 0 ;retry--) {
297 ret = dbus_method_async_with_reply(POPUP_BUS_NAME,
299 POPUP_INTERFACE_BATTERY,
301 NULL, NULL, full_noti_cb, -1, NULL);
303 _D("Created battery full noti");
307 _E("Failed to call dbus method (err: %d)", ret);
309 case CHARGING_NOT_FULL:
312 snprintf(str_id, sizeof(str_id), "%d", noti_id);
314 for (retry = RETRY_MAX; retry > 0 ;retry--) {
315 ret = dbus_method_async(POPUP_BUS_NAME,
317 POPUP_INTERFACE_BATTERY,
318 METHOD_FULL_NOTI_OFF,
321 _D("Deleted battery full noti");
326 _E("Failed to call dbus method (err: %d)", ret);
332 int send_charge_noti(void)
337 for (retry = RETRY_MAX; retry > 0 ;retry--) {
338 ret = dbus_method_async(POPUP_BUS_NAME,
340 POPUP_INTERFACE_BATTERY,
341 METHOD_CHARGE_NOTI_ON,
344 _D("Created battery charge noti");
348 _E("Failed to call dbus method (err: %d)", ret);
352 void battery_noti(enum battery_noti_type type, enum battery_noti_status status)
354 static int charge = CHARGER_DISCHARGING;
355 static int full = CHARGING_NOT_FULL;
358 if (type == DEVICE_NOTI_BATT_FULL && status == DEVICE_NOTI_ON &&
359 full == CHARGING_NOT_FULL) {
360 if (charge == CHARGER_DISCHARGING)
362 ret = send_full_noti(CHARGING_FULL);
364 full = CHARGING_FULL;
365 } else if (type == DEVICE_NOTI_BATT_FULL && status == DEVICE_NOTI_OFF &&
366 full == CHARGING_FULL) {
367 ret = send_full_noti(CHARGING_NOT_FULL);
369 full = CHARGING_NOT_FULL;
370 } else if (type == DEVICE_NOTI_BATT_CHARGE &&
371 battery.charge_now == CHARGER_CHARGING &&
372 charge == CHARGER_DISCHARGING) {
373 if (full == CHARGING_FULL) {
374 ret = send_full_noti(CHARGING_NOT_FULL);
376 full = CHARGING_NOT_FULL;
380 charge = battery.charge_now;
383 static void noti_batt_full(void)
385 char params[BUFF_MAX];
386 static int bat_full_noti = 0;
387 int r_disturb, s_disturb, r_block, s_block;
389 r_disturb = vconf_get_int("memory/shealth/sleep/do_not_disturb", &s_disturb);
390 r_block = vconf_get_bool("db/setting/blockmode_wearable", &s_block);
391 if (!battery.charge_full && bat_full_noti == 1) {
392 battery_noti(DEVICE_NOTI_BATT_FULL, DEVICE_NOTI_OFF);
394 /* off the full charge state */
395 device_notify(DEVICE_NOTIFIER_FULLBAT, (void*)false);
397 if (battery.charge_full && bat_full_noti == 0) {
398 battery_noti(DEVICE_NOTI_BATT_FULL, DEVICE_NOTI_ON);
400 /* turn on LCD, if battery is full charged */
401 if ((r_disturb != 0 && r_block != 0) ||
402 (s_disturb == 0 && s_block == 0))
403 pm_change_internal(getpid(), LCD_NORMAL);
406 /* on the full charge state */
407 device_notify(DEVICE_NOTIFIER_FULLBAT, (void*)true);
411 static void check_power_supply(int state)
415 char params[BUFF_MAX];
417 check_lowbat_charge_device(state);
418 if (update_pm_setting)
419 update_pm_setting(SETTING_CHARGING, state);
421 ret = device_get_property(DEVICE_TYPE_POWER,
422 PROP_POWER_INSUSPEND_CHARGING_SUPPORT, &val);
424 if (ret != 0 || val == 1) {
425 _D("fail to check charger insuspend");
430 pm_unlock_internal(INTERNAL_LOCK_TA, LCD_OFF, STAY_CUR_STATE);
432 pm_lock_internal(INTERNAL_LOCK_TA, LCD_OFF, STAY_CUR_STATE, 0);
434 _I("ta device %d(capacity %d)", state, battery.capacity);
436 sync_cradle_status();
439 static void update_present(enum battery_noti_status status)
441 static int old = DEVICE_NOTI_OFF;
442 enum present_type present;
446 _I("charge %d present %d", battery.charge_now, battery.present);
448 pm_change_internal(getpid(), LCD_NORMAL);
449 if (status == DEVICE_NOTI_ON)
450 present = PRESENT_ABNORMAL;
452 present = PRESENT_NORMAL;
453 changed_battery_cf(present);
456 static void update_health(enum battery_noti_status status)
458 static int old = DEVICE_NOTI_OFF;
462 _I("charge %d health %d", battery.charge_now, battery.health);
465 if (alert_popup && status == DEVICE_NOTI_ON) {
466 _I("silent health popup");
470 pm_change_internal(getpid(), LCD_NORMAL);
471 if (status == DEVICE_NOTI_ON) {
472 _I("popup - Battery health status is not good");
473 vconf_set_int(SIOP_DISABLE, 1);
474 device_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)HEALTH_BAD);
475 pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0);
476 if (battery.temp == TEMP_LOW)
477 battery_charge_err_low_act(NULL);
478 else if (battery.temp == TEMP_HIGH)
479 battery_charge_err_high_act(NULL);
481 vconf_set_int(SIOP_DISABLE, 0);
482 device_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)HEALTH_GOOD);
483 pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN);
484 clean_health_popup();
485 abnormal_popup_timer_init();
489 static void update_ovp(enum battery_noti_status status)
491 static int old = DEVICE_NOTI_OFF;
495 _I("charge %d ovp %d", battery.charge_now, battery.ovp);
497 pm_change_internal(getpid(), LCD_NORMAL);
498 if (status == DEVICE_NOTI_ON)
499 device_notify(DEVICE_NOTIFIER_BATTERY_OVP, (void *)OVP_ABNORMAL);
501 device_notify(DEVICE_NOTIFIER_BATTERY_OVP, (void *)OVP_NORMAL);
504 static void check_battery_status(void)
506 static int old = DEVICE_CHANGE_NORMAL;
509 if (battery.charge_now == CHARGER_ABNORMAL &&
510 (battery.health == HEALTH_BAD || battery.present == PRESENT_ABNORMAL))
511 status = DEVICE_CHANGE_ABNORMAL;
512 else if (battery.ovp == OVP_ABNORMAL)
513 status = DEVICE_CHANGE_ABNORMAL;
515 status = DEVICE_CHANGE_NORMAL;
520 if (battery.charge_now == CHARGER_ABNORMAL) {
521 if (battery.health == HEALTH_BAD) {
522 update_health(DEVICE_NOTI_ON);
524 } else if (battery.present == PRESENT_ABNORMAL) {
525 update_present(DEVICE_NOTI_ON);
529 if (battery.ovp == OVP_ABNORMAL) {
530 update_ovp(DEVICE_NOTI_ON);
534 if (battery.charge_now != CHARGER_ABNORMAL &&
535 status == DEVICE_CHANGE_NORMAL) {
536 update_health(DEVICE_NOTI_OFF);
537 update_ovp(DEVICE_NOTI_OFF);
538 update_present(DEVICE_NOTI_OFF);
542 static void check_online(void)
544 static int old_online;
546 if (battery.online > POWER_SUPPLY_TYPE_BATTERY &&
547 old_online == VCONFKEY_SYSMAN_CHARGER_DISCONNECTED) {
548 old_online = VCONFKEY_SYSMAN_CHARGER_CONNECTED;
549 vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS, old_online);
550 power_supply_broadcast(CHARGER_STATUS_SIGNAL, old_online);
551 extcon_set_count(EXTCON_TA);
552 check_power_supply(old_online);
553 } else if (battery.online <= POWER_SUPPLY_TYPE_BATTERY &&
554 old_online == VCONFKEY_SYSMAN_CHARGER_CONNECTED) {
555 old_online = VCONFKEY_SYSMAN_CHARGER_DISCONNECTED;
556 vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS, old_online);
557 power_supply_broadcast(CHARGER_STATUS_SIGNAL, old_online);
558 check_power_supply(old_online);
562 static int load_uevent(struct parse_result *result, void *user_data)
564 struct battery_status *info = user_data;
569 if (MATCH(result->name, CHARGE_STATUS)) {
570 if (strstr(result->value, "Charging")) {
571 info->charge_now = CHARGER_CHARGING;
572 info->charge_full = CHARGING_NOT_FULL;
573 } else if (strstr(result->value, "Discharging")) {
574 info->charge_now = CHARGER_DISCHARGING;
575 info->charge_full = CHARGING_NOT_FULL;
576 } else if (strstr(result->value, "Full")) {
577 info->charge_now = CHARGER_DISCHARGING;
578 info->charge_full = CHARGING_FULL;
579 } else if (strstr(result->value, "Not charging")) {
580 info->charge_now = CHARGER_ABNORMAL;
581 info->charge_full = CHARGING_NOT_FULL;
584 else if (MATCH(result->name, CAPACITY))
585 info->capacity = atoi(result->value);
589 static void power_load_uevent(void)
592 static int initialized = POWER_SUPPLY_NOT_READY;
594 if (initialized == POWER_SUPPLY_INITIALIZED)
596 ret = config_parse(POWER_SUPPLY_UEVENT, load_uevent, &battery);
598 _E("Failed to load %s, %d Use default value!", POWER_SUPPLY_UEVENT, ret);
600 initialized = POWER_SUPPLY_INITIALIZED;
603 static int sleep_execute(void *data)
605 static const struct device_ops *ops = NULL;
607 FIND_DEVICE_INT(ops, DEVICE_SLEEP_OPS);
608 return ops->execute(data);
611 void power_supply(void *data)
614 int status = POWER_SUPPLY_STATUS_DISCHARGING;
615 static struct battery_status old;
617 if (old.charge_now != battery.charge_now || battery.charge_now == CHARGER_ABNORMAL) {
618 vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, battery.charge_now);
619 power_supply_broadcast(CHARGE_NOW_SIGNAL, battery.charge_now);
622 if (old.capacity != battery.capacity)
623 journal_system_battery_level(battery.capacity);
624 if (old.online != battery.online ||
625 old.charge_now != battery.charge_now ||
626 old.charge_full != battery.charge_full) {
627 switch (battery.charge_now)
629 case CHARGER_ABNORMAL:
630 status = POWER_SUPPLY_STATUS_NOT_CHARGING;
632 case CHARGER_DISCHARGING:
633 if (battery.charge_full == CHARGING_FULL)
634 status = POWER_SUPPLY_STATUS_FULL;
636 status = POWER_SUPPLY_STATUS_DISCHARGING;
638 case CHARGER_CHARGING:
639 status = POWER_SUPPLY_STATUS_CHARGING;
642 journal_system_power_supply_status(battery.online, status);
645 lowbat_monitor(data);
647 if (old.charge_full != battery.charge_full) {
651 old.capacity = battery.capacity;
652 old.online = battery.online;
653 old.charge_now = battery.charge_now;
654 old.charge_full = battery.charge_full;
656 check_battery_status();
657 device_notify(DEVICE_NOTIFIER_POWER_SUPPLY, NULL);
658 device_notify(DEVICE_NOTIFIER_BATTERY_CHARGING, (void*)battery.charge_now);
659 if (battery.online > POWER_SUPPLY_TYPE_BATTERY)
663 void power_supply_status_init(void)
666 static int charge_now = -1;
667 static int charge_full = -1;
668 static int capacity = -1;
671 battery.health = HEALTH_GOOD;
672 battery.ovp = OVP_NORMAL;
673 battery.present = PRESENT_NORMAL;
674 battery.temp = TEMP_LOW;
676 if (charge_now == battery.charge_now &&
677 charge_full == battery.charge_full &&
678 capacity == battery.capacity)
681 if (charge_now != battery.charge_now ||
682 charge_full != battery.charge_full ||
683 capacity != battery.capacity)
684 _I("charging %d full %d capacity %d", battery.charge_now, battery.charge_full, battery.capacity);
686 if (charge_now != battery.charge_now) {
687 vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, battery.charge_now);
688 power_supply_broadcast(CHARGE_NOW_SIGNAL, battery.charge_now);
690 if (capacity != battery.capacity)
691 vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CAPACITY, battery.capacity);
693 charge_now = battery.charge_now;
694 charge_full = battery.charge_full;
695 capacity = battery.capacity;
698 static Eina_Bool power_supply_update(void *data)
700 power_supply_status_init();
704 void power_supply_timer_start(void)
706 _D("battery init timer during booting");
707 power_timer = ecore_timer_add(BATTERY_CHECK_TIMER_INTERVAL,
708 power_supply_update, NULL);
709 if (power_timer == NULL)
710 _E("fail to add battery init timer during booting");
713 void power_supply_timer_stop(void)
715 _D("battery init timer during booting");
718 ecore_timer_del(power_timer);
722 void power_supply_broadcast(char *sig, int status)
725 static char sig_old[32];
729 if (strcmp(sig_old, sig) == 0 && old == status)
732 _D("%s %d", sig, status);
735 snprintf(sig_old, sizeof(sig_old), "%s", sig);
736 snprintf(str_status, sizeof(str_status), "%d", status);
739 broadcast_edbus_signal(DEVICED_PATH_BATTERY, DEVICED_INTERFACE_BATTERY,
743 static DBusMessage *dbus_get_charger_status(E_DBus_Object *obj, DBusMessage *msg)
745 DBusMessageIter iter;
749 if (vconf_get_int(VCONFKEY_SYSMAN_CHARGER_STATUS, &ret) < 0) {
750 _E("vconf_get_int() failed");
753 reply = dbus_message_new_method_return(msg);
754 dbus_message_iter_init_append(reply, &iter);
755 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
759 static DBusMessage *dbus_get_charge_now(E_DBus_Object *obj, DBusMessage *msg)
761 DBusMessageIter iter;
765 ret = battery.charge_now;
767 reply = dbus_message_new_method_return(msg);
768 dbus_message_iter_init_append(reply, &iter);
769 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
773 static DBusMessage *dbus_get_charge_level(E_DBus_Object *obj, DBusMessage *msg)
775 DBusMessageIter iter;
779 if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &ret) < 0) {
780 _E("vconf_get_int() failed");
784 reply = dbus_message_new_method_return(msg);
785 dbus_message_iter_init_append(reply, &iter);
786 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
790 static DBusMessage *dbus_get_percent(E_DBus_Object *obj, DBusMessage *msg)
792 DBusMessageIter iter;
796 ret = battery.capacity;
798 reply = dbus_message_new_method_return(msg);
799 dbus_message_iter_init_append(reply, &iter);
800 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
804 static DBusMessage *dbus_get_percent_raw(E_DBus_Object *obj, DBusMessage *msg)
806 DBusMessageIter iter;
810 ret = device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY_RAW, &val);
820 reply = dbus_message_new_method_return(msg);
821 dbus_message_iter_init_append(reply, &iter);
822 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
826 static DBusMessage *dbus_is_full(E_DBus_Object *obj, DBusMessage *msg)
828 DBusMessageIter iter;
832 ret = battery.charge_full;
834 reply = dbus_message_new_method_return(msg);
835 dbus_message_iter_init_append(reply, &iter);
836 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
840 static DBusMessage *dbus_get_health(E_DBus_Object *obj, DBusMessage *msg)
842 DBusMessageIter iter;
846 ret = battery.health;
848 reply = dbus_message_new_method_return(msg);
849 dbus_message_iter_init_append(reply, &iter);
850 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
854 static const struct edbus_method edbus_methods[] = {
855 { CHARGER_STATUS_SIGNAL, NULL, "i", dbus_get_charger_status },
856 { CHARGE_NOW_SIGNAL, NULL, "i", dbus_get_charge_now },
857 { CHARGE_LEVEL_SIGNAL, NULL, "i", dbus_get_charge_level },
858 { CHARGE_CAPACITY_SIGNAL, NULL, "i", dbus_get_percent },
859 { CHARGE_CAPACITY_LAW_SIGNAL, NULL, "i", dbus_get_percent_raw },
860 { CHARGE_FULL_SIGNAL, NULL, "i", dbus_is_full },
861 { CHARGE_HEALTH_SIGNAL, NULL, "i", dbus_get_health },
864 static int alert_popup_cb(keynode_t *key_nodes, void *data)
866 alert_popup = vconf_keynode_get_bool(key_nodes);
867 _D("changed alert popup %d", alert_popup);
871 int power_supply_init(void *data)
875 ret = vconf_get_bool(VCONFKEY_TESTMODE_TEMP_ALERT_POPUP, &alert_popup);
877 _E("fail to get alert popup status");
878 vconf_notify_key_changed(VCONFKEY_TESTMODE_TEMP_ALERT_POPUP, (void *)alert_popup_cb, NULL);
880 ret = register_edbus_method(DEVICED_PATH_BATTERY, edbus_methods, ARRAY_SIZE(edbus_methods));
882 _E("fail to init edbus method(%d)", ret);
883 ret = register_edbus_signal_handler(DEVICED_PATH_SYSNOTI,
884 DEVICED_INTERFACE_SYSNOTI, SIGNAL_CHARGEERR_RESPONSE,
885 abnormal_popup_edbus_signal_handler);
887 _E("fail to init edbus signal(%d)", ret);
889 /* for simple noti change cb */
890 power_supply_status_init();