From 47488b32d02721d3f5fe239e050f59e5510f93ba Mon Sep 17 00:00:00 2001 From: "giyeol.ok" Date: Thu, 25 Apr 2013 23:09:16 +0900 Subject: [PATCH] remove vfat check routine Change-Id: I014ad837570ea6c8e55681e63c90beff74aa33e6 Signed-off-by: giyeol.ok --- src/battery/lowbat-handler.c | 20 +++--- src/control/control.c | 13 ++-- src/core/common.h | 7 +- src/core/core.c | 5 +- src/core/device-change-handler.c | 50 ++++++------- src/core/device-notifier.c | 16 ++--- src/core/edbus-handler.c | 40 +++++------ src/core/noti.c | 4 +- src/core/predefine.c | 2 +- src/core/queue.c | 6 +- src/core/sig-handler.c | 13 +--- src/display/battery.c | 40 +++++------ src/display/core.c | 150 +++++++++++++++++++-------------------- src/display/display-dbus.c | 38 +++++----- src/display/key-filter.c | 10 +-- src/display/llinterface.c | 30 ++++---- src/display/lsensor.c | 30 ++++---- src/display/poll.c | 66 ++++++++--------- src/display/setting.c | 8 +-- src/display/util.c | 12 ++-- src/display/util.h | 30 ++++---- src/display/x-lcd-on.c | 8 +-- src/mmc/ext4.c | 12 ++-- src/mmc/mmc-handler.c | 31 ++++---- src/mmc/vfat.c | 10 +-- src/power/power-handler.c | 61 ++++++++-------- src/proc/lowmem-handler.c | 31 ++++---- src/proc/pmon-handler.c | 8 +-- src/proc/proc-handler.c | 28 ++++---- src/shared/control.c | 9 ++- src/shared/display.c | 2 +- src/time/time-handler.c | 6 +- 32 files changed, 389 insertions(+), 407 deletions(-) diff --git a/src/battery/lowbat-handler.c b/src/battery/lowbat-handler.c index 067431a..38338f2 100644 --- a/src/battery/lowbat-handler.c +++ b/src/battery/lowbat-handler.c @@ -150,7 +150,7 @@ static int battery_charge_act(void *data) int ss_lowbat_set_charge_on(int onoff) { - if(vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, onoff)!=0) { + if(vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, onoff) != 0) { _E("fail to set charge vconf value"); return -1; } @@ -159,7 +159,7 @@ int ss_lowbat_set_charge_on(int onoff) return 0; } -int ss_lowbat_is_charge_in_now() +int ss_lowbat_is_charge_in_now(void) { int val = 0; if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) < 0) { @@ -186,9 +186,11 @@ static int lowbat_process(int bat_percent, void *ad) int i, ret = 0; int val = 0; int status = -1; + new_bat_capacity = bat_percent; if (new_bat_capacity < 0) return -1; + if (new_bat_capacity != cur_bat_capacity) { _D("[BAT_MON] cur = %d new = %d", cur_bat_capacity, new_bat_capacity); if (vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CAPACITY, new_bat_capacity) == 0) @@ -281,8 +283,7 @@ static int lowbat_process(int bat_percent, void *ad) } } } - - _D("[BATMON] Unknown battery state cur:%d new:%d",cur_bat_state,new_bat_state); + _D("[BATMON] Unknown battery state cur:%d new:%d", cur_bat_state, new_bat_state); cur_bat_state = new_bat_state; if (new_bat_capacity != cur_bat_capacity) @@ -340,8 +341,7 @@ static int __check_lowbat_percent(int *pct) ecore_timer_interval_set(lowbat_timer, BAT_MON_INTERVAL_MIN); bat_err_count++; if (bat_err_count > MAX_BATTERY_ERROR) { - _E - ("[BATMON] Cannot read battery gage. stop read fuel gage"); + _E("[BATMON] Cannot read battery gauge. stopping read of battery gauge"); return -ENODEV; } return -ENODEV; @@ -416,7 +416,7 @@ int lowbat_popup(void *data) ret = syspopup_launch("lowbat-syspopup", b); if (ret < 0) { - PRT_TRACE_EM("popup lauch failed\n"); + _E("popup lauch failed"); bundle_free(b); return 1; } @@ -424,7 +424,7 @@ int lowbat_popup(void *data) lowbat_popup_option = 0; bundle_free(b); } else { - PRT_TRACE_EM("boot-animation running yet"); + _E("boot-animation running yet"); return 1; } @@ -464,13 +464,13 @@ int lowbat_def_predefine_action(int argc, char **argv) ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &state); if (state == 1 || ret != 0) { if (predefine_control_launch("lowbat-syspopup", b, lowbat_popup_option) < 0) { - PRT_TRACE_ERR("popup lauch failed\n"); + _E("popup lauch failed\n"); bundle_free(b); lowbat_popup_option = 0; return -1; } } else { - PRT_TRACE_EM("boot-animation running yet"); + _E("boot-animation running yet"); lowbat_popup_id = ecore_timer_add(1, lowbat_popup, NULL); } bundle_free(b); diff --git a/src/control/control.c b/src/control/control.c index b1e4c37..9d90be6 100644 --- a/src/control/control.c +++ b/src/control/control.c @@ -31,11 +31,8 @@ static const struct control_device { const int id; const struct device_ops *ops; } devices[] = { - /* code example - * { DEVICE_CONTROL_DISPLAY, &display_device_ops }, - */ /* Add id & ops to provide start/stop control */ - { DEVICE_CONTROL_MMC, &mmc_device_ops }, + { DEVICE_CONTROL_MMC, &mmc_device_ops }, }; static int control_handler(int argc, char **argv) @@ -46,12 +43,12 @@ static int control_handler(int argc, char **argv) bool enable; int ret; - PRT_TRACE("argc : %d", argc); + _I("argc : %d", argc); for (i = 0; i < argc; ++i) - PRT_TRACE("[%2d] %s", i, argv[i]); + _I("[%2d] %s", i, argv[i]); if (argc > 5) { - PRT_TRACE_ERR("Invalid argument"); + _E("Invalid argument"); errno = EINVAL; return -1; } @@ -59,7 +56,7 @@ static int control_handler(int argc, char **argv) pid = atoi(argv[0]); device = atoi(argv[1]); enable = atoi(argv[2]); - PRT_TRACE("pid : %d, device : %d, enable :%d", pid, device, enable); + _I("pid : %d, device : %d, enable :%d", pid, device, enable); for (i = 0; i < ARRAY_SIZE(devices); i++) if (devices[i].id == device) diff --git a/src/core/common.h b/src/core/common.h index 8e7a353..adac491 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -17,9 +17,10 @@ */ -#ifndef _SS_COMMON_H -#define _SS_COMMON_H +#ifndef __COMMON_H__ +#define __COMMON_H__ +#include #include #define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0])) @@ -29,5 +30,5 @@ int get_exec_pid(const char *execpath); int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size); int is_vip(int pid); -#endif /* _SS_COMMON_H */ +#endif /* __COMMON_H__ */ diff --git a/src/core/core.c b/src/core/core.c index 6a7fbdf..8bbce93 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -76,8 +76,7 @@ static int core_pipe_cb(void *userdata, Ecore_Fd_Handler * fd_handler) int retry_count = 0; int r = -1; if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) { - _E - ("ecore_main_fd_handler_active_get error , return\n"); + _E("ecore_main_fd_handler_active_get error , return"); return 1; } @@ -168,7 +167,7 @@ static void core_init(void *data) __pipe_stop(core_pipe[1]); if (__pipe_start(ad) == -1) - PRT_TRACE_ERR("fail pipe control fd init"); + _E("fail pipe control fd init"); } const struct device_ops core_device_ops = { diff --git a/src/core/device-change-handler.c b/src/core/device-change-handler.c index d107789..50f59ed 100644 --- a/src/core/device-change-handler.c +++ b/src/core/device-change-handler.c @@ -147,7 +147,7 @@ static int check_lowbat_charge_device(int bInserted) bundle_add(b, "_SYSPOPUP_CONTENT_", "warning"); ret = syspopup_launch("lowbat-syspopup", b); if (ret < 0) { - _I("popup lauch failed\n"); + _I("popup launch failed"); } bundle_free(b); } @@ -228,26 +228,26 @@ static void ta_chgdet_cb(struct ss_main_data *ad) __sync_usb_status(); } else - _E("failed to get ta status\n"); + _E("failed to get ta status"); } static void earjack_chgdet_cb(struct ss_main_data *ad) { - _D("jack - earjack changed\n"); + _D("jack - earjack changed"); ss_action_entry_call_internal(PREDEF_EARJACKCON, 0); } static void earkey_chgdet_cb(struct ss_main_data *ad) { int val; - _D("jack - earkey changed\n"); + _D("jack - earkey changed"); if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_EARKEY_ONLINE, &val) == 0) vconf_set_int(VCONFKEY_SYSMAN_EARJACKKEY, val); } static void tvout_chgdet_cb(struct ss_main_data *ad) { - _D("jack - tvout changed\n"); + _D("jack - tvout changed"); pm_change_internal(getpid(), LCD_NORMAL); } @@ -265,7 +265,7 @@ static void hdmi_chgdet_cb(struct ss_main_data *ad) } } if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_HDMI_ONLINE, &val) == 0) { - _D("jack - hdmi changed %d",val); + _D("jack - hdmi changed %d", val); vconf_set_int(VCONFKEY_SYSMAN_HDMI,val); if(val == 1) pm_lock_internal(getpid(), LCD_NORMAL, GOTO_STATE_NOW, 0); @@ -281,7 +281,7 @@ static void keyboard_chgdet_cb(struct ss_main_data *ad) int val = -1; if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_KEYBOARD_ONLINE, &val) == 0) { - _D("jack - keyboard changed %d",val); + _D("jack - keyboard changed %d", val); if(val != 1) val = 0; vconf_set_int(VCONFKEY_SYSMAN_SLIDING_KEYBOARD, val); @@ -306,16 +306,10 @@ static void mmc_chgdet_cb(void *data) } if (data == NULL) { - /* when removed mmc, emul kernel notify twice - * So this code ignores second event */ - if (!inserted) - return; - inserted = false; _D("mmc removed"); ss_mmc_removed(); } else { - /* when inserted mmc, emul kernel notify twice(insert, changed) - * So this code ignores second event */ + _D("mmc added"); if (inserted) return; inserted = true; @@ -385,16 +379,16 @@ static void charge_cb(struct ss_main_data *ad) ret = device_get_property(DEVICE_TYPE_POWER, PROP_POWER_PRESENT, &val); if (ret != 0) - PRT_TRACE_ERR("fail to get battery present value"); + _E("fail to get battery present value"); if (val == 0 && present_status == 1) { present_status = 0; - PRT_TRACE_ERR("battery cf is opened"); + _E("battery cf is opened"); ss_action_entry_call_internal(PREDEF_BATTERY_CF_OPENED, 0); } if (val == 1 && present_status == 0) { present_status = 1; - PRT_TRACE_ERR("battery cf is closed again"); + _E("battery cf is closed again"); } if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &charge_now) != 0 || @@ -464,14 +458,14 @@ static void usb_host_chgdet_cb(keynode_t *in_key, struct ss_main_data *ad) int status; int ret = vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &status); if (ret != 0) { - _E("vconf get failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)\n"); + _E("vconf get failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)"); return ; } if(VCONFKEY_SYSMAN_USB_HOST_CONNECTED == status) { int pid = ss_launch_if_noexist(USBCON_EXEC_PATH, NULL); if (pid < 0) { - _D("usb-server launching failed\n"); + _D("usb-server launching failed"); return; } } @@ -480,16 +474,16 @@ static void usb_host_chgdet_cb(keynode_t *in_key, struct ss_main_data *ad) static void usb_host_add_cb() { - _D("ENTER: usb_host_add_cb()\n"); + _D("ENTER: usb_host_add_cb()"); int status; int ret = vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &status); if (ret != 0) { - _D("vconf get failed ()\n"); + _D("vconf get failed ()"); return; } if (-1 == status) { /* '-1' means that USB host mode is not loaded yet */ - _D("This usb device is connected defaultly\n"); + _D("This usb device is connected defaultly"); ret = system(STORE_DEFAULT_USB_INFO); _D("Return value of usb-devices: %d\n", ret); @@ -498,7 +492,7 @@ static void usb_host_add_cb() _D("Return value of usb-devices: %d\n", ret); } } - _D("EXIT: usb_host_add_cb()\n"); + _D("EXIT: usb_host_add_cb()"); } static int uevent_control_stop(int ufd) @@ -618,7 +612,7 @@ static int uevent_control_cb(void *data, Ecore_Fd_Handler *fd_handler) return -1; } - _D("UEVENT DETECTED (%s)",env_value); + _D("UEVENT DETECTED (%s)", env_value); ss_action_entry_call_internal(PREDEF_DEVICE_CHANGED,1,env_value); udev_device_unref(dev); @@ -676,12 +670,12 @@ int usbcon_def_predefine_action(int argc, char **argv) pm_lock_internal(getpid(), LCD_OFF, STAY_CUR_STATE, 0); pid = ss_launch_if_noexist(USBCON_EXEC_PATH, NULL); if (pid < 0) { - PRT_TRACE_ERR("usb predefine action failed\n"); + _E("usb predefine action failed\n"); return -1; } return pid; } - PRT_TRACE_ERR("failed to get usb status\n"); + _E("failed to get usb status\n"); return -1; } @@ -689,7 +683,7 @@ int earjackcon_def_predefine_action(int argc, char **argv) { int val; - PRT_TRACE_EM("earjack_normal predefine action\n"); + _E("earjack_normal predefine action"); if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_EARJACK_ONLINE, &val) == 0) { return vconf_set_int(VCONFKEY_SYSMAN_EARJACK, val); } @@ -708,7 +702,7 @@ static int battery_def_cf_opened_actioin(int argc, char **argv) ret = syspopup_launch("lowbat-syspopup", b); if (ret < 0) { - PRT_TRACE_ERR("popup launch failed"); + _E("popup launch failed"); } bundle_free(b); diff --git a/src/core/device-notifier.c b/src/core/device-notifier.c index b9b5936..e7cc9a2 100644 --- a/src/core/device-notifier.c +++ b/src/core/device-notifier.c @@ -40,22 +40,22 @@ int register_notifier(enum device_notifier_type status, int (*func)(void *data)) Eina_List *n, *next; struct device_notifier *data, *notifier; - PRT_TRACE("%d, %x", status, func); + _I("%d, %x", status, func); if (!func) { - PRT_TRACE_ERR("invalid func address!"); + _E("invalid func address!"); return -EINVAL; } FIND_NOTIFIER(device_notifier_list, n, next, notifier, status, func) { - PRT_TRACE_ERR("function is already registered! [%d, %x]", + _E("function is already registered! [%d, %x]", status, func); return -EINVAL; } notifier = malloc(sizeof(struct device_notifier)); if (!notifier) { - PRT_TRACE_ERR("Fail to malloc for notifier!"); + _E("Fail to malloc for notifier!"); return -ENOMEM; } @@ -73,12 +73,12 @@ int unregister_notifier(enum device_notifier_type status, int (*func)(void *data struct device_notifier *notifier; if (!func) { - PRT_TRACE_ERR("invalid func address!"); + _E("invalid func address!"); return -EINVAL; } FIND_NOTIFIER(device_notifier_list, n, next, notifier, status, func) { - PRT_TRACE("[%d, %x]", status, func); + _I("[%d, %x]", status, func); free(notifier); EINA_LIST_REMOVE_LIST(device_notifier_list, n); } @@ -101,7 +101,7 @@ void device_notify(enum device_notifier_type status, void *data) } } - PRT_TRACE("cb is called! status:%d, cnt:%d ", status, cnt); + _I("cb is called! status:%d, cnt:%d ", status, cnt); } static void device_notifier_exit(void) @@ -115,7 +115,7 @@ static void device_notifier_exit(void) EINA_LIST_REMOVE_LIST(device_notifier_list, n); } - PRT_TRACE("all deleted!"); + _I("all deleted!"); } const struct device_ops notifier_device_ops = { diff --git a/src/core/edbus-handler.c b/src/core/edbus-handler.c index 08b187f..1e3171f 100644 --- a/src/core/edbus-handler.c +++ b/src/core/edbus-handler.c @@ -51,19 +51,19 @@ static int register_edbus_interface(struct edbus_object *object) int ret; if (!object) { - PRT_TRACE_ERR("object is invalid value!"); + _E("object is invalid value!"); return -1; } object->obj = e_dbus_object_add(edbus_conn, object->path, NULL); if (!object->obj) { - PRT_TRACE_ERR("fail to add edbus obj"); + _E("fail to add edbus obj"); return -1; } object->iface = e_dbus_interface_new(object->interface); if (!object->iface) { - PRT_TRACE_ERR("fail to add edbus interface"); + _E("fail to add edbus interface"); return -1; } @@ -93,13 +93,13 @@ pid_t get_edbus_sender_pid(DBusMessage *msg) pid_t pid; if (!msg) { - PRT_TRACE_ERR("invalid argument!"); + _E("invalid argument!"); return -1; } sender = dbus_message_get_sender(msg); if (!sender) { - PRT_TRACE_ERR("invalid sender!"); + _E("invalid sender!"); return -1; } @@ -108,21 +108,21 @@ pid_t get_edbus_sender_pid(DBusMessage *msg) DBUS_INTERFACE_DBUS, "GetConnectionUnixProcessID"); if (!send_msg) { - PRT_TRACE_ERR("invalid send msg!"); + _E("invalid send msg!"); return -1; } ret = dbus_message_append_args(send_msg, DBUS_TYPE_STRING, &sender, DBUS_TYPE_INVALID); if (!ret) { - PRT_TRACE_ERR("fail to append args!"); + _E("fail to append args!"); dbus_message_unref(send_msg); return -1; } pending = e_dbus_message_send(edbus_conn, send_msg, NULL, -1, NULL); if (!pending) { - PRT_TRACE_ERR("pending is null!"); + _E("pending is null!"); dbus_message_unref(send_msg); return -1; } @@ -135,7 +135,7 @@ pid_t get_edbus_sender_pid(DBusMessage *msg) msg = dbus_pending_call_steal_reply(pending); dbus_pending_call_unref(pending); if (!msg) { - PRT_TRACE_ERR("reply msg is null!"); + _E("reply msg is null!"); return -1; } @@ -178,23 +178,23 @@ int register_edbus_signal_handler(const char *path, const char *interface, interface, name, cb, NULL); if (!handler) { - _D("fail to add edbus handler"); + _E("fail to add edbus handler"); return -1; } - _D("add edbus service: %s", name); + _E("add edbus service: %s", name); entry = malloc(sizeof(struct edbus_list)); if (!entry) { - _D("Malloc failed"); + _E("Malloc failed"); return -1; } entry->signal_name = strndup(name, strlen(name)); if (!entry->signal_name) { - _D("Malloc failed"); + _E("Malloc failed"); free(entry); return -1; } @@ -202,7 +202,7 @@ int register_edbus_signal_handler(const char *path, const char *interface, entry->handler = handler; edbus_handler_list = eina_list_prepend(edbus_handler_list, entry); if (!edbus_handler_list) { - _D("eina_list_prepend failed"); + _E("eina_list_prepend failed"); free(entry->signal_name); free(entry); return -1; @@ -220,7 +220,7 @@ int broadcast_edbus_signal(const char *path, const char *interface, signal = dbus_message_new_signal(path, interface, name); if (!signal) { - _D("fail to allocate new %s.%s signal", interface, name); + _E("fail to allocate new %s.%s signal", interface, name); return -1; } @@ -242,7 +242,7 @@ static void edbus_init(void *data) if (edbus_init_val) break; if (!retry) { - _D("fail to init edbus"); + _E("fail to init edbus"); return; } } @@ -253,7 +253,7 @@ static void edbus_init(void *data) if (edbus_conn) break; if (!retry) { - _D("fail to get edbus"); + _E("fail to get edbus"); goto err_dbus_shutdown; } } @@ -264,7 +264,7 @@ static void edbus_init(void *data) if (edbus_request_name) break; if (!retry) { - _D("fail to request edbus name"); + _E("fail to request edbus name"); goto err_dbus_close; } } @@ -272,10 +272,10 @@ static void edbus_init(void *data) for (i = 0; i < ARRAY_SIZE(edbus_objects); i++) { r = register_edbus_interface(&edbus_objects[i]); if (r < 0) - _D("fail to add obj & interface for %s", + _E("fail to add obj & interface for %s", edbus_objects[i].interface); - _D("add new obj for %s", edbus_objects[i].interface); + _I("add new obj for %s", edbus_objects[i].interface); } _D("start edbus service"); diff --git a/src/core/noti.c b/src/core/noti.c index 1585a02..dca7679 100644 --- a/src/core/noti.c +++ b/src/core/noti.c @@ -47,11 +47,11 @@ static void noti_init(void *data) struct ss_main_data *ad = (struct ss_main_data*)data; if ((ad->noti_fd = heynoti_init()) < 0) { - PRT_TRACE_ERR("Hey Notification Initialize failed"); + _E("Hey Notification Initialize failed"); return; } if (heynoti_attach_handler(ad->noti_fd) != 0) { - PRT_TRACE_ERR("fail to attach hey noti handler"); + _E("fail to attach hey noti handler"); return; } diff --git a/src/core/predefine.c b/src/core/predefine.c index 16da09a..9f3377f 100644 --- a/src/core/predefine.c +++ b/src/core/predefine.c @@ -62,7 +62,7 @@ static int __predefine_get_pid(const char *execpath) dp = opendir("/proc"); if (!dp) { - PRT_TRACE_ERR("open /proc"); + _E("open /proc"); return -1; } diff --git a/src/core/queue.c b/src/core/queue.c index 529b58a..5f3d567 100644 --- a/src/core/queue.c +++ b/src/core/queue.c @@ -157,9 +157,9 @@ int ss_action_entry_call_internal(char *type, int argc, ...) int ret; ret=ss_run_queue_add(data, argc, argv); - _E("ss_run_queue_add : %d",ret); + _E("ss_run_queue_add : %d", ret); ret=ss_core_action_run(); - _E("ss_core_action_run : %d",ret); + _E("ss_core_action_run : %d", ret); return 0; } } @@ -191,7 +191,7 @@ int ss_action_entry_call(struct sysnoti *msg, int sockfd) } } - _I("[SYSMAN] cannot found action"); + _I("[SYSMAN] cannot find action"); return -1; } diff --git a/src/core/sig-handler.c b/src/core/sig-handler.c index 99fab3e..e591406 100644 --- a/src/core/sig-handler.c +++ b/src/core/sig-handler.c @@ -22,22 +22,11 @@ #include #include #include "core.h" +#include "log.h" #include "core/edbus-handler.h" #include "display/poll.h" #include "devices.h" -#define _E(format, args...) do { \ - char buf[255];\ - snprintf(buf, 255, format, ##args);\ - write(2, buf, strlen(buf));\ -} while (0); - -#define _D(format, args...) do { \ - char buf[255];\ - snprintf(buf, 255, format, ##args);\ - write(1, buf, strlen(buf));\ -} while (0); - static struct sigaction sig_child_old_act; static struct sigaction sig_pipe_old_act; diff --git a/src/display/battery.c b/src/display/battery.c index cd1eb7e..a9d6eb4 100644 --- a/src/display/battery.c +++ b/src/display/battery.c @@ -73,7 +73,7 @@ static void print_all_batt_node(enum state_b b_index) Batt_node *node = NULL; int cnt = 0; - LOGINFO("print_all_batt_node [%d]", b_index); + _I("print_all_batt_node [%d]", b_index); if(b_index < 0 || b_index >= B_END) return; @@ -84,7 +84,7 @@ static void print_all_batt_node(enum state_b b_index) node = batt_head[b_index]; while(node != NULL) { cnt++; - LOGINFO("[%d] capacity %5d, time %s", cnt, node->capacity, + _I("[%d] capacity %5d, time %s", cnt, node->capacity, ctime(&node->clock)); node = node->next; } @@ -105,14 +105,14 @@ static int check_value_validity(enum state_b b_index,time_t clock,int capacity) old_capacity = batt_head[b_index]->capacity; if(system_wakeup_flag == true) { - LOGERR("check value validity : invalid cuz system suspend!"); + _E("check value validity : invalid cuz system suspend!"); system_wakeup_flag = false; return -1; } /* capacity */ capadiff = capacity - old_capacity; if((capadiff * multiply_value[b_index]) <= 0) { - LOGERR("check value validity : capadiff(%d) wrong!", capadiff); + _E("check value validity : capadiff(%d) wrong!", capadiff); return -1; } return 0; @@ -129,7 +129,7 @@ static int add_batt_node(enum state_b b_index, time_t clock, int capacity) node = (Batt_node *) malloc(sizeof(Batt_node)); if(node == NULL) { - LOGERR("Not enough memory, add battery node fail!"); + _E("Not enough memory, add battery node fail!"); return -1; } @@ -235,7 +235,7 @@ static float update_factor(enum state_b b_index) node = node->next; cnt++; - /*LOGINFO("[%d] timediff(%lf) / capadiff(%lf) = factor(%lf)", + /*_I("[%d] timediff(%lf) / capadiff(%lf) = factor(%lf)", cnt, timediff, capadiff, factor);*/ factor = 0.0; @@ -246,9 +246,9 @@ static float update_factor(enum state_b b_index) break; } } - LOGINFO(" sum = %lf", total_factor); + _I(" sum = %lf", total_factor); total_factor /= (float)cnt; - LOGINFO(" avg_factor = %lf", total_factor); + _I(" avg_factor = %lf", total_factor); return total_factor; } @@ -267,12 +267,12 @@ static void update_time(enum state_a a_index, int seconds) case A_TIMETOFULL: vconf_set_int(VCONFKEY_PM_BATTERY_TIMETOFULL, seconds); - LOGINFO("update time[%d,%d]", a_index, seconds); + _I("update time[%d,%d]", a_index, seconds); break; case A_TIMETOEMPTY: vconf_set_int(VCONFKEY_PM_BATTERY_TIMETOEMPTY, seconds); - LOGINFO("update time[%d,%d]", a_index, seconds); + _I("update time[%d,%d]", a_index, seconds); break; } } @@ -303,7 +303,7 @@ int battinfo_calculation(void) >= BATTERY_FULL_THRESHOLD) { if(battery_ops.get_charge_full()) { del_all_batt_node(B_CHARGING); - LOGINFO("battery fully charged!"); + _I("battery fully charged!"); update_time(A_TIMETOFULL, 0); return 0; } @@ -349,7 +349,7 @@ static int init_battery_func(void) if(ret >= 0) { get_battery_capacity = battery_ops.get_capacity_raw; full_capacity = FULL_CAPACITY_RAW; - LOGINFO("init_battery_func : full capacity(%d)", full_capacity); + _I("init_battery_func : full capacity(%d)", full_capacity); return 0; } @@ -357,11 +357,11 @@ static int init_battery_func(void) if(ret >= 0) { get_battery_capacity = battery_ops.get_capacity; full_capacity = FULL_CAPACITY; - LOGINFO("init_battery_func : full capacity(%d)", full_capacity); + _I("init_battery_func : full capacity(%d)", full_capacity); return 0; } - LOGERR("init_battery_func : fail to get battery info!"); + _E("init_battery_func : fail to get battery info!"); return -1; } @@ -369,10 +369,10 @@ int start_battinfo_gathering(int timeout) { int ret; - LOGINFO("Start battery gathering!"); + _I("Start battery gathering!"); if(timeout < 0) { - LOGERR("invalid timeout value [%d]!", timeout); + _E("invalid timeout value [%d]!", timeout); return -1; } if(init_battery_func() != 0) @@ -389,19 +389,19 @@ int start_battinfo_gathering(int timeout) /* Using heynoti from system-server(udev) for gathering battery info */ if((noti_fd = heynoti_init()) < 0) { - LOGERR("heynoti init failed!"); + _E("heynoti init failed!"); return -1; } ret = heynoti_subscribe(noti_fd, "device_charge_chgdet", (void *)battinfo_calculation, (void *)NULL); if(ret != 0) { - LOGERR("heynoti subscribe fail!"); + _E("heynoti subscribe fail!"); return -1; } ret = heynoti_attach_handler(noti_fd); if(ret != 0) { - LOGERR("heynoti attach handler fail!"); + _E("heynoti attach handler fail!"); return -1; } } @@ -410,7 +410,7 @@ int start_battinfo_gathering(int timeout) void end_battinfo_gathering(void) { - LOGINFO("End battery gathering!"); + _I("End battery gathering!"); if (!timeout_id) { ecore_timer_del(timeout_id); diff --git a/src/display/core.c b/src/display/core.c index ff7ed73..eee0bbb 100644 --- a/src/display/core.c +++ b/src/display/core.c @@ -186,7 +186,7 @@ static PmLockNode *add_node(enum state_t s_index, pid_t pid, Ecore_Timer *timeou n = (PmLockNode *) malloc(sizeof(PmLockNode)); if (n == NULL) { - LOGERR("Not enough memory, add cond. fail"); + _E("Not enough memory, add cond. fail"); return NULL; } @@ -229,7 +229,7 @@ static int del_node(enum state_t s_index, PmLockNode *n) static Eina_Bool del_dim_cond(void *data) { PmLockNode *tmp = NULL; - LOGINFO("delete prohibit dim condition by timeout\n"); + _I("delete prohibit dim condition by timeout"); tmp = find_node(S_LCDDIM, (pid_t) data); del_node(S_LCDDIM, tmp); @@ -243,7 +243,7 @@ static Eina_Bool del_dim_cond(void *data) static Eina_Bool del_off_cond(void *data) { PmLockNode *tmp = NULL; - LOGINFO("delete prohibit off condition by timeout\n"); + _I("delete prohibit off condition by timeout"); tmp = find_node(S_LCDOFF, (pid_t) data); del_node(S_LCDOFF, tmp); @@ -257,7 +257,7 @@ static Eina_Bool del_off_cond(void *data) static Eina_Bool del_sleep_cond(void *data) { PmLockNode *tmp = NULL; - LOGINFO("delete prohibit sleep condition by timeout\n"); + _I("delete prohibit sleep condition by timeout"); tmp = find_node(S_SLEEP, (pid_t) data); del_node(S_SLEEP, tmp); @@ -311,7 +311,7 @@ static int proc_condition(PMMsg *data) tmp->holdkey_block = holdkey_block; } /* for debug */ - LOGINFO("[%s] locked by pid %d - process %s\n", "S_NORMAL", pid, + _I("[%s] locked by pid %d - process %s", "S_NORMAL", pid, pname); } if (val & MASK_OFF) { @@ -330,7 +330,7 @@ static int proc_condition(PMMsg *data) tmp->holdkey_block = holdkey_block; } /* for debug */ - LOGINFO("[%s] locked by pid %d - process %s\n", "S_LCDDIM", pid, + _I("[%s] locked by pid %d - process %s", "S_LCDDIM", pid, pname); } if (val & MASK_SLP) { @@ -350,7 +350,7 @@ static int proc_condition(PMMsg *data) set_process_active(EINA_TRUE, pid); /* for debug */ - LOGINFO("[%s] locked by pid %d - process %s\n", "S_LCDOFF", pid, + _I("[%s] locked by pid %d - process %s", "S_LCDOFF", pid, pname); } @@ -359,13 +359,13 @@ static int proc_condition(PMMsg *data) if (val & MASK_DIM) { tmp = find_node(S_LCDDIM, pid); del_node(S_LCDDIM, tmp); - LOGINFO("[%s] unlocked by pid %d - process %s\n", "S_NORMAL", + _I("[%s] unlocked by pid %d - process %s", "S_NORMAL", pid, pname); } if (val & MASK_OFF) { tmp = find_node(S_LCDOFF, pid); del_node(S_LCDOFF, tmp); - LOGINFO("[%s] unlocked by pid %d - process %s\n", "S_LCDDIM", + _I("[%s] unlocked by pid %d - process %s", "S_LCDDIM", pid, pname); } if (val & MASK_SLP) { @@ -373,22 +373,22 @@ static int proc_condition(PMMsg *data) del_node(S_SLEEP, tmp); set_process_active(EINA_FALSE, pid); - LOGINFO("[%s] unlocked by pid %d - process %s\n", "S_LCDOFF", + _I("[%s] unlocked by pid %d - process %s", "S_LCDOFF", pid, pname); } val = val >> 8; if (val != 0) { if ((val & 0x1)) { reset_timeout(states[pm_cur_state].timeout); - LOGINFO("reset timeout (%d seconds)", - states[pm_cur_state].timeout); + _I("reset timeout (%d seconds)", + states[pm_cur_state].timeout); } } else { /* guard time for suspend */ if (pm_cur_state == S_LCDOFF) { reset_timeout(states[S_LCDOFF].timeout); - LOGINFO("margin timeout (%d seconds)", - states[S_LCDOFF].timeout); + _I("margin timeout (%d seconds)", + states[S_LCDOFF].timeout); } } @@ -410,7 +410,7 @@ static int proc_change_state(unsigned int cond) break; } } - LOGINFO("Change State to %s", state_string[next_state]); + _I("Change State to %s", state_string[next_state]); switch (next_state) { case S_NORMAL: @@ -427,7 +427,7 @@ static int proc_change_state(unsigned int cond) } break; case S_SLEEP: - LOGINFO("Dangerous requests."); + _I("Dangerous requests."); /* at first LCD_OFF and then goto sleep */ /* state transition */ pm_old_state = pm_cur_state; @@ -460,7 +460,7 @@ int check_processes(enum state_t prohibit_state) while (t != NULL) { if (kill(t->pid, 0) == -1) { - LOGERR("%d process does not exist, delete the REQ" + _E("%d process does not exist, delete the REQ" " - prohibit state %d ", t->pid, prohibit_state); tmp = t; @@ -482,12 +482,12 @@ int check_holdkey_block(enum state_t state) PmLockNode *t = cond_head[state]; int ret = 0; - LOGINFO("check holdkey block : state of %s", state_string[state]); + _I("check holdkey block : state of %s", state_string[state]); while (t != NULL) { if (t->holdkey_block == true) { ret = 1; - LOGINFO("Hold key blocked by pid(%d)!", t->pid); + _I("Hold key blocked by pid(%d)!", t->pid); break; } t = t->next; @@ -502,7 +502,7 @@ int delete_condition(enum state_t state) int ret = 0; PmLockNode *tmp = NULL; - LOGINFO("delete condition : state of %s", state_string[state]); + _I("delete condition : state of %s", state_string[state]); while (t != NULL) { if (t->timeout_id > 0) { @@ -510,7 +510,7 @@ int delete_condition(enum state_t state) } tmp = t; t = t->next; - LOGINFO("delete node of pid(%d)", tmp->pid); + _I("delete node of pid(%d)", tmp->pid); del_node(state, tmp); } @@ -691,7 +691,7 @@ static void sig_hup(int signo) /* timeout handler */ Eina_Bool timeout_handler(void *data) { - LOGINFO("Time out state %s\n", state_string[pm_cur_state]); + _I("Time out state %s", state_string[pm_cur_state]); if (timeout_src_id != NULL) { ecore_timer_del(timeout_src_id); @@ -736,7 +736,7 @@ static int default_trans(int evt) int next_state; if (pm_cur_state == S_NORMAL && st->timeout == 0) { - LOGINFO("LCD always on enabled!"); + _I("LCD always on enabled!"); return 0; } @@ -745,7 +745,7 @@ static int default_trans(int evt) /* check conditions */ while (st->check && !st->check(next_state)) { /* There is a condition. */ - LOGINFO("%s -> %s : check fail", state_string[pm_cur_state], + _I("%s -> %s : check fail", state_string[pm_cur_state], state_string[next_state]); if (!check_processes(next_state)) { /* this is valid condition - the application that sent the condition is running now. */ @@ -762,7 +762,7 @@ static int default_trans(int evt) if (st->action) { if (pm_cur_state == S_LCDDIM && st->timeout == 0) { /* dim timeout 0, enter next state directly */ - LOGINFO("dim timeout 0, goto LCDOFF state"); + _I("dim timeout 0, goto LCDOFF state"); states[pm_cur_state].trans(EVENT_TIMEOUT); } else { @@ -785,7 +785,7 @@ static int default_action(int timeout) struct itimerval val; if (status != DEVICE_OPS_STATUS_START) { - LOGERR("display is not started!"); + _E("display is not started!"); return -EINVAL; } @@ -808,7 +808,7 @@ static int default_action(int timeout) i++) { vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); - LOGERR("Idle lock check: %d, vonf: %d", + _E("Idle lock check: %d, vonf: %d", i, lock_state); if (lock_state) break; @@ -874,16 +874,16 @@ static int default_action(int timeout) /* sleep state : set system mode to SUSPEND */ if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_WAKEUP_COUNT, &wakeup_count) < 0) - LOGERR("wakeup count read error"); + _E("wakeup count read error"); if (wakeup_count < 0) { - LOGINFO("Wakup Event! Can not enter suspend mode."); + _I("Wakup Event! Can not enter suspend mode."); goto go_lcd_off; } if (device_set_property(DEVICE_TYPE_POWER, PROP_POWER_WAKEUP_COUNT, wakeup_count) < 0) { - LOGERR("wakeup count write error"); + _E("wakeup count write error"); goto go_lcd_off; } goto go_suspend; @@ -891,7 +891,7 @@ static int default_action(int timeout) /* set timer with current state timeout */ reset_timeout(timeout); - LOGINFO("timout set: %s state %d sec", + _I("timout set: %s state %d sec", state_string[pm_cur_state], timeout); return 0; @@ -901,7 +901,7 @@ go_suspend: pm_history_save(PM_LOG_SLEEP, pm_cur_state); #endif power_ops.suspend(); - LOGINFO("system wakeup!!"); + _I("system wakeup!!"); system_wakeup_flag = true; heynoti_publish(PM_WAKEUP_NOTI_NAME); /* Resume !! */ @@ -930,11 +930,11 @@ static int default_check(int next) int trans_cond = trans_condition & MASK_BIT; int lock_state = -1; - LOGINFO("trans_cond : %x", trans_cond); + _I("trans_cond : %x", trans_cond); vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); if (lock_state==VCONFKEY_IDLE_LOCK && next != S_SLEEP) { - LOGINFO("default_check:LOCK STATE, it's transitable"); + _I("default_check:LOCK STATE, it's transitable"); return 1; } @@ -1005,7 +1005,7 @@ static int get_lcd_timeout_from_settings(void) break; } } - LOGINFO("%s state : %d timeout", state_string[i], + _I("%s state : %d timeout", state_string[i], states[i].timeout); } @@ -1029,14 +1029,14 @@ static int poll_callback(int condition, PMMsg *data) if (condition == INPUT_POLL_EVENT) { if (pm_cur_state == S_LCDOFF || pm_cur_state == S_SLEEP) - LOGINFO("Power key input"); + _I("Power key input"); time(&now); if (last_t != now) { states[pm_cur_state].trans(EVENT_INPUT); last_t = now; } } else if (condition == PM_CONTROL_EVENT) { - LOGINFO("process pid(%d) pm_control condition : %x ", + _I("process pid(%d) pm_control condition : %x ", data->pid, data->cond); if (data->cond & MASK_BIT @@ -1044,7 +1044,7 @@ static int poll_callback(int condition, PMMsg *data) proc_condition(data); if (data->cond & CHANGE_STATE_BIT) { - LOGINFO("Change state by pid(%d) request.", data->pid); + _I("Change state by pid(%d) request.", data->pid); proc_change_state(data->cond); } } @@ -1065,11 +1065,11 @@ static int update_setting(int key_idx, int val) case SETTING_TO_NORMAL: ret = get_dim_timeout(&dim_timeout); if (ret < 0 || dim_timeout < 0) { - LOGERR("Can not get dim timeout.set default 5 seconds"); + _E("Can not get dim timeout.set default 5 seconds"); dim_timeout = DEFAULT_DIM_TIMEOUT; } if (val < 0) { - LOGERR("LCD timeout is wrong, set default 15 seconds"); + _E("LCD timeout is wrong, set default 15 seconds"); val = 15; } if (val == 0) { @@ -1120,13 +1120,13 @@ static int update_setting(int key_idx, int val) pm_status_flag |= BRTCH_FLAG; vconf_set_bool(VCONFKEY_PM_BRIGHTNESS_CHANGED_IN_LPM, true); - LOGINFO("brightness changed in low battery," + _I("brightness changed in low battery," "escape dim state"); } backlight_ops.set_default_brt(val); snprintf(buf, sizeof(buf), "%s %d", SET_BRIGHTNESS_IN_BOOTLOADER, val); - LOGINFO("Brightness set in bl : %d",val); + _I("Brightness set in bl : %d",val); system(buf); break; case SETTING_LOCK_SCREEN: @@ -1134,19 +1134,19 @@ static int update_setting(int key_idx, int val) set_lock_screen_state(val); states[S_NORMAL].timeout = LOCK_SCREEN_TIMEOUT; states[S_LCDDIM].timeout = 0; - LOGERR("LOCKED: NORMAL timeout is set by %d seconds", + _E("LOCKED: NORMAL timeout is set by %d seconds", LOCK_SCREEN_TIMEOUT); } else { set_lock_screen_state(val); get_run_timeout(&run_timeout); if (run_timeout < 0) { - LOGERR("Can not get run timeout." + _E("Can not get run timeout." "set default 15 seconds"); run_timeout = 10; } states[S_NORMAL].timeout = run_timeout; states[S_LCDDIM].timeout = DEFAULT_DIM_TIMEOUT; - LOGINFO("UNLOCKED: NORMAL timeout is set by" + _I("UNLOCKED: NORMAL timeout is set by" " %d seconds", run_timeout); } if (pm_cur_state == S_NORMAL) { @@ -1162,7 +1162,7 @@ static int update_setting(int key_idx, int val) set_power_saving_display_stat(power_saving_display_stat); if (device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_FRAME_RATE, power_saving_display_stat) < 0) { - LOGERR("Fail to set display frame rate!"); + _E("Fail to set display frame rate!"); } backlight_ops.restore(); break; @@ -1177,7 +1177,7 @@ static int update_setting(int key_idx, int val) set_power_saving_display_stat(power_saving_display_stat); if (device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_FRAME_RATE, power_saving_display_stat) < 0) { - LOGERR("Fail to set display frame rate!"); + _E("Fail to set display frame rate!"); } backlight_ops.restore(); } @@ -1218,13 +1218,13 @@ static void check_seed_status(void) ret = get_setting_brightness(&tmp); if (ret != 0 || (tmp < PM_MIN_BRIGHTNESS || tmp > PM_MAX_BRIGHTNESS)) { - LOGINFO("fail to read vconf value for brightness"); + _I("fail to read vconf value for brightness"); brt = PM_DEFAULT_BRIGHTNESS; if (tmp < PM_MIN_BRIGHTNESS || tmp > PM_MAX_BRIGHTNESS) vconf_set_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, brt); tmp = brt; } - LOGINFO("Set brightness from Setting App. %d", tmp); + _I("Set brightness from Setting App. %d", tmp); backlight_ops.set_default_brt(tmp); vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state); @@ -1252,7 +1252,7 @@ static void check_seed_status(void) if (lock_state == VCONFKEY_IDLE_LOCK) { states[S_NORMAL].timeout = LOCK_SCREEN_TIMEOUT; states[S_LCDDIM].timeout = 0; - LOGERR("LCD NORMAL timeout is set by %d seconds" + _E("LCD NORMAL timeout is set by %d seconds" " for lock screen", LOCK_SCREEN_TIMEOUT); } @@ -1266,9 +1266,9 @@ static void check_seed_status(void) &power_saving_display_stat); } if (power_saving_display_stat < 0) { - LOGERR("failed to read power saving display stat!"); + _E("failed to read power saving display stat!"); } else { - LOGINFO("power saving display stat : %d", + _I("power saving display stat : %d", power_saving_display_stat); set_power_saving_display_stat(power_saving_display_stat); } @@ -1301,10 +1301,10 @@ void print_dev_list(int fd) indev *tmp; total = eina_list_count(indev_list); - LOGINFO("***** total list : %d *****", total); + _I("***** total list : %d *****", total); for (i = 0; i < total; i++) { tmp = (indev*)eina_list_nth(indev_list, i); - LOGINFO("* %d | path:%s, fd:%d, dev_fd:%d", + _I("* %d | path:%s, fd:%d, dev_fd:%d", i, tmp->dev_path, tmp->fd, tmp->dev_fd); if (fd >= 0) { char buf[255]; @@ -1313,7 +1313,7 @@ void print_dev_list(int fd) write(fd, buf, strlen(buf)); } } - LOGINFO("***************************\n"); + _I("***************************\n"); } static int input_action(char* input_act, char* input_path) @@ -1326,12 +1326,12 @@ static int input_action(char* input_act, char* input_path) PmLockNode *tmp = NULL; if (!strcmp("add", input_act)) { - LOGINFO("add input path : %s", input_path); + _I("add input path : %s", input_path); ret = init_pm_poll_input(poll_callback, input_path); } else if (!strcmp("remove", input_act)) { EINA_LIST_FOREACH_SAFE(indev_list, l, l_next, data) if(!strcmp(input_path, data->dev_path)) { - LOGINFO("remove %s", input_path); + _I("remove %s", input_path); ecore_main_fd_handler_del(data->dev_fd); close(data->fd); free(data->dev_path); @@ -1341,7 +1341,7 @@ static int input_action(char* input_act, char* input_path) ret = 0; } else if (!strcmp("change", input_act)) { if (!strcmp("ESD", input_path)) { - LOGINFO("ESD on"); + _I("ESD on"); if (pm_cur_state == S_NORMAL) { backlight_ops.off(); backlight_ops.on(); @@ -1356,7 +1356,7 @@ static int input_action(char* input_act, char* input_path) if (!strcmp("lcdoff", input_path)) { tmp = find_node(S_SLEEP, 1); if (!tmp && add_node(S_SLEEP, 1, -1, 0) != NULL) - LOGINFO("lock LCD OFF from pm_event"); + _I("lock LCD OFF from pm_event"); } ret = 0; } else if (!strcmp("unlock", input_act)) { @@ -1364,7 +1364,7 @@ static int input_action(char* input_act, char* input_path) tmp = find_node(S_SLEEP, 1); if (tmp != NULL) { del_node(S_SLEEP, tmp); - LOGINFO("unlock LCD OFF from pm_event"); + _I("unlock LCD OFF from pm_event"); } } ret = 0; @@ -1381,13 +1381,13 @@ static void input_cb(void* data) fp = fopen((char *) data, "r"); if (fp == NULL) { - LOGERR("input file open fail"); + _E("input file open fail"); return ; } while (fgets(args, NAME_MAX + MAX_INPUT, fp) != NULL) { if (args[strlen(args)-1] != '\n') { - LOGERR("input file must be terminated with" + _E("input file must be terminated with" " new line character\n"); break; } @@ -1395,7 +1395,7 @@ static void input_cb(void* data) for (i = 0; i< NAME_MAX + MAX_INPUT; i++) { if (args[i] == ' ') { if (i >= NAME_MAX) { - LOGERR("bsfile name is over" + _E("bsfile name is over" " the name_max(255)\n"); break; } @@ -1433,21 +1433,21 @@ static int set_noti(int *noti_fd) fd = heynoti_init(); if (fd < 0) { - LOGERR("heynoti_init error"); + _E("heynoti_init error"); return -1; } if (heynoti_subscribe(fd, PM_EVENT_NOTI_NAME, input_cb, PM_EVENT_NOTI_PATH) < 0) { - LOGERR("input file change noti add failed(%s). %s", + _E("input file change noti add failed(%s). %s", buf, strerror(errno)); return -1; } else { - LOGERR("input file change noti add ok"); + _E("input file change noti add ok"); } if (heynoti_attach_handler(fd) < 0) { - LOGERR("heynoti_attach_handler error"); + _E("heynoti_attach_handler error"); return -1; } @@ -1458,13 +1458,13 @@ static int set_noti(int *noti_fd) static int unset_noti(int noti_fd) { if (noti_fd < 0) { - LOGINFO("set noti already failed. nothing to do in unset"); + _I("set noti already failed. nothing to do in unset"); return 0; } if (heynoti_unsubscribe(noti_fd, PM_EVENT_NOTI_NAME, input_cb) < 0 || heynoti_detach_handler(noti_fd) < 0) { - LOGERR("heynoti unsubsribe or detach error"); + _E("heynoti unsubsribe or detach error"); return -1; } return 0; @@ -1506,7 +1506,7 @@ static void display_init(void *data) unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS); int timeout = 0; - LOGINFO("Start power manager"); + _I("Start power manager"); signal(SIGHUP, sig_hup); @@ -1528,16 +1528,16 @@ static void display_init(void *data) ret = init_sysfs(flags); break; case INIT_POLL: - LOGINFO("poll init"); + _I("poll init"); ret = init_pm_poll(poll_callback); break; case INIT_DBUS: - LOGINFO("dbus init"); + _I("dbus init"); ret = init_pm_dbus(); break; } if (ret != 0) { - LOGERR("%s", errMSG[i]); + _E("%s", errMSG[i]); break; } } @@ -1552,7 +1552,7 @@ static void display_init(void *data) pm_init_extention(NULL); if (flags & WITHOUT_STARTNOTI) { /* start without noti */ - LOGINFO("Start Power managing without noti"); + _I("Start Power managing without noti"); pm_cur_state = S_NORMAL; set_setting_pmstate(pm_cur_state); @@ -1597,7 +1597,7 @@ static void display_exit(void *data) if (pm_exit_extention != NULL) pm_exit_extention(); - LOGINFO("Stop power manager"); + _I("Stop power manager"); } static int display_status(void) diff --git a/src/display/display-dbus.c b/src/display/display-dbus.c index c82525b..d6c46ad 100644 --- a/src/display/display-dbus.c +++ b/src/display/display-dbus.c @@ -65,20 +65,20 @@ static DBusMessage *e_dbus_lockstate_cb(E_DBus_Object *obj, DBusMessage *msg) DBUS_TYPE_STRING, &option1_str, DBUS_TYPE_STRING, &option2_str, DBUS_TYPE_INT32, &timeout, DBUS_TYPE_INVALID)) { - LOGERR("there is no message"); + _E("there is no message"); ret = -EINVAL; goto out; } if (!state_str || timeout < 0) { - LOGERR("message is invalid!"); + _E("message is invalid!"); ret = -EINVAL; goto out; } pid = get_edbus_sender_pid(msg); if (kill(pid, 0) == -1) { - LOGERR("%d process does not exist, dbus ignored!", pid); + _E("%d process does not exist, dbus ignored!", pid); ret = -ESRCH; goto out; } @@ -90,7 +90,7 @@ static DBusMessage *e_dbus_lockstate_cb(E_DBus_Object *obj, DBusMessage *msg) else if (!strcmp(state_str, PM_LCDOFF_STR)) state = LCD_OFF; else { - LOGERR("%s state is invalid, dbus ignored!", state_str); + _E("%s state is invalid, dbus ignored!", state_str); ret = -EINVAL; goto out; } @@ -100,7 +100,7 @@ static DBusMessage *e_dbus_lockstate_cb(E_DBus_Object *obj, DBusMessage *msg) else if (!strcmp(option1_str, GOTOSTATENOW_STR)) flag = GOTO_STATE_NOW; else { - LOGERR("%s option is invalid. set default option!", option1_str); + _E("%s option is invalid. set default option!", option1_str); flag = STAY_CUR_STATE; } @@ -130,20 +130,20 @@ static DBusMessage *e_dbus_unlockstate_cb(E_DBus_Object *obj, DBusMessage *msg) if (!dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &state_str, DBUS_TYPE_STRING, &option_str, DBUS_TYPE_INVALID)) { - LOGERR("there is no message"); + _E("there is no message"); ret = -EINVAL; goto out; } if (!state_str) { - LOGERR("message is invalid!"); + _E("message is invalid!"); ret = -EINVAL; goto out; } pid = get_edbus_sender_pid(msg); if (kill(pid, 0) == -1) { - LOGERR("%d process does not exist, dbus ignored!", pid); + _E("%d process does not exist, dbus ignored!", pid); ret = -ESRCH; goto out; } @@ -155,7 +155,7 @@ static DBusMessage *e_dbus_unlockstate_cb(E_DBus_Object *obj, DBusMessage *msg) else if (!strcmp(state_str, PM_LCDOFF_STR)) state = LCD_OFF; else { - LOGERR("%s state is invalid, dbus ignored!", state_str); + _E("%s state is invalid, dbus ignored!", state_str); ret = -EINVAL; goto out; } @@ -167,7 +167,7 @@ static DBusMessage *e_dbus_unlockstate_cb(E_DBus_Object *obj, DBusMessage *msg) else if (!strcmp(option_str, KEEP_TIMER_STR)) flag = PM_KEEP_TIMER; else { - LOGERR("%s option is invalid. set default option!", option_str); + _E("%s option is invalid. set default option!", option_str); flag = PM_RESET_TIMER; } @@ -194,20 +194,20 @@ static DBusMessage *e_dbus_changestate_cb(E_DBus_Object *obj, DBusMessage *msg) if (!dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &state_str, DBUS_TYPE_INVALID)) { - LOGERR("there is no message"); + _E("there is no message"); ret = -EINVAL; goto out; } if (!state_str) { - LOGERR("message is invalid!"); + _E("message is invalid!"); ret = -EINVAL; goto out; } pid = get_edbus_sender_pid(msg); if (kill(pid, 0) == -1) { - LOGERR("%d process does not exist, dbus ignored!", pid); + _E("%d process does not exist, dbus ignored!", pid); ret = -ESRCH; goto out; } @@ -219,7 +219,7 @@ static DBusMessage *e_dbus_changestate_cb(E_DBus_Object *obj, DBusMessage *msg) else if (!strcmp(state_str, PM_LCDOFF_STR)) state = LCD_OFF; else { - LOGERR("%s state is invalid, dbus ignored!", state_str); + _E("%s state is invalid, dbus ignored!", state_str); ret = -EINVAL; goto out; } @@ -244,7 +244,7 @@ static DBusMessage *e_dbus_getbrightness_cb(E_DBus_Object *obj, DBusMessage *msg cmd = DISP_CMD(PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY); ret = device_get_property(DEVICE_TYPE_DISPLAY, cmd, &brightness); - LOGINFO("get brightness %d, %d", brightness, ret); + _I("get brightness %d, %d", brightness, ret); reply = dbus_message_new_method_return(msg); dbus_message_iter_init_append(reply, &iter); @@ -267,7 +267,7 @@ static DBusMessage *e_dbus_setbrightness_cb(E_DBus_Object *obj, DBusMessage *msg cmd = DISP_CMD(PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY); ret = device_set_property(DEVICE_TYPE_DISPLAY, cmd, brightness); - LOGINFO("set brightness %d, %d", brightness, ret); + _I("set brightness %d, %d", brightness, ret); reply = dbus_message_new_method_return(msg); dbus_message_iter_init_append(reply, &iter); @@ -300,10 +300,10 @@ int init_pm_dbus(void) iface = get_edbus_interface(DEVICED_PATH_DISPLAY); - LOGINFO("%s, %x", DEVICED_PATH_DISPLAY, iface); + _I("%s, %x", DEVICED_PATH_DISPLAY, iface); if (!iface) { - LOGERR("fail to get edbus interface!"); + _E("fail to get edbus interface!"); return -1; } @@ -314,7 +314,7 @@ int init_pm_dbus(void) edbus_methods[i].reply_signature, edbus_methods[i].func); if (!ret) { - LOGERR("fail to add method %s!", edbus_methods[i].member); + _E("fail to add method %s!", edbus_methods[i].member); return -1; } } diff --git a/src/display/key-filter.c b/src/display/key-filter.c index b5a0fb5..b6600ed 100644 --- a/src/display/key-filter.c +++ b/src/display/key-filter.c @@ -68,7 +68,7 @@ static void longkey_pressed() { int val = 0; char *opt; - LOGINFO("Power key long pressed!"); + _I("Power key long pressed!"); cancel_lcdoff = 1; /* change state - LCD on */ @@ -156,13 +156,13 @@ static int process_power_key(struct input_event *pinput) case KEY_PRESSED: if (timediff_usec(pressed_time, pinput->time) < (POWER_KEY_PRESS_IGNORE_TIME * USEC_PER_SEC)) { - LOGINFO("power key double pressed ignored"); + _I("power key double pressed ignored"); powerkey_ignored = true; break; } else { powerkey_ignored = false; } - LOGINFO("power key pressed"); + _I("power key pressed"); pressed_time.tv_sec = (pinput->time).tv_sec; pressed_time.tv_usec = (pinput->time).tv_usec; if (key_combination == KEY_COMBINATION_STOP) { @@ -179,7 +179,7 @@ static int process_power_key(struct input_event *pinput) ecore_timer_del(combination_timeout_id); combination_timeout_id = NULL; } - LOGINFO("capture mode"); + _I("capture mode"); key_combination = KEY_COMBINATION_SCREENCAPTURE; ignore = false; } @@ -209,7 +209,7 @@ static int process_volumedown_key(struct input_event *pinput) ecore_timer_del(combination_timeout_id); combination_timeout_id = NULL; } - LOGINFO("capture mode"); + _I("capture mode"); key_combination = KEY_COMBINATION_SCREENCAPTURE; ignore = false; } diff --git a/src/display/llinterface.c b/src/display/llinterface.c index fa3778c..02c8a17 100644 --- a/src/display/llinterface.c +++ b/src/display/llinterface.c @@ -82,7 +82,7 @@ static int _bl_brt(PMSys *p, int brightness) /* Update device brightness */ ret = device_set_property(DEVICE_TYPE_DISPLAY, cmd, brightness); - LOGERR("set brightness %d, %d", brightness, ret); + _E("set brightness %d, %d", brightness, ret); return ret; } @@ -189,7 +189,7 @@ static void _init_pmsys(PMSys *p) static void *_system_suspend_cb(void *data) { - LOGINFO("enter system suspend"); + _I("enter system suspend"); if (pmsys && pmsys->sys_power_state) return pmsys->sys_power_state(pmsys, POWER_STATE_SUSPEND); return 0; @@ -202,7 +202,7 @@ static int system_suspend(void) ret = pthread_create(&pth, 0, _system_suspend_cb, (void*)NULL); if (ret < 0) { - LOGERR("pthread creation failed!, suspend directly!"); + _E("pthread creation failed!, suspend directly!"); _system_suspend_cb((void*)NULL); } else { pthread_join(pth, NULL); @@ -213,7 +213,7 @@ static int system_suspend(void) static int system_pre_suspend(void) { - LOGINFO("enter system pre suspend"); + _I("enter system pre suspend"); if (pmsys && pmsys->sys_power_state) return pmsys->sys_power_state(pmsys, POWER_STATE_PRE_SUSPEND); @@ -222,7 +222,7 @@ static int system_pre_suspend(void) static int system_post_resume(void) { - LOGINFO("enter system post resume"); + _I("enter system post resume"); if (pmsys && pmsys->sys_power_state) return pmsys->sys_power_state(pmsys, POWER_STATE_POST_RESUME); @@ -267,7 +267,7 @@ static int backlight_on(void) int ret = -1; int i; - LOGINFO("LCD on"); + _I("LCD on"); if (!pmsys || !pmsys->bl_onoff) return -1; @@ -284,9 +284,9 @@ static int backlight_on(void) pm_history_save(PM_LOG_LCD_ON_FAIL, pm_cur_state); #endif #ifdef ENABLE_X_LCD_ONOFF - LOGERR("Failed to LCD on, through xset"); + _E("Failed to LCD on, through xset"); #else - LOGERR("Failed to LCD on, through OAL"); + _E("Failed to LCD on, through OAL"); #endif ret = -1; } @@ -299,7 +299,7 @@ static int backlight_off(void) int ret = -1; int i; - LOGINFO("LCD off"); + _I("LCD off"); if (!pmsys || !pmsys->bl_onoff) return -1; @@ -320,9 +320,9 @@ static int backlight_off(void) pm_history_save(PM_LOG_LCD_OFF_FAIL, pm_cur_state); #endif #ifdef ENABLE_X_LCD_ONOFF - LOGERR("Failed to LCD off, through xset"); + _E("Failed to LCD off, through xset"); #else - LOGERR("Failed to LCD off, through OAL"); + _E("Failed to LCD off, through OAL"); #endif ret = -1; } @@ -352,7 +352,7 @@ static int backlight_restore(void) ret = vconf_get_int(VCONFKEY_PM_CUSTOM_BRIGHTNESS_STATUS, &val); if (ret == 0 && val == VCONFKEY_PM_CUSTOM_BRIGHTNESS_ON) { - LOGINFO("custom brightness mode! brt no restored"); + _I("custom brightness mode! brt no restored"); return 0; } if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) { @@ -405,7 +405,7 @@ int init_sysfs(unsigned int flags) pmsys = (PMSys *) malloc(sizeof(PMSys)); if (pmsys == NULL) { - LOGERR("Not enough memory to alloc PM Sys"); + _E("Not enough memory to alloc PM Sys"); return -1; } @@ -415,7 +415,7 @@ int init_sysfs(unsigned int flags) _init_bldev(pmsys, flags); if (pmsys->bl_onoff == NULL || pmsys->sys_power_state == NULL) { - LOGERR + _E ("We have no managable resource to reduce the power consumption"); return -1; } @@ -431,7 +431,7 @@ int exit_sysfs(void) fd = open("/tmp/sem.pixmap_1", O_RDONLY); if (fd == -1) { - LOGERR("X server disable"); + _E("X server disable"); backlight_on(); } diff --git a/src/display/lsensor.c b/src/display/lsensor.c index 995a053..2207386 100644 --- a/src/display/lsensor.c +++ b/src/display/lsensor.c @@ -58,7 +58,7 @@ static bool alc_handler(void* data) fault_count++; } else { if (light_data.values[0] < 0.0 || light_data.values[0] > 10.0) { - LOGINFO("fail to load light data : %d", (int)light_data.values[0]); + _I("fail to load light data : %d", (int)light_data.values[0]); fault_count++; } else { int tmp_value; @@ -71,7 +71,7 @@ static bool alc_handler(void* data) backlight_ops.set_default_brt(value); backlight_ops.restore(); } - LOGINFO("load light data : %d, brightness : %d", (int)light_data.values[0], value); + _I("load light data : %d, brightness : %d", (int)light_data.values[0], value); } } } @@ -82,7 +82,7 @@ static bool alc_handler(void* data) alc_timeout_id = NULL; vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_OFF); - LOGERR("Fault counts is over %d, disable automatic brightness", + _E("Fault counts is over %d, disable automatic brightness", MAX_FAULT); return EINA_FALSE; } @@ -95,7 +95,7 @@ static bool alc_handler(void* data) static int alc_action(int timeout) { - LOGINFO("alc action"); + _I("alc action"); /* sampling timer add */ if (alc_timeout_id == 0 && !(pm_status_flag & PWRSV_FLAG)) alc_timeout_id = @@ -113,15 +113,15 @@ static int connect_sfsvc(void) { int sf_state = -1; /* connect with sensor fw */ - LOGINFO("connect with sensor fw"); + _I("connect with sensor fw"); sf_handle = sf_connect(LIGHT_SENSOR); if (sf_handle < 0) { - LOGERR("sensor attach fail"); + _E("sensor attach fail"); return -1; } sf_state = sf_start(sf_handle, 0); if (sf_state < 0) { - LOGERR("sensor attach fail"); + _E("sensor attach fail"); sf_disconnect(sf_handle); sf_handle = -1; return -2; @@ -132,7 +132,7 @@ static int connect_sfsvc(void) static int disconnect_sfsvc(void) { - LOGINFO("disconnect with sensor fw"); + _I("disconnect with sensor fw"); if(sf_handle >= 0) { sf_stop(sf_handle); @@ -157,7 +157,7 @@ static inline void set_brtch_state(void) if (pm_status_flag & PWRSV_FLAG) { pm_status_flag |= BRTCH_FLAG; vconf_set_bool(VCONFKEY_PM_BRIGHTNESS_CHANGED_IN_LPM, true); - LOGINFO("brightness changed in low battery," + _I("brightness changed in low battery," "escape dim state (light)"); } } @@ -171,7 +171,7 @@ static int set_alc_function(keynode_t *key_nodes, void *data) int max_brt = -1; if (key_nodes == NULL) { - LOGERR("wrong parameter, key_nodes is null"); + _E("wrong parameter, key_nodes is null"); return -1; } @@ -191,7 +191,7 @@ static int set_alc_function(keynode_t *key_nodes, void *data) ecore_timer_add(SAMPLING_INTERVAL, (Ecore_Task_Cb)alc_handler, NULL); } else if (onoff == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) { - LOGINFO("auto brightness paused!"); + _I("auto brightness paused!"); disconnect_sfsvc(); } else { disconnect_sfsvc(); @@ -200,7 +200,7 @@ static int set_alc_function(keynode_t *key_nodes, void *data) ret = get_setting_brightness(&default_brt); if (ret != 0 || (default_brt < PM_MIN_BRIGHTNESS || default_brt > PM_MAX_BRIGHTNESS)) { - LOGINFO("fail to read vconf value for brightness"); + _I("fail to read vconf value for brightness"); brt = PM_DEFAULT_BRIGHTNESS; if(default_brt < PM_MIN_BRIGHTNESS || default_brt > PM_MAX_BRIGHTNESS) vconf_set_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, brt); @@ -220,7 +220,7 @@ static bool check_sfsvc(void* data) int vconf_auto; int sf_state = 0; - LOGINFO("register sfsvc"); + _I("register sfsvc"); vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &vconf_auto); if (vconf_auto == SETTING_BRIGHTNESS_AUTOMATIC_ON) { @@ -239,7 +239,7 @@ static bool check_sfsvc(void* data) disconnect_sfsvc(); return EINA_TRUE; } - LOGINFO("change vconf value before registering sfsvc"); + _I("change vconf value before registering sfsvc"); return EINA_FALSE; } @@ -265,7 +265,7 @@ static int prepare_lsensor(void *data) void set_power_saving_display_stat(int stat) { - LOGINFO("stat = %d", stat); + _I("stat = %d", stat); power_saving_display_stat = stat; } diff --git a/src/display/poll.c b/src/display/poll.c index 542a431..de48a86 100644 --- a/src/display/poll.c +++ b/src/display/poll.c @@ -79,7 +79,7 @@ static Eina_Bool pm_handler(void *data, Ecore_Fd_Handler *fd_handler) int clilen = sizeof(clientaddr); if (device_get_status(&display_device_ops) != DEVICE_OPS_STATUS_START) { - LOGERR("display is not started!"); + _E("display is not started!"); return EINA_FALSE; } @@ -106,16 +106,16 @@ static int init_sock(char *sock_path) struct sockaddr_un serveraddr; int fd; - LOGINFO("initialize pm_socket for pm_control library"); + _I("initialize pm_socket for pm_control library"); if (sock_path == NULL || strcmp(sock_path, SOCK_PATH)) { - LOGERR("invalid sock_path= %s"); + _E("invalid sock_path= %s"); return -1; } fd = socket(AF_UNIX, SOCK_DGRAM, 0); if (fd < 0) { - LOGERR("socket error"); + _E("socket error"); return -1; } @@ -126,18 +126,18 @@ static int init_sock(char *sock_path) strncpy(serveraddr.sun_path, sock_path, sizeof(serveraddr.sun_path) - 1); if (bind(fd, (struct sockaddr *)&serveraddr, sizeof(serveraddr)) < 0) { - LOGERR("bind error"); + _E("bind error"); close(fd); return -1; } if (chmod(sock_path, (S_IRWXU | S_IRWXG | S_IRWXO)) < 0) /* 0777 */ - LOGERR("failed to change the socket permission"); + _E("failed to change the socket permission"); if (!strcmp(sock_path, SOCK_PATH)) sockfd = fd; - LOGINFO("init sock() sueccess!"); + _I("init sock() sueccess!"); return fd; } @@ -152,12 +152,12 @@ int init_pm_poll(int (*pm_callback) (int, PMMsg *)) g_pm_callback = pm_callback; - LOGINFO + _I ("initialize pm poll - input devices and domain socket(deviced)"); pm_input_env = getenv("PM_INPUT"); if ((pm_input_env != NULL) && (strlen(pm_input_env) < 1024)) { - LOGINFO("Getting input device path from environment: %s", + _I("Getting input device path from environment: %s", pm_input_env); /* Add 2 bytes for following strncat() */ dev_paths_size = strlen(pm_input_env) + strlen(SOCK_PATH) + strlen(DEV_PATH_DLM) + 1; @@ -181,7 +181,7 @@ int init_pm_poll(int (*pm_callback) (int, PMMsg *)) path_tok = strtok_r(dev_paths, DEV_PATH_DLM, &save_ptr); if (path_tok == NULL) { - LOGERR("Device Path Tokeninzing Failed"); + _E("Device Path Tokeninzing Failed"); goto err_devpaths; } @@ -192,17 +192,17 @@ int init_pm_poll(int (*pm_callback) (int, PMMsg *)) if (strcmp(path_tok, SOCK_PATH) == 0) { fd = init_sock(SOCK_PATH); path = SOCK_PATH; - LOGINFO("pm_poll domain socket file: %s, fd: %d", + _I("pm_poll domain socket file: %s, fd: %d", path_tok, fd); } else { fd = open(path_tok, O_RDONLY); path = path_tok; - LOGINFO("pm_poll input device file: %s, fd: %d", + _I("pm_poll input device file: %s, fd: %d", path_tok, fd); } if (fd == -1) { - LOGERR("Cannot open the file: %s", path_tok); + _E("Cannot open the file: %s", path_tok); goto err_devpaths; } @@ -210,13 +210,13 @@ int init_pm_poll(int (*pm_callback) (int, PMMsg *)) ECORE_FD_READ|ECORE_FD_ERROR, pm_handler, fd, NULL, NULL); if (fd_handler == NULL) { - LOGERR("Failed ecore_main_handler_add() in init_pm_poll()"); + _E("Failed ecore_main_handler_add() in init_pm_poll()"); goto err_fd; } new_dev = (indev *)malloc(sizeof(indev)); if (!new_dev) { - LOGERR("Fail to malloc for new_dev %s", path); + _E("Fail to malloc for new_dev %s", path); goto err_fdhandler; } @@ -224,7 +224,7 @@ int init_pm_poll(int (*pm_callback) (int, PMMsg *)) len = strlen(path) + 1; new_path = (char*) malloc(len); if (!new_path) { - LOGERR("Fail to malloc for dev_path %s", path); + _E("Fail to malloc for dev_path %s", path); goto err_dev; } @@ -266,7 +266,7 @@ int exit_pm_poll(void) close(sockfd); unlink(SOCK_PATH); - LOGINFO("pm_poll is finished"); + _I("pm_poll is finished"); return 0; } @@ -281,29 +281,29 @@ int init_pm_poll_input(int (*pm_callback)(int , PMMsg * ), const char *path) char *dev_path = NULL; if (!pm_callback || !path) { - LOGERR("argument is NULL! (%x,%x)", pm_callback, path); + _E("argument is NULL! (%x,%x)", pm_callback, path); return -1; } EINA_LIST_FOREACH_SAFE(indev_list, l, l_next, data) if(!strcmp(path, data->dev_path)) { - LOGERR("%s is already polled!", path); + _E("%s is already polled!", path); return -1; } - LOGINFO("initialize pm poll for bt %s", path); + _I("initialize pm poll for bt %s", path); g_pm_callback = pm_callback; fd = open(path, O_RDONLY); if (fd == -1) { - LOGERR("Cannot open the file for BT: %s", path); + _E("Cannot open the file for BT: %s", path); return -1; } dev_path = (char*)malloc(strlen(path) + 1); if (!dev_path) { - LOGERR("Fail to malloc for dev_path"); + _E("Fail to malloc for dev_path"); close(fd); return -1; } @@ -313,7 +313,7 @@ int init_pm_poll_input(int (*pm_callback)(int , PMMsg * ), const char *path) ECORE_FD_READ|ECORE_FD_ERROR, pm_handler, fd, NULL, NULL); if (!fd_handler) { - LOGERR("Fail to ecore fd handler add! %s", path); + _E("Fail to ecore fd handler add! %s", path); close(fd); free(dev_path); return -1; @@ -321,7 +321,7 @@ int init_pm_poll_input(int (*pm_callback)(int , PMMsg * ), const char *path) new_dev = (indev *)malloc(sizeof(indev)); if (!new_dev) { - LOGERR("Fail to malloc for new_dev %s", path); + _E("Fail to malloc for new_dev %s", path); ecore_main_fd_handler_del(fd_handler); close(fd); free(dev_path); @@ -331,7 +331,7 @@ int init_pm_poll_input(int (*pm_callback)(int , PMMsg * ), const char *path) new_dev->fd = fd; new_dev->dev_fd = fd_handler; - LOGINFO("pm_poll for BT input device file(path: %s, fd: %d", + _I("pm_poll for BT input device file(path: %s, fd: %d", new_dev->dev_path, new_dev->fd); indev_list = eina_list_append(indev_list, new_dev); @@ -421,7 +421,7 @@ void lcd_control_edbus_signal_handler(void *data, DBusMessage *msg) int timeout = -1; if (dbus_message_is_signal(msg, INTERFACE_NAME, SIGNAL_NAME_LCD_CONTROL) == 0) { - LOGERR("there is lcd control signal"); + _E("there is lcd control signal"); return; } @@ -432,17 +432,17 @@ void lcd_control_edbus_signal_handler(void *data, DBusMessage *msg) DBUS_TYPE_STRING, &lock_str, DBUS_TYPE_STRING, &state_str, DBUS_TYPE_INT32, &timeout, DBUS_TYPE_INVALID) == 0) { - LOGERR("there is no message"); + _E("there is no message"); return; } if (pid == -1 || !lock_str || !state_str) { - LOGERR("message is invalid!!"); + _E("message is invalid!!"); return; } if (kill(pid, 0) == -1) { - LOGERR("%d process does not exist, dbus ignored!", pid); + _E("%d process does not exist, dbus ignored!", pid); return; } @@ -453,13 +453,13 @@ void lcd_control_edbus_signal_handler(void *data, DBusMessage *msg) else if (!strcmp(state_str, PM_LCDOFF_STR)) state = LCD_OFF; else { - LOGERR("%d process does not exist, dbus ignored!", pid); + _E("%d process does not exist, dbus ignored!", pid); return; } if (!strcmp(lock_str, PM_LOCK_STR)) { if (timeout < 0) { - LOGERR("pm_lock timeout is invalid! %d", timeout); + _E("pm_lock timeout is invalid! %d", timeout); return; } pm_lock_internal(pid, state, STAY_CUR_STATE, timeout); @@ -468,8 +468,8 @@ void lcd_control_edbus_signal_handler(void *data, DBusMessage *msg) } else if (!strcmp(lock_str, PM_CHANGE_STR)) { pm_change_internal(pid, state); } else { - LOGERR("%s process does not exist, dbus ignored!", pid); + _E("%s process does not exist, dbus ignored!", pid); return; } - LOGINFO("dbus call success from %d\n", pid); + _I("dbus call success from %d\n", pid); } diff --git a/src/display/setting.c b/src/display/setting.c index 8f8b0a4..b3ee2a6 100644 --- a/src/display/setting.c +++ b/src/display/setting.c @@ -83,7 +83,7 @@ int get_run_timeout(int *timeout) get_dim_timeout(&dim_timeout); if(dim_timeout < 0) { - LOGERR("Can not get dim timeout. set default 5 seconds"); + _E("Can not get dim timeout. set default 5 seconds"); dim_timeout = 5; } @@ -103,7 +103,7 @@ int get_dim_timeout(int *timeout) /* TODO if needed */ *timeout = 5; /* default timeout */ get_env("PM_TO_LCDDIM", buf, sizeof(buf)); - LOGINFO("Get lcddim timeout [%s]", buf); + _I("Get lcddim timeout [%s]", buf); *timeout = atoi(buf); return 0; } @@ -114,7 +114,7 @@ int get_off_timeout(int *timeout) /* TODO if needed */ *timeout = 5; /* default timeout */ get_env("PM_TO_LCDOFF", buf, sizeof(buf)); - LOGINFO("Get lcdoff timeout [%s]", buf); + _I("Get lcdoff timeout [%s]", buf); *timeout = atoi(buf); return 0; } @@ -124,7 +124,7 @@ static int setting_cb(keynode_t *key_nodes, void *data) keynode_t *tmp = key_nodes; if ((int)data > SETTING_END) { - LOGERR("Unknown setting key: %s, idx=%d", + _E("Unknown setting key: %s, idx=%d", vconf_keynode_get_name(tmp), (int)data); return -1; } diff --git a/src/display/util.c b/src/display/util.c index 5dac009..cdb0fb5 100644 --- a/src/display/util.c +++ b/src/display/util.c @@ -97,7 +97,7 @@ int readpid(char *pidpath) fp = fopen(pidpath, "r"); if (fp != NULL) { if (fscanf(fp, "%5d", &ret) == EOF) - LOGERR("readpid fscanf failed!"); + _E("readpid fscanf failed!"); fclose(fp); } @@ -125,7 +125,7 @@ int daemonize(void) setsid(); if (chdir("/") == -1) { - LOGERR("Failed to chdir"); + _E("Failed to chdir"); } close(0); @@ -134,11 +134,11 @@ int daemonize(void) fd = open("/dev/null", O_RDONLY); if (fd == -1) { - LOGERR("daemonize open failed [/dev/null RD]"); + _E("daemonize open failed [/dev/null RD]"); } fd = open("/dev/null", O_RDWR); if (fd == -1) { - LOGERR("daemonize open failed [/dev/null RDWR]"); + _E("daemonize open failed [/dev/null RDWR]"); } dup(1); @@ -164,14 +164,14 @@ int exec_process(char *name) pid = fork(); switch (pid) { case -1: - LOGERR("Fork error"); + _E("Fork error"); ret = -1; break; case 0: for (i = 0; i < _NSIG; i++) signal(i, SIG_DFL); execlp(name, name, NULL); - LOGERR("execlp() error : %s\n", strerror(errno)); + _E("execlp() error : %s\n", strerror(errno)); exit(-1); break; default: diff --git a/src/display/util.h b/src/display/util.h index 9b6bc6c..4bc503f 100644 --- a/src/display/util.h +++ b/src/display/util.h @@ -29,8 +29,24 @@ * @{ */ -#ifdef ENABLE_DLOG_OUT -#define LOG_TAG "POWER_MANAGER" +#ifndef FEATURE_POWER_MANAGER_DLOG +#define FEATURE_POWER_MANAGER_DLOG +#endif + +#ifdef FEATURE_POWER_MANAGER_DLOG +#define LOG_TAG "POWER_MANAGER" +#include +#define _D(fmt, arg...) \ + do { SLOGD(fmt, ##arg); } while(0) +#define _I(fmt, arg...) \ + do { SLOGI(fmt, ##arg); } while(0) +#define _E(fmt, arg...) \ + do { SLOGE(fmt, ##arg); } while(0) +#else +# include +#define _D(fmt, arg...) pm_log(LOG_INFO, fmt, ## arg) +#define _I(fmt, arg...) pm_log(LOG_INFO, fmt, ## arg) +#define _E(fmt, arg...) pm_log(LOG_ERR, fmt, ## arg) #endif #define SEC_TO_MSEC(x) ((x)*1000) @@ -93,16 +109,6 @@ extern char *get_pkgname(char *exepath); */ extern void pm_log(int priority, char *fmt, ...); -#if defined(ENABLE_DLOG_OUT) -# include -# define LOGINFO LOGI -# define LOGERR LOGE -#else -# include -# define LOGINFO(fmt, arg...) pm_log(LOG_INFO, fmt, ## arg) -# define LOGERR(fmt, arg...) pm_log(LOG_ERR, fmt, ## arg) -#endif - /** * @} */ diff --git a/src/display/x-lcd-on.c b/src/display/x-lcd-on.c index d522e94..c78a473 100644 --- a/src/display/x-lcd-on.c +++ b/src/display/x-lcd-on.c @@ -33,7 +33,7 @@ static int pm_x_set_lcd_backlight(struct _PMSys *p, int on) char cmd_line[8]; int ret; - LOGINFO("Backlight on=%d", on); + _I("Backlight on=%d", on); switch (on) { case STATUS_ON: @@ -48,18 +48,18 @@ static int pm_x_set_lcd_backlight(struct _PMSys *p, int on) pid = vfork(); if (pid < 0) { - LOGERR("[1] Failed to fork child process for LCD On/Off"); + _E("[1] Failed to fork child process for LCD On/Off"); return -1; } if (pid == 0) { - LOGERR("[1] Child proccess for LCD %d was created (%s)", + _E("[1] Child proccess for LCD %d was created (%s)", on, cmd_line); execl("/usr/bin/xset", "/usr/bin/xset", "dpms", "force", cmd_line, NULL); _exit(0); } else if (pid != (ret = waitpid(pid, NULL, 0))) { - LOGERR + _E ("[1] Waiting failed for the child process pid: %d, ret: %d, errno: %d", pid, ret, errno); } diff --git a/src/mmc/ext4.c b/src/mmc/ext4.c index 5522661..494090e 100644 --- a/src/mmc/ext4.c +++ b/src/mmc/ext4.c @@ -46,7 +46,7 @@ static int mmc_check_smack(void) vconf_set_int(VCONFKEY_SYSMAN_MMC_STATUS, VCONFKEY_SYSMAN_MMC_MOUNTED); vconf_set_int(VCONFKEY_SYSMAN_MMC_MOUNT, VCONFKEY_SYSMAN_MMC_MOUNT_COMPLETED); if (mmc_popup_pid > 0) { - PRT_TRACE_ERR("will be killed mmc-popup(%d)", mmc_popup_pid); + _E("will be killed mmc-popup(%d)", mmc_popup_pid); kill(mmc_popup_pid, SIGTERM); } return 0; @@ -63,7 +63,7 @@ static int check_smack_popup(void) ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &val); if (val == 1 || ret != 0) { if ((mmc_popup_pid = syspopup_launch("mmc-syspopup", b)) < 0) { - PRT_TRACE_EM("popup launch failed\n"); + _E("popup launch failed\n"); } } bundle_free(b); @@ -83,15 +83,15 @@ static int ext4_init(void *data) ext4_check_arg[argc - 2] = path; if ((fd = open(path, O_RDONLY)) < 0) { - PRT_TRACE_ERR("can't open the '%s': %s", path, strerror(errno)); + _E("can't open the '%s': %s", path, strerror(errno)); return -EINVAL; } /* check fs type with magic code */ lseek(fd, fs_ext4_type.offset, SEEK_SET); ret = read(fd, buf, 2); - PRT_TRACE("mmc search magic : 0x%2x, 0x%2x", buf[0],buf[1]); + _D("mmc search magic : 0x%2x, 0x%2x", buf[0],buf[1]); if (!memcmp(buf, fs_ext4_type.magic, fs_ext4_type.magic_sz)) { - PRT_TRACE("mmc type : %s", fs_ext4_type.name); + _D("mmc type : %s", fs_ext4_type.name); close(fd); return fs_ext4_type.type; @@ -107,7 +107,7 @@ static const char **ext4_check(void) static int ext4_mount(int smack, void *data) { - PRT_TRACE_ERR("ext4_mount"); + _E("ext4_mount"); if (mount_fs((char *)data, "ext4", NULL) != 0) return errno; if (smack) { diff --git a/src/mmc/mmc-handler.c b/src/mmc/mmc-handler.c index 63037f6..cd61377 100644 --- a/src/mmc/mmc-handler.c +++ b/src/mmc/mmc-handler.c @@ -125,7 +125,7 @@ int get_mmcblk_num(void) int mmc_dev_changed = 0; if ((dp = opendir("/sys/block")) == NULL) { - _E("Can not open directory..\n"); + _E("Can not open directory: /sys/block"); return -1; } chdir("/sys/block"); @@ -166,7 +166,7 @@ int get_mmcblk_num(void) free(str_mmcblk_num); closedir(dp); - _D("%d \n", mmcblk_num); + _D("%d", mmcblk_num); snprintf(buf, 255, "/sys/block/%s/device/cid", dir->d_name); @@ -206,7 +206,7 @@ int get_mmcblk_num(void) } } closedir(dp); - _E("Failed to find mmc block number\n"); + _E("Failed to find mmc block number"); return -1; } @@ -215,7 +215,7 @@ static int mmc_umount(int option) int ret; ret = umount2(MMC_MOUNT_POINT, option); if (ret != 0) - _E("Failed to unmount mmc card\n"); + _E("Failed to unmount mmc card"); return ret; } @@ -299,7 +299,7 @@ static int create_partition(const char *dev_path) return 0; } -static int mmc_format_exec(const char *path, int fs) +static int mmc_format_exec(const char *path) { unsigned int size; int mkfs_pid; @@ -370,12 +370,9 @@ static int mmc_format(int blknum) return r; } } - - _E("insert type : %d", inserted_type); - - r = mmc_format_exec(dev_mmcblkp, inserted_type); - if (r < 0) { - _E("%s format fail", dev_mmcblkp); + r = mmc_format_exec(dev_mmcblkp); + if (r != 0) { + _E("format_mmc fail"); vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED); heynoti_publish("mmcblk_remove"); return r; @@ -503,7 +500,7 @@ static int mmc_mount(void) vconf_set_int(VCONFKEY_SYSMAN_MMC_STATUS, VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED); vconf_set_int(VCONFKEY_SYSMAN_MMC_MOUNT, VCONFKEY_SYSMAN_MMC_MOUNT_FAILED); vconf_set_int(VCONFKEY_SYSMAN_MMC_ERR_STATUS, errno); - _E("Failed to mount mmc card\n"); + _E("Failed to mount mmc card"); return -1; mount_complete: @@ -542,7 +539,7 @@ int ss_mmc_inserted(void) int ret; if (mmc_disabled) { - _E("mmc is blocked!"); + _D("mmc is blocked!"); vconf_set_int(VCONFKEY_SYSMAN_MMC_STATUS, VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED); return -ENODEV; } @@ -550,7 +547,7 @@ int ss_mmc_inserted(void) vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &mmc_status); if (mmc_status == VCONFKEY_SYSMAN_MMC_MOUNTED) { - _D("Mmc is already mounted.\n"); + _D("Mmc is already mounted"); vconf_set_int(VCONFKEY_SYSMAN_MMC_MOUNT, VCONFKEY_SYSMAN_MMC_MOUNT_ALREADY); return 0; } @@ -576,7 +573,7 @@ static int ss_mmc_unmounted(int argc, char **argv) } if (mmc_umount(MNT_DETACH) != 0) { - _E("Failed to unmount mmc card\n"); + _E("Failed to unmount mmc card"); vconf_set_int(VCONFKEY_SYSMAN_MMC_UNMOUNT, VCONFKEY_SYSMAN_MMC_UNMOUNT_FAILED); vconf_set_int(VCONFKEY_SYSMAN_MMC_ERR_STATUS, errno); @@ -619,14 +616,14 @@ static void mmc_init(void *data) static void mmc_start(void) { mmc_disabled = false; - _E("start"); + _D("start"); } static void mmc_stop(void) { mmc_disabled = true; vconf_set_int(VCONFKEY_SYSMAN_MMC_STATUS, VCONFKEY_SYSMAN_MMC_REMOVED); - _E("stop"); + _D("stop"); } const struct device_ops mmc_device_ops = { diff --git a/src/mmc/vfat.c b/src/mmc/vfat.c index 52de71f..3038eab 100644 --- a/src/mmc/vfat.c +++ b/src/mmc/vfat.c @@ -48,15 +48,15 @@ static int vfat_init(void *data) vfat_check_arg[argc - 2] = path; if ((fd = open(path, O_RDONLY)) < 0) { - PRT_TRACE_ERR("can't open the '%s': %s", path, strerror(errno)); + _E("can't open the '%s': %s", path, strerror(errno)); return -EINVAL; } /* check fs type with magic code */ lseek(fd, fs_vfat_type.offset, SEEK_SET); ret = read(fd, buf, 2); - PRT_TRACE("mmc search magic : 0x%2x, 0x%2x", buf[0],buf[1]); + _D("mmc search magic : 0x%2x, 0x%2x", buf[0],buf[1]); if (!memcmp(buf, fs_vfat_type.magic, fs_vfat_type.magic_sz)) { - PRT_TRACE("mmc type : %s", fs_vfat_type.name); + _D("mmc type : %s", fs_vfat_type.name); close(fd); return fs_vfat_type.type; } @@ -66,14 +66,14 @@ static int vfat_init(void *data) static const char ** vfat_check(void) { - return vfat_check_arg; + return NULL; } static int vfat_mount(int smack, void *data) { char options[NAME_MAX]; - PRT_TRACE_ERR("vfat_mount"); + _E("vfat_mount"); if (smack) snprintf(options, sizeof(options), "%s,%s", FS_VFAT_MOUNT_OPT, SMACKFS_MOUNT_OPT); else diff --git a/src/power/power-handler.c b/src/power/power-handler.c index f27dca5..ddefdce 100644 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -79,14 +78,14 @@ static void poweroff_popup_edbus_signal_handler(void *data, DBusMessage *msg) int val = 0; if (dbus_message_is_signal(msg, INTERFACE_NAME, SIGNAL_NAME_POWEROFF_POPUP) == 0) { - PRT_TRACE_ERR("there is no power off popup signal"); + _E("there is no power off popup signal"); return; } dbus_error_init(&err); if (dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID) == 0) { - PRT_TRACE_ERR("there is no message"); + _E("there is no message"); return; } @@ -97,7 +96,7 @@ static void poweroff_popup_edbus_signal_handler(void *data, DBusMessage *msg) else if (strncmp(str, PREDEF_POWEROFF, strlen(PREDEF_REBOOT)) == 0) val = VCONFKEY_SYSMAN_POWER_OFF_RESTART; if (val == 0) { - PRT_TRACE_ERR("not supported message : %s", str); + _E("not supported message : %s", str); return; } vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, val); @@ -159,13 +158,13 @@ static void enter_flight_mode_cb(TapiHandle *handle, int result, void *data, voi { int bCurFlightMode = 0; if (result != TAPI_POWER_FLIGHT_MODE_ENTER) { - PRT_TRACE_ERR("flight mode enter failed %d",result); + _E("flight mode enter failed %d",result); } else { - PRT_TRACE("enter flight mode result : %d",result); + _D("enter flight mode result : %d",result); if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE,&bCurFlightMode) == 0) { - PRT_TRACE("Flight Mode is %d", bCurFlightMode); + _D("Flight Mode is %d", bCurFlightMode); } else { - PRT_TRACE_ERR("failed to get vconf key"); + _E("failed to get vconf key"); } } } @@ -174,13 +173,13 @@ static void leave_flight_mode_cb(TapiHandle *handle, int result, void *data, voi { int bCurFlightMode = 0; if (result != TAPI_POWER_FLIGHT_MODE_LEAVE) { - PRT_TRACE_ERR("flight mode leave failed %d",result); + _E("flight mode leave failed %d",result); } else { - PRT_TRACE("leave flight mode result : %d",result); + _D("leave flight mode result : %d",result); if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE,&bCurFlightMode) == 0) { - PRT_TRACE("Flight Mode is %d", bCurFlightMode); + _D("Flight Mode is %d", bCurFlightMode); } else { - PRT_TRACE_ERR("failed to get vconf key"); + _E("failed to get vconf key"); } } } @@ -190,7 +189,7 @@ int flight_mode_def_predefine_action(int argc, char **argv) int bCurFlightMode; int err = TAPI_API_SUCCESS; if (argc != 1 || argv[0] == NULL) { - PRT_TRACE_ERR("FlightMode Set predefine action failed"); + _E("FlightMode Set predefine action failed"); return -1; } bCurFlightMode = atoi(argv[0]); @@ -200,7 +199,7 @@ int flight_mode_def_predefine_action(int argc, char **argv) err = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_ENTER, enter_flight_mode_cb, NULL); } if (err != TAPI_API_SUCCESS) - PRT_TRACE_ERR("FlightMode tel api action failed %d",err); + _E("FlightMode tel api action failed %d",err); return 0; } @@ -213,10 +212,10 @@ static void __tel_init_cb(keynode_t *key_nodes,void *data) vconf_ignore_key_changed(VCONFKEY_TELEPHONY_READY, (void*)__tel_init_cb); tapi_handle = tel_init(NULL); if (tapi_handle == NULL) { - PRT_TRACE_ERR("tapi init error"); + _E("tapi init error"); } } else { - PRT_TRACE_ERR("tapi is not ready yet"); + _E("tapi is not ready yet"); } } @@ -245,7 +244,7 @@ Eina_Bool powerdown_ap_by_force(void *data) gettimeofday(&now, NULL); } - PRT_TRACE("Power off by force\n"); + _D("Power off by force\n"); /* give a chance to be terminated for each process */ power_off = 1; sync(); @@ -269,7 +268,7 @@ static void powerdown_ap(TapiHandle *handle, const char *noti_id, void *data, vo tel_deinit(tapi_handle); tapi_handle = NULL; } - PRT_TRACE("Power off \n"); + _D("Power off \n"); /* Getting poweroff duration */ buf = getenv("PWROFF_DUR"); @@ -293,7 +292,7 @@ static void powerdown_ap(TapiHandle *handle, const char *noti_id, void *data, vo } static void powerdown_res_cb(TapiHandle *handle, int result, void *data, void *user_data) { - PRT_TRACE("poweroff command request : %d",result); + _D("poweroff command request : %d",result); } @@ -310,7 +309,7 @@ int internal_poweroff_def_predefine_action(int argc, char **argv) ret = tel_register_noti_event(tapi_handle, TAPI_NOTI_MODEM_POWER, powerdown_ap, NULL); if (ret != TAPI_API_SUCCESS) { - PRT_TRACE_ERR + _E ("tel_register_event is not subscribed. error %d\n", ret); powerdown_ap_by_force(NULL); return 0; @@ -318,7 +317,7 @@ int internal_poweroff_def_predefine_action(int argc, char **argv) ret = tel_process_power_command(tapi_handle, TAPI_PHONE_POWER_OFF, powerdown_res_cb, NULL); if (ret != TAPI_API_SUCCESS) { - PRT_TRACE_ERR("tel_process_power_command() error %d\n", ret); + _E("tel_process_power_command() error %d\n", ret); powerdown_ap_by_force(NULL); return 0; } @@ -394,7 +393,7 @@ static void restart_ap_by_force(void *data) tapi_handle = NULL; } - PRT_TRACE("Restart\n"); + _I("Restart\n"); power_off = 1; sync(); @@ -422,7 +421,7 @@ int entersleep_def_predefine_action(int argc, char **argv) sync(); ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_ENTER, enter_flight_mode_cb, NULL); - PRT_TRACE_ERR("request for changing into flight mode : %d\n", ret); + _E("request for changing into flight mode : %d\n", ret); system("/etc/rc.d/rc.entersleep"); pm_change_internal(getpid(), POWER_OFF); @@ -438,7 +437,7 @@ int poweroff_def_predefine_action(int argc, char **argv) while (retry_count < MAX_RETRY) { if (ss_action_entry_call_internal(PREDEF_INTERNAL_POWEROFF, 0) < 0) { - PRT_TRACE_ERR("failed to request poweroff to system_server \n"); + _E("failed to request poweroff to system_server \n"); retry_count++; continue; } @@ -457,7 +456,7 @@ int launching_predefine_action(int argc, char **argv) /* current just launching poweroff-popup */ if (predefine_control_launch("poweroff-syspopup", NULL, 0) < 0) { - PRT_TRACE_ERR("poweroff-syspopup launch failed"); + _E("poweroff-syspopup launch failed"); return -1; } return 0; @@ -471,7 +470,7 @@ int leavesleep_def_predefine_action(int argc, char **argv) sync(); ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_LEAVE, leave_flight_mode_cb, NULL); - PRT_TRACE_ERR("request for changing into flight mode : %d\n", ret); + _E("request for changing into flight mode : %d\n", ret); return 0; } @@ -491,7 +490,7 @@ int restart_def_predefine_action(int argc, char **argv) ret = tel_register_noti_event(tapi_handle, TAPI_NOTI_MODEM_POWER, restart_ap, NULL); if (ret != TAPI_API_SUCCESS) { - PRT_TRACE_ERR + _E ("tel_register_event is not subscribed. error %d\n", ret); restart_ap_by_force((void *)-1); return 0; @@ -500,7 +499,7 @@ int restart_def_predefine_action(int argc, char **argv) ret = tel_process_power_command(tapi_handle, TAPI_PHONE_POWER_OFF, powerdown_res_cb, NULL); if (ret != TAPI_API_SUCCESS) { - PRT_TRACE_ERR("tel_process_power_command() error %d\n", ret); + _E("tel_process_power_command() error %d\n", ret); restart_ap_by_force((void *)-1); return 0; } @@ -517,13 +516,13 @@ static void power_init(void *data) if (bTelReady == 1) { tapi_handle = tel_init(NULL); if (tapi_handle == NULL) { - PRT_TRACE_ERR("tapi init error"); + _E("tapi init error"); } } else { vconf_notify_key_changed(VCONFKEY_TELEPHONY_READY, (void *)__tel_init_cb, NULL); } } else { - PRT_TRACE_ERR("failed to get tapi vconf key"); + _E("failed to get tapi vconf key"); } ss_action_entry_add_internal(PREDEF_ENTERSLEEP, @@ -546,7 +545,7 @@ static void power_init(void *data) flight_mode_def_predefine_action, NULL, NULL); if (vconf_notify_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (void *)poweroff_control_cb, NULL) < 0) { - PRT_TRACE_ERR("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS); + _E("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS); } register_edbus_signal_handler(OBJECT_PATH, INTERFACE_NAME, diff --git a/src/proc/lowmem-handler.c b/src/proc/lowmem-handler.c index 8c5e7b6..d486fb4 100644 --- a/src/proc/lowmem-handler.c +++ b/src/proc/lowmem-handler.c @@ -92,7 +92,7 @@ static int remove_shm() maxid = shmctl(0, SHM_INFO, (struct shmid_ds *)(void *)&shm_info); if (maxid < 0) { - _E("shared mem error\n"); + _E("shared mem error"); return -1; } @@ -101,7 +101,7 @@ static int remove_shm() if (shmid < 0) continue; if (shmseg.shm_nattch == 0) { - _D("shared memory killer ==> %d killed\n", + _D("shared memory killer ==> %d killed", shmid); shmctl(shmid, IPC_RMID, NULL); } @@ -150,11 +150,11 @@ static int get_lowmemnotify_info(FILE *output_fp) return -1; _D("make LOWMEM_LOG"); fprintf(output_fp, - "====================================================================\n"); - fprintf(output_fp, "MEMORY INFO by lowmemnotify\n"); + "===================================================================="); + fprintf(output_fp, "MEMORY INFO by lowmemnotify"); while (fgets(line, BUF_MAX, fp) != NULL) { - _D("%s",line); + _D("%s", line); fputs(line, output_fp); } fclose(fp); @@ -284,7 +284,7 @@ static unsigned int lowmem_read(int fd) { unsigned int mem_state; if (read(fd, &mem_state, sizeof(mem_state)) < 0) { - PRT_TRACE_ERR("error lowmem state"); + _E("error lowmem state"); return -1; } return mem_state; @@ -345,17 +345,17 @@ static void make_memps_log(char *file, pid_t pid, char *victim_name) now = time(NULL); cur_tm = (struct tm *)malloc(sizeof(struct tm)); if (cur_tm == NULL) { - PRT_TRACE_ERR("Fail to memory allocation"); + _E("Fail to memory allocation"); return; } if (localtime_r(&now, cur_tm) == NULL) { - PRT_TRACE_ERR("Fail to get localtime"); + _E("Fail to get localtime"); free(cur_tm); return; } - PRT_TRACE("%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name, + _D("%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name, pid, (1900 + cur_tm->tm_year), 1 + cur_tm->tm_mon, cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min, cur_tm->tm_sec); @@ -385,7 +385,7 @@ static int lowmem_get_victim_pid() int fd; if (device_get_property(DEVICE_TYPE_MEMORY, PROP_MEMORY_VICTIM_TASK, &pid) < 0) { - PRT_TRACE_ERR("Get victim task failed"); + _E("Get victim task failed"); return -1; } @@ -405,16 +405,15 @@ int lowmem_def_predefine_action(int argc, char **argv) if (pid > 0 && pid != get_exec_pid(LOWMEM_EXEC_PATH) && pid != get_exec_pid(MEMPS_EXEC_PATH)) { if ((get_cmdline_name(pid, appname, PATH_MAX)) == 0) { - PRT_TRACE_EM - ("we will kill, lowmem lv2 = %d (%s)\n", + _E("we will kill, lowmem lv2 = %d (%s)\n", pid, appname); make_memps_log(MEMPS_LOG_FILE, pid, appname); if(get_app_oomadj(pid, &oom_adj) < 0) { - PRT_TRACE_ERR("Failed to get oom_adj"); + _E("Failed to get oom_adj"); return -1; } - PRT_TRACE("%d will be killed with %d oom_adj value", pid, oom_adj); + _D("%d will be killed with %d oom_adj value", pid, oom_adj); kill(pid, SIGTERM); @@ -428,12 +427,12 @@ int lowmem_def_predefine_action(int argc, char **argv) ret = syspopup_launch("lowmem-syspopup", b); bundle_free(b); if (ret < 0) { - PRT_TRACE_EM("popup lauch failed\n"); + _E("popup lauch failed\n"); return -1; } if (set_su_oomadj(ret) < 0) { - PRT_TRACE_ERR("Failed to set oom_adj"); + _E("Failed to set oom_adj"); } } } diff --git a/src/proc/pmon-handler.c b/src/proc/pmon-handler.c index 93806f4..3b6aa29 100644 --- a/src/proc/pmon-handler.c +++ b/src/proc/pmon-handler.c @@ -159,8 +159,7 @@ static int pmon_process(int pid, void *ad) FILE *fp; - _D - ("[Process MON] OOMADJ_SET : pid %d, new_oomadj %d", + _D("[Process MON] OOMADJ_SET : pid %d, new_oomadj %d", new_pid, (-17)); fp = open_proc_oom_adj_file(new_pid, "w"); @@ -194,8 +193,7 @@ static int pmon_cb(void *data, Ecore_Fd_Handler * fd_handler) struct ss_main_data *ad = (struct ss_main_data *)data; int dead_pid; if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) { - _E - ("ecore_main_fd_handler_active_get error , return\n"); + _E("ecore_main_fd_handler_active_get error , return"); return -1; } @@ -262,7 +260,7 @@ static void pmon_init(void *data) pmon_efd = NULL; } if (__pmon_start(ad) == -1) { - PRT_TRACE_ERR("fail pmon control fd init"); + _E("fail pmon control fd init"); return; } } diff --git a/src/proc/proc-handler.c b/src/proc/proc-handler.c index dbced62..522a79d 100644 --- a/src/proc/proc-handler.c +++ b/src/proc/proc-handler.c @@ -84,13 +84,13 @@ int set_app_oomadj(pid_t pid, int new_oomadj) } old_oomadj = atoi(buf); fclose(fp); - PRT_TRACE_EM("Process %s, pid %d, old_oomadj %d", exe_name, pid, + _E("Process %s, pid %d, old_oomadj %d", exe_name, pid, old_oomadj); if (old_oomadj < OOMADJ_APP_LIMIT) return 0; - PRT_TRACE_EM("Process %s, pid %d, new_oomadj %d", exe_name, pid, + _E("Process %s, pid %d, new_oomadj %d", exe_name, pid, new_oomadj); snprintf(buf, sizeof(buf), "/proc/%d/oom_adj", pid); fp = fopen(buf, "w"); @@ -128,7 +128,7 @@ int set_oomadj_action(int argc, char **argv) char buf[255]; FILE *fp; - PRT_TRACE_EM("OOMADJ_SET : pid %d, new_oomadj %d", pid, new_oomadj); + _E("OOMADJ_SET : pid %d, new_oomadj %d", pid, new_oomadj); snprintf(buf, sizeof(buf), "/proc/%d/oom_adj", pid); fp = fopen(buf, "w"); if (fp == NULL) @@ -168,7 +168,7 @@ int check_and_set_old_backgrd() dp = opendir("/proc"); if (!dp) { - PRT_TRACE_EM("BACKGRD MANAGE : fail to open /proc : %s", strerror(errno)); + _E("BACKGRD MANAGE : fail to open /proc : %s", strerror(errno)); return -1; } @@ -195,7 +195,7 @@ int check_and_set_old_backgrd() break; } if (i >= LIMITED_BACKGRD_NUM) - PRT_TRACE_EM("BACKGRB MANAGE : background applications(oom_adj %d) exceeds limitation", i); + _E("BACKGRB MANAGE : background applications(oom_adj %d) exceeds limitation", i); else bucket[i] = pid; } @@ -209,7 +209,11 @@ int check_and_set_old_backgrd() pid = buckets[oom_adj][i]; if (!pid) break; - if (new_oomadj < MAX_BACKGRD_OOMADJ) { + if (new_oomadj >= MAX_BACKGRD_OOMADJ) { + _D("BACKGRD MANAGE : kill the process %d (oom_adj %d)", pid, MAX_BACKGRD_OOMADJ); + kill(pid, SIGTERM); + } + else { if (new_oomadj != oom_adj) update_backgrd_app_oomadj(pid, new_oomadj); new_oomadj++; @@ -253,7 +257,7 @@ int set_active_action(int argc, char **argv) if(oomadj > OOMADJ_BACKGRD_UNLOCKED) { ret = set_app_oomadj((pid_t) pid, OOMADJ_BACKGRD_LOCKED); } else { - PRT_TRACE_EM("Unknown oomadj value (%d) !", oomadj); + _E("Unknown oomadj value (%d) !", oomadj); ret = -1; } break; @@ -296,7 +300,7 @@ int set_inactive_action(int argc, char **argv) if(oomadj > OOMADJ_BACKGRD_UNLOCKED) { ret = 0; } else { - PRT_TRACE_EM("Unknown oomadj value (%d) !", oomadj); + _E("Unknown oomadj value (%d) !", oomadj); ret = -1; } break; @@ -338,7 +342,7 @@ int set_foregrd_action(int argc, char **argv) if(oomadj > OOMADJ_BACKGRD_UNLOCKED) { ret = set_app_oomadj((pid_t) pid, OOMADJ_FOREGRD_UNLOCKED); } else { - PRT_TRACE_EM("Unknown oomadj value (%d) !", oomadj); + _E("Unknown oomadj value (%d) !", oomadj); ret = -1; } break; @@ -381,7 +385,7 @@ int set_backgrd_action(int argc, char **argv) if(oomadj > OOMADJ_BACKGRD_UNLOCKED) { ret = 0; } else { - PRT_TRACE_EM("Unknown oomadj value (%d) !", oomadj); + _E("Unknown oomadj value (%d) !", oomadj); ret = -1; } break; @@ -405,9 +409,9 @@ int set_process_group_action(int argc, char **argv) ret = device_set_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_MP_PNP, pid); if (ret == 0) - PRT_TRACE_ERR("%s : pid %d", argv[1], pid); + _E("%s : pid %d", argv[1], pid); else - PRT_TRACE_ERR("fail to set %s : pid %d",argv[1], pid); + _E("fail to set %s : pid %d",argv[1], pid); return 0; } diff --git a/src/shared/control.c b/src/shared/control.c index d0421ab..c274e5f 100644 --- a/src/shared/control.c +++ b/src/shared/control.c @@ -39,11 +39,6 @@ static int deviced_control_common(int device, bool enable) buf_dev, buf_enable); } -API int deviced_mmc_control(bool enable) -{ - return deviced_control_common(DEVICE_CONTROL_MMC, enable); -} - /* * example of control api * API int deviced_display_control(bool enable) @@ -52,3 +47,7 @@ API int deviced_mmc_control(bool enable) * } */ +API int deviced_mmc_control(bool enable) +{ + return deviced_control_common(DEVICE_CONTROL_MMC, enable); +} \ No newline at end of file diff --git a/src/shared/display.c b/src/shared/display.c index 11c72d7..34292db 100644 --- a/src/shared/display.c +++ b/src/shared/display.c @@ -20,12 +20,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include "log.h" #include "dd-display.h" diff --git a/src/time/time-handler.c b/src/time/time-handler.c index a75dd07..14aa816 100644 --- a/src/time/time-handler.c +++ b/src/time/time-handler.c @@ -93,14 +93,14 @@ int handle_timezone(char *str) _D("TZPATH = %s\n", tzpath); if (stat(tzpath, &sts) == -1 && errno == ENOENT) { - PRT_TRACE_ERR("invalid tzpath(%s)", tzpath); + _E("invalid tzpath(%s)", tzpath); return -EINVAL; } /* FIXME for debugging purpose */ time(&now); ts = localtime(&now); - PRT_TRACE_ERR("cur local time is %s", asctime(ts)); + _E("cur local time is %s", asctime(ts)); /* unlink current link * eg. rm /opt/etc/localtime */ @@ -130,7 +130,7 @@ int handle_timezone(char *str) /* FIXME for debugging purpose */ ts = localtime(&now); - PRT_TRACE_ERR("new local time is %s", asctime(ts)); + _E("new local time is %s", asctime(ts)); return 0; } -- 2.7.4