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;
}
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) {
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)
}
}
}
-
- _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)
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;
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;
}
lowbat_popup_option = 0;
bundle_free(b);
} else {
- PRT_TRACE_EM("boot-animation running yet");
+ _E("boot-animation running yet");
return 1;
}
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);
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)
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;
}
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)
*/
-#ifndef _SS_COMMON_H
-#define _SS_COMMON_H
+#ifndef __COMMON_H__
+#define __COMMON_H__
+#include <stdio.h>
#include <unistd.h>
#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
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__ */
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;
}
__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 = {
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);
}
__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);
}
}
}
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);
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);
}
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;
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 ||
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;
}
}
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);
_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)
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);
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;
}
{
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);
}
ret = syspopup_launch("lowbat-syspopup", b);
if (ret < 0) {
- PRT_TRACE_ERR("popup launch failed");
+ _E("popup launch failed");
}
bundle_free(b);
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;
}
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);
}
}
}
- 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)
EINA_LIST_REMOVE_LIST(device_notifier_list, n);
}
- PRT_TRACE("all deleted!");
+ _I("all deleted!");
}
const struct device_ops notifier_device_ops = {
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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;
}
if (edbus_init_val)
break;
if (!retry) {
- _D("fail to init edbus");
+ _E("fail to init edbus");
return;
}
}
if (edbus_conn)
break;
if (!retry) {
- _D("fail to get edbus");
+ _E("fail to get edbus");
goto err_dbus_shutdown;
}
}
if (edbus_request_name)
break;
if (!retry) {
- _D("fail to request edbus name");
+ _E("fail to request edbus name");
goto err_dbus_close;
}
}
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");
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;
}
dp = opendir("/proc");
if (!dp) {
- PRT_TRACE_ERR("open /proc");
+ _E("open /proc");
return -1;
}
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;
}
}
}
}
- _I("[SYSMAN] cannot found action");
+ _I("[SYSMAN] cannot find action");
return -1;
}
#include <sys/wait.h>
#include <vconf.h>
#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;
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;
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;
}
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;
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;
}
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;
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;
}
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;
}
}
>= 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;
}
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;
}
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;
}
{
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)
/* 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;
}
}
void end_battinfo_gathering(void)
{
- LOGINFO("End battery gathering!");
+ _I("End battery gathering!");
if (!timeout_id) {
ecore_timer_del(timeout_id);
n = (PmLockNode *) malloc(sizeof(PmLockNode));
if (n == NULL) {
- LOGERR("Not enough memory, add cond. fail");
+ _E("Not enough memory, add cond. fail");
return NULL;
}
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);
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);
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);
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) {
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) {
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);
}
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) {
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);
}
}
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:
}
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;
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;
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;
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) {
}
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);
}
/* 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);
int next_state;
if (pm_cur_state == S_NORMAL && st->timeout == 0) {
- LOGINFO("LCD always on enabled!");
+ _I("LCD always on enabled!");
return 0;
}
/* 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. */
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 {
struct itimerval val;
if (status != DEVICE_OPS_STATUS_START) {
- LOGERR("display is not started!");
+ _E("display is not started!");
return -EINVAL;
}
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;
/* 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;
/* 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;
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 !! */
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;
}
break;
}
}
- LOGINFO("%s state : %d timeout", state_string[i],
+ _I("%s state : %d timeout", state_string[i],
states[i].timeout);
}
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
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);
}
}
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) {
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:
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) {
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;
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();
}
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);
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);
}
&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);
}
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];
write(fd, buf, strlen(buf));
}
}
- LOGINFO("***************************\n");
+ _I("***************************\n");
}
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);
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();
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)) {
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;
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;
}
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;
}
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;
}
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;
unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS);
int timeout = 0;
- LOGINFO("Start power manager");
+ _I("Start power manager");
signal(SIGHUP, sig_hup);
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;
}
}
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);
if (pm_exit_extention != NULL)
pm_exit_extention();
- LOGINFO("Stop power manager");
+ _I("Stop power manager");
}
static int display_status(void)
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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);
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;
}
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;
}
}
{
int val = 0;
char *opt;
- LOGINFO("Power key long pressed!");
+ _I("Power key long pressed!");
cancel_lcdoff = 1;
/* change state - LCD on */
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) {
ecore_timer_del(combination_timeout_id);
combination_timeout_id = NULL;
}
- LOGINFO("capture mode");
+ _I("capture mode");
key_combination = KEY_COMBINATION_SCREENCAPTURE;
ignore = false;
}
ecore_timer_del(combination_timeout_id);
combination_timeout_id = NULL;
}
- LOGINFO("capture mode");
+ _I("capture mode");
key_combination = KEY_COMBINATION_SCREENCAPTURE;
ignore = false;
}
/* 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;
}
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;
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);
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);
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);
int ret = -1;
int i;
- LOGINFO("LCD on");
+ _I("LCD on");
if (!pmsys || !pmsys->bl_onoff)
return -1;
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;
}
int ret = -1;
int i;
- LOGINFO("LCD off");
+ _I("LCD off");
if (!pmsys || !pmsys->bl_onoff)
return -1;
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;
}
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)) {
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;
}
_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;
}
fd = open("/tmp/sem.pixmap_1", O_RDONLY);
if (fd == -1) {
- LOGERR("X server disable");
+ _E("X server disable");
backlight_on();
}
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;
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);
}
}
}
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;
}
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 =
{
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;
static int disconnect_sfsvc(void)
{
- LOGINFO("disconnect with sensor fw");
+ _I("disconnect with sensor fw");
if(sf_handle >= 0)
{
sf_stop(sf_handle);
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)");
}
}
int max_brt = -1;
if (key_nodes == NULL) {
- LOGERR("wrong parameter, key_nodes is null");
+ _E("wrong parameter, key_nodes is null");
return -1;
}
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();
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);
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) {
disconnect_sfsvc();
return EINA_TRUE;
}
- LOGINFO("change vconf value before registering sfsvc");
+ _I("change vconf value before registering sfsvc");
return EINA_FALSE;
}
void set_power_saving_display_stat(int stat)
{
- LOGINFO("stat = %d", stat);
+ _I("stat = %d", stat);
power_saving_display_stat = stat;
}
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;
}
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;
}
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;
}
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;
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;
}
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;
}
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;
}
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;
}
close(sockfd);
unlink(SOCK_PATH);
- LOGINFO("pm_poll is finished");
+ _I("pm_poll is finished");
return 0;
}
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;
}
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;
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);
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);
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;
}
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;
}
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);
} 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);
}
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;
}
/* 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;
}
/* 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;
}
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;
}
fp = fopen(pidpath, "r");
if (fp != NULL) {
if (fscanf(fp, "%5d", &ret) == EOF)
- LOGERR("readpid fscanf failed!");
+ _E("readpid fscanf failed!");
fclose(fp);
}
setsid();
if (chdir("/") == -1) {
- LOGERR("Failed to chdir");
+ _E("Failed to chdir");
}
close(0);
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);
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:
* @{
*/
-#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 <dlog.h>
+#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 <syslog.h>
+#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)
*/
extern void pm_log(int priority, char *fmt, ...);
-#if defined(ENABLE_DLOG_OUT)
-# include <dlog.h>
-# define LOGINFO LOGI
-# define LOGERR LOGE
-#else
-# include <syslog.h>
-# define LOGINFO(fmt, arg...) pm_log(LOG_INFO, fmt, ## arg)
-# define LOGERR(fmt, arg...) pm_log(LOG_ERR, fmt, ## arg)
-#endif
-
/**
* @}
*/
char cmd_line[8];
int ret;
- LOGINFO("Backlight on=%d", on);
+ _I("Backlight on=%d", on);
switch (on) {
case STATUS_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);
}
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;
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);
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;
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) {
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");
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);
}
}
closedir(dp);
- _E("Failed to find mmc block number\n");
+ _E("Failed to find mmc block number");
return -1;
}
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;
}
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;
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;
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:
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;
}
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;
}
}
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);
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 = {
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;
}
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
#include <TelPower.h>
#include <tapi_event.h>
#include <tapi_common.h>
-#include <fcntl.h>
#include <syspopup_caller.h>
#include <sys/reboot.h>
#include <sys/time.h>
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;
}
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);
{
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");
}
}
}
{
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");
}
}
}
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]);
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;
}
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");
}
}
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();
tel_deinit(tapi_handle);
tapi_handle = NULL;
}
- PRT_TRACE("Power off \n");
+ _D("Power off \n");
/* Getting poweroff duration */
buf = getenv("PWROFF_DUR");
}
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);
}
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;
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;
}
tapi_handle = NULL;
}
- PRT_TRACE("Restart\n");
+ _I("Restart\n");
power_off = 1;
sync();
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);
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;
}
/* 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;
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;
}
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;
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;
}
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,
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,
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;
}
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);
}
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);
{
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;
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);
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;
}
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);
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");
}
}
}
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");
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;
}
pmon_efd = NULL;
}
if (__pmon_start(ad) == -1) {
- PRT_TRACE_ERR("fail pmon control fd init");
+ _E("fail pmon control fd init");
return;
}
}
}
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");
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)
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;
}
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;
}
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++;
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;
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;
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;
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;
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;
}
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)
* }
*/
+API int deviced_mmc_control(bool enable)
+{
+ return deviced_control_common(DEVICE_CONTROL_MMC, enable);
+}
\ No newline at end of file
#include <stdio.h>
#include <vconf.h>
#include <errno.h>
+#include <device-node.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <linux/limits.h>
-#include <device-node.h>
#include "log.h"
#include "dd-display.h"
_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 */
/* 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;
}