From 0cc6f7907522b916a9b99e1f11d61dd23114408e Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Fri, 8 Feb 2019 01:55:58 +0000 Subject: [PATCH 01/16] Revert "Do not unnecessarily check booting-done" This reverts commit 53256c665e90251b688e277d6ea8673476d317cf. Change-Id: Ic9ddcec6a9b7a2e7832901d296e3eb6d4a9b99d3 --- src/core/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/main.c b/src/core/main.c index a68db93..64d44c8 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -68,6 +68,13 @@ void watchdog_notify(void) static void deviced_dbus_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data) { + int ret; + ret = booting_finished(); + if (ret == 1) { + _I("notify relaunch"); + device_notify(DEVICE_NOTIFIER_BOOTING_DONE, &ret); + } + _I("sd_notify(READY=1)"); sd_notify(0, "READY=1"); } -- 2.7.4 From 1f75d0dda57f0c4aaa52f12ed2662afc67886a5f Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Fri, 8 Feb 2019 11:02:25 +0900 Subject: [PATCH 02/16] Apply device_notify_once() Change-Id: Ic56422e699bd3b1bae9174d31b271c40c7c5e907 Signed-off-by: Hyotaek Shim --- src/core/main.c | 8 ++++---- src/power/power-handler.c | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 64d44c8..a2ece6b 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -71,8 +71,9 @@ static void deviced_dbus_name_acquired(GDBusConnection *connection, const gchar int ret; ret = booting_finished(); if (ret == 1) { + /* Restarted: deviced was terminated */ _I("notify relaunch"); - device_notify(DEVICE_NOTIFIER_BOOTING_DONE, &ret); + device_notify_once(DEVICE_NOTIFIER_BOOTING_DONE, &ret); } _I("sd_notify(READY=1)"); @@ -94,9 +95,8 @@ static int deviced_main(int argc, char **argv) ret = check_power_flag(); if (ret) { - /* assume reboot was requested and deviced was - * killed/terminated in middle of it - resume - * procedure + /* Restarted: deviced was terminated + * in middle of reboot/poweroff - resume procedure */ poweroff_procedure(); return 0; diff --git a/src/power/power-handler.c b/src/power/power-handler.c index a084cc7..9b82c50 100644 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -259,7 +259,6 @@ static void poweroff_direct(void) int poweroff_procedure(void) { - powerdown(); if (poweroff_opt.type == POWER_OFF_DIRECT) -- 2.7.4 From 7f68002e284654b16cb74a90942f6ce220630324 Mon Sep 17 00:00:00 2001 From: "sanghyeok.oh" Date: Tue, 15 Jan 2019 08:35:12 +0900 Subject: [PATCH 03/16] dbus: systemd: change api - start/stop systemd unit move systemd related dbus api to libgdbus(libsyscommon) Change-Id: I6ae0c125dc5293fbc38df7ca3a0ba7cde12a8f38 Signed-off-by: sanghyeok.oh --- src/power/boot.c | 4 ++-- src/power/power-handler.c | 8 ++++---- src/shared/CMakeLists.txt | 1 - src/usb-host-test/usb-host-test.c | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/power/boot.c b/src/power/boot.c index 89bc808..413a968 100644 --- a/src/power/boot.c +++ b/src/power/boot.c @@ -21,13 +21,13 @@ #include #include #include +#include #include "core/log.h" #include "core/device-notifier.h" #include "core/common.h" #include "display/poll.h" #include "display/display-ops.h" -#include "shared/deviced-systemd.h" #define SIGNAL_BOOTING_DONE "BootingDone" #define SYSTEMD_DBUS_SIGNAL_SYSTEM_STARTUP_FINISHED "StartupFinished" @@ -43,7 +43,7 @@ int booting_finished(void) size_t len; GVariant *reply = NULL; - reply = deviced_systemd_get_manager_property(SYSTEMD_DBUS_METHOD_SYSTEM_STATE); + reply = systemd_get_manager_property(SYSTEMD_DBUS_METHOD_SYSTEM_STATE); if (!reply) { _E("Failed to get System State: no reply"); goto err; diff --git a/src/power/power-handler.c b/src/power/power-handler.c index 9b82c50..589dd02 100644 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "dd-deviced.h" #include "core/log.h" @@ -53,7 +54,6 @@ #include "display/display-ops.h" #include "power-handler.h" #include "apps/apps.h" -#include "shared/deviced-systemd.h" #include "boot.h" #define POWEROFF_DURATION 2 @@ -109,7 +109,7 @@ static void poweroff_start_animation(void) { int ret; - ret = deviced_systemd_start_unit("shutdown-animation.service"); + ret = systemd_start_unit_async("shutdown-animation.service", NULL); if (ret < 0) _E("Failed to start shutdown animation"); @@ -154,13 +154,13 @@ static int disable_systemd_journald(void) { int ret; - ret = deviced_systemd_stop_unit("systemd-journald.socket"); + ret = systemd_stop_unit_async("systemd-journald.socket", NULL); if (ret < 0) { _E("failed to stop 'systemd-journald.socket'"); return ret; } - ret |= deviced_systemd_stop_unit("systemd-journald.service"); + ret = systemd_stop_unit_async("systemd-journald.service", NULL); if (ret < 0) { _E("failed to stop 'systemd-journald.service'"); return ret; diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt index 2ad9dc1..67290f9 100644 --- a/src/shared/CMakeLists.txt +++ b/src/shared/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) SET(SHARED_SRCS - deviced-systemd.c plugin.c ) diff --git a/src/usb-host-test/usb-host-test.c b/src/usb-host-test/usb-host-test.c index e83811b..7ea07c8 100644 --- a/src/usb-host-test/usb-host-test.c +++ b/src/usb-host-test/usb-host-test.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "core/log.h" #include "core/config-parser.h" @@ -30,7 +31,6 @@ #include "core/device-notifier.h" #include "core/devices.h" #include "core/list.h" -#include "shared/deviced-systemd.h" #define FFS_PATH "/run/usb-host-test-ffs" #define GADGET_SCHEME_PATH "/etc/deviced/usb-host-test/test_gadget.gs" @@ -409,7 +409,7 @@ int start() _E("fail to init dbus signal(%d)", ret); sigid_start = ret; - ret = deviced_systemd_start_unit(SYSTEMD_UNIT_NAME); + ret = systemd_start_unit_sync(SYSTEMD_UNIT_NAME, NULL, -1); if (ret < 0) { _E("Error starting daemon"); /*unregister_dbus_signal_handler(SYSTEMD_DBUS_PATH, @@ -455,13 +455,13 @@ static int stop() sigid_stop = ret; - ret = deviced_systemd_stop_unit(SYSTEMD_UNIT_NAME); + ret = systemd_stop_unit_sync(SYSTEMD_UNIT_NAME, NULL, -1); if (ret < 0) { _E("could not stop socket unit"); goto out; } - ret = deviced_systemd_stop_unit(SYSTEMD_SERVICE_NAME); + ret = systemd_stop_unit_sync(SYSTEMD_SERVICE_NAME, NULL, -1); if (ret < 0) { _E("could not stop service unit"); goto out; -- 2.7.4 From 386706aea1c051d9b19f5d4b3eb93e99482928f5 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Thu, 27 Dec 2018 20:42:01 +0900 Subject: [PATCH 04/16] Add dbus_get_temperature for method, GetTemperature Change-Id: I732241d0d3c57deba03e0beaf6caf949ddf7009f Signed-off-by: lokilee73 --- src/thermal/thermal.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/thermal/thermal.c b/src/thermal/thermal.c index 794b186..d9a5e9f 100644 --- a/src/thermal/thermal.c +++ b/src/thermal/thermal.c @@ -21,6 +21,7 @@ #include #include +#include #include "apps/apps.h" #include "core/devices.h" @@ -343,6 +344,40 @@ static int thermal_service_stop(void) return ret; } +static GVariant *dbus_get_temperature(GDBusConnection *conn, + const gchar *sender, const gchar *path, const gchar *iface, const gchar *name, + GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) +{ + struct thermal_info info; + int index, ret = 0; + + g_variant_get(param, "(i)", &index); + + if (!thermal_dev || !thermal_dev->get_info) { + ret = -ENODEV; + goto exit; + } + + ret = thermal_dev->get_info((device_thermal_e)index, &info); + if (!ret) + ret = info.temp; + +exit: + return g_variant_new("(i)", ret); +} + +static const dbus_method_s dbus_methods[] = { + { "GetTemperature", "i", "i", dbus_get_temperature}, + /* Add methods here */ +}; + +static const dbus_interface_u dbus_interface = { + .oh = NULL, + .name = DEVICED_INTERFACE_TEMPERATURE, + .methods = dbus_methods, + .nr_methods = ARRAY_SIZE(dbus_methods), +}; + static int booting_done(void *data) { static int done; @@ -402,6 +437,10 @@ static void thermal_init(void *data) ret = register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); if (ret < 0) _E("Fail to register booting done Notifier"); + + ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_TEMPERATURE, &dbus_interface); + if (ret < 0) + _E("fail to init dbus method(%d)", ret); } static void thermal_exit(void *data) -- 2.7.4 From 90cc6072381e4e7fcffb43c1f0cda4069f913818 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Thu, 14 Feb 2019 16:47:00 +0100 Subject: [PATCH 05/16] power: Remove erronous DIRECT poweroff type Commit 51849e1cad ("power: Rework handling of repeated poweroff/reboot request") mistakenly introduced POWEROFF type. Before that commit "DIRECT" type was used to mean POWEROFF. This commit reverts to original behaviour, dropping DIRECT type for all new uses but retains constant for compatiblity. Change-Id: I4ddd5fa7fe45dd54bd9a597ed36b989b93a2f3f8 --- src/core/main.c | 2 +- src/power/power-handler.c | 83 +++++++++++++++++------------------------------ src/power/power-handler.h | 4 +-- 3 files changed, 32 insertions(+), 57 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index a2ece6b..9ff0cd1 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -98,7 +98,7 @@ static int deviced_main(int argc, char **argv) /* Restarted: deviced was terminated * in middle of reboot/poweroff - resume procedure */ - poweroff_procedure(); + powerdown(); return 0; } diff --git a/src/power/power-handler.c b/src/power/power-handler.c index 589dd02..f0fa00f 100644 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -74,14 +74,13 @@ static bool during_poweroff; static dd_list *poweroff_handles; static char *poweroff_type_flagpaths[] = { // index denotes type - [POWER_OFF_DIRECT] = POWER_FLAG_POWEROFF, + [POWER_OFF_POWEROFF] = POWER_FLAG_POWEROFF, [POWER_OFF_REBOOT] = POWER_FLAG_REBOOT, }; static char *poweroff_type_names[] = { // index denotes type [POWER_OFF_POWEROFF] = POWER_POWEROFF, [POWER_OFF_POPUP] = PWROFF_POPUP, [POWER_OFF_REBOOT] = POWER_REBOOT, - [POWER_OFF_DIRECT] = "", }; static char *poweroff_type_to_name(enum poweroff_type type) @@ -189,7 +188,31 @@ static bool disable_coredump_handler(void) return is_ok; } -static void powerdown(void) +static void poweroff_request_shutdown() +{ + _I("Requested power off via systemd"); + + char *method; + + if (poweroff_opt.type == POWER_OFF_REBOOT) + method = "Reboot"; + else if (poweroff_opt.type == POWER_OFF_POWEROFF) + method = "PowerOff"; + else { + _E("poweroff invalid type (%d)", poweroff_opt.type); + return; + } + + dbus_handle_method_sync_timeout(SYSTEMD_DBUS_DEST, + SYSTEMD_DBUS_PATH, + SYSTEMD_DBUS_IFACE_MANAGER, + method, + NULL, + NULL, + POWEROFF_WAIT_SYSTEMD_MS); +} + +void powerdown(void) { static int wait; struct timeval now; @@ -223,50 +246,8 @@ static void powerdown(void) } watchdog_notify(); -} - -static void poweroff_request_shutdown() -{ - _I("Requested power off via systemd"); - - char *method; - if (poweroff_opt.type == POWER_OFF_REBOOT) - method = "Reboot"; - else if (poweroff_opt.type == POWER_OFF_POWEROFF) - method = "PowerOff"; - else { - _E("poweroff invalid type (%d)", poweroff_opt.type); - return; - } - - dbus_handle_method_sync_timeout(SYSTEMD_DBUS_DEST, - SYSTEMD_DBUS_PATH, - SYSTEMD_DBUS_IFACE_MANAGER, - method, - NULL, - NULL, - POWEROFF_WAIT_SYSTEMD_MS); -} - -static void poweroff_direct(void) -{ - _I("Requested power off without systemd (direct call)"); - if (syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, - LINUX_REBOOT_CMD_POWER_OFF, NULL) < 0) - _E("Failed to poweroff (%d)", errno); -} - -int poweroff_procedure(void) -{ - powerdown(); - - if (poweroff_opt.type == POWER_OFF_DIRECT) - poweroff_direct(); - else - poweroff_request_shutdown(); - - return 0; + poweroff_request_shutdown(); } int check_power_flag(void) @@ -336,10 +317,8 @@ static void poweroff_remove_handle(pid_t pid) static gboolean poweroff_timeout_cb(void *data) { - int ret; - pid_t pid; + pid_t pid = (pid_t)((intptr_t)data); - pid = (pid_t)((intptr_t)data); poweroff_remove_handle(pid); if (DD_LIST_LENGTH(poweroff_handles)) { @@ -368,9 +347,7 @@ static gboolean poweroff_timeout_cb(void *data) /* TODO for notify. will be removed asap. */ vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, poweroff_opt.type); - ret = poweroff_procedure(); - if (ret < 0) - _E("Failed to %s (%d)", name, ret); + powerdown(); out: if (disp_plgn.update_pm_setting) @@ -488,7 +465,6 @@ static void poweroff_send_broadcast(int status) g_variant_new("(i)", status)); } - static int power_execute_pid(char *type, char *option, pid_t pid) { if (during_poweroff) { @@ -790,7 +766,6 @@ static void power_init(void *data) register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); add_poweroff_option(POWER_OFF_POWEROFF, NULL); - add_poweroff_option(POWER_OFF_DIRECT, NULL); add_poweroff_option(POWER_OFF_RESTART, NULL); add_poweroff_option(POWER_OFF_POPUP, NULL); diff --git a/src/power/power-handler.h b/src/power/power-handler.h index 968e17a..551356c 100644 --- a/src/power/power-handler.h +++ b/src/power/power-handler.h @@ -36,9 +36,9 @@ enum poweroff_type { POWER_OFF_NONE = POWER_OFF_INVALID, // compat only POWER_OFF_POPUP, POWER_OFF_POWEROFF, /* replaces POWER_OFF_DIRECT */ + POWER_OFF_DIRECT = POWER_OFF_POWEROFF, // compat only POWER_OFF_REBOOT, POWER_OFF_RESTART = POWER_OFF_REBOOT, // compat only - POWER_OFF_DIRECT, }; struct power_option { @@ -53,6 +53,6 @@ struct poweroff_handle { }; int check_power_flag(void); -int poweroff_procedure(void); +void powerdown(void); #endif /* __POWER_HANDLE_H__ */ -- 2.7.4 From ccd59fc762c1602429360e978f2af830a86d329e Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Fri, 15 Feb 2019 16:27:07 +0100 Subject: [PATCH 06/16] power: Introduce 'exit' reboot option This option will cause system to perform complete shutdown without final 'reboot' syscall. Such feature was requested by test team. Test by calling: dbus-send --system --print-reply --dest=org.tizen.system.deviced --type=method_call /Org/Tizen/System/DeviceD/Reboot org.tizen.system.deviced.reboot.reboot string:exit int32:0 The system will execute shutdown sequence but most processes will remain running (eg. when tested on odroid, the shell from which command was invoked was not terminated). To confirm it works see thatt PID1 binary is replaced by systemd-shutdown: root@localhost:~# ps auxww USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 8.3 0.1 3828 2164 ? Ss 00:37 0:06 /usr/lib/systemd/systemd-shutdown exit --log-level 6 --log-target kmsg --log-color --exit-code 0 Change-Id: I91112c535c80713f2d35081edeaa7c0e1d772c3b --- src/power-shutdown/shutdown.c | 34 +++++++++++++++++++++++++++++----- src/power/power-handler.c | 6 ++++++ src/power/power-handler.h | 4 ++++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/power-shutdown/shutdown.c b/src/power-shutdown/shutdown.c index 0ac97c5..e81d485 100644 --- a/src/power-shutdown/shutdown.c +++ b/src/power-shutdown/shutdown.c @@ -39,6 +39,13 @@ #include "core/log.h" #include "core/common.h" +enum { + CMD_REBOOT, + CMD_POWEROFF, + CMD_HALT = CMD_POWEROFF, + CMD_EXIT, +}; + #define UMOUNT_RW_PATH_USER "/opt/usr" #define UMOUNT_RW_PATH_SYSTEM "/opt" #define MAX_UMOUNT_KILL_RETRY 4 @@ -82,6 +89,21 @@ static void autoboot(void) &buf); } +static void handle_exit(void) +{ + /* systemd default behviour for handling exit in system manager + * is to treat is as poweroff. Exiting from PID1 would cause + * system to panic, so it's not really "supported. Poweroff is + * sane default, but it's also implementation detail and something + * user should depend on. + * + * In Tizen we put shutdown binary to sleep, rather than powering + * it off. This functionaliy has been requested by test team. + */ + for (;;) + pause(); +} + int main(int ac, char *av[]) { enum { @@ -112,11 +134,11 @@ int main(int ac, char *av[]) return usage(); if (strcmp(cmd_name, "reboot") == 0) - cmd = RB_AUTOBOOT; + cmd = CMD_REBOOT; else if (strcmp(cmd_name, "halt") == 0 || strcmp(cmd_name, "poweroff") == 0) - cmd = RB_POWER_OFF; + cmd = CMD_POWEROFF; else if (strcmp(cmd_name, "exit") == 0) - exit(0); + cmd = CMD_EXIT; else // XXX this is critical failure - we are pid1 already // and can't perform requested action - exit below @@ -141,10 +163,12 @@ int main(int ac, char *av[]) printf("%s: performing %s\n", progname, cmd_name); - if (cmd == RB_AUTOBOOT) + if (cmd == CMD_REBOOT) autoboot(); + else if (cmd == CMD_EXIT) + handle_exit(); else - reboot(cmd); + reboot(RB_POWER_OFF); return 1; } diff --git a/src/power/power-handler.c b/src/power/power-handler.c index f0fa00f..6d35ec1 100644 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -76,11 +76,14 @@ static dd_list *poweroff_handles; static char *poweroff_type_flagpaths[] = { // index denotes type [POWER_OFF_POWEROFF] = POWER_FLAG_POWEROFF, [POWER_OFF_REBOOT] = POWER_FLAG_REBOOT, + [POWER_OFF_EXIT] = POWER_FLAG_EXIT, }; + static char *poweroff_type_names[] = { // index denotes type [POWER_OFF_POWEROFF] = POWER_POWEROFF, [POWER_OFF_POPUP] = PWROFF_POPUP, [POWER_OFF_REBOOT] = POWER_REBOOT, + [POWER_OFF_EXIT] = POWER_EXIT, }; static char *poweroff_type_to_name(enum poweroff_type type) @@ -198,6 +201,8 @@ static void poweroff_request_shutdown() method = "Reboot"; else if (poweroff_opt.type == POWER_OFF_POWEROFF) method = "PowerOff"; + else if (poweroff_opt.type == POWER_OFF_EXIT) + method = "Exit"; else { _E("poweroff invalid type (%d)", poweroff_opt.type); return; @@ -768,6 +773,7 @@ static void power_init(void *data) add_poweroff_option(POWER_OFF_POWEROFF, NULL); add_poweroff_option(POWER_OFF_RESTART, NULL); add_poweroff_option(POWER_OFF_POPUP, NULL); + add_poweroff_option(POWER_OFF_EXIT, NULL); ret = config_parse(POWER_CONF_FILE, load_config, NULL); if (ret < 0) diff --git a/src/power/power-handler.h b/src/power/power-handler.h index 551356c..ae726f8 100644 --- a/src/power/power-handler.h +++ b/src/power/power-handler.h @@ -28,8 +28,11 @@ #define PWROFF_POPUP "pwroff-popup" #define PWROFF_POPUP_LEN 12 +#define POWER_EXIT "exit" + #define POWER_FLAG_POWEROFF "/run/"POWER_POWEROFF #define POWER_FLAG_REBOOT "/run/"POWER_REBOOT +#define POWER_FLAG_EXIT "/run/deviced-shutdown-exit" enum poweroff_type { POWER_OFF_INVALID = 0, @@ -39,6 +42,7 @@ enum poweroff_type { POWER_OFF_DIRECT = POWER_OFF_POWEROFF, // compat only POWER_OFF_REBOOT, POWER_OFF_RESTART = POWER_OFF_REBOOT, // compat only + POWER_OFF_EXIT, }; struct power_option { -- 2.7.4 From 6fb424e7518eb3ec908f25f6e0c0ced87a97d7b6 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Mon, 18 Feb 2019 13:18:20 +0100 Subject: [PATCH 07/16] shutdown: Ensure messages are printed as fast as possible Change-Id: I568816d81b357592f279638404292b7c299e10f9 --- src/power-shutdown/shutdown.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/power-shutdown/shutdown.c b/src/power-shutdown/shutdown.c index e81d485..a3f7c1e 100644 --- a/src/power-shutdown/shutdown.c +++ b/src/power-shutdown/shutdown.c @@ -124,6 +124,11 @@ int main(int ac, char *av[]) progname = av[0]; + // Ensure messages are printed to console as fast as possible. + // Otherwise we risk that in case of error nothing will be printed + // as last step is reboot. + setvbuf(stdout, NULL, _IONBF, 0); + int c; while ((c = getopt_long(ac, av, "", opts, NULL)) >= 0) ; // not supported for now -- 2.7.4 From 50de9e0fd62b75b938fc3b4f89f764a7c0ce3b78 Mon Sep 17 00:00:00 2001 From: "sanghyeok.oh" Date: Wed, 20 Feb 2019 11:35:27 +0900 Subject: [PATCH 08/16] coverity: fix SIGSEGV warning Change-Id: I401b65eda545123127659fe557565827c4369482 Signed-off-by: sanghyeok.oh --- src/power-shutdown/shutdown.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/power-shutdown/shutdown.c b/src/power-shutdown/shutdown.c index a3f7c1e..2e25f99 100644 --- a/src/power-shutdown/shutdown.c +++ b/src/power-shutdown/shutdown.c @@ -79,7 +79,7 @@ static void autoboot(void) static char buf[4096] = {0,}; int fd = open("/run/reboot", O_RDONLY); // XXX POWER_FLAG_REBOOT if (fd >= 0) { - (void)read(fd, buf, sizeof(buf)); + (void)read(fd, buf, sizeof(buf) - 1); close(fd); } -- 2.7.4 From fa982ca332ad1133834b3580c0c1fbd53062c5c0 Mon Sep 17 00:00:00 2001 From: Yunmi Ha Date: Wed, 20 Feb 2019 14:51:07 +0900 Subject: [PATCH 09/16] Apply consistent log messages. 1. First letter to uppercase. 2. Period at the end. 3. Rearrange parameters. Change-Id: I8d037b3c7001ad9a41262a30f47cdf05332949d1 Signed-off-by: Yunmi Ha --- plugins/iot/display/ambient-mode.c | 14 +++--- plugins/iot/display/auto-brightness.c | 72 +++++++++++++++--------------- plugins/mobile/display/ambient-mode.c | 14 +++--- plugins/mobile/display/auto-brightness.c | 72 +++++++++++++++--------------- plugins/tv/display/ambient-mode.c | 14 +++--- plugins/tv/display/auto-brightness.c | 72 +++++++++++++++--------------- plugins/wearable/display/ambient-mode.c | 14 +++--- plugins/wearable/display/auto-brightness.c | 70 ++++++++++++++--------------- src/apps/apps.c | 8 ++-- src/auto-test/battery.c | 58 ++++++++++++------------ src/battery/battery-time.c | 16 +++---- src/power/boot.c | 20 ++++----- 12 files changed, 222 insertions(+), 222 deletions(-) mode change 100644 => 100755 plugins/iot/display/auto-brightness.c mode change 100644 => 100755 plugins/mobile/display/ambient-mode.c mode change 100644 => 100755 plugins/mobile/display/auto-brightness.c mode change 100644 => 100755 plugins/tv/display/ambient-mode.c mode change 100644 => 100755 plugins/tv/display/auto-brightness.c mode change 100644 => 100755 plugins/wearable/display/ambient-mode.c mode change 100644 => 100755 plugins/wearable/display/auto-brightness.c mode change 100644 => 100755 src/apps/apps.c mode change 100644 => 100755 src/auto-test/battery.c mode change 100644 => 100755 src/battery/battery-time.c mode change 100644 => 100755 src/power/boot.c diff --git a/plugins/iot/display/ambient-mode.c b/plugins/iot/display/ambient-mode.c index 7afecc2..72ce1a2 100644 --- a/plugins/iot/display/ambient-mode.c +++ b/plugins/iot/display/ambient-mode.c @@ -64,12 +64,12 @@ static void ambient_set_condition(keynode_t *key_nodes, void *data) int state; if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } ambient_condition = vconf_keynode_get_bool(key_nodes); - _I("ambient mode condition is %d", ambient_condition); + _I("Ambient mode condition is %d.", ambient_condition); state = (ambient_condition == 0 ? 0 : 1); device_notify(DEVICE_NOTIFIER_DISPLAY_AMBIENT_CONDITION, (void *)&state); @@ -89,7 +89,7 @@ int ambient_set_state(int on) if (!on) ambient_pid = 0; - _D("AMBIENT is %s", (on ? ON : OFF)); + _D("AMBIENT is %s.", (on ? ON : OFF)); ambient_state = on; @@ -115,7 +115,7 @@ void ambient_check_invalid_state(pid_t pid) if (ambient_get_state() == false) return; - _E("Invalid state! Ambient state is change to off!"); + _E("Invalid state. Ambient state is change to off."); /* If lcd_power is on and ambient state is true * when pm state is changed to sleep, @@ -156,7 +156,7 @@ static void end_clock(pid_t pid) update_count = 1; ambient_pid = pid; - _I("enter real ambient state by %d", + _I("Enter real ambient state by process(%d).", ambient_pid); } @@ -180,10 +180,10 @@ static void ambient_init(void *data) ret = vconf_get_bool(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, &ambient_condition); if (ret < 0) { - _E("Failed to get ambient mode condition ! (%d)", ret); + _E("Failed to get ambient mode condition: %d", ret); ambient_condition = false; } - _I("ambient mode condition is %d", ambient_condition); + _I("Ambient mode condition is %d.", ambient_condition); vconf_notify_key_changed(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, ambient_set_condition, NULL); diff --git a/plugins/iot/display/auto-brightness.c b/plugins/iot/display/auto-brightness.c old mode 100644 new mode 100755 index 0a36de1..484e4fd --- a/plugins/iot/display/auto-brightness.c +++ b/plugins/iot/display/auto-brightness.c @@ -85,7 +85,7 @@ static bool update_working_position(void) ret = sensor_listener_read_data(accel_listener, &data); if (ret != SENSOR_ERROR_NONE) { - _E("Fail to get accelerometer data! %d", ret); + _E("Failed to get accelerometer data: %d", ret); return true; } @@ -96,7 +96,7 @@ static bool update_working_position(void) realg = (float)sqrt((x * x) + (y * y) + (z * z)); pitch = ROTATION_90 - abs((int) (asin(z / realg) * RADIAN_VALUE)); - _D("accel data [%f, %f, %f] - %f", x, y, z, pitch); + _D("Accel data x=%f y=%f z=%f pitch=%f", x, y, z, pitch); if (pitch >= WORKING_ANGLE_MIN && pitch <= WORKING_ANGLE_MAX) return true; @@ -110,7 +110,7 @@ static void alc_set_brightness(int setting, int value, float light) ret = backlight_ops.get_brightness(&tmp_value); if (ret < 0) { - _E("Fail to get display brightness!"); + _E("Failed to get display brightness."); return; } @@ -123,7 +123,7 @@ static void alc_set_brightness(int setting, int value, float light) position = update_working_position(); if (!position && (old > light)) { _D("It's not working position, " - "LCD isn't getting dark!"); + "LCD isn't getting dark."); return; } } @@ -148,8 +148,8 @@ static void alc_set_brightness(int setting, int value, float light) backlight_ops.set_default_brt(tmp_value); backlight_ops.update(); } - _I("load light data:%f ,auto brt %d,min brightness %d," - "brightness %d", light, automatic_brt, min_brightness, value); + _I("Load light data(%f). auto brt=%d min brightness=%d " + "brightness=%d", light, automatic_brt, min_brightness, value); old = light; } } @@ -180,13 +180,13 @@ static bool alc_update_brt(bool setting) ret = sensor_listener_read_data(light_listener, &light_data); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to read light sensor data(%d)", ret); + _E("Failed to read light sensor data: %d", ret); goto out; } index = light_data.value_count - 1; if (index < 0 || light_data.values[index] < 0) { - _E("Invalid light sensor data"); + _E("Invalid light sensor data."); goto out; } @@ -194,12 +194,12 @@ static bool alc_update_brt(bool setting) ret = backlight_ops.get_brightness_by_light_sensor( lmax, lmin, light, &value); if (ret == -ENOTSUP) { - _E("Not supported to handle the light data"); + _E("Not supported to handle the light data."); goto out; } if (ret < 0 || value < PM_MIN_BRIGHTNESS || value > PM_MAX_BRIGHTNESS) { - _E("fail to load light data : light(%f), value(%d), ret(%d)", light, value, ret); + _E("Failed to load light data. light=%f value=%d: %d", light, value, ret); goto out; } @@ -224,7 +224,7 @@ out: } vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_OFF); - _E("Fault counts is over %d, disable automatic brightness", MAX_FAULT); + _E("Fault counts is over %d, disable automatic brightness.", MAX_FAULT); return false; } return true; @@ -273,11 +273,11 @@ static int connect_sensor(void) sensor_h *list = NULL; int cnt = 0; - _I("connect with sensor fw"); + _I("Connect with sensor fw."); /* light sensor */ ret = sensor_get_sensor_list(SENSOR_LIGHT, &list, &cnt); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor list(%d)", ret); + _E("Failed to get light sensor list: %d", ret); goto error; } @@ -293,25 +293,25 @@ static int connect_sensor(void) ret = sensor_get_min_range(sensor, &lmin); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor min range (%d)", ret); + _E("Failed to get light sensor min range: %d", ret); goto error; } ret = sensor_get_max_range(sensor, &lmax); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor max range (%d)", ret); + _E("Failed to get light sensor max range: %d", ret); goto error; } - _I("Light sensor min(%f), max(%f)", lmin, lmax); + _I("Light sensor min=%f max=%f", lmin, lmax); ret = sensor_create_listener(sensor, &light_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to create listener(light)!"); + _E("Failed to create listener(light)."); goto error; } sensor_listener_set_option(light_listener, SENSOR_OPTION_ALWAYS_ON); ret = sensor_listener_start(light_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to start light sensor!"); + _E("Failed to start light sensor."); sensor_destroy_listener(light_listener); light_listener = 0; goto error; @@ -323,18 +323,18 @@ static int connect_sensor(void) /* accelerometer sensor */ ret = sensor_get_default_sensor(SENSOR_ACCELEROMETER, &sensor); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get default accel sensor!"); + _E("Failed to get default accel sensor."); goto error; } ret = sensor_create_listener(&sensor, &accel_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to create listener(accel)!"); + _E("Failed to create listener(accel)."); goto error; } sensor_listener_set_option(accel_listener, SENSOR_OPTION_ALWAYS_ON); ret = sensor_listener_start(accel_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to start accel sensor!"); + _E("Failed to start accel sensor."); sensor_destroy_listener(accel_listener); accel_listener = 0; goto error; @@ -360,7 +360,7 @@ error: static int disconnect_sensor(void) { - _I("disconnect with sensor fw"); + _I("Disconnect with sensor fw."); /* light sensor*/ if (light_listener > 0) { sensor_listener_stop(light_listener); @@ -391,8 +391,8 @@ void set_brightness_changed_state(void) { if (pm_status_flag & PWRSV_FLAG) { pm_status_flag |= BRTCH_FLAG; - _D("brightness changed in low battery," - "escape dim state (light)"); + _D("Brightness changed in low battery," + "escape dim state (light)."); } } @@ -420,7 +420,7 @@ static int set_autobrightness_state(int status) g_timeout_add_seconds(display_conf.lightsensor_interval, alc_handler, NULL); } else if (status == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) { - _I("auto brightness paused!"); + _I("Auto brightness paused."); disconnect_sensor(); } else { disconnect_sensor(); @@ -429,7 +429,7 @@ static int set_autobrightness_state(int status) ret = get_setting_brightness(&default_brt); if (ret != 0 || (default_brt < PM_MIN_BRIGHTNESS || default_brt > PM_MAX_BRIGHTNESS)) { - _I("fail to read vconf value for brightness"); + _I("Failed 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); @@ -448,7 +448,7 @@ static void set_alc_function(keynode_t *key_nodes, void *data) int status, ret; if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } @@ -459,21 +459,21 @@ static void set_alc_function(keynode_t *key_nodes, void *data) case SETTING_BRIGHTNESS_AUTOMATIC_ON: case SETTING_BRIGHTNESS_AUTOMATIC_PAUSE: ret = set_autobrightness_state(status); - _D("set auto brightness : %d", ret); + _D("Set auto brightness: %d", ret); break; default: - _E("invalid value! %d", status); + _E("Invalid value(%d)", status); } } static void set_alc_automatic_brt(keynode_t *key_nodes, void *data) { if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } automatic_brt = vconf_keynode_get_int(key_nodes) / AUTOMATIC_DEVIDE_VAL; - _D("automatic brt : %d", automatic_brt); + _D("Automatic brt(%d)", automatic_brt); alc_update_brt(true); } @@ -491,7 +491,7 @@ static gboolean update_handler(void *data) if (ret < 0 || on != SETTING_BRIGHTNESS_AUTOMATIC_ON) return G_SOURCE_REMOVE; - _D("auto brightness is working!"); + _D("Auto brightness is working."); alc_update_brt(true); return G_SOURCE_REMOVE; @@ -526,10 +526,10 @@ static int prepare_lsensor(void *data) vconf_get_int(VCONFKEY_SETAPPL_LCD_AUTOMATIC_BRIGHTNESS, &brt); if (brt < PM_MIN_BRIGHTNESS || brt > PM_MAX_BRIGHTNESS) { - _E("Failed to get automatic brightness!"); + _E("Failed to get automatic brightness."); } else { automatic_brt = brt / AUTOMATIC_DEVIDE_VAL; - _I("automatic brt init success %d", automatic_brt); + _I("Automatic brt(%d) init success.", automatic_brt); } vconf_notify_key_changed(VCONFKEY_SETAPPL_LCD_AUTOMATIC_BRIGHTNESS, @@ -565,7 +565,7 @@ static int set_autobrightness_min(int val, char *name) update_brightness_direct(); - _I("auto brightness min value changed! (%d, %s)", + _I("Auto brightness min value changed. min_brightness=%d min_brightness_name=%s", min_brightness, min_brightness_name); return 0; @@ -585,7 +585,7 @@ static void reset_autobrightness_min(GDBusConnection *conn, if (strcmp(sender, min_brightness_name)) return; - _I("change to default %d -> %d, %s", min_brightness, + _I("Change to default min brightness. before=%d changed=%d brightness_name=%s", min_brightness, PM_MIN_BRIGHTNESS, min_brightness_name); min_brightness = PM_MIN_BRIGHTNESS; if (min_brightness_name) { diff --git a/plugins/mobile/display/ambient-mode.c b/plugins/mobile/display/ambient-mode.c old mode 100644 new mode 100755 index 7afecc2..72ce1a2 --- a/plugins/mobile/display/ambient-mode.c +++ b/plugins/mobile/display/ambient-mode.c @@ -64,12 +64,12 @@ static void ambient_set_condition(keynode_t *key_nodes, void *data) int state; if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } ambient_condition = vconf_keynode_get_bool(key_nodes); - _I("ambient mode condition is %d", ambient_condition); + _I("Ambient mode condition is %d.", ambient_condition); state = (ambient_condition == 0 ? 0 : 1); device_notify(DEVICE_NOTIFIER_DISPLAY_AMBIENT_CONDITION, (void *)&state); @@ -89,7 +89,7 @@ int ambient_set_state(int on) if (!on) ambient_pid = 0; - _D("AMBIENT is %s", (on ? ON : OFF)); + _D("AMBIENT is %s.", (on ? ON : OFF)); ambient_state = on; @@ -115,7 +115,7 @@ void ambient_check_invalid_state(pid_t pid) if (ambient_get_state() == false) return; - _E("Invalid state! Ambient state is change to off!"); + _E("Invalid state. Ambient state is change to off."); /* If lcd_power is on and ambient state is true * when pm state is changed to sleep, @@ -156,7 +156,7 @@ static void end_clock(pid_t pid) update_count = 1; ambient_pid = pid; - _I("enter real ambient state by %d", + _I("Enter real ambient state by process(%d).", ambient_pid); } @@ -180,10 +180,10 @@ static void ambient_init(void *data) ret = vconf_get_bool(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, &ambient_condition); if (ret < 0) { - _E("Failed to get ambient mode condition ! (%d)", ret); + _E("Failed to get ambient mode condition: %d", ret); ambient_condition = false; } - _I("ambient mode condition is %d", ambient_condition); + _I("Ambient mode condition is %d.", ambient_condition); vconf_notify_key_changed(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, ambient_set_condition, NULL); diff --git a/plugins/mobile/display/auto-brightness.c b/plugins/mobile/display/auto-brightness.c old mode 100644 new mode 100755 index 0a36de1..6391a8e --- a/plugins/mobile/display/auto-brightness.c +++ b/plugins/mobile/display/auto-brightness.c @@ -85,7 +85,7 @@ static bool update_working_position(void) ret = sensor_listener_read_data(accel_listener, &data); if (ret != SENSOR_ERROR_NONE) { - _E("Fail to get accelerometer data! %d", ret); + _E("Failed to get accelerometer data: %d", ret); return true; } @@ -96,7 +96,7 @@ static bool update_working_position(void) realg = (float)sqrt((x * x) + (y * y) + (z * z)); pitch = ROTATION_90 - abs((int) (asin(z / realg) * RADIAN_VALUE)); - _D("accel data [%f, %f, %f] - %f", x, y, z, pitch); + _D("Accel data x=%f y=%f z=%f pitch=%f", x, y, z, pitch); if (pitch >= WORKING_ANGLE_MIN && pitch <= WORKING_ANGLE_MAX) return true; @@ -110,7 +110,7 @@ static void alc_set_brightness(int setting, int value, float light) ret = backlight_ops.get_brightness(&tmp_value); if (ret < 0) { - _E("Fail to get display brightness!"); + _E("Failed to get display brightness."); return; } @@ -123,7 +123,7 @@ static void alc_set_brightness(int setting, int value, float light) position = update_working_position(); if (!position && (old > light)) { _D("It's not working position, " - "LCD isn't getting dark!"); + "LCD isn't getting dark."); return; } } @@ -148,8 +148,8 @@ static void alc_set_brightness(int setting, int value, float light) backlight_ops.set_default_brt(tmp_value); backlight_ops.update(); } - _I("load light data:%f ,auto brt %d,min brightness %d," - "brightness %d", light, automatic_brt, min_brightness, value); + _I("Load light data(%f) auto brt=%d min brightness=%d " + "brightness=%d", light, automatic_brt, min_brightness, value); old = light; } } @@ -180,13 +180,13 @@ static bool alc_update_brt(bool setting) ret = sensor_listener_read_data(light_listener, &light_data); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to read light sensor data(%d)", ret); + _E("Failed to read light sensor data: %d", ret); goto out; } index = light_data.value_count - 1; if (index < 0 || light_data.values[index] < 0) { - _E("Invalid light sensor data"); + _E("Invalid light sensor data."); goto out; } @@ -194,12 +194,12 @@ static bool alc_update_brt(bool setting) ret = backlight_ops.get_brightness_by_light_sensor( lmax, lmin, light, &value); if (ret == -ENOTSUP) { - _E("Not supported to handle the light data"); + _E("Not supported to handle the light data."); goto out; } if (ret < 0 || value < PM_MIN_BRIGHTNESS || value > PM_MAX_BRIGHTNESS) { - _E("fail to load light data : light(%f), value(%d), ret(%d)", light, value, ret); + _E("Failed to load light data. light=%f value=%d: %d", light, value, ret); goto out; } @@ -224,7 +224,7 @@ out: } vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_OFF); - _E("Fault counts is over %d, disable automatic brightness", MAX_FAULT); + _E("Fault counts is over %d, disable automatic brightness.", MAX_FAULT); return false; } return true; @@ -273,11 +273,11 @@ static int connect_sensor(void) sensor_h *list = NULL; int cnt = 0; - _I("connect with sensor fw"); + _I("Connect with sensor fw."); /* light sensor */ ret = sensor_get_sensor_list(SENSOR_LIGHT, &list, &cnt); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor list(%d)", ret); + _E("Failed to get light sensor list: %d", ret); goto error; } @@ -293,25 +293,25 @@ static int connect_sensor(void) ret = sensor_get_min_range(sensor, &lmin); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor min range (%d)", ret); + _E("Failed to get light sensor min range: %d", ret); goto error; } ret = sensor_get_max_range(sensor, &lmax); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor max range (%d)", ret); + _E("Failed to get light sensor max range: %d", ret); goto error; } - _I("Light sensor min(%f), max(%f)", lmin, lmax); + _I("Light sensor min=%f max=%f", lmin, lmax); ret = sensor_create_listener(sensor, &light_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to create listener(light)!"); + _E("Failed to create listener(light)."); goto error; } sensor_listener_set_option(light_listener, SENSOR_OPTION_ALWAYS_ON); ret = sensor_listener_start(light_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to start light sensor!"); + _E("Failed to start light sensor."); sensor_destroy_listener(light_listener); light_listener = 0; goto error; @@ -323,18 +323,18 @@ static int connect_sensor(void) /* accelerometer sensor */ ret = sensor_get_default_sensor(SENSOR_ACCELEROMETER, &sensor); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get default accel sensor!"); + _E("Failed to get default accel sensor."); goto error; } ret = sensor_create_listener(&sensor, &accel_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to create listener(accel)!"); + _E("Failed to create listener(accel)."); goto error; } sensor_listener_set_option(accel_listener, SENSOR_OPTION_ALWAYS_ON); ret = sensor_listener_start(accel_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to start accel sensor!"); + _E("Failed to start accel sensor."); sensor_destroy_listener(accel_listener); accel_listener = 0; goto error; @@ -360,7 +360,7 @@ error: static int disconnect_sensor(void) { - _I("disconnect with sensor fw"); + _I("Disconnect with sensor fw."); /* light sensor*/ if (light_listener > 0) { sensor_listener_stop(light_listener); @@ -391,8 +391,8 @@ void set_brightness_changed_state(void) { if (pm_status_flag & PWRSV_FLAG) { pm_status_flag |= BRTCH_FLAG; - _D("brightness changed in low battery," - "escape dim state (light)"); + _D("Brightness changed in low battery," + "escape dim state (light)."); } } @@ -420,7 +420,7 @@ static int set_autobrightness_state(int status) g_timeout_add_seconds(display_conf.lightsensor_interval, alc_handler, NULL); } else if (status == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) { - _I("auto brightness paused!"); + _I("Auto brightness paused."); disconnect_sensor(); } else { disconnect_sensor(); @@ -429,7 +429,7 @@ static int set_autobrightness_state(int status) ret = get_setting_brightness(&default_brt); if (ret != 0 || (default_brt < PM_MIN_BRIGHTNESS || default_brt > PM_MAX_BRIGHTNESS)) { - _I("fail to read vconf value for brightness"); + _I("Failed 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); @@ -448,7 +448,7 @@ static void set_alc_function(keynode_t *key_nodes, void *data) int status, ret; if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } @@ -459,21 +459,21 @@ static void set_alc_function(keynode_t *key_nodes, void *data) case SETTING_BRIGHTNESS_AUTOMATIC_ON: case SETTING_BRIGHTNESS_AUTOMATIC_PAUSE: ret = set_autobrightness_state(status); - _D("set auto brightness : %d", ret); + _D("Set auto brightness: %d", ret); break; default: - _E("invalid value! %d", status); + _E("Invalid value(%d)", status); } } static void set_alc_automatic_brt(keynode_t *key_nodes, void *data) { if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } automatic_brt = vconf_keynode_get_int(key_nodes) / AUTOMATIC_DEVIDE_VAL; - _D("automatic brt : %d", automatic_brt); + _D("Automatic brt(%d)", automatic_brt); alc_update_brt(true); } @@ -491,7 +491,7 @@ static gboolean update_handler(void *data) if (ret < 0 || on != SETTING_BRIGHTNESS_AUTOMATIC_ON) return G_SOURCE_REMOVE; - _D("auto brightness is working!"); + _D("Auto brightness is working."); alc_update_brt(true); return G_SOURCE_REMOVE; @@ -526,10 +526,10 @@ static int prepare_lsensor(void *data) vconf_get_int(VCONFKEY_SETAPPL_LCD_AUTOMATIC_BRIGHTNESS, &brt); if (brt < PM_MIN_BRIGHTNESS || brt > PM_MAX_BRIGHTNESS) { - _E("Failed to get automatic brightness!"); + _E("Failed to get automatic brightness."); } else { automatic_brt = brt / AUTOMATIC_DEVIDE_VAL; - _I("automatic brt init success %d", automatic_brt); + _I("Automatic brt(%d) init success.", automatic_brt); } vconf_notify_key_changed(VCONFKEY_SETAPPL_LCD_AUTOMATIC_BRIGHTNESS, @@ -565,7 +565,7 @@ static int set_autobrightness_min(int val, char *name) update_brightness_direct(); - _I("auto brightness min value changed! (%d, %s)", + _I("Auto brightness min value changed. min_brightness=%d min_brightness_name=%s", min_brightness, min_brightness_name); return 0; @@ -585,7 +585,7 @@ static void reset_autobrightness_min(GDBusConnection *conn, if (strcmp(sender, min_brightness_name)) return; - _I("change to default %d -> %d, %s", min_brightness, + _I("Change to default min brightness. before=%d changed=%d brightness_name=%s", min_brightness, PM_MIN_BRIGHTNESS, min_brightness_name); min_brightness = PM_MIN_BRIGHTNESS; if (min_brightness_name) { diff --git a/plugins/tv/display/ambient-mode.c b/plugins/tv/display/ambient-mode.c old mode 100644 new mode 100755 index 7afecc2..72ce1a2 --- a/plugins/tv/display/ambient-mode.c +++ b/plugins/tv/display/ambient-mode.c @@ -64,12 +64,12 @@ static void ambient_set_condition(keynode_t *key_nodes, void *data) int state; if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } ambient_condition = vconf_keynode_get_bool(key_nodes); - _I("ambient mode condition is %d", ambient_condition); + _I("Ambient mode condition is %d.", ambient_condition); state = (ambient_condition == 0 ? 0 : 1); device_notify(DEVICE_NOTIFIER_DISPLAY_AMBIENT_CONDITION, (void *)&state); @@ -89,7 +89,7 @@ int ambient_set_state(int on) if (!on) ambient_pid = 0; - _D("AMBIENT is %s", (on ? ON : OFF)); + _D("AMBIENT is %s.", (on ? ON : OFF)); ambient_state = on; @@ -115,7 +115,7 @@ void ambient_check_invalid_state(pid_t pid) if (ambient_get_state() == false) return; - _E("Invalid state! Ambient state is change to off!"); + _E("Invalid state. Ambient state is change to off."); /* If lcd_power is on and ambient state is true * when pm state is changed to sleep, @@ -156,7 +156,7 @@ static void end_clock(pid_t pid) update_count = 1; ambient_pid = pid; - _I("enter real ambient state by %d", + _I("Enter real ambient state by process(%d).", ambient_pid); } @@ -180,10 +180,10 @@ static void ambient_init(void *data) ret = vconf_get_bool(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, &ambient_condition); if (ret < 0) { - _E("Failed to get ambient mode condition ! (%d)", ret); + _E("Failed to get ambient mode condition: %d", ret); ambient_condition = false; } - _I("ambient mode condition is %d", ambient_condition); + _I("Ambient mode condition is %d.", ambient_condition); vconf_notify_key_changed(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, ambient_set_condition, NULL); diff --git a/plugins/tv/display/auto-brightness.c b/plugins/tv/display/auto-brightness.c old mode 100644 new mode 100755 index 0a36de1..0faa106 --- a/plugins/tv/display/auto-brightness.c +++ b/plugins/tv/display/auto-brightness.c @@ -85,7 +85,7 @@ static bool update_working_position(void) ret = sensor_listener_read_data(accel_listener, &data); if (ret != SENSOR_ERROR_NONE) { - _E("Fail to get accelerometer data! %d", ret); + _E("Failed to get accelerometer data: %d", ret); return true; } @@ -96,7 +96,7 @@ static bool update_working_position(void) realg = (float)sqrt((x * x) + (y * y) + (z * z)); pitch = ROTATION_90 - abs((int) (asin(z / realg) * RADIAN_VALUE)); - _D("accel data [%f, %f, %f] - %f", x, y, z, pitch); + _D("Accel data x=%f y=%f z=%f pitch=%f", x, y, z, pitch); if (pitch >= WORKING_ANGLE_MIN && pitch <= WORKING_ANGLE_MAX) return true; @@ -110,7 +110,7 @@ static void alc_set_brightness(int setting, int value, float light) ret = backlight_ops.get_brightness(&tmp_value); if (ret < 0) { - _E("Fail to get display brightness!"); + _E("Failed to get display brightness."); return; } @@ -123,7 +123,7 @@ static void alc_set_brightness(int setting, int value, float light) position = update_working_position(); if (!position && (old > light)) { _D("It's not working position, " - "LCD isn't getting dark!"); + "LCD isn't getting dark."); return; } } @@ -148,8 +148,8 @@ static void alc_set_brightness(int setting, int value, float light) backlight_ops.set_default_brt(tmp_value); backlight_ops.update(); } - _I("load light data:%f ,auto brt %d,min brightness %d," - "brightness %d", light, automatic_brt, min_brightness, value); + _I("Load light data(%f). auto brt=%d min brightness=%d " + "brightness=%d", light, automatic_brt, min_brightness, value); old = light; } } @@ -180,13 +180,13 @@ static bool alc_update_brt(bool setting) ret = sensor_listener_read_data(light_listener, &light_data); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to read light sensor data(%d)", ret); + _E("Failed to read light sensor data: %d", ret); goto out; } index = light_data.value_count - 1; if (index < 0 || light_data.values[index] < 0) { - _E("Invalid light sensor data"); + _E("Invalid light sensor data."); goto out; } @@ -194,12 +194,12 @@ static bool alc_update_brt(bool setting) ret = backlight_ops.get_brightness_by_light_sensor( lmax, lmin, light, &value); if (ret == -ENOTSUP) { - _E("Not supported to handle the light data"); + _E("Not supported to handle the light data."); goto out; } if (ret < 0 || value < PM_MIN_BRIGHTNESS || value > PM_MAX_BRIGHTNESS) { - _E("fail to load light data : light(%f), value(%d), ret(%d)", light, value, ret); + _E("Failed to load light data. light=%f value=%d: %d", light, value, ret); goto out; } @@ -224,7 +224,7 @@ out: } vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_OFF); - _E("Fault counts is over %d, disable automatic brightness", MAX_FAULT); + _E("Fault counts is over %d, disable automatic brightness.", MAX_FAULT); return false; } return true; @@ -273,11 +273,11 @@ static int connect_sensor(void) sensor_h *list = NULL; int cnt = 0; - _I("connect with sensor fw"); + _I("Connect with sensor fw."); /* light sensor */ ret = sensor_get_sensor_list(SENSOR_LIGHT, &list, &cnt); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor list(%d)", ret); + _E("Failed to get light sensor list: %d", ret); goto error; } @@ -293,25 +293,25 @@ static int connect_sensor(void) ret = sensor_get_min_range(sensor, &lmin); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor min range (%d)", ret); + _E("Failed to get light sensor min range: %d", ret); goto error; } ret = sensor_get_max_range(sensor, &lmax); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor max range (%d)", ret); + _E("Failed to get light sensor max range: %d", ret); goto error; } - _I("Light sensor min(%f), max(%f)", lmin, lmax); + _I("Light sensor min=%f max=%f", lmin, lmax); ret = sensor_create_listener(sensor, &light_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to create listener(light)!"); + _E("Failed to create listener(light)."); goto error; } sensor_listener_set_option(light_listener, SENSOR_OPTION_ALWAYS_ON); ret = sensor_listener_start(light_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to start light sensor!"); + _E("Failed to start light sensor."); sensor_destroy_listener(light_listener); light_listener = 0; goto error; @@ -323,18 +323,18 @@ static int connect_sensor(void) /* accelerometer sensor */ ret = sensor_get_default_sensor(SENSOR_ACCELEROMETER, &sensor); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get default accel sensor!"); + _E("Failed to get default accel sensor."); goto error; } ret = sensor_create_listener(&sensor, &accel_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to create listener(accel)!"); + _E("Failed to create listener(accel)."); goto error; } sensor_listener_set_option(accel_listener, SENSOR_OPTION_ALWAYS_ON); ret = sensor_listener_start(accel_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to start accel sensor!"); + _E("Failed to start accel sensor."); sensor_destroy_listener(accel_listener); accel_listener = 0; goto error; @@ -360,7 +360,7 @@ error: static int disconnect_sensor(void) { - _I("disconnect with sensor fw"); + _I("Disconnect with sensor fw."); /* light sensor*/ if (light_listener > 0) { sensor_listener_stop(light_listener); @@ -391,8 +391,8 @@ void set_brightness_changed_state(void) { if (pm_status_flag & PWRSV_FLAG) { pm_status_flag |= BRTCH_FLAG; - _D("brightness changed in low battery," - "escape dim state (light)"); + _D("Brightness changed in low battery," + "escape dim state (light)."); } } @@ -420,7 +420,7 @@ static int set_autobrightness_state(int status) g_timeout_add_seconds(display_conf.lightsensor_interval, alc_handler, NULL); } else if (status == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) { - _I("auto brightness paused!"); + _I("Auto brightness paused."); disconnect_sensor(); } else { disconnect_sensor(); @@ -429,7 +429,7 @@ static int set_autobrightness_state(int status) ret = get_setting_brightness(&default_brt); if (ret != 0 || (default_brt < PM_MIN_BRIGHTNESS || default_brt > PM_MAX_BRIGHTNESS)) { - _I("fail to read vconf value for brightness"); + _I("Failed 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); @@ -448,7 +448,7 @@ static void set_alc_function(keynode_t *key_nodes, void *data) int status, ret; if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } @@ -459,21 +459,21 @@ static void set_alc_function(keynode_t *key_nodes, void *data) case SETTING_BRIGHTNESS_AUTOMATIC_ON: case SETTING_BRIGHTNESS_AUTOMATIC_PAUSE: ret = set_autobrightness_state(status); - _D("set auto brightness : %d", ret); + _D("Set auto brightness: %d", ret); break; default: - _E("invalid value! %d", status); + _E("Invalid value(%d)", status); } } static void set_alc_automatic_brt(keynode_t *key_nodes, void *data) { if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } automatic_brt = vconf_keynode_get_int(key_nodes) / AUTOMATIC_DEVIDE_VAL; - _D("automatic brt : %d", automatic_brt); + _D("Automatic brt(%d)", automatic_brt); alc_update_brt(true); } @@ -491,7 +491,7 @@ static gboolean update_handler(void *data) if (ret < 0 || on != SETTING_BRIGHTNESS_AUTOMATIC_ON) return G_SOURCE_REMOVE; - _D("auto brightness is working!"); + _D("Auto brightness is working."); alc_update_brt(true); return G_SOURCE_REMOVE; @@ -526,10 +526,10 @@ static int prepare_lsensor(void *data) vconf_get_int(VCONFKEY_SETAPPL_LCD_AUTOMATIC_BRIGHTNESS, &brt); if (brt < PM_MIN_BRIGHTNESS || brt > PM_MAX_BRIGHTNESS) { - _E("Failed to get automatic brightness!"); + _E("Failed to get automatic brightness."); } else { automatic_brt = brt / AUTOMATIC_DEVIDE_VAL; - _I("automatic brt init success %d", automatic_brt); + _I("Automatic brt(%d) init success." , automatic_brt); } vconf_notify_key_changed(VCONFKEY_SETAPPL_LCD_AUTOMATIC_BRIGHTNESS, @@ -565,7 +565,7 @@ static int set_autobrightness_min(int val, char *name) update_brightness_direct(); - _I("auto brightness min value changed! (%d, %s)", + _I("Auto brightness min value changed. min_brightness=%d min_brightness_name=%s", min_brightness, min_brightness_name); return 0; @@ -585,7 +585,7 @@ static void reset_autobrightness_min(GDBusConnection *conn, if (strcmp(sender, min_brightness_name)) return; - _I("change to default %d -> %d, %s", min_brightness, + _I("Change to default min brightness. before=%d changed=%d brightness_name=%s", min_brightness, PM_MIN_BRIGHTNESS, min_brightness_name); min_brightness = PM_MIN_BRIGHTNESS; if (min_brightness_name) { diff --git a/plugins/wearable/display/ambient-mode.c b/plugins/wearable/display/ambient-mode.c old mode 100644 new mode 100755 index 7afecc2..72ce1a2 --- a/plugins/wearable/display/ambient-mode.c +++ b/plugins/wearable/display/ambient-mode.c @@ -64,12 +64,12 @@ static void ambient_set_condition(keynode_t *key_nodes, void *data) int state; if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } ambient_condition = vconf_keynode_get_bool(key_nodes); - _I("ambient mode condition is %d", ambient_condition); + _I("Ambient mode condition is %d.", ambient_condition); state = (ambient_condition == 0 ? 0 : 1); device_notify(DEVICE_NOTIFIER_DISPLAY_AMBIENT_CONDITION, (void *)&state); @@ -89,7 +89,7 @@ int ambient_set_state(int on) if (!on) ambient_pid = 0; - _D("AMBIENT is %s", (on ? ON : OFF)); + _D("AMBIENT is %s.", (on ? ON : OFF)); ambient_state = on; @@ -115,7 +115,7 @@ void ambient_check_invalid_state(pid_t pid) if (ambient_get_state() == false) return; - _E("Invalid state! Ambient state is change to off!"); + _E("Invalid state. Ambient state is change to off."); /* If lcd_power is on and ambient state is true * when pm state is changed to sleep, @@ -156,7 +156,7 @@ static void end_clock(pid_t pid) update_count = 1; ambient_pid = pid; - _I("enter real ambient state by %d", + _I("Enter real ambient state by process(%d).", ambient_pid); } @@ -180,10 +180,10 @@ static void ambient_init(void *data) ret = vconf_get_bool(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, &ambient_condition); if (ret < 0) { - _E("Failed to get ambient mode condition ! (%d)", ret); + _E("Failed to get ambient mode condition: %d", ret); ambient_condition = false; } - _I("ambient mode condition is %d", ambient_condition); + _I("Ambient mode condition is %d.", ambient_condition); vconf_notify_key_changed(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, ambient_set_condition, NULL); diff --git a/plugins/wearable/display/auto-brightness.c b/plugins/wearable/display/auto-brightness.c old mode 100644 new mode 100755 index 0a36de1..70a555e --- a/plugins/wearable/display/auto-brightness.c +++ b/plugins/wearable/display/auto-brightness.c @@ -85,7 +85,7 @@ static bool update_working_position(void) ret = sensor_listener_read_data(accel_listener, &data); if (ret != SENSOR_ERROR_NONE) { - _E("Fail to get accelerometer data! %d", ret); + _E("Failed to get accelerometer data: %d", ret); return true; } @@ -96,7 +96,7 @@ static bool update_working_position(void) realg = (float)sqrt((x * x) + (y * y) + (z * z)); pitch = ROTATION_90 - abs((int) (asin(z / realg) * RADIAN_VALUE)); - _D("accel data [%f, %f, %f] - %f", x, y, z, pitch); + _D("Accel data x=%f y=%f z=%f pitch=%f", x, y, z, pitch); if (pitch >= WORKING_ANGLE_MIN && pitch <= WORKING_ANGLE_MAX) return true; @@ -110,7 +110,7 @@ static void alc_set_brightness(int setting, int value, float light) ret = backlight_ops.get_brightness(&tmp_value); if (ret < 0) { - _E("Fail to get display brightness!"); + _E("Failed to get display brightness."); return; } @@ -123,7 +123,7 @@ static void alc_set_brightness(int setting, int value, float light) position = update_working_position(); if (!position && (old > light)) { _D("It's not working position, " - "LCD isn't getting dark!"); + "LCD isn't getting dark."); return; } } @@ -148,8 +148,8 @@ static void alc_set_brightness(int setting, int value, float light) backlight_ops.set_default_brt(tmp_value); backlight_ops.update(); } - _I("load light data:%f ,auto brt %d,min brightness %d," - "brightness %d", light, automatic_brt, min_brightness, value); + _I("Load light data(%f). auto brt=%d min brightness=%d " + "brightness=%d", light, automatic_brt, min_brightness, value); old = light; } } @@ -180,13 +180,13 @@ static bool alc_update_brt(bool setting) ret = sensor_listener_read_data(light_listener, &light_data); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to read light sensor data(%d)", ret); + _E("Failed to read light sensor data: %d", ret); goto out; } index = light_data.value_count - 1; if (index < 0 || light_data.values[index] < 0) { - _E("Invalid light sensor data"); + _E("Invalid light sensor data."); goto out; } @@ -194,12 +194,12 @@ static bool alc_update_brt(bool setting) ret = backlight_ops.get_brightness_by_light_sensor( lmax, lmin, light, &value); if (ret == -ENOTSUP) { - _E("Not supported to handle the light data"); + _E("Not supported to handle the light data."); goto out; } if (ret < 0 || value < PM_MIN_BRIGHTNESS || value > PM_MAX_BRIGHTNESS) { - _E("fail to load light data : light(%f), value(%d), ret(%d)", light, value, ret); + _E("Failed to load light data. light=%f value=%d: %d", light, value, ret); goto out; } @@ -224,7 +224,7 @@ out: } vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_OFF); - _E("Fault counts is over %d, disable automatic brightness", MAX_FAULT); + _E("Fault counts is over %d, disable automatic brightness.", MAX_FAULT); return false; } return true; @@ -273,11 +273,11 @@ static int connect_sensor(void) sensor_h *list = NULL; int cnt = 0; - _I("connect with sensor fw"); + _I("Connect with sensor fw."); /* light sensor */ ret = sensor_get_sensor_list(SENSOR_LIGHT, &list, &cnt); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor list(%d)", ret); + _E("Failed to get light sensor list: %d", ret); goto error; } @@ -293,25 +293,25 @@ static int connect_sensor(void) ret = sensor_get_min_range(sensor, &lmin); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor min range (%d)", ret); + _E("Failed to get light sensor min range: %d", ret); goto error; } ret = sensor_get_max_range(sensor, &lmax); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get light sensor max range (%d)", ret); + _E("Failed to get light sensor max range: %d", ret); goto error; } _I("Light sensor min(%f), max(%f)", lmin, lmax); ret = sensor_create_listener(sensor, &light_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to create listener(light)!"); + _E("Failed to create listener(light)."); goto error; } sensor_listener_set_option(light_listener, SENSOR_OPTION_ALWAYS_ON); ret = sensor_listener_start(light_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to start light sensor!"); + _E("Failed to start light sensor."); sensor_destroy_listener(light_listener); light_listener = 0; goto error; @@ -323,18 +323,18 @@ static int connect_sensor(void) /* accelerometer sensor */ ret = sensor_get_default_sensor(SENSOR_ACCELEROMETER, &sensor); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to get default accel sensor!"); + _E("Failed to get default accel sensor."); goto error; } ret = sensor_create_listener(&sensor, &accel_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to create listener(accel)!"); + _E("Failed to create listener(accel)."); goto error; } sensor_listener_set_option(accel_listener, SENSOR_OPTION_ALWAYS_ON); ret = sensor_listener_start(accel_listener); if (ret != SENSOR_ERROR_NONE) { - _E("Failed to start accel sensor!"); + _E("Failed to start accel sensor."); sensor_destroy_listener(accel_listener); accel_listener = 0; goto error; @@ -360,7 +360,7 @@ error: static int disconnect_sensor(void) { - _I("disconnect with sensor fw"); + _I("Disconnect with sensor fw."); /* light sensor*/ if (light_listener > 0) { sensor_listener_stop(light_listener); @@ -391,8 +391,8 @@ void set_brightness_changed_state(void) { if (pm_status_flag & PWRSV_FLAG) { pm_status_flag |= BRTCH_FLAG; - _D("brightness changed in low battery," - "escape dim state (light)"); + _D("Brightness changed in low battery," + "escape dim state (light)."); } } @@ -420,7 +420,7 @@ static int set_autobrightness_state(int status) g_timeout_add_seconds(display_conf.lightsensor_interval, alc_handler, NULL); } else if (status == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) { - _I("auto brightness paused!"); + _I("Auto brightness paused."); disconnect_sensor(); } else { disconnect_sensor(); @@ -429,7 +429,7 @@ static int set_autobrightness_state(int status) ret = get_setting_brightness(&default_brt); if (ret != 0 || (default_brt < PM_MIN_BRIGHTNESS || default_brt > PM_MAX_BRIGHTNESS)) { - _I("fail to read vconf value for brightness"); + _I("Failed 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); @@ -448,7 +448,7 @@ static void set_alc_function(keynode_t *key_nodes, void *data) int status, ret; if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } @@ -459,21 +459,21 @@ static void set_alc_function(keynode_t *key_nodes, void *data) case SETTING_BRIGHTNESS_AUTOMATIC_ON: case SETTING_BRIGHTNESS_AUTOMATIC_PAUSE: ret = set_autobrightness_state(status); - _D("set auto brightness : %d", ret); + _D("Set auto brightness: %d", ret); break; default: - _E("invalid value! %d", status); + _E("Invalid value(%d)", status); } } static void set_alc_automatic_brt(keynode_t *key_nodes, void *data) { if (key_nodes == NULL) { - _E("wrong parameter, key_nodes is null"); + _E("Wrong parameter, key_nodes is null."); return; } automatic_brt = vconf_keynode_get_int(key_nodes) / AUTOMATIC_DEVIDE_VAL; - _D("automatic brt : %d", automatic_brt); + _D("Automatic brt(%d)", automatic_brt); alc_update_brt(true); } @@ -491,7 +491,7 @@ static gboolean update_handler(void *data) if (ret < 0 || on != SETTING_BRIGHTNESS_AUTOMATIC_ON) return G_SOURCE_REMOVE; - _D("auto brightness is working!"); + _D("Auto brightness is working."); alc_update_brt(true); return G_SOURCE_REMOVE; @@ -526,10 +526,10 @@ static int prepare_lsensor(void *data) vconf_get_int(VCONFKEY_SETAPPL_LCD_AUTOMATIC_BRIGHTNESS, &brt); if (brt < PM_MIN_BRIGHTNESS || brt > PM_MAX_BRIGHTNESS) { - _E("Failed to get automatic brightness!"); + _E("Failed to get automatic brightness."); } else { automatic_brt = brt / AUTOMATIC_DEVIDE_VAL; - _I("automatic brt init success %d", automatic_brt); + _I("Automatic brt(%d) init success.", automatic_brt); } vconf_notify_key_changed(VCONFKEY_SETAPPL_LCD_AUTOMATIC_BRIGHTNESS, @@ -565,7 +565,7 @@ static int set_autobrightness_min(int val, char *name) update_brightness_direct(); - _I("auto brightness min value changed! (%d, %s)", + _I("Auto brightness min value changed. min_brightness=%d min_brightness_name=%s", min_brightness, min_brightness_name); return 0; @@ -585,7 +585,7 @@ static void reset_autobrightness_min(GDBusConnection *conn, if (strcmp(sender, min_brightness_name)) return; - _I("change to default %d -> %d, %s", min_brightness, + _I("Change to default min brightness. before=%d changed=%d brightness_name=%s", min_brightness, PM_MIN_BRIGHTNESS, min_brightness_name); min_brightness = PM_MIN_BRIGHTNESS; if (min_brightness_name) { diff --git a/src/apps/apps.c b/src/apps/apps.c old mode 100644 new mode 100755 index cd4a654..6b8656f --- a/src/apps/apps.c +++ b/src/apps/apps.c @@ -42,16 +42,16 @@ static void __cb(GVariant *var, void *user_data, GError *err) int ret; if (!var) { - _E("no message [%s]", err->message); + _E("No message: %s", err->message); return; } if (!dh_get_param_from_var(var, "(i)", &ret)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("No message: %s", g_variant_get_type_string(var)); goto out; } - _D("reply value : %d", ret); + _D("Reply value: %d", ret); out: g_variant_unref(var); @@ -77,7 +77,7 @@ int launch_system_app(char *type, int num, ...) break; } if (match < 0) { - _E("Failed to find app matched (%s)", app_type); + _E("Failed to find matched app type(%s).", app_type); return -EINVAL; } diff --git a/src/auto-test/battery.c b/src/auto-test/battery.c old mode 100644 new mode 100755 index c01ee52..f9b9920 --- a/src/auto-test/battery.c +++ b/src/auto-test/battery.c @@ -131,14 +131,14 @@ static bool get_battery_method(const char *method, int *value) DEVICED_INTERFACE_BATTERY, method, NULL); if (!msg) { - _E("fail (%s): no reply", method); + _E("Failed to call dbus method(%s): No reply.", method); return ret; } if (!dh_get_param_from_var(msg, "(i)", &val)) { - _E("fail (%s): no message", method); + _E("Failed to call dbus method(%s): No message.", method); } else { - _I("success (%s): %d", method, val); + _I("Success. %s=%d", method, val); ret = TRUE; if (NULL != value) *value = val; @@ -159,17 +159,17 @@ static bool get_battery_method_vconf(const char *method) DEVICED_INTERFACE_BATTERY, method, NULL); if (!msg) { - _E("fail (%s): no reply", method); + _E("Failed to call dbus method(%s): No reply.", method); return ret; } if (!dh_get_param_from_var(msg, "(i)", &val)) - _E("fail (%s): no message", method); + _E("Failed to call dbus method(%s): No message.", method); else { if (val == -EIO) { - _E("fail (%s): return fail", method); + _E("Failed to call dbus method(%s): Return fail.", method); } else { - _I("success (%s): %d", method, val); + _I("Success. %s=%d", method, val); ret = TRUE; } } @@ -206,38 +206,38 @@ static bool set_battery_low_level(int newlevel) METHOD_BATTERY_SETLOWBATLEVEL, g_variant_new("(i)", newlevel)); if (!msg) { - _E("fail : no reply"); + _E("Failed to call dbus method(%s): No reply", METHOD_BATTERY_SETLOWBATLEVEL); return ret; } if (!dh_get_param_from_var(msg, "(i)", &val)) { - _E("fail : no message"); + _E("Failed to call dbus method(%s): No message", METHOD_BATTERY_SETLOWBATLEVEL); goto out; } else { if (newlevel <= DEFAULT_LOWBATLEVEL) { if (0 != val) { - _I("success : can't set low level (%d) smaller than default (%d)", newlevel, DEFAULT_LOWBATLEVEL); + _I("Success. Can't set low level(%d) smaller than default(%d).", newlevel, DEFAULT_LOWBATLEVEL); ret = TRUE; } else { - _E("fail : can't set low level (%d) smaller than default (%d), but returned success", newlevel, DEFAULT_LOWBATLEVEL); + _E("Failed. Can't set low level(%d) smaller than default(%d), but returned success.", newlevel, DEFAULT_LOWBATLEVEL); } goto out; } else { if (0 != val) { - _E("fail : return fail"); + _E("Failed to call dbus method(%s): Return fail.", METHOD_BATTERY_SETLOWBATLEVEL); goto out; } } } if (!get_battery_low_level(&getlevel)) { - _E("fail : can't get battery low level"); + _E("Failed to get battery low level."); } else { if (getlevel == newlevel) { - _I("success : %d", newlevel); + _I("Success : battery low level=%d", newlevel); ret = TRUE; } else { - _E("fail : set low level %d, but current low level %d", newlevel, getlevel); + _E("Failed to set low level(%d). Current low level is %d.", newlevel, getlevel); } } out: @@ -292,7 +292,7 @@ static bool get_battery_info() DEVICED_INTERFACE_BATTERY, METHOD_BATTERY_GETINFO, NULL); if (!msg) { - _E("fail: no reply"); + _E("Failed to call dbus method(%s): No reply", METHOD_BATTERY_GETINFO); return ret; } @@ -308,12 +308,12 @@ static bool get_battery_info() &val[6], //voltage_now &val[7], //voltage_average &val[8])) //temperature - _E("fail: no message"); + _E("Failed to call dbus method(%s): No message", METHOD_BATTERY_GETINFO); else { if (val[0] < 0) { - _E("fail: return fail"); + _E("Failed to call dbus method(%s): Return fail", METHOD_BATTERY_GETINFO); } else { - _I("success: %s %s %s %d %d %d %d %d", argv[0], argv[1], argv[2], val[1], val[2], val[3], val[4], val[5]); + _I("Success: %s %s %s %d %d %d %d %d", argv[0], argv[1], argv[2], val[1], val[2], val[3], val[4], val[5]); ret = TRUE; } g_free(argv[0]); @@ -352,18 +352,18 @@ static bool set_battery_power_supply(int index) DEVICED_INTERFACE_BATTERY, POWER_SUBSYSTEM, var); if (!msg) { - _E("fail: no reply"); + _E("Failed to call dbus method(%s): No reply", POWER_SUBSYSTEM); return ret; } if (!dh_get_param_from_var(msg, "(i)", &val)) { - _E("fail: no message"); + _E("Failed to call dbus method(%s): No message", POWER_SUBSYSTEM); val = -EBADMSG; } else { if (val < 0) { - _E("fail: return fail"); + _E("Failed to call dbus method(%s): Return fail", POWER_SUBSYSTEM); } else { - _I("success: %d", val); + _I("Success. val=%d", val); ret = TRUE; } } @@ -427,16 +427,16 @@ static void battery_init(void *data) int success = 0; int fail = 0; - _I("start test"); + _I("Start test."); battery_test_all(&success, &fail); - _I("Total: %d, Success: %d, Fail: %d", success+fail, success, fail); + _I("Total=%d Success=%d Fail=%d", success+fail, success, fail); } static void battery_exit(void *data) { - _I("end test"); + _I("End test."); } @@ -445,9 +445,9 @@ static int battery_unit(int argc, char **argv) if (argc < 4) { int success = 0; int fail = 0; - _I("start test"); + _I("Start test."); battery_test_all(&success, &fail); - _I("Total: %d, Success: %d, Fail: %d", success+fail, success, fail); + _I("Total=%d Success=%d Fail=%d", success+fail, success, fail); } else if (0 == strcasecmp(argv[3], METHOD_BATTERY_TIMETOFULL)) { get_battery_time_to_full(); } else if (0 == strcasecmp(argv[3], METHOD_BATTERY_TIMETOEMPTY)) { @@ -476,7 +476,7 @@ static int battery_unit(int argc, char **argv) for (int index = 0; index < ARRAY_SIZE(power_supply_types); index++) set_battery_power_supply(index); } else { - _E("Unknown test case!!!"); + _E("Unknown test case."); } return 0; diff --git a/src/battery/battery-time.c b/src/battery/battery-time.c old mode 100644 new mode 100755 index 4e808b6..70d84a5 --- a/src/battery/battery-time.c +++ b/src/battery/battery-time.c @@ -90,7 +90,7 @@ static int add_batt_node(enum state_b b_index, time_t clock, int capacity) node = (struct Batt_node *) malloc(sizeof(struct Batt_node)); if (node == NULL) { - _E("Not enough memory, add battery node fail!"); + _E("Failed to add battery node. Not enough memory."); return -1; } @@ -269,7 +269,7 @@ static int battinfo_calculation(void) >= BATTERY_FULL_THRESHOLD) { if (battery.charge_full == CHARGING_FULL) { del_all_batt_node(B_CHARGING); - _I("battery fully charged!"); + _I("Battery fully charged."); update_time(A_TIMETOFULL, 0); return 0; } @@ -309,10 +309,10 @@ static gboolean battinfo_cb(void *data) static int start_battinfo_gathering(int timeout) { - _I("Start battery gathering!"); + _I("Start battery gathering."); if (timeout <= 0) { - _E("invalid timeout value [%d]!", timeout); + _E("Invalid timeout value(%d).", timeout); return -1; } @@ -329,7 +329,7 @@ static int start_battinfo_gathering(int timeout) static void end_battinfo_gathering(void) { - _I("End battery gathering!"); + _I("End battery gathering."); if (timeout_id) { g_source_remove(timeout_id); @@ -348,7 +348,7 @@ GVariant * dbus_get_timetofull(GDBusConnection *conn, val = time_to_full; - _D("get time %d", val); + _D("Get time=%d", val); return g_variant_new("(i)", val); } @@ -361,7 +361,7 @@ static GVariant * dbus_get_timetoempty(GDBusConnection *conn, val = time_to_empty; - _D("get time %d", val); + _D("Get time=%d", val); return g_variant_new("(i)", val); } @@ -399,7 +399,7 @@ static void battery_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_BATTERY, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); start_battinfo_gathering(POLLING_TIME); } diff --git a/src/power/boot.c b/src/power/boot.c old mode 100644 new mode 100755 index 413a968..080c23a --- a/src/power/boot.c +++ b/src/power/boot.c @@ -45,15 +45,15 @@ int booting_finished(void) reply = systemd_get_manager_property(SYSTEMD_DBUS_METHOD_SYSTEM_STATE); if (!reply) { - _E("Failed to get System State: no reply"); + _E("Failed to get system state: No reply"); goto err; } if (!dh_get_param_from_var(reply, "s", &state)) { - _E("Failed to get System State %s", g_variant_get_type_string(reply)); + _E("Failed to get system state(%s)", g_variant_get_type_string(reply)); goto err; } - _I("System State: (%s)", state); + _I("System state=%s", state); len = strlen(state) + 1; if (!strncmp(state, SYSTEMD_STATE_RUNNING, len) || @@ -95,17 +95,17 @@ static void booting_done_received(GDBusConnection *conn, system_done = booting_finished(); if (system_done == 0) { - _E("System Session is not ready yet"); + _E("System session is not ready yet."); return; } - _I("System Session is Ready"); + _I("System session is ready."); device_notify_once(DEVICE_NOTIFIER_BOOTING_DONE, &system_done); } else if (strcmp(name, SYSTEMD_DBUS_SIGNAL_USER_STARTUP_FINISHED) == 0) { if (user_done) return; user_done = 1; - _I("User Session is Ready"); + _I("User session is ready."); } if (!system_done || !user_done) @@ -113,11 +113,11 @@ static void booting_done_received(GDBusConnection *conn, remove_booting_done_handler(NULL); - _I("real booting done, unlock LCD_OFF"); + _I("Real booting done. Unlock LCD_OFF."); if (disp_plgn.pm_unlock_internal) disp_plgn.pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN); - _I("signal booting done"); + _I("Signal booting done."); dbus_handle_broadcast_dbus_signal(DEVICED_PATH_CORE, DEVICED_INTERFACE_CORE, @@ -137,7 +137,7 @@ void add_booting_done_handler(void *data) NULL, NULL); if (sig_id[0] <= 0) - _E("fail to init dbus signal(%s)", SYSTEMD_DBUS_SIGNAL_SYSTEM_STARTUP_FINISHED); + _E("Failed to init dbus signal(%s).", SYSTEMD_DBUS_SIGNAL_SYSTEM_STARTUP_FINISHED); /* User Session is loaded completely */ sig_id[1] = subscribe_dbus_signal(NULL, @@ -148,5 +148,5 @@ void add_booting_done_handler(void *data) NULL, NULL); if (sig_id[1] <= 0) - _E("fail to init dbus signal(%s)", SYSTEMD_DBUS_SIGNAL_USER_STARTUP_FINISHED); + _E("Failed to init dbus signal(%s).", SYSTEMD_DBUS_SIGNAL_USER_STARTUP_FINISHED); } -- 2.7.4 From c74f7981b1a15cf9009cd1be9f006ee3356ada42 Mon Sep 17 00:00:00 2001 From: Yunmi Ha Date: Thu, 21 Feb 2019 17:13:50 +0900 Subject: [PATCH 10/16] Apply consistent log messages. 1. First letter to uppercase. 2. Period at the end. 3. Rearrange parameters. Change-Id: I187a357a5b7670dd62e5e1d84883e0df75b4063a Signed-off-by: Yunmi Ha --- plugins/iot/display/core.c | 227 ++++++++++++++-------------- plugins/iot/display/device-interface.c | 60 ++++---- plugins/mobile/display/core.c | 227 ++++++++++++++-------------- plugins/mobile/display/device-interface.c | 60 ++++---- plugins/tv/display/core.c | 227 ++++++++++++++-------------- plugins/tv/display/device-interface.c | 60 ++++---- plugins/wearable/display/core.c | 227 ++++++++++++++-------------- plugins/wearable/display/device-interface.c | 60 ++++---- src/battery/config.c | 4 +- src/battery/lowbat-handler.c | 82 +++++----- src/battery/power-supply.c | 88 +++++------ src/control/control.c | 28 ++-- src/core/common.c | 4 +- src/core/config-parser.c | 6 +- src/core/device-idler.c | 6 +- src/core/device-notifier.c | 18 +-- src/core/devices.c | 12 +- src/core/event-handler.c | 6 +- src/core/execute.c | 14 +- src/core/launch.c | 12 +- src/core/main.c | 10 +- src/core/sig-handler.c | 4 +- src/core/udev.c | 28 ++-- 23 files changed, 733 insertions(+), 737 deletions(-) mode change 100644 => 100755 plugins/iot/display/core.c mode change 100644 => 100755 plugins/iot/display/device-interface.c mode change 100644 => 100755 plugins/mobile/display/core.c mode change 100644 => 100755 plugins/mobile/display/device-interface.c mode change 100644 => 100755 plugins/tv/display/core.c mode change 100644 => 100755 plugins/tv/display/device-interface.c mode change 100644 => 100755 plugins/wearable/display/core.c mode change 100644 => 100755 plugins/wearable/display/device-interface.c mode change 100644 => 100755 src/battery/config.c mode change 100644 => 100755 src/battery/lowbat-handler.c mode change 100644 => 100755 src/battery/power-supply.c mode change 100644 => 100755 src/control/control.c mode change 100644 => 100755 src/core/common.c mode change 100644 => 100755 src/core/config-parser.c mode change 100644 => 100755 src/core/device-idler.c mode change 100644 => 100755 src/core/device-notifier.c mode change 100644 => 100755 src/core/devices.c mode change 100644 => 100755 src/core/event-handler.c mode change 100644 => 100755 src/core/execute.c mode change 100644 => 100755 src/core/launch.c mode change 100644 => 100755 src/core/main.c mode change 100644 => 100755 src/core/sig-handler.c mode change 100644 => 100755 src/core/udev.c diff --git a/plugins/iot/display/core.c b/plugins/iot/display/core.c old mode 100644 new mode 100755 index 4bffbb8..05505ef --- a/plugins/iot/display/core.c +++ b/plugins/iot/display/core.c @@ -234,7 +234,7 @@ static void set_process_active(bool flag, pid_t pid) RESOURCED_METHOD_ACTIVE, g_variant_new("(si)", (flag ? ACTIVE_ACT : INACTIVE_ACT), pid)); if (ret < 0) - _E("Fail to send dbus signal to resourced!!"); + _E("Failed to send dbus signal to resourced."); } bool check_lock_state(int state) @@ -252,37 +252,37 @@ bool check_lock_state(int state) void change_state_action(enum state_t state, int (*func)(int timeout)) { - _I("[%s] action is changed", states[state].name); + _I("[%s] 'action' is changed.", states[state].name); states[state].action = func; } void change_state_trans(enum state_t state, int (*func)(int evt)) { - _I("[%s] trans is changed", states[state].name); + _I("[%s] 'trans' is changed.", states[state].name); states[state].trans = func; } void change_state_check(enum state_t state, int (*func)(int curr, int next)) { - _I("[%s] check is changed", states[state].name); + _I("[%s] 'check' is changed.", states[state].name); states[state].check = func; } void change_state_name(enum state_t state, char *name) { - _I("[%s] name is changed", states[state].name); + _I("[%s] 'name' is changed.", states[state].name); states[state].name = name; } void change_trans_table(enum state_t state, enum state_t next) { - _I("[%s] timeout trans table is changed", states[state].name); + _I("[%s] 'timeout trans table' is changed.", states[state].name); trans_table[state][EVENT_TIMEOUT] = next; } void change_proc_change_state(int (*func)(unsigned int cond, pid_t pid)) { - _I("proc change state is changed"); + _I("'proc change state' is changed."); proc_change_state = func; } @@ -292,7 +292,7 @@ static void broadcast_lcd_on(enum signal_type type, enum device_flags flags) const char *signal; if (type <= SIGNAL_INVALID || type >= SIGNAL_MAX) { - _E("invalid signal type %d", type); + _E("Invalid signal type(%d).", type); return; } @@ -308,7 +308,7 @@ static void broadcast_lcd_on(enum signal_type type, enum device_flags flags) str = UNKNOWN_STR; signal = lcdon_sig_lookup[type]; - _I("lcdstep : broadcast %s %s", signal, str); + _I("lcdstep : Broadcast signal(%s:%s).", signal, str); dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, signal, @@ -321,7 +321,7 @@ static void broadcast_lcd_off(enum signal_type type, enum device_flags flags) const char *signal; if (type <= SIGNAL_INVALID || type >= SIGNAL_MAX) { - _E("invalid signal type %d", type); + _E("Invalid signal type(%d).", type); return; } @@ -336,7 +336,7 @@ static void broadcast_lcd_off(enum signal_type type, enum device_flags flags) else str = UNKNOWN_STR; - _I("lcdstep : broadcast %s", signal); + _I("lcdstep : Broadcast signal(%s).", signal); dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, signal, @@ -471,7 +471,7 @@ inline void lcd_off_procedure(enum device_flags flag) void set_stay_touchscreen_off(int val) { - _D("stay touch screen off : %d", val); + _D("stay touch screen off: %d", val); stay_touchscreen_off = val; lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); @@ -480,7 +480,7 @@ void set_stay_touchscreen_off(int val) void set_lcd_paneloff_mode(int val) { - _D("lcd paneloff mode : %d", val); + _D("lcd paneloff mode: %d", val); lcd_paneloff_mode = val; lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); @@ -546,7 +546,7 @@ static PmLockNode *add_node(enum state_t s_index, pid_t pid, guint timeout_id, n = (PmLockNode *) malloc(sizeof(PmLockNode)); if (n == NULL) { - _E("Not enough memory, add cond. fail"); + _E("Failed to add cond. Not enough memory."); return NULL; } @@ -596,9 +596,9 @@ static void print_node(int next) ctime_r(&n->time, buf); if (diff > LOCK_TIME_WARNING) - _W("over %.0f s, pid: %5d, lock time: %s", diff, n->pid, buf); + _W("over=%.0f s pid=%5d locktime=%s", diff, n->pid, buf); else - _I("pid: %5d, lock time: %s", n->pid, buf); + _I("pid=%5d locktime=%s", n->pid, buf); } } @@ -615,7 +615,7 @@ void get_pname(pid_t pid, char *pname) cmdline = open(buf, O_RDONLY); if (cmdline < 0) { pname[0] = '\0'; - _E("%d does not exist now(may be dead without unlock)", pid); + _E("Process(%d) does not exist now(may be dead without unlock).", pid); return; } @@ -639,7 +639,7 @@ static void del_state_cond(void *data, enum state_t state) /* A passed data is a pid_t type data, not a 64bit data. */ pid = (pid_t)((intptr_t)data); - _I("delete prohibit dim condition by timeout (%d)", pid); + _I("Delete process(%d)'s prohibit dim condition by timeout.", pid); tmp = find_node(state, pid); del_node(state, tmp); @@ -676,7 +676,7 @@ gboolean timeout_handler(void *data) { int run_timeout; - _I("Time out state %s\n", states[pm_cur_state].name); + _I("Time out state %s.\n", states[pm_cur_state].name); /* default setting */ get_run_timeout(&run_timeout); @@ -684,7 +684,7 @@ gboolean timeout_handler(void *data) * if the run_timeout is zero, it regards AlwaysOn state */ if (pm_cur_state == S_NORMAL && (run_timeout == 0 || display_conf.lcd_always_on)) { - _D("run_timeout is always on"); + _D("'run_timeout' is always on."); return G_SOURCE_CONTINUE; } @@ -702,7 +702,7 @@ void reset_timeout(int timeout) if (!display_conf.timeout_enable) return; - _I("Reset Timeout (%d)ms", timeout); + _I("Reset timeout(%d ms)", timeout); if (timeout_src_id != 0) { g_source_remove(timeout_src_id); timeout_src_id = 0; @@ -743,7 +743,7 @@ static int get_lcd_timeout_from_settings(void) if (val > 0) states[i].timeout = val; - _I("%s state : %d ms timeout", states[i].name, + _I("state=%s timeout=%d ms", states[i].name, states[i].timeout); } @@ -757,7 +757,7 @@ static void update_display_time(void) /* first priority : s cover */ if (!hallic_open) { states[S_NORMAL].timeout = S_COVER_TIMEOUT; - _I("S cover closed : timeout is set by normal(%d ms)", + _I("S cover closed: Timeout(%d ms) is set by normal.", S_COVER_TIMEOUT); return; } @@ -766,7 +766,7 @@ static void update_display_time(void) if (custom_normal_timeout > 0) { states[S_NORMAL].timeout = custom_normal_timeout; states[S_LCDDIM].timeout = custom_dim_timeout; - _I("CUSTOM : timeout is set by normal(%d ms), dim(%d ms)", + _I("CUSTOM: Timeout(%d ms) and dim(%d ms) are set by normal.", custom_normal_timeout, custom_dim_timeout); return; } @@ -776,7 +776,7 @@ static void update_display_time(void) !get_lock_screen_bg_state()) { /* timeout is different according to key or event. */ states[S_NORMAL].timeout = lock_screen_timeout; - _I("LOCK : timeout is set by normal(%d ms)", + _I("LOCK: Timeout(%d ms) is set by normal.", lock_screen_timeout); return; } @@ -789,7 +789,7 @@ static void update_display_time(void) */ if (run_timeout == 0 || display_conf.lcd_always_on) { run_timeout = ALWAYS_ON_TIMEOUT; - _I("LCD Always On"); + _I("LCD always on."); } states[S_NORMAL].timeout = run_timeout; @@ -797,8 +797,7 @@ static void update_display_time(void) get_dim_timeout(&val); states[S_LCDDIM].timeout = val; - _I("Normal: NORMAL timeout is set by %d ms", states[S_NORMAL].timeout); - _I("Normal: DIM timeout is set by %d ms", states[S_LCDDIM].timeout); + _I("Normal: timeout(%d ms) and dim(%d ms) are set.", states[S_NORMAL].timeout, states[S_LCDDIM].timeout); } static void update_display_locktime(int time) @@ -810,7 +809,7 @@ static void update_display_locktime(int time) void set_dim_state(bool on) { - _I("dim state is %d", on); + _I("Dim state is %d.", on); update_display_time(); states[pm_cur_state].trans(EVENT_INPUT); } @@ -825,7 +824,7 @@ void lcd_on_direct(enum device_flags flags) power_ops.power_lock(); #ifdef MICRO_DD - _D("lcd is on directly"); + _D("Lcd is on directly."); gettimeofday(&lcdon_tv, NULL); lcd_on_procedure(LCD_NORMAL, flags); reset_timeout(DD_LCDOFF_INPUT_TIMEOUT); @@ -833,7 +832,7 @@ void lcd_on_direct(enum device_flags flags) ret = vconf_get_int(VCONFKEY_CALL_STATE, &call_state); if ((ret >= 0 && call_state != VCONFKEY_CALL_OFF) || (__get_lock_screen_state() == VCONFKEY_IDLE_LOCK)) { - _D("LOCK state, lcd is on directly"); + _D("LOCK state, lcd is on directly."); lcd_on_procedure(LCD_NORMAL, flags); } reset_timeout(display_conf.lcdoff_timeout); @@ -859,7 +858,7 @@ int custom_lcdon(int timeout) if (check_lcd_is_on() == false) lcd_on_direct(LCD_ON_BY_GESTURE); - _I("custom lcd on %d ms", timeout); + _I("Custom lcd on timeout(%d ms).", timeout); if (set_custom_lcdon_timeout(timeout) == true) update_display_time(); @@ -897,7 +896,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) enum state_t next; next = GET_COND_STATE(cond); - _I("Change State to %s (%d)", states[next].name, pid); + _I("Change process(%d) state to %s.", pid, states[next].name); switch (next) { case S_NORMAL: @@ -976,7 +975,7 @@ static void proc_condition_lock(PMMsg *data) states[state].timeout_cb, (void*)((intptr_t)pid)); if (!cond_timeout_id) - _E("Failed to register display timer"); + _E("Failed to register display timer."); } holdkey_block = GET_COND_FLAG(data->cond) & PM_FLAG_BLOCK_HOLDKEY; @@ -993,7 +992,7 @@ static void proc_condition_lock(PMMsg *data) set_process_active(TRUE, pid); /* for debug */ - _SD("[%s] locked by pid %d - process %s holdkeyblock %d\n", + _SD("[%s] Locked by pid=%d process=%s holdkeyblock=%d\n", states[state].name, pid, pname, holdkey_block); set_lock_time(pname, state); @@ -1022,7 +1021,7 @@ static void proc_condition_unlock(PMMsg *data) if (ambient_get_state()) ambient_check_invalid_state(pid); - _SD("[%s] unlocked by pid %d - process %s\n", + _SD("[%s] Unlocked by pid=%d process=%s\n", states[state].name, pid, pname); set_unlock_time(pname, state); @@ -1047,12 +1046,12 @@ static int proc_condition(PMMsg *data) /* guard time for suspend */ if (pm_cur_state == S_LCDOFF) { reset_timeout(states[S_LCDOFF].timeout); - _I("Margin timeout (%d ms)", states[S_LCDOFF].timeout); + _I("Margin timeout(%d ms)", states[S_LCDOFF].timeout); } } else { if (flags & PM_FLAG_RESET_TIMER) { reset_timeout(states[pm_cur_state].timeout); - _I("Reset timeout (%d ms)", states[pm_cur_state].timeout); + _I("Reset timeout(%d ms)", states[pm_cur_state].timeout); } } @@ -1071,8 +1070,8 @@ int check_processes(enum state_t prohibit_state) DD_LIST_FOREACH_SAFE(cond_head[prohibit_state], elem, next, t) { if (t->pid < INTERNAL_LOCK_BASE && kill(t->pid, 0) == -1) { - _E("%d process does not exist, delete the REQ" - " - prohibit state %d ", + _E("Process(%d) does not exist, delete the REQ" + " - prohibit state=%d.", t->pid, prohibit_state); if (t->pid == custom_change_pid) { get_lcd_timeout_from_settings(); @@ -1093,10 +1092,10 @@ int check_holdkey_block(enum state_t state) PmLockNode *t; int ret = 0; - _I("check holdkey block : state of %s", states[state].name); + _I("Check holdkey block: state of %s", states[state].name); if (custom_holdkey_block == true) { - _I("custom hold key blocked by pid(%d)", + _I("Custom hold key blocked by pid(%d).", custom_change_pid); return 1; } @@ -1104,7 +1103,7 @@ int check_holdkey_block(enum state_t state) DD_LIST_FOREACH(cond_head[state], elem, t) { if (t->holdkey_block == true) { ret = 1; - _I("Hold key blocked by pid(%d)!", t->pid); + _I("Hold key blocked by pid(%d).", t->pid); break; } } @@ -1119,7 +1118,7 @@ int delete_condition(enum state_t state) pid_t pid; char pname[PATH_MAX]; - _I("delete condition : state of %s", states[state].name); + _I("Delete condition: state of %s", states[state].name); if (!cond_head[state]) return 0; @@ -1132,7 +1131,7 @@ int delete_condition(enum state_t state) pid = t->pid; if (state == S_LCDOFF) set_process_active(FALSE, pid); - _I("delete node of pid(%d)", pid); + _I("Delete node of pid(%d).", pid); del_node(state, t); get_pname(pid, pname); set_unlock_time(pname, state-1); @@ -1148,13 +1147,13 @@ void update_lcdoff_source(int source) { switch (source) { case VCONFKEY_PM_LCDOFF_BY_TIMEOUT: - _I("LCD OFF by timeout"); + _I("LCD OFF by timeout."); break; case VCONFKEY_PM_LCDOFF_BY_POWERKEY: - _I("LCD OFF by powerkey"); + _I("LCD OFF by powerkey."); break; default: - _E("Invalid value(%d)", source); + _E("Invalid value(%d).", source); return; } vconf_set_int(VCONFKEY_PM_LCDOFF_SOURCE, source); @@ -1227,7 +1226,7 @@ void pm_history_print(int fd, int count) time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); } } #endif @@ -1251,13 +1250,13 @@ void print_info(int fd) "===========================\n"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Timeout Info: Run[%dms] Dim[%dms] Off[%dms]\n", states[S_NORMAL].timeout, states[S_LCDDIM].timeout, states[S_LCDOFF].timeout); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n", (trans_condition & MASK_NORMAL) ? states[S_NORMAL].name : "-", @@ -1265,18 +1264,18 @@ void print_info(int fd) (trans_condition & MASK_OFF) ? states[S_LCDOFF].name : "-"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Current State: %s\n", states[pm_cur_state].name); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Current Lock Conditions: \n"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); for (s_index = S_NORMAL; s_index < S_END; s_index++) { DD_LIST_FOREACH(cond_head[s_index], elem, t) { @@ -1287,7 +1286,7 @@ void print_info(int fd) i++, states[s_index].name, t->pid, pname, time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); } } @@ -1305,7 +1304,7 @@ void save_display_log(void) time_t now_time; char time_buf[30]; - _D("internal state is saved!"); + _D("Internal state is saved."); time(&now_time); ctime_r(&now_time, time_buf); @@ -1317,18 +1316,18 @@ void save_display_log(void) (int)now_time, time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "pm_status_flag: %x\n", pm_status_flag); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "screen lock status : %d\n", __get_lock_screen_state()); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); print_info(fd); close(fd); } @@ -1371,7 +1370,7 @@ int check_lcdoff_direct(void) if (ret >= 0 && cradle == DOCK_SOUND) return false; - _D("Goto LCDOFF direct(%d,%d,%d)", lock, hdmi_state, cradle); + _D("Goto LCDOFF direct(lock=%d hdmi=%d cradle=%d).", lock, hdmi_state, cradle); return true; } @@ -1400,7 +1399,7 @@ static int default_trans(int evt) /* check conditions */ while (st->check && !st->check(pm_cur_state, next_state)) { /* There is a condition. */ - _I("(%s) locked. Trans to (%s) failed", states[pm_cur_state].name, + _I("%s locked. Trans to %s failed.", states[pm_cur_state].name, states[next_state].name); if (!check_processes(pm_cur_state)) { /* This is valid condition @@ -1504,7 +1503,7 @@ static int default_action(int timeout) struct timeval now_tv; if (status != DEVICE_OPS_STATUS_START) { - _E("display is not started!"); + _E("Display is not started."); return -EINVAL; } @@ -1522,7 +1521,7 @@ static int default_action(int timeout) time(&last_update_time); last_timeout = timeout; } else { - _I("timout set: %s state %d ms", + _I("Timout set: %s state %d ms", states[pm_cur_state].name, timeout); } } @@ -1537,7 +1536,7 @@ static int default_action(int timeout) if (pm_old_state == S_NORMAL && pm_cur_state != S_NORMAL) { time(&now); diff = difftime(now, last_update_time); - _I("S_NORMAL is changed to %s [%d ms, %.0f s]", + _I("S_NORMAL is changed to %s (timeout=%d ms diff=%.0f s).", states[pm_cur_state].name, last_timeout, diff); } @@ -1590,15 +1589,15 @@ static int default_action(int timeout) if (!power_ops.get_power_lock_support()) { /* sleep state : set system mode to SUSPEND */ if (power_ops.get_wakeup_count(&wakeup_count) < 0) - _E("wakeup count read error"); + _E("Wakeup count read error."); if (wakeup_count < 0) { - _I("Wakup Event! Can not enter suspend mode."); + _I("Wakup Event. Can not enter suspend mode."); goto go_lcd_off; } if (power_ops.set_wakeup_count(wakeup_count) < 0) { - _E("wakeup count write error"); + _E("Wakeup count write error."); goto go_lcd_off; } } @@ -1616,7 +1615,7 @@ go_suspend: power_ops.enable_autosleep(); if (power_ops.power_unlock() < 0) - _E("power unlock state error!"); + _E("Power unlock state error."); } else { dd_list *elem, *elem_n; const struct device_ops *dev; @@ -1634,7 +1633,7 @@ go_suspend: dev->resume(); } - _I("system wakeup!!"); + _I("System wakeup."); disp_plgn.system_wakeup_flag = true; /* Resume !! */ if (power_ops.check_wakeup_src() == EVENT_DEVICE) @@ -1710,13 +1709,13 @@ static int poll_callback(int condition, PMMsg *data) time_t now; if (status != DEVICE_OPS_STATUS_START) { - _E("display logic is not started!"); + _E("Display logic is not started."); return -ECANCELED; } if (condition == INPUT_POLL_EVENT) { if (pm_cur_state == S_LCDOFF || pm_cur_state == S_SLEEP) - _I("Power key input"); + _I("Power key input."); time(&now); if (last_t != now || pm_cur_state == S_LCDOFF || @@ -1790,12 +1789,12 @@ static int update_setting(int key_idx, int val) pm_status_flag |= BRTCH_FLAG; vconf_set_bool(VCONFKEY_PM_BRIGHTNESS_CHANGED_IN_LPM, true); - _I("brightness changed in low battery," - "escape dim state"); + _I("Brightness changed in low battery," + "escape dim state."); } backlight_ops.set_default_brt(val); snprintf(buf, sizeof(buf), "%d", val); - _D("Brightness set in bl : %d", val); + _D("Brightness set in bl(%d).", val); launch_evenif_exist(SET_BRIGHTNESS_IN_BOOTLOADER, buf); break; case SETTING_LOCK_SCREEN: @@ -1860,13 +1859,13 @@ static void check_seed_status(void) ret = get_setting_brightness(&tmp); if (ret != 0 || (tmp < PM_MIN_BRIGHTNESS || tmp > PM_MAX_BRIGHTNESS)) { - _I("fail to read vconf value for brightness"); + _I("Failed 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; } - _I("Set brightness from Setting App. %d", tmp); + _I("Set brightness(%d) from setting app.", tmp); backlight_ops.set_default_brt(tmp); vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state); @@ -1882,8 +1881,8 @@ static void check_seed_status(void) set_lock_screen_state(lock_state); if (lock_state == VCONFKEY_IDLE_LOCK) { states[S_NORMAL].timeout = lock_screen_timeout; - _I("LCD NORMAL timeout is set by %d ms" - " for lock screen", lock_screen_timeout); + _I("LCD NORMAL timeout(%d ms) is set" + " for lock screen.", lock_screen_timeout); } return; @@ -1936,13 +1935,13 @@ static const char *errMSG[INIT_END] = { int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) { if (on == 0 && dim == 0) { - _I("LCD timeout changed : default setting"); + _I("LCD timeout changed: default setting"); custom_normal_timeout = custom_dim_timeout = 0; } else if (on < 0 || dim < 0) { - _E("fail to set value (%d,%d)", on, dim); + _E("Failed to set value(on=%d dim=%d).", on, dim); return -EINVAL; } else { - _I("LCD timeout changed : on(%ds), dim(%ds)", on, dim); + _I("LCD timeout changed: on=%ds dim=%ds", on, dim); custom_normal_timeout = SEC_TO_MSEC(on); custom_dim_timeout = SEC_TO_MSEC(dim); } @@ -1953,10 +1952,10 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) if (holdkey_block) { custom_holdkey_block = true; - _I("hold key disabled !"); + _I("Hold key disabled."); } else { custom_holdkey_block = false; - _I("hold key enabled !"); + _I("Hold key enabled."); } if (custom_change_name) { @@ -1971,7 +1970,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) custom_change_name = strndup(name, strlen(name)); if (!custom_change_name) { - _E("Malloc falied!"); + _E("Failed to malloc."); custom_normal_timeout = custom_dim_timeout = 0; custom_holdkey_block = false; return -ENOMEM; @@ -1994,7 +1993,7 @@ void reset_lcd_timeout(GDBusConnection *conn, if (strcmp(sender, custom_change_name)) return; - _I("reset lcd timeout %s: set default timeout", sender); + _I("reset lcd timeout: Set default timeout. sender=%s", sender); free(custom_change_name); custom_change_name = 0; @@ -2017,7 +2016,7 @@ static int booting_done(void *data) if (!done) return done; - _I("booting done. Release display and power lock"); + _I("Booting done. Release display and power lock."); if (disp_plgn.pm_unlock_internal) { disp_plgn.pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN); disp_plgn.pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_NORMAL, PM_SLEEP_MARGIN); @@ -2050,7 +2049,7 @@ static int process_background(void *data) node = find_node(S_NORMAL, pid); if (node) { node->background = true; - _I("%d pid is background, then PM will be unlocked LCD_NORMAL", pid); + _I("Process(%d) is background, then PM will be unlocked LCD_NORMAL.", pid); } return 0; @@ -2066,7 +2065,7 @@ static int process_foreground(void *data) node = find_node(S_NORMAL, pid); if (node) { node->background = false; - _I("%d pid is foreground, then PM will be maintained locked LCD_NORMAL", pid); + _I("Process(%d) is foreground, then PM will be maintained locked LCD_NORMAL.", pid); } return 0; @@ -2076,7 +2075,7 @@ static int display_load_config(struct parse_result *result, void *user_data) { struct display_config *c = user_data; - _D("%s,%s,%s", result->section, result->name, result->value); + _D("display_load_config: section=%s name=%s value=%s", result->section, result->name, result->value); if (!c) return -EINVAL; @@ -2086,49 +2085,49 @@ static int display_load_config(struct parse_result *result, void *user_data) if (MATCH(result->name, "LockScreenWaitingTime")) { SET_CONF(c->lock_wait_time, atof(result->value)); - _D("lock wait time is %.3f", c->lock_wait_time); + _D("'lock wait time' is %.3f.", c->lock_wait_time); } else if (MATCH(result->name, "LongPressInterval")) { SET_CONF(c->longpress_interval, atof(result->value)); - _D("long press interval is %.3f", c->longpress_interval); + _D("'long press interval' is %.3f.", c->longpress_interval); } else if (MATCH(result->name, "LightSensorSamplingInterval")) { SET_CONF(c->lightsensor_interval, atof(result->value)); - _D("lightsensor interval is %.3f", c->lightsensor_interval); + _D("'lightsensor interval' is %.3f.", c->lightsensor_interval); } else if (MATCH(result->name, "LCDOffTimeout")) { SET_CONF(c->lcdoff_timeout, atoi(result->value)); - _D("lcdoff timeout is %d ms", c->lcdoff_timeout); + _D("'lcdoff timeout' is %d ms.", c->lcdoff_timeout); } else if (MATCH(result->name, "BrightnessChangeStep")) { SET_CONF(c->brightness_change_step, atoi(result->value)); - _D("brightness change step is %d", c->brightness_change_step); + _D("'brightness change step' is %d.", c->brightness_change_step); } else if (MATCH(result->name, "LCDAlwaysOn")) { c->lcd_always_on = (MATCH(result->value, "yes") ? 1 : 0); - _D("LCD always on is %d", c->lcd_always_on); + _D("'LCD always on' is %d.", c->lcd_always_on); } else if (MATCH(result->name, "ChangedFrameRateAllowed")) { if (strstr(result->value, "setting")) { c->framerate_app[REFRESH_SETTING] = 1; - _D("framerate app is Setting"); + _D("'framerate app' is setting"); } if (strstr(result->value, "all")) { memset(c->framerate_app, 1, sizeof(c->framerate_app)); - _D("framerate app is All"); + _D("'framerate app' is all"); } } else if (MATCH(result->name, "ControlDisplay")) { c->control_display = (MATCH(result->value, "yes") ? 1 : 0); - _D("ControlDisplay is %d", c->control_display); + _D("'ControlDisplay' is %d.", c->control_display); } else if (MATCH(result->name, "PowerKeyDoublePressSupport")) { c->powerkey_doublepress = (MATCH(result->value, "yes") ? 1 : 0); - _D("PowerKeyDoublePressSupport is %d", c->powerkey_doublepress); + _D("'PowerKeyDoublePressSupport' is %d.", c->powerkey_doublepress); } else if (MATCH(result->name, "AccelSensorOn")) { c->accel_sensor_on = (MATCH(result->value, "yes") ? 1 : 0); - _D("AccelSensorOn is %d", c->accel_sensor_on); + _D("'AccelSensorOn' is %d.", c->accel_sensor_on); } else if (MATCH(result->name, "ContinuousSampling")) { c->continuous_sampling = (MATCH(result->value, "yes") ? 1 : 0); - _D("ContinuousSampling is %d", c->continuous_sampling); + _D("'ContinuousSampling' is %d.", c->continuous_sampling); } else if (MATCH(result->name, "TimeoutEnable")) { c->timeout_enable = (MATCH(result->value, "yes") ? true : false); - _D("Timeout is %s", c->timeout_enable ? "enalbed" : "disabled"); + _D("'Timeout' is %s.", c->timeout_enable ? "enalbed" : "disabled"); } else if (MATCH(result->name, "InputSupport")) { c->input_support = (MATCH(result->value, "yes") ? true : false); - _D("Input is %s", c->input_support ? "supported" : "NOT supported"); + _D("'Input' is %s.", c->input_support ? "supported" : "NOT supported"); } return 0; @@ -2137,11 +2136,11 @@ static int display_load_config(struct parse_result *result, void *user_data) static bool check_wm_ready(void) { if (access("/run/.wm_ready", F_OK) == 0) { - _I("Window manager is ready"); + _I("Window manager is ready."); return true; } - _I("Window manager is not ready"); + _I("Window manager is not ready."); return false; } @@ -2175,7 +2174,7 @@ static void add_timer_for_wm_ready(void) { guint id = g_timeout_add(500/* milliseconds */, lcd_on_wm_ready, NULL); if (id == 0) - _E("Failed to add wm_ready timeout"); + _E("Failed to add wm_ready timeout."); } /** @@ -2208,7 +2207,7 @@ static void display_init(void *data) int timeout = 0; bool wm_ready; - _I("Start power manager"); + _I("Start power manager."); signal(SIGHUP, sig_hup); @@ -2217,7 +2216,7 @@ static void display_init(void *data) /* load configutation */ ret = config_parse(DISPLAY_CONF_FILE, display_load_config, &display_conf); if (ret < 0) - _W("Failed to load %s, %d Use default value!", + _W("Failed to load '%s', use default value: %d", DISPLAY_CONF_FILE, ret); register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); @@ -2236,7 +2235,7 @@ static void display_init(void *data) ret = init_sysfs(); break; case INIT_POLL: - _I("input init"); + _I("Input init."); pm_callback = poll_callback; if (display_conf.input_support) ret = init_input(); @@ -2244,12 +2243,12 @@ static void display_init(void *data) ret = 0; break; case INIT_DBUS: - _I("dbus init"); + _I("Dbus init."); ret = init_pm_dbus(); break; } if (ret != 0) { - _E("%s", errMSG[i]); + _E("Failed to init: %s", errMSG[i]); break; } } @@ -2272,11 +2271,11 @@ static void display_init(void *data) add_timer_for_wm_ready(); if (display_conf.lcd_always_on) { - _I("LCD always on!"); + _I("LCD always on."); trans_table[S_NORMAL][EVENT_TIMEOUT] = S_NORMAL; } - _I("Start Power managing without noti"); + _I("Start Power managing without noti."); if (power_ops.get_power_lock_support()) power_ops.power_lock(); @@ -2353,7 +2352,7 @@ static void display_exit(void *data) /* free display service */ display_service_free(); - _I("Stop power manager"); + _I("Stop power manager."); } static int display_start(enum device_flags flags) diff --git a/plugins/iot/display/device-interface.c b/plugins/iot/display/device-interface.c old mode 100644 new mode 100755 index 3e7144f..a9088ac --- a/plugins/iot/display/device-interface.c +++ b/plugins/iot/display/device-interface.c @@ -106,7 +106,7 @@ static int bl_brt(int brightness, int delay) usleep(delay); if (force_brightness > 0) { - _I("brightness(%d), force brightness(%d)", + _I("brightness=%d force brightness=%d", brightness, force_brightness); brightness = force_brightness; } @@ -114,7 +114,7 @@ static int bl_brt(int brightness, int delay) /* Update device brightness */ ret = backlight_ops.set_brightness(brightness); - _I("set brightness %d, %d", brightness, ret); + _I("Set brightness(%d): %d", brightness, ret); return ret; } @@ -125,13 +125,13 @@ static int system_suspend(void) _I("system suspend"); ret = sys_set_str(POWER_STATE_PATH, "mem"); - _I("system resume (result : %d)", ret); + _I("System resume: %d", ret); return 0; } static int system_enable_autosleep(void) { - _I("system autosleep enabled"); + _I("System autosleep enabled."); return sys_set_str(POWER_AUTOSLEEP_PATH, "mem"); } @@ -141,7 +141,7 @@ static int system_power_lock(void) const struct device_ops *dev; int ret; - _I("system power lock"); + _I("system power lock."); ret = sys_set_str(POWER_LOCK_PATH, "mainlock"); /* Devices Resume */ @@ -164,7 +164,7 @@ static int system_power_unlock(void) dev->suspend(); } - _I("system power unlock"); + _I("system power unlock."); return sys_set_str(POWER_UNLOCK_PATH, "mainlock"); } @@ -182,7 +182,7 @@ static int system_get_power_lock_support(void) else power_lock_support = true; - _I("system power lock : %s", + _I("system power lock: %s", (power_lock_support ? "support" : "not support")); out: @@ -235,14 +235,14 @@ void change_brightness(int start, int end, int step) ret = backlight_ops.get_brightness(&prev); if (ret < 0) { - _E("fail to get brightness : %d", ret); + _E("Failed to get brightness: %d", ret); return; } if (prev == end) return; - _D("start %d end %d step %d", start, end, step); + _D("start=%d end=%d step=%d", start, end, step); diff = end - start; @@ -271,7 +271,7 @@ static int backlight_on(enum device_flags flags) ret = bl_onoff(DPMS_ON); if (ret < 0) - _E("Failed to turn on backlight"); + _E("Failed to turn on backlight."); if (flags & LCD_PHASED_TRANSIT_MODE) change_brightness(LCD_PHASED_MIN_BRIGHTNESS, @@ -295,7 +295,7 @@ static int backlight_off(enum device_flags flags) ret = bl_onoff(DPMS_OFF); if (ret < 0) - _E("Failed to turn off backlight"); + _E("Failed to turn off backlight."); return ret; } @@ -306,7 +306,7 @@ static int backlight_dim(void) int brightness; if (vconf_get_int(VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS, &brightness) != 0) { - _E("Failed to get VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS value"); + _E("Failed to get VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS value."); return -EPERM; } @@ -353,7 +353,7 @@ static int custom_backlight_update(void) if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) { ret = backlight_dim(); } else { - _I("custom brightness restored! %d", custom_brightness); + _I("Custom brightness(%d) restored.", custom_brightness); ret = bl_brt(custom_brightness, 0); } @@ -375,7 +375,7 @@ static int backlight_update(void) int ret = 0; if (get_custom_status()) { - _I("custom brightness mode! brt no updated"); + _I("Custom brightness mode. brt no updated."); return 0; } if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) @@ -452,7 +452,7 @@ static int get_max_brightness(void) return max; if (!display_dev) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } @@ -463,7 +463,7 @@ static int get_max_brightness(void) ret = display_dev->get_max_brightness(&max); if (ret < 0) { - _E("Failed to get max brightness (%d)", ret); + _E("Failed to get max brightness: %d", ret); return ret; } @@ -475,13 +475,13 @@ static int set_brightness(int val) int max; if (!display_dev || !display_dev->set_brightness) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } max = get_max_brightness(); if (max < 0) { - _E("Failed to get max brightness"); + _E("Failed to get max brightness."); return max; } @@ -499,7 +499,7 @@ static int get_brt_normalized(int brt_raw) max = get_max_brightness(); if (max < 0) { - _E("Failed to get max brightness"); + _E("Failed to get max brightness."); return max; } @@ -527,13 +527,13 @@ static int get_brightness(int *val) int brt, ret; if (!display_dev || !display_dev->get_brightness) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } ret = display_dev->get_brightness(&brt); if (ret < 0) { - _E("failed to get brightness (%d)", ret); + _E("Failed to get brightness: %d", ret); return ret; } @@ -551,7 +551,7 @@ static int get_brightness_by_light_sensor(float lmax, float lmin, float light, i ret = display_dev->get_auto_brightness(lmax, lmin, light, &brt_raw); if (ret < 0) { - _E("failed to get brightness by light sensor(%d)", ret); + _E("Failed to get brightness by light sensor: %d", ret); return ret; } @@ -583,12 +583,12 @@ static int set_frame_rate(int rate) if (fmin < 0) { ret = display_dev->get_min_frame_rate(&fmin); if (ret < 0) { - _E("Failed to get min frate rate (%d)", ret); + _E("Failed to get min frate rate: %d", ret); return ret; } } if (rate < fmin) { - _E("Invalid rate(%d)! (Valid rate: %d <= rate)", rate, fmin); + _E("Invalid rate(%d). (Valid rate: %d <= rate)", rate, fmin); return -EINVAL; } } @@ -597,12 +597,12 @@ static int set_frame_rate(int rate) if (fmax < 0) { ret = display_dev->get_max_frame_rate(&fmax); if (ret < 0) { - _E("Failed to get max frate rate (%d)", ret); + _E("Failed to get max frate rate: %d", ret); return ret; } } if (rate > fmax) { - _E("Invalid rate(%d)! (Valid rate: rate <= %d)", rate, fmax); + _E("Invalid rate(%d). (Valid rate: rate <= %d)", rate, fmax); return -EINVAL; } } @@ -651,22 +651,22 @@ int display_service_load(void) r = hw_get_info(DISPLAY_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (r < 0) { - _I("display shared library is not supported: %d", r); + _I("Display shared library is not supported: %d", r); return -ENODEV; } if (!info->open) { - _E("fail to open display device : open(NULL)"); + _E("Failed to open display device: open(NULL)"); return -EPERM; } r = info->open(info, NULL, (struct hw_common **)&display_dev); if (r < 0) { - _E("fail to get display device structure : %d", r); + _E("Failed to get display device structure: %d", r); return -EPERM; } - _D("display device structure load success"); + _D("Display device structure load success."); return 0; } diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c old mode 100644 new mode 100755 index 4bffbb8..05505ef --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -234,7 +234,7 @@ static void set_process_active(bool flag, pid_t pid) RESOURCED_METHOD_ACTIVE, g_variant_new("(si)", (flag ? ACTIVE_ACT : INACTIVE_ACT), pid)); if (ret < 0) - _E("Fail to send dbus signal to resourced!!"); + _E("Failed to send dbus signal to resourced."); } bool check_lock_state(int state) @@ -252,37 +252,37 @@ bool check_lock_state(int state) void change_state_action(enum state_t state, int (*func)(int timeout)) { - _I("[%s] action is changed", states[state].name); + _I("[%s] 'action' is changed.", states[state].name); states[state].action = func; } void change_state_trans(enum state_t state, int (*func)(int evt)) { - _I("[%s] trans is changed", states[state].name); + _I("[%s] 'trans' is changed.", states[state].name); states[state].trans = func; } void change_state_check(enum state_t state, int (*func)(int curr, int next)) { - _I("[%s] check is changed", states[state].name); + _I("[%s] 'check' is changed.", states[state].name); states[state].check = func; } void change_state_name(enum state_t state, char *name) { - _I("[%s] name is changed", states[state].name); + _I("[%s] 'name' is changed.", states[state].name); states[state].name = name; } void change_trans_table(enum state_t state, enum state_t next) { - _I("[%s] timeout trans table is changed", states[state].name); + _I("[%s] 'timeout trans table' is changed.", states[state].name); trans_table[state][EVENT_TIMEOUT] = next; } void change_proc_change_state(int (*func)(unsigned int cond, pid_t pid)) { - _I("proc change state is changed"); + _I("'proc change state' is changed."); proc_change_state = func; } @@ -292,7 +292,7 @@ static void broadcast_lcd_on(enum signal_type type, enum device_flags flags) const char *signal; if (type <= SIGNAL_INVALID || type >= SIGNAL_MAX) { - _E("invalid signal type %d", type); + _E("Invalid signal type(%d).", type); return; } @@ -308,7 +308,7 @@ static void broadcast_lcd_on(enum signal_type type, enum device_flags flags) str = UNKNOWN_STR; signal = lcdon_sig_lookup[type]; - _I("lcdstep : broadcast %s %s", signal, str); + _I("lcdstep : Broadcast signal(%s:%s).", signal, str); dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, signal, @@ -321,7 +321,7 @@ static void broadcast_lcd_off(enum signal_type type, enum device_flags flags) const char *signal; if (type <= SIGNAL_INVALID || type >= SIGNAL_MAX) { - _E("invalid signal type %d", type); + _E("Invalid signal type(%d).", type); return; } @@ -336,7 +336,7 @@ static void broadcast_lcd_off(enum signal_type type, enum device_flags flags) else str = UNKNOWN_STR; - _I("lcdstep : broadcast %s", signal); + _I("lcdstep : Broadcast signal(%s).", signal); dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, signal, @@ -471,7 +471,7 @@ inline void lcd_off_procedure(enum device_flags flag) void set_stay_touchscreen_off(int val) { - _D("stay touch screen off : %d", val); + _D("stay touch screen off: %d", val); stay_touchscreen_off = val; lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); @@ -480,7 +480,7 @@ void set_stay_touchscreen_off(int val) void set_lcd_paneloff_mode(int val) { - _D("lcd paneloff mode : %d", val); + _D("lcd paneloff mode: %d", val); lcd_paneloff_mode = val; lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); @@ -546,7 +546,7 @@ static PmLockNode *add_node(enum state_t s_index, pid_t pid, guint timeout_id, n = (PmLockNode *) malloc(sizeof(PmLockNode)); if (n == NULL) { - _E("Not enough memory, add cond. fail"); + _E("Failed to add cond. Not enough memory."); return NULL; } @@ -596,9 +596,9 @@ static void print_node(int next) ctime_r(&n->time, buf); if (diff > LOCK_TIME_WARNING) - _W("over %.0f s, pid: %5d, lock time: %s", diff, n->pid, buf); + _W("over=%.0f s pid=%5d locktime=%s", diff, n->pid, buf); else - _I("pid: %5d, lock time: %s", n->pid, buf); + _I("pid=%5d locktime=%s", n->pid, buf); } } @@ -615,7 +615,7 @@ void get_pname(pid_t pid, char *pname) cmdline = open(buf, O_RDONLY); if (cmdline < 0) { pname[0] = '\0'; - _E("%d does not exist now(may be dead without unlock)", pid); + _E("Process(%d) does not exist now(may be dead without unlock).", pid); return; } @@ -639,7 +639,7 @@ static void del_state_cond(void *data, enum state_t state) /* A passed data is a pid_t type data, not a 64bit data. */ pid = (pid_t)((intptr_t)data); - _I("delete prohibit dim condition by timeout (%d)", pid); + _I("Delete process(%d)'s prohibit dim condition by timeout.", pid); tmp = find_node(state, pid); del_node(state, tmp); @@ -676,7 +676,7 @@ gboolean timeout_handler(void *data) { int run_timeout; - _I("Time out state %s\n", states[pm_cur_state].name); + _I("Time out state %s.\n", states[pm_cur_state].name); /* default setting */ get_run_timeout(&run_timeout); @@ -684,7 +684,7 @@ gboolean timeout_handler(void *data) * if the run_timeout is zero, it regards AlwaysOn state */ if (pm_cur_state == S_NORMAL && (run_timeout == 0 || display_conf.lcd_always_on)) { - _D("run_timeout is always on"); + _D("'run_timeout' is always on."); return G_SOURCE_CONTINUE; } @@ -702,7 +702,7 @@ void reset_timeout(int timeout) if (!display_conf.timeout_enable) return; - _I("Reset Timeout (%d)ms", timeout); + _I("Reset timeout(%d ms)", timeout); if (timeout_src_id != 0) { g_source_remove(timeout_src_id); timeout_src_id = 0; @@ -743,7 +743,7 @@ static int get_lcd_timeout_from_settings(void) if (val > 0) states[i].timeout = val; - _I("%s state : %d ms timeout", states[i].name, + _I("state=%s timeout=%d ms", states[i].name, states[i].timeout); } @@ -757,7 +757,7 @@ static void update_display_time(void) /* first priority : s cover */ if (!hallic_open) { states[S_NORMAL].timeout = S_COVER_TIMEOUT; - _I("S cover closed : timeout is set by normal(%d ms)", + _I("S cover closed: Timeout(%d ms) is set by normal.", S_COVER_TIMEOUT); return; } @@ -766,7 +766,7 @@ static void update_display_time(void) if (custom_normal_timeout > 0) { states[S_NORMAL].timeout = custom_normal_timeout; states[S_LCDDIM].timeout = custom_dim_timeout; - _I("CUSTOM : timeout is set by normal(%d ms), dim(%d ms)", + _I("CUSTOM: Timeout(%d ms) and dim(%d ms) are set by normal.", custom_normal_timeout, custom_dim_timeout); return; } @@ -776,7 +776,7 @@ static void update_display_time(void) !get_lock_screen_bg_state()) { /* timeout is different according to key or event. */ states[S_NORMAL].timeout = lock_screen_timeout; - _I("LOCK : timeout is set by normal(%d ms)", + _I("LOCK: Timeout(%d ms) is set by normal.", lock_screen_timeout); return; } @@ -789,7 +789,7 @@ static void update_display_time(void) */ if (run_timeout == 0 || display_conf.lcd_always_on) { run_timeout = ALWAYS_ON_TIMEOUT; - _I("LCD Always On"); + _I("LCD always on."); } states[S_NORMAL].timeout = run_timeout; @@ -797,8 +797,7 @@ static void update_display_time(void) get_dim_timeout(&val); states[S_LCDDIM].timeout = val; - _I("Normal: NORMAL timeout is set by %d ms", states[S_NORMAL].timeout); - _I("Normal: DIM timeout is set by %d ms", states[S_LCDDIM].timeout); + _I("Normal: timeout(%d ms) and dim(%d ms) are set.", states[S_NORMAL].timeout, states[S_LCDDIM].timeout); } static void update_display_locktime(int time) @@ -810,7 +809,7 @@ static void update_display_locktime(int time) void set_dim_state(bool on) { - _I("dim state is %d", on); + _I("Dim state is %d.", on); update_display_time(); states[pm_cur_state].trans(EVENT_INPUT); } @@ -825,7 +824,7 @@ void lcd_on_direct(enum device_flags flags) power_ops.power_lock(); #ifdef MICRO_DD - _D("lcd is on directly"); + _D("Lcd is on directly."); gettimeofday(&lcdon_tv, NULL); lcd_on_procedure(LCD_NORMAL, flags); reset_timeout(DD_LCDOFF_INPUT_TIMEOUT); @@ -833,7 +832,7 @@ void lcd_on_direct(enum device_flags flags) ret = vconf_get_int(VCONFKEY_CALL_STATE, &call_state); if ((ret >= 0 && call_state != VCONFKEY_CALL_OFF) || (__get_lock_screen_state() == VCONFKEY_IDLE_LOCK)) { - _D("LOCK state, lcd is on directly"); + _D("LOCK state, lcd is on directly."); lcd_on_procedure(LCD_NORMAL, flags); } reset_timeout(display_conf.lcdoff_timeout); @@ -859,7 +858,7 @@ int custom_lcdon(int timeout) if (check_lcd_is_on() == false) lcd_on_direct(LCD_ON_BY_GESTURE); - _I("custom lcd on %d ms", timeout); + _I("Custom lcd on timeout(%d ms).", timeout); if (set_custom_lcdon_timeout(timeout) == true) update_display_time(); @@ -897,7 +896,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) enum state_t next; next = GET_COND_STATE(cond); - _I("Change State to %s (%d)", states[next].name, pid); + _I("Change process(%d) state to %s.", pid, states[next].name); switch (next) { case S_NORMAL: @@ -976,7 +975,7 @@ static void proc_condition_lock(PMMsg *data) states[state].timeout_cb, (void*)((intptr_t)pid)); if (!cond_timeout_id) - _E("Failed to register display timer"); + _E("Failed to register display timer."); } holdkey_block = GET_COND_FLAG(data->cond) & PM_FLAG_BLOCK_HOLDKEY; @@ -993,7 +992,7 @@ static void proc_condition_lock(PMMsg *data) set_process_active(TRUE, pid); /* for debug */ - _SD("[%s] locked by pid %d - process %s holdkeyblock %d\n", + _SD("[%s] Locked by pid=%d process=%s holdkeyblock=%d\n", states[state].name, pid, pname, holdkey_block); set_lock_time(pname, state); @@ -1022,7 +1021,7 @@ static void proc_condition_unlock(PMMsg *data) if (ambient_get_state()) ambient_check_invalid_state(pid); - _SD("[%s] unlocked by pid %d - process %s\n", + _SD("[%s] Unlocked by pid=%d process=%s\n", states[state].name, pid, pname); set_unlock_time(pname, state); @@ -1047,12 +1046,12 @@ static int proc_condition(PMMsg *data) /* guard time for suspend */ if (pm_cur_state == S_LCDOFF) { reset_timeout(states[S_LCDOFF].timeout); - _I("Margin timeout (%d ms)", states[S_LCDOFF].timeout); + _I("Margin timeout(%d ms)", states[S_LCDOFF].timeout); } } else { if (flags & PM_FLAG_RESET_TIMER) { reset_timeout(states[pm_cur_state].timeout); - _I("Reset timeout (%d ms)", states[pm_cur_state].timeout); + _I("Reset timeout(%d ms)", states[pm_cur_state].timeout); } } @@ -1071,8 +1070,8 @@ int check_processes(enum state_t prohibit_state) DD_LIST_FOREACH_SAFE(cond_head[prohibit_state], elem, next, t) { if (t->pid < INTERNAL_LOCK_BASE && kill(t->pid, 0) == -1) { - _E("%d process does not exist, delete the REQ" - " - prohibit state %d ", + _E("Process(%d) does not exist, delete the REQ" + " - prohibit state=%d.", t->pid, prohibit_state); if (t->pid == custom_change_pid) { get_lcd_timeout_from_settings(); @@ -1093,10 +1092,10 @@ int check_holdkey_block(enum state_t state) PmLockNode *t; int ret = 0; - _I("check holdkey block : state of %s", states[state].name); + _I("Check holdkey block: state of %s", states[state].name); if (custom_holdkey_block == true) { - _I("custom hold key blocked by pid(%d)", + _I("Custom hold key blocked by pid(%d).", custom_change_pid); return 1; } @@ -1104,7 +1103,7 @@ int check_holdkey_block(enum state_t state) DD_LIST_FOREACH(cond_head[state], elem, t) { if (t->holdkey_block == true) { ret = 1; - _I("Hold key blocked by pid(%d)!", t->pid); + _I("Hold key blocked by pid(%d).", t->pid); break; } } @@ -1119,7 +1118,7 @@ int delete_condition(enum state_t state) pid_t pid; char pname[PATH_MAX]; - _I("delete condition : state of %s", states[state].name); + _I("Delete condition: state of %s", states[state].name); if (!cond_head[state]) return 0; @@ -1132,7 +1131,7 @@ int delete_condition(enum state_t state) pid = t->pid; if (state == S_LCDOFF) set_process_active(FALSE, pid); - _I("delete node of pid(%d)", pid); + _I("Delete node of pid(%d).", pid); del_node(state, t); get_pname(pid, pname); set_unlock_time(pname, state-1); @@ -1148,13 +1147,13 @@ void update_lcdoff_source(int source) { switch (source) { case VCONFKEY_PM_LCDOFF_BY_TIMEOUT: - _I("LCD OFF by timeout"); + _I("LCD OFF by timeout."); break; case VCONFKEY_PM_LCDOFF_BY_POWERKEY: - _I("LCD OFF by powerkey"); + _I("LCD OFF by powerkey."); break; default: - _E("Invalid value(%d)", source); + _E("Invalid value(%d).", source); return; } vconf_set_int(VCONFKEY_PM_LCDOFF_SOURCE, source); @@ -1227,7 +1226,7 @@ void pm_history_print(int fd, int count) time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); } } #endif @@ -1251,13 +1250,13 @@ void print_info(int fd) "===========================\n"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Timeout Info: Run[%dms] Dim[%dms] Off[%dms]\n", states[S_NORMAL].timeout, states[S_LCDDIM].timeout, states[S_LCDOFF].timeout); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n", (trans_condition & MASK_NORMAL) ? states[S_NORMAL].name : "-", @@ -1265,18 +1264,18 @@ void print_info(int fd) (trans_condition & MASK_OFF) ? states[S_LCDOFF].name : "-"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Current State: %s\n", states[pm_cur_state].name); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Current Lock Conditions: \n"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); for (s_index = S_NORMAL; s_index < S_END; s_index++) { DD_LIST_FOREACH(cond_head[s_index], elem, t) { @@ -1287,7 +1286,7 @@ void print_info(int fd) i++, states[s_index].name, t->pid, pname, time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); } } @@ -1305,7 +1304,7 @@ void save_display_log(void) time_t now_time; char time_buf[30]; - _D("internal state is saved!"); + _D("Internal state is saved."); time(&now_time); ctime_r(&now_time, time_buf); @@ -1317,18 +1316,18 @@ void save_display_log(void) (int)now_time, time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "pm_status_flag: %x\n", pm_status_flag); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "screen lock status : %d\n", __get_lock_screen_state()); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); print_info(fd); close(fd); } @@ -1371,7 +1370,7 @@ int check_lcdoff_direct(void) if (ret >= 0 && cradle == DOCK_SOUND) return false; - _D("Goto LCDOFF direct(%d,%d,%d)", lock, hdmi_state, cradle); + _D("Goto LCDOFF direct(lock=%d hdmi=%d cradle=%d).", lock, hdmi_state, cradle); return true; } @@ -1400,7 +1399,7 @@ static int default_trans(int evt) /* check conditions */ while (st->check && !st->check(pm_cur_state, next_state)) { /* There is a condition. */ - _I("(%s) locked. Trans to (%s) failed", states[pm_cur_state].name, + _I("%s locked. Trans to %s failed.", states[pm_cur_state].name, states[next_state].name); if (!check_processes(pm_cur_state)) { /* This is valid condition @@ -1504,7 +1503,7 @@ static int default_action(int timeout) struct timeval now_tv; if (status != DEVICE_OPS_STATUS_START) { - _E("display is not started!"); + _E("Display is not started."); return -EINVAL; } @@ -1522,7 +1521,7 @@ static int default_action(int timeout) time(&last_update_time); last_timeout = timeout; } else { - _I("timout set: %s state %d ms", + _I("Timout set: %s state %d ms", states[pm_cur_state].name, timeout); } } @@ -1537,7 +1536,7 @@ static int default_action(int timeout) if (pm_old_state == S_NORMAL && pm_cur_state != S_NORMAL) { time(&now); diff = difftime(now, last_update_time); - _I("S_NORMAL is changed to %s [%d ms, %.0f s]", + _I("S_NORMAL is changed to %s (timeout=%d ms diff=%.0f s).", states[pm_cur_state].name, last_timeout, diff); } @@ -1590,15 +1589,15 @@ static int default_action(int timeout) if (!power_ops.get_power_lock_support()) { /* sleep state : set system mode to SUSPEND */ if (power_ops.get_wakeup_count(&wakeup_count) < 0) - _E("wakeup count read error"); + _E("Wakeup count read error."); if (wakeup_count < 0) { - _I("Wakup Event! Can not enter suspend mode."); + _I("Wakup Event. Can not enter suspend mode."); goto go_lcd_off; } if (power_ops.set_wakeup_count(wakeup_count) < 0) { - _E("wakeup count write error"); + _E("Wakeup count write error."); goto go_lcd_off; } } @@ -1616,7 +1615,7 @@ go_suspend: power_ops.enable_autosleep(); if (power_ops.power_unlock() < 0) - _E("power unlock state error!"); + _E("Power unlock state error."); } else { dd_list *elem, *elem_n; const struct device_ops *dev; @@ -1634,7 +1633,7 @@ go_suspend: dev->resume(); } - _I("system wakeup!!"); + _I("System wakeup."); disp_plgn.system_wakeup_flag = true; /* Resume !! */ if (power_ops.check_wakeup_src() == EVENT_DEVICE) @@ -1710,13 +1709,13 @@ static int poll_callback(int condition, PMMsg *data) time_t now; if (status != DEVICE_OPS_STATUS_START) { - _E("display logic is not started!"); + _E("Display logic is not started."); return -ECANCELED; } if (condition == INPUT_POLL_EVENT) { if (pm_cur_state == S_LCDOFF || pm_cur_state == S_SLEEP) - _I("Power key input"); + _I("Power key input."); time(&now); if (last_t != now || pm_cur_state == S_LCDOFF || @@ -1790,12 +1789,12 @@ static int update_setting(int key_idx, int val) pm_status_flag |= BRTCH_FLAG; vconf_set_bool(VCONFKEY_PM_BRIGHTNESS_CHANGED_IN_LPM, true); - _I("brightness changed in low battery," - "escape dim state"); + _I("Brightness changed in low battery," + "escape dim state."); } backlight_ops.set_default_brt(val); snprintf(buf, sizeof(buf), "%d", val); - _D("Brightness set in bl : %d", val); + _D("Brightness set in bl(%d).", val); launch_evenif_exist(SET_BRIGHTNESS_IN_BOOTLOADER, buf); break; case SETTING_LOCK_SCREEN: @@ -1860,13 +1859,13 @@ static void check_seed_status(void) ret = get_setting_brightness(&tmp); if (ret != 0 || (tmp < PM_MIN_BRIGHTNESS || tmp > PM_MAX_BRIGHTNESS)) { - _I("fail to read vconf value for brightness"); + _I("Failed 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; } - _I("Set brightness from Setting App. %d", tmp); + _I("Set brightness(%d) from setting app.", tmp); backlight_ops.set_default_brt(tmp); vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state); @@ -1882,8 +1881,8 @@ static void check_seed_status(void) set_lock_screen_state(lock_state); if (lock_state == VCONFKEY_IDLE_LOCK) { states[S_NORMAL].timeout = lock_screen_timeout; - _I("LCD NORMAL timeout is set by %d ms" - " for lock screen", lock_screen_timeout); + _I("LCD NORMAL timeout(%d ms) is set" + " for lock screen.", lock_screen_timeout); } return; @@ -1936,13 +1935,13 @@ static const char *errMSG[INIT_END] = { int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) { if (on == 0 && dim == 0) { - _I("LCD timeout changed : default setting"); + _I("LCD timeout changed: default setting"); custom_normal_timeout = custom_dim_timeout = 0; } else if (on < 0 || dim < 0) { - _E("fail to set value (%d,%d)", on, dim); + _E("Failed to set value(on=%d dim=%d).", on, dim); return -EINVAL; } else { - _I("LCD timeout changed : on(%ds), dim(%ds)", on, dim); + _I("LCD timeout changed: on=%ds dim=%ds", on, dim); custom_normal_timeout = SEC_TO_MSEC(on); custom_dim_timeout = SEC_TO_MSEC(dim); } @@ -1953,10 +1952,10 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) if (holdkey_block) { custom_holdkey_block = true; - _I("hold key disabled !"); + _I("Hold key disabled."); } else { custom_holdkey_block = false; - _I("hold key enabled !"); + _I("Hold key enabled."); } if (custom_change_name) { @@ -1971,7 +1970,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) custom_change_name = strndup(name, strlen(name)); if (!custom_change_name) { - _E("Malloc falied!"); + _E("Failed to malloc."); custom_normal_timeout = custom_dim_timeout = 0; custom_holdkey_block = false; return -ENOMEM; @@ -1994,7 +1993,7 @@ void reset_lcd_timeout(GDBusConnection *conn, if (strcmp(sender, custom_change_name)) return; - _I("reset lcd timeout %s: set default timeout", sender); + _I("reset lcd timeout: Set default timeout. sender=%s", sender); free(custom_change_name); custom_change_name = 0; @@ -2017,7 +2016,7 @@ static int booting_done(void *data) if (!done) return done; - _I("booting done. Release display and power lock"); + _I("Booting done. Release display and power lock."); if (disp_plgn.pm_unlock_internal) { disp_plgn.pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN); disp_plgn.pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_NORMAL, PM_SLEEP_MARGIN); @@ -2050,7 +2049,7 @@ static int process_background(void *data) node = find_node(S_NORMAL, pid); if (node) { node->background = true; - _I("%d pid is background, then PM will be unlocked LCD_NORMAL", pid); + _I("Process(%d) is background, then PM will be unlocked LCD_NORMAL.", pid); } return 0; @@ -2066,7 +2065,7 @@ static int process_foreground(void *data) node = find_node(S_NORMAL, pid); if (node) { node->background = false; - _I("%d pid is foreground, then PM will be maintained locked LCD_NORMAL", pid); + _I("Process(%d) is foreground, then PM will be maintained locked LCD_NORMAL.", pid); } return 0; @@ -2076,7 +2075,7 @@ static int display_load_config(struct parse_result *result, void *user_data) { struct display_config *c = user_data; - _D("%s,%s,%s", result->section, result->name, result->value); + _D("display_load_config: section=%s name=%s value=%s", result->section, result->name, result->value); if (!c) return -EINVAL; @@ -2086,49 +2085,49 @@ static int display_load_config(struct parse_result *result, void *user_data) if (MATCH(result->name, "LockScreenWaitingTime")) { SET_CONF(c->lock_wait_time, atof(result->value)); - _D("lock wait time is %.3f", c->lock_wait_time); + _D("'lock wait time' is %.3f.", c->lock_wait_time); } else if (MATCH(result->name, "LongPressInterval")) { SET_CONF(c->longpress_interval, atof(result->value)); - _D("long press interval is %.3f", c->longpress_interval); + _D("'long press interval' is %.3f.", c->longpress_interval); } else if (MATCH(result->name, "LightSensorSamplingInterval")) { SET_CONF(c->lightsensor_interval, atof(result->value)); - _D("lightsensor interval is %.3f", c->lightsensor_interval); + _D("'lightsensor interval' is %.3f.", c->lightsensor_interval); } else if (MATCH(result->name, "LCDOffTimeout")) { SET_CONF(c->lcdoff_timeout, atoi(result->value)); - _D("lcdoff timeout is %d ms", c->lcdoff_timeout); + _D("'lcdoff timeout' is %d ms.", c->lcdoff_timeout); } else if (MATCH(result->name, "BrightnessChangeStep")) { SET_CONF(c->brightness_change_step, atoi(result->value)); - _D("brightness change step is %d", c->brightness_change_step); + _D("'brightness change step' is %d.", c->brightness_change_step); } else if (MATCH(result->name, "LCDAlwaysOn")) { c->lcd_always_on = (MATCH(result->value, "yes") ? 1 : 0); - _D("LCD always on is %d", c->lcd_always_on); + _D("'LCD always on' is %d.", c->lcd_always_on); } else if (MATCH(result->name, "ChangedFrameRateAllowed")) { if (strstr(result->value, "setting")) { c->framerate_app[REFRESH_SETTING] = 1; - _D("framerate app is Setting"); + _D("'framerate app' is setting"); } if (strstr(result->value, "all")) { memset(c->framerate_app, 1, sizeof(c->framerate_app)); - _D("framerate app is All"); + _D("'framerate app' is all"); } } else if (MATCH(result->name, "ControlDisplay")) { c->control_display = (MATCH(result->value, "yes") ? 1 : 0); - _D("ControlDisplay is %d", c->control_display); + _D("'ControlDisplay' is %d.", c->control_display); } else if (MATCH(result->name, "PowerKeyDoublePressSupport")) { c->powerkey_doublepress = (MATCH(result->value, "yes") ? 1 : 0); - _D("PowerKeyDoublePressSupport is %d", c->powerkey_doublepress); + _D("'PowerKeyDoublePressSupport' is %d.", c->powerkey_doublepress); } else if (MATCH(result->name, "AccelSensorOn")) { c->accel_sensor_on = (MATCH(result->value, "yes") ? 1 : 0); - _D("AccelSensorOn is %d", c->accel_sensor_on); + _D("'AccelSensorOn' is %d.", c->accel_sensor_on); } else if (MATCH(result->name, "ContinuousSampling")) { c->continuous_sampling = (MATCH(result->value, "yes") ? 1 : 0); - _D("ContinuousSampling is %d", c->continuous_sampling); + _D("'ContinuousSampling' is %d.", c->continuous_sampling); } else if (MATCH(result->name, "TimeoutEnable")) { c->timeout_enable = (MATCH(result->value, "yes") ? true : false); - _D("Timeout is %s", c->timeout_enable ? "enalbed" : "disabled"); + _D("'Timeout' is %s.", c->timeout_enable ? "enalbed" : "disabled"); } else if (MATCH(result->name, "InputSupport")) { c->input_support = (MATCH(result->value, "yes") ? true : false); - _D("Input is %s", c->input_support ? "supported" : "NOT supported"); + _D("'Input' is %s.", c->input_support ? "supported" : "NOT supported"); } return 0; @@ -2137,11 +2136,11 @@ static int display_load_config(struct parse_result *result, void *user_data) static bool check_wm_ready(void) { if (access("/run/.wm_ready", F_OK) == 0) { - _I("Window manager is ready"); + _I("Window manager is ready."); return true; } - _I("Window manager is not ready"); + _I("Window manager is not ready."); return false; } @@ -2175,7 +2174,7 @@ static void add_timer_for_wm_ready(void) { guint id = g_timeout_add(500/* milliseconds */, lcd_on_wm_ready, NULL); if (id == 0) - _E("Failed to add wm_ready timeout"); + _E("Failed to add wm_ready timeout."); } /** @@ -2208,7 +2207,7 @@ static void display_init(void *data) int timeout = 0; bool wm_ready; - _I("Start power manager"); + _I("Start power manager."); signal(SIGHUP, sig_hup); @@ -2217,7 +2216,7 @@ static void display_init(void *data) /* load configutation */ ret = config_parse(DISPLAY_CONF_FILE, display_load_config, &display_conf); if (ret < 0) - _W("Failed to load %s, %d Use default value!", + _W("Failed to load '%s', use default value: %d", DISPLAY_CONF_FILE, ret); register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); @@ -2236,7 +2235,7 @@ static void display_init(void *data) ret = init_sysfs(); break; case INIT_POLL: - _I("input init"); + _I("Input init."); pm_callback = poll_callback; if (display_conf.input_support) ret = init_input(); @@ -2244,12 +2243,12 @@ static void display_init(void *data) ret = 0; break; case INIT_DBUS: - _I("dbus init"); + _I("Dbus init."); ret = init_pm_dbus(); break; } if (ret != 0) { - _E("%s", errMSG[i]); + _E("Failed to init: %s", errMSG[i]); break; } } @@ -2272,11 +2271,11 @@ static void display_init(void *data) add_timer_for_wm_ready(); if (display_conf.lcd_always_on) { - _I("LCD always on!"); + _I("LCD always on."); trans_table[S_NORMAL][EVENT_TIMEOUT] = S_NORMAL; } - _I("Start Power managing without noti"); + _I("Start Power managing without noti."); if (power_ops.get_power_lock_support()) power_ops.power_lock(); @@ -2353,7 +2352,7 @@ static void display_exit(void *data) /* free display service */ display_service_free(); - _I("Stop power manager"); + _I("Stop power manager."); } static int display_start(enum device_flags flags) diff --git a/plugins/mobile/display/device-interface.c b/plugins/mobile/display/device-interface.c old mode 100644 new mode 100755 index 3e7144f..a9088ac --- a/plugins/mobile/display/device-interface.c +++ b/plugins/mobile/display/device-interface.c @@ -106,7 +106,7 @@ static int bl_brt(int brightness, int delay) usleep(delay); if (force_brightness > 0) { - _I("brightness(%d), force brightness(%d)", + _I("brightness=%d force brightness=%d", brightness, force_brightness); brightness = force_brightness; } @@ -114,7 +114,7 @@ static int bl_brt(int brightness, int delay) /* Update device brightness */ ret = backlight_ops.set_brightness(brightness); - _I("set brightness %d, %d", brightness, ret); + _I("Set brightness(%d): %d", brightness, ret); return ret; } @@ -125,13 +125,13 @@ static int system_suspend(void) _I("system suspend"); ret = sys_set_str(POWER_STATE_PATH, "mem"); - _I("system resume (result : %d)", ret); + _I("System resume: %d", ret); return 0; } static int system_enable_autosleep(void) { - _I("system autosleep enabled"); + _I("System autosleep enabled."); return sys_set_str(POWER_AUTOSLEEP_PATH, "mem"); } @@ -141,7 +141,7 @@ static int system_power_lock(void) const struct device_ops *dev; int ret; - _I("system power lock"); + _I("system power lock."); ret = sys_set_str(POWER_LOCK_PATH, "mainlock"); /* Devices Resume */ @@ -164,7 +164,7 @@ static int system_power_unlock(void) dev->suspend(); } - _I("system power unlock"); + _I("system power unlock."); return sys_set_str(POWER_UNLOCK_PATH, "mainlock"); } @@ -182,7 +182,7 @@ static int system_get_power_lock_support(void) else power_lock_support = true; - _I("system power lock : %s", + _I("system power lock: %s", (power_lock_support ? "support" : "not support")); out: @@ -235,14 +235,14 @@ void change_brightness(int start, int end, int step) ret = backlight_ops.get_brightness(&prev); if (ret < 0) { - _E("fail to get brightness : %d", ret); + _E("Failed to get brightness: %d", ret); return; } if (prev == end) return; - _D("start %d end %d step %d", start, end, step); + _D("start=%d end=%d step=%d", start, end, step); diff = end - start; @@ -271,7 +271,7 @@ static int backlight_on(enum device_flags flags) ret = bl_onoff(DPMS_ON); if (ret < 0) - _E("Failed to turn on backlight"); + _E("Failed to turn on backlight."); if (flags & LCD_PHASED_TRANSIT_MODE) change_brightness(LCD_PHASED_MIN_BRIGHTNESS, @@ -295,7 +295,7 @@ static int backlight_off(enum device_flags flags) ret = bl_onoff(DPMS_OFF); if (ret < 0) - _E("Failed to turn off backlight"); + _E("Failed to turn off backlight."); return ret; } @@ -306,7 +306,7 @@ static int backlight_dim(void) int brightness; if (vconf_get_int(VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS, &brightness) != 0) { - _E("Failed to get VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS value"); + _E("Failed to get VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS value."); return -EPERM; } @@ -353,7 +353,7 @@ static int custom_backlight_update(void) if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) { ret = backlight_dim(); } else { - _I("custom brightness restored! %d", custom_brightness); + _I("Custom brightness(%d) restored.", custom_brightness); ret = bl_brt(custom_brightness, 0); } @@ -375,7 +375,7 @@ static int backlight_update(void) int ret = 0; if (get_custom_status()) { - _I("custom brightness mode! brt no updated"); + _I("Custom brightness mode. brt no updated."); return 0; } if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) @@ -452,7 +452,7 @@ static int get_max_brightness(void) return max; if (!display_dev) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } @@ -463,7 +463,7 @@ static int get_max_brightness(void) ret = display_dev->get_max_brightness(&max); if (ret < 0) { - _E("Failed to get max brightness (%d)", ret); + _E("Failed to get max brightness: %d", ret); return ret; } @@ -475,13 +475,13 @@ static int set_brightness(int val) int max; if (!display_dev || !display_dev->set_brightness) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } max = get_max_brightness(); if (max < 0) { - _E("Failed to get max brightness"); + _E("Failed to get max brightness."); return max; } @@ -499,7 +499,7 @@ static int get_brt_normalized(int brt_raw) max = get_max_brightness(); if (max < 0) { - _E("Failed to get max brightness"); + _E("Failed to get max brightness."); return max; } @@ -527,13 +527,13 @@ static int get_brightness(int *val) int brt, ret; if (!display_dev || !display_dev->get_brightness) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } ret = display_dev->get_brightness(&brt); if (ret < 0) { - _E("failed to get brightness (%d)", ret); + _E("Failed to get brightness: %d", ret); return ret; } @@ -551,7 +551,7 @@ static int get_brightness_by_light_sensor(float lmax, float lmin, float light, i ret = display_dev->get_auto_brightness(lmax, lmin, light, &brt_raw); if (ret < 0) { - _E("failed to get brightness by light sensor(%d)", ret); + _E("Failed to get brightness by light sensor: %d", ret); return ret; } @@ -583,12 +583,12 @@ static int set_frame_rate(int rate) if (fmin < 0) { ret = display_dev->get_min_frame_rate(&fmin); if (ret < 0) { - _E("Failed to get min frate rate (%d)", ret); + _E("Failed to get min frate rate: %d", ret); return ret; } } if (rate < fmin) { - _E("Invalid rate(%d)! (Valid rate: %d <= rate)", rate, fmin); + _E("Invalid rate(%d). (Valid rate: %d <= rate)", rate, fmin); return -EINVAL; } } @@ -597,12 +597,12 @@ static int set_frame_rate(int rate) if (fmax < 0) { ret = display_dev->get_max_frame_rate(&fmax); if (ret < 0) { - _E("Failed to get max frate rate (%d)", ret); + _E("Failed to get max frate rate: %d", ret); return ret; } } if (rate > fmax) { - _E("Invalid rate(%d)! (Valid rate: rate <= %d)", rate, fmax); + _E("Invalid rate(%d). (Valid rate: rate <= %d)", rate, fmax); return -EINVAL; } } @@ -651,22 +651,22 @@ int display_service_load(void) r = hw_get_info(DISPLAY_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (r < 0) { - _I("display shared library is not supported: %d", r); + _I("Display shared library is not supported: %d", r); return -ENODEV; } if (!info->open) { - _E("fail to open display device : open(NULL)"); + _E("Failed to open display device: open(NULL)"); return -EPERM; } r = info->open(info, NULL, (struct hw_common **)&display_dev); if (r < 0) { - _E("fail to get display device structure : %d", r); + _E("Failed to get display device structure: %d", r); return -EPERM; } - _D("display device structure load success"); + _D("Display device structure load success."); return 0; } diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c old mode 100644 new mode 100755 index 37d3c50..639b8c7 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -236,7 +236,7 @@ static void set_process_active(bool flag, pid_t pid) RESOURCED_METHOD_ACTIVE, g_variant_new("(si)", (flag ? ACTIVE_ACT : INACTIVE_ACT), pid)); if (ret < 0) - _E("Fail to send dbus signal to resourced!!"); + _E("Failed to send dbus signal to resourced."); } bool check_lock_state(int state) @@ -254,37 +254,37 @@ bool check_lock_state(int state) void change_state_action(enum state_t state, int (*func)(int timeout)) { - _I("[%s] action is changed", states[state].name); + _I("[%s] 'action' is changed.", states[state].name); states[state].action = func; } void change_state_trans(enum state_t state, int (*func)(int evt)) { - _I("[%s] trans is changed", states[state].name); + _I("[%s] 'trans' is changed.", states[state].name); states[state].trans = func; } void change_state_check(enum state_t state, int (*func)(int curr, int next)) { - _I("[%s] check is changed", states[state].name); + _I("[%s] 'check' is changed.", states[state].name); states[state].check = func; } void change_state_name(enum state_t state, char *name) { - _I("[%s] name is changed", states[state].name); + _I("[%s] 'name' is changed.", states[state].name); states[state].name = name; } void change_trans_table(enum state_t state, enum state_t next) { - _I("[%s] timeout trans table is changed", states[state].name); + _I("[%s] 'timeout trans table' is changed.", states[state].name); trans_table[state][EVENT_TIMEOUT] = next; } void change_proc_change_state(int (*func)(unsigned int cond, pid_t pid)) { - _I("proc change state is changed"); + _I("'proc change state' is changed."); proc_change_state = func; } @@ -294,7 +294,7 @@ static void broadcast_lcd_on(enum signal_type type, enum device_flags flags) const char *signal; if (type <= SIGNAL_INVALID || type >= SIGNAL_MAX) { - _E("invalid signal type %d", type); + _E("Invalid signal type(%d).", type); return; } @@ -310,7 +310,7 @@ static void broadcast_lcd_on(enum signal_type type, enum device_flags flags) str = UNKNOWN_STR; signal = lcdon_sig_lookup[type]; - _I("lcdstep : broadcast %s %s", signal, str); + _I("lcdstep : Broadcast signal(%s:%s).", signal, str); dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, signal, @@ -323,7 +323,7 @@ static void broadcast_lcd_off(enum signal_type type, enum device_flags flags) const char *signal; if (type <= SIGNAL_INVALID || type >= SIGNAL_MAX) { - _E("invalid signal type %d", type); + _E("Invalid signal type(%d).", type); return; } @@ -338,7 +338,7 @@ static void broadcast_lcd_off(enum signal_type type, enum device_flags flags) else str = UNKNOWN_STR; - _I("lcdstep : broadcast %s", signal); + _I("lcdstep : Broadcast signal(%s).", signal); dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, signal, @@ -473,7 +473,7 @@ inline void lcd_off_procedure(enum device_flags flag) void set_stay_touchscreen_off(int val) { - _D("stay touch screen off : %d", val); + _D("stay touch screen off: %d", val); stay_touchscreen_off = val; lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); @@ -482,7 +482,7 @@ void set_stay_touchscreen_off(int val) void set_lcd_paneloff_mode(int val) { - _D("lcd paneloff mode : %d", val); + _D("lcd paneloff mode: %d", val); lcd_paneloff_mode = val; lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); @@ -548,7 +548,7 @@ static PmLockNode *add_node(enum state_t s_index, pid_t pid, guint timeout_id, n = (PmLockNode *) malloc(sizeof(PmLockNode)); if (n == NULL) { - _E("Not enough memory, add cond. fail"); + _E("Failed to add cond. Not enough memory."); return NULL; } @@ -598,9 +598,9 @@ static void print_node(int next) ctime_r(&n->time, buf); if (diff > LOCK_TIME_WARNING) - _W("over %.0f s, pid: %5d, lock time: %s", diff, n->pid, buf); + _W("over=%.0f s pid=%5d locktime=%s", diff, n->pid, buf); else - _I("pid: %5d, lock time: %s", n->pid, buf); + _I("pid=%5d locktime=%s", n->pid, buf); } } @@ -617,7 +617,7 @@ void get_pname(pid_t pid, char *pname) cmdline = open(buf, O_RDONLY); if (cmdline < 0) { pname[0] = '\0'; - _E("%d does not exist now(may be dead without unlock)", pid); + _E("Process(%d) does not exist now(may be dead without unlock).", pid); return; } @@ -641,7 +641,7 @@ static void del_state_cond(void *data, enum state_t state) /* A passed data is a pid_t type data, not a 64bit data. */ pid = (pid_t)((intptr_t)data); - _I("delete prohibit dim condition by timeout (%d)", pid); + _I("Delete process(%d)'s prohibit dim condition by timeout.", pid); tmp = find_node(state, pid); del_node(state, tmp); @@ -678,7 +678,7 @@ gboolean timeout_handler(void *data) { int run_timeout; - _I("Time out state %s\n", states[pm_cur_state].name); + _I("Time out state %s.\n", states[pm_cur_state].name); /* default setting */ get_run_timeout(&run_timeout); @@ -686,7 +686,7 @@ gboolean timeout_handler(void *data) * if the run_timeout is zero, it regards AlwaysOn state */ if (pm_cur_state == S_NORMAL && (run_timeout == 0 || display_conf.lcd_always_on)) { - _D("run_timeout is always on"); + _D("'run_timeout' is always on."); return G_SOURCE_CONTINUE; } @@ -704,7 +704,7 @@ void reset_timeout(int timeout) if (!display_conf.timeout_enable) return; - _I("Reset Timeout (%d)ms", timeout); + _I("Reset timeout(%d ms)", timeout); if (timeout_src_id != 0) { g_source_remove(timeout_src_id); timeout_src_id = 0; @@ -745,7 +745,7 @@ static int get_lcd_timeout_from_settings(void) if (val > 0) states[i].timeout = val; - _I("%s state : %d ms timeout", states[i].name, + _I("state=%s timeout=%d ms", states[i].name, states[i].timeout); } @@ -759,7 +759,7 @@ static void update_display_time(void) /* first priority : s cover */ if (!hallic_open) { states[S_NORMAL].timeout = S_COVER_TIMEOUT; - _I("S cover closed : timeout is set by normal(%d ms)", + _I("S cover closed: Timeout(%d ms) is set by normal.", S_COVER_TIMEOUT); return; } @@ -768,7 +768,7 @@ static void update_display_time(void) if (custom_normal_timeout > 0) { states[S_NORMAL].timeout = custom_normal_timeout; states[S_LCDDIM].timeout = custom_dim_timeout; - _I("CUSTOM : timeout is set by normal(%d ms), dim(%d ms)", + _I("CUSTOM: Timeout(%d ms) and dim(%d ms) are set by normal.", custom_normal_timeout, custom_dim_timeout); return; } @@ -778,7 +778,7 @@ static void update_display_time(void) !get_lock_screen_bg_state()) { /* timeout is different according to key or event. */ states[S_NORMAL].timeout = lock_screen_timeout; - _I("LOCK : timeout is set by normal(%d ms)", + _I("LOCK: Timeout(%d ms) is set by normal.", lock_screen_timeout); return; } @@ -791,7 +791,7 @@ static void update_display_time(void) */ if (run_timeout == 0 || display_conf.lcd_always_on) { run_timeout = ALWAYS_ON_TIMEOUT; - _I("LCD Always On"); + _I("LCD always on."); } states[S_NORMAL].timeout = run_timeout; @@ -799,8 +799,7 @@ static void update_display_time(void) get_dim_timeout(&val); states[S_LCDDIM].timeout = val; - _I("Normal: NORMAL timeout is set by %d ms", states[S_NORMAL].timeout); - _I("Normal: DIM timeout is set by %d ms", states[S_LCDDIM].timeout); + _I("Normal: timeout(%d ms) and dim(%d ms) are set.", states[S_NORMAL].timeout, states[S_LCDDIM].timeout); } static void update_display_locktime(int time) @@ -812,7 +811,7 @@ static void update_display_locktime(int time) void set_dim_state(bool on) { - _I("dim state is %d", on); + _I("Dim state is %d.", on); update_display_time(); states[pm_cur_state].trans(EVENT_INPUT); } @@ -827,7 +826,7 @@ void lcd_on_direct(enum device_flags flags) power_ops.power_lock(); #ifdef MICRO_DD - _D("lcd is on directly"); + _D("Lcd is on directly."); gettimeofday(&lcdon_tv, NULL); lcd_on_procedure(LCD_NORMAL, flags); reset_timeout(DD_LCDOFF_INPUT_TIMEOUT); @@ -835,7 +834,7 @@ void lcd_on_direct(enum device_flags flags) ret = vconf_get_int(VCONFKEY_CALL_STATE, &call_state); if ((ret >= 0 && call_state != VCONFKEY_CALL_OFF) || (__get_lock_screen_state() == VCONFKEY_IDLE_LOCK)) { - _D("LOCK state, lcd is on directly"); + _D("LOCK state, lcd is on directly."); lcd_on_procedure(LCD_NORMAL, flags); } reset_timeout(display_conf.lcdoff_timeout); @@ -861,7 +860,7 @@ int custom_lcdon(int timeout) if (check_lcd_is_on() == false) lcd_on_direct(LCD_ON_BY_GESTURE); - _I("custom lcd on %d ms", timeout); + _I("Custom lcd on timeout(%d ms).", timeout); if (set_custom_lcdon_timeout(timeout) == true) update_display_time(); @@ -899,7 +898,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) enum state_t next; next = GET_COND_STATE(cond); - _I("Change State to %s (%d)", states[next].name, pid); + _I("Change process(%d) state to %s.", pid, states[next].name); switch (next) { case S_NORMAL: @@ -978,7 +977,7 @@ static void proc_condition_lock(PMMsg *data) states[state].timeout_cb, (void*)((intptr_t)pid)); if (!cond_timeout_id) - _E("Failed to register display timer"); + _E("Failed to register display timer."); } holdkey_block = GET_COND_FLAG(data->cond) & PM_FLAG_BLOCK_HOLDKEY; @@ -995,7 +994,7 @@ static void proc_condition_lock(PMMsg *data) set_process_active(TRUE, pid); /* for debug */ - _SD("[%s] locked by pid %d - process %s holdkeyblock %d\n", + _SD("[%s] Locked by pid=%d process=%s holdkeyblock=%d\n", states[state].name, pid, pname, holdkey_block); set_lock_time(pname, state); @@ -1024,7 +1023,7 @@ static void proc_condition_unlock(PMMsg *data) if (ambient_get_state()) ambient_check_invalid_state(pid); - _SD("[%s] unlocked by pid %d - process %s\n", + _SD("[%s] Unlocked by pid=%d process=%s\n", states[state].name, pid, pname); set_unlock_time(pname, state); @@ -1049,12 +1048,12 @@ static int proc_condition(PMMsg *data) /* guard time for suspend */ if (pm_cur_state == S_LCDOFF) { reset_timeout(states[S_LCDOFF].timeout); - _I("Margin timeout (%d ms)", states[S_LCDOFF].timeout); + _I("Margin timeout(%d ms)", states[S_LCDOFF].timeout); } } else { if (flags & PM_FLAG_RESET_TIMER) { reset_timeout(states[pm_cur_state].timeout); - _I("Reset timeout (%d ms)", states[pm_cur_state].timeout); + _I("Reset timeout(%d ms)", states[pm_cur_state].timeout); } } @@ -1073,8 +1072,8 @@ int check_processes(enum state_t prohibit_state) DD_LIST_FOREACH_SAFE(cond_head[prohibit_state], elem, next, t) { if (t->pid < INTERNAL_LOCK_BASE && kill(t->pid, 0) == -1) { - _E("%d process does not exist, delete the REQ" - " - prohibit state %d ", + _E("Process(%d) does not exist, delete the REQ" + " - prohibit state=%d.", t->pid, prohibit_state); if (t->pid == custom_change_pid) { get_lcd_timeout_from_settings(); @@ -1095,10 +1094,10 @@ int check_holdkey_block(enum state_t state) PmLockNode *t; int ret = 0; - _I("check holdkey block : state of %s", states[state].name); + _I("Check holdkey block: state of %s", states[state].name); if (custom_holdkey_block == true) { - _I("custom hold key blocked by pid(%d)", + _I("Custom hold key blocked by pid(%d).", custom_change_pid); return 1; } @@ -1106,7 +1105,7 @@ int check_holdkey_block(enum state_t state) DD_LIST_FOREACH(cond_head[state], elem, t) { if (t->holdkey_block == true) { ret = 1; - _I("Hold key blocked by pid(%d)!", t->pid); + _I("Hold key blocked by pid(%d).", t->pid); break; } } @@ -1121,7 +1120,7 @@ int delete_condition(enum state_t state) pid_t pid; char pname[PATH_MAX]; - _I("delete condition : state of %s", states[state].name); + _I("Delete condition: state of %s", states[state].name); if (!cond_head[state]) return 0; @@ -1134,7 +1133,7 @@ int delete_condition(enum state_t state) pid = t->pid; if (state == S_LCDOFF) set_process_active(FALSE, pid); - _I("delete node of pid(%d)", pid); + _I("Delete node of pid(%d).", pid); del_node(state, t); get_pname(pid, pname); set_unlock_time(pname, state-1); @@ -1150,13 +1149,13 @@ void update_lcdoff_source(int source) { switch (source) { case VCONFKEY_PM_LCDOFF_BY_TIMEOUT: - _I("LCD OFF by timeout"); + _I("LCD OFF by timeout."); break; case VCONFKEY_PM_LCDOFF_BY_POWERKEY: - _I("LCD OFF by powerkey"); + _I("LCD OFF by powerkey."); break; default: - _E("Invalid value(%d)", source); + _E("Invalid value(%d).", source); return; } vconf_set_int(VCONFKEY_PM_LCDOFF_SOURCE, source); @@ -1229,7 +1228,7 @@ void pm_history_print(int fd, int count) time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); } } #endif @@ -1253,13 +1252,13 @@ void print_info(int fd) "===========================\n"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Timeout Info: Run[%dms] Dim[%dms] Off[%dms]\n", states[S_NORMAL].timeout, states[S_LCDDIM].timeout, states[S_LCDOFF].timeout); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n", (trans_condition & MASK_NORMAL) ? states[S_NORMAL].name : "-", @@ -1267,18 +1266,18 @@ void print_info(int fd) (trans_condition & MASK_OFF) ? states[S_LCDOFF].name : "-"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Current State: %s\n", states[pm_cur_state].name); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Current Lock Conditions: \n"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); for (s_index = S_NORMAL; s_index < S_END; s_index++) { DD_LIST_FOREACH(cond_head[s_index], elem, t) { @@ -1289,7 +1288,7 @@ void print_info(int fd) i++, states[s_index].name, t->pid, pname, time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); } } @@ -1307,7 +1306,7 @@ void save_display_log(void) time_t now_time; char time_buf[30]; - _D("internal state is saved!"); + _D("Internal state is saved."); time(&now_time); ctime_r(&now_time, time_buf); @@ -1319,18 +1318,18 @@ void save_display_log(void) (int)now_time, time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "pm_status_flag: %x\n", pm_status_flag); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "screen lock status : %d\n", __get_lock_screen_state()); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); print_info(fd); close(fd); } @@ -1373,7 +1372,7 @@ int check_lcdoff_direct(void) if (ret >= 0 && cradle == DOCK_SOUND) return false; - _D("Goto LCDOFF direct(%d,%d,%d)", lock, hdmi_state, cradle); + _D("Goto LCDOFF direct(lock=%d hdmi=%d cradle=%d).", lock, hdmi_state, cradle); return true; } @@ -1402,7 +1401,7 @@ static int default_trans(int evt) /* check conditions */ while (st->check && !st->check(pm_cur_state, next_state)) { /* There is a condition. */ - _I("(%s) locked. Trans to (%s) failed", states[pm_cur_state].name, + _I("%s locked. Trans to %s failed.", states[pm_cur_state].name, states[next_state].name); if (!check_processes(pm_cur_state)) { /* This is valid condition @@ -1506,7 +1505,7 @@ static int default_action(int timeout) struct timeval now_tv; if (status != DEVICE_OPS_STATUS_START) { - _E("display is not started!"); + _E("Display is not started."); return -EINVAL; } @@ -1524,7 +1523,7 @@ static int default_action(int timeout) time(&last_update_time); last_timeout = timeout; } else { - _I("timout set: %s state %d ms", + _I("Timout set: %s state %d ms", states[pm_cur_state].name, timeout); } } @@ -1539,7 +1538,7 @@ static int default_action(int timeout) if (pm_old_state == S_NORMAL && pm_cur_state != S_NORMAL) { time(&now); diff = difftime(now, last_update_time); - _I("S_NORMAL is changed to %s [%d ms, %.0f s]", + _I("S_NORMAL is changed to %s (timeout=%d ms diff=%.0f s).", states[pm_cur_state].name, last_timeout, diff); } @@ -1592,15 +1591,15 @@ static int default_action(int timeout) if (!power_ops.get_power_lock_support()) { /* sleep state : set system mode to SUSPEND */ if (power_ops.get_wakeup_count(&wakeup_count) < 0) - _E("wakeup count read error"); + _E("Wakeup count read error."); if (wakeup_count < 0) { - _I("Wakup Event! Can not enter suspend mode."); + _I("Wakup Event. Can not enter suspend mode."); goto go_lcd_off; } if (power_ops.set_wakeup_count(wakeup_count) < 0) { - _E("wakeup count write error"); + _E("Wakeup count write error."); goto go_lcd_off; } } @@ -1618,7 +1617,7 @@ go_suspend: power_ops.enable_autosleep(); if (power_ops.power_unlock() < 0) - _E("power unlock state error!"); + _E("Power unlock state error."); } else { dd_list *elem, *elem_n; const struct device_ops *dev; @@ -1636,7 +1635,7 @@ go_suspend: dev->resume(); } - _I("system wakeup!!"); + _I("System wakeup."); disp_plgn.system_wakeup_flag = true; /* Resume !! */ if (power_ops.check_wakeup_src() == EVENT_DEVICE) @@ -1712,13 +1711,13 @@ static int poll_callback(int condition, PMMsg *data) time_t now; if (status != DEVICE_OPS_STATUS_START) { - _E("display logic is not started!"); + _E("Display logic is not started."); return -ECANCELED; } if (condition == INPUT_POLL_EVENT) { if (pm_cur_state == S_LCDOFF || pm_cur_state == S_SLEEP) - _I("Power key input"); + _I("Power key input."); time(&now); if (last_t != now || pm_cur_state == S_LCDOFF || @@ -1792,12 +1791,12 @@ static int update_setting(int key_idx, int val) pm_status_flag |= BRTCH_FLAG; vconf_set_bool(VCONFKEY_PM_BRIGHTNESS_CHANGED_IN_LPM, true); - _I("brightness changed in low battery," - "escape dim state"); + _I("Brightness changed in low battery," + "escape dim state."); } backlight_ops.set_default_brt(val); snprintf(buf, sizeof(buf), "%d", val); - _D("Brightness set in bl : %d", val); + _D("Brightness set in bl(%d).", val); launch_evenif_exist(SET_BRIGHTNESS_IN_BOOTLOADER, buf); break; case SETTING_LOCK_SCREEN: @@ -1862,13 +1861,13 @@ static void check_seed_status(void) ret = get_setting_brightness(&tmp); if (ret != 0 || (tmp < PM_MIN_BRIGHTNESS || tmp > PM_MAX_BRIGHTNESS)) { - _I("fail to read vconf value for brightness"); + _I("Failed 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; } - _I("Set brightness from Setting App. %d", tmp); + _I("Set brightness(%d) from setting app.", tmp); backlight_ops.set_default_brt(tmp); vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state); @@ -1884,8 +1883,8 @@ static void check_seed_status(void) set_lock_screen_state(lock_state); if (lock_state == VCONFKEY_IDLE_LOCK) { states[S_NORMAL].timeout = lock_screen_timeout; - _I("LCD NORMAL timeout is set by %d ms" - " for lock screen", lock_screen_timeout); + _I("LCD NORMAL timeout(%d ms) is set" + " for lock screen.", lock_screen_timeout); } return; @@ -1938,13 +1937,13 @@ static const char *errMSG[INIT_END] = { int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) { if (on == 0 && dim == 0) { - _I("LCD timeout changed : default setting"); + _I("LCD timeout changed: default setting"); custom_normal_timeout = custom_dim_timeout = 0; } else if (on < 0 || dim < 0) { - _E("fail to set value (%d,%d)", on, dim); + _E("Failed to set value(on=%d dim=%d).", on, dim); return -EINVAL; } else { - _I("LCD timeout changed : on(%ds), dim(%ds)", on, dim); + _I("LCD timeout changed: on=%ds dim=%ds", on, dim); custom_normal_timeout = SEC_TO_MSEC(on); custom_dim_timeout = SEC_TO_MSEC(dim); } @@ -1955,10 +1954,10 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) if (holdkey_block) { custom_holdkey_block = true; - _I("hold key disabled !"); + _I("Hold key disabled."); } else { custom_holdkey_block = false; - _I("hold key enabled !"); + _I("Hold key enabled."); } if (custom_change_name) { @@ -1973,7 +1972,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) custom_change_name = strndup(name, strlen(name)); if (!custom_change_name) { - _E("Malloc falied!"); + _E("Failed to malloc."); custom_normal_timeout = custom_dim_timeout = 0; custom_holdkey_block = false; return -ENOMEM; @@ -1996,7 +1995,7 @@ void reset_lcd_timeout(GDBusConnection *conn, if (strcmp(sender, custom_change_name)) return; - _I("reset lcd timeout %s: set default timeout", sender); + _I("reset lcd timeout: Set default timeout. sender=%s", sender); free(custom_change_name); custom_change_name = 0; @@ -2019,7 +2018,7 @@ static int booting_done(void *data) if (!done) return done; - _I("booting done. Release display and power lock"); + _I("Booting done. Release display and power lock."); if (disp_plgn.pm_unlock_internal) { disp_plgn.pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN); disp_plgn.pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_NORMAL, PM_SLEEP_MARGIN); @@ -2052,7 +2051,7 @@ static int process_background(void *data) node = find_node(S_NORMAL, pid); if (node) { node->background = true; - _I("%d pid is background, then PM will be unlocked LCD_NORMAL", pid); + _I("Process(%d) is background, then PM will be unlocked LCD_NORMAL.", pid); } return 0; @@ -2068,7 +2067,7 @@ static int process_foreground(void *data) node = find_node(S_NORMAL, pid); if (node) { node->background = false; - _I("%d pid is foreground, then PM will be maintained locked LCD_NORMAL", pid); + _I("Process(%d) is foreground, then PM will be maintained locked LCD_NORMAL.", pid); } return 0; @@ -2078,7 +2077,7 @@ static int display_load_config(struct parse_result *result, void *user_data) { struct display_config *c = user_data; - _D("%s,%s,%s", result->section, result->name, result->value); + _D("display_load_config: section=%s name=%s value=%s", result->section, result->name, result->value); if (!c) return -EINVAL; @@ -2088,49 +2087,49 @@ static int display_load_config(struct parse_result *result, void *user_data) if (MATCH(result->name, "LockScreenWaitingTime")) { SET_CONF(c->lock_wait_time, atof(result->value)); - _D("lock wait time is %.3f", c->lock_wait_time); + _D("'lock wait time' is %.3f.", c->lock_wait_time); } else if (MATCH(result->name, "LongPressInterval")) { SET_CONF(c->longpress_interval, atof(result->value)); - _D("long press interval is %.3f", c->longpress_interval); + _D("'long press interval' is %.3f.", c->longpress_interval); } else if (MATCH(result->name, "LightSensorSamplingInterval")) { SET_CONF(c->lightsensor_interval, atof(result->value)); - _D("lightsensor interval is %.3f", c->lightsensor_interval); + _D("'lightsensor interval' is %.3f.", c->lightsensor_interval); } else if (MATCH(result->name, "LCDOffTimeout")) { SET_CONF(c->lcdoff_timeout, atoi(result->value)); - _D("lcdoff timeout is %d ms", c->lcdoff_timeout); + _D("'lcdoff timeout' is %d ms.", c->lcdoff_timeout); } else if (MATCH(result->name, "BrightnessChangeStep")) { SET_CONF(c->brightness_change_step, atoi(result->value)); - _D("brightness change step is %d", c->brightness_change_step); + _D("'brightness change step' is %d.", c->brightness_change_step); } else if (MATCH(result->name, "LCDAlwaysOn")) { c->lcd_always_on = (MATCH(result->value, "yes") ? 1 : 0); - _D("LCD always on is %d", c->lcd_always_on); + _D("'LCD always on' is %d.", c->lcd_always_on); } else if (MATCH(result->name, "ChangedFrameRateAllowed")) { if (strstr(result->value, "setting")) { c->framerate_app[REFRESH_SETTING] = 1; - _D("framerate app is Setting"); + _D("'framerate app' is setting"); } if (strstr(result->value, "all")) { memset(c->framerate_app, 1, sizeof(c->framerate_app)); - _D("framerate app is All"); + _D("'framerate app' is all"); } } else if (MATCH(result->name, "ControlDisplay")) { c->control_display = (MATCH(result->value, "yes") ? 1 : 0); - _D("ControlDisplay is %d", c->control_display); + _D("'ControlDisplay' is %d.", c->control_display); } else if (MATCH(result->name, "PowerKeyDoublePressSupport")) { c->powerkey_doublepress = (MATCH(result->value, "yes") ? 1 : 0); - _D("PowerKeyDoublePressSupport is %d", c->powerkey_doublepress); + _D("'PowerKeyDoublePressSupport' is %d.", c->powerkey_doublepress); } else if (MATCH(result->name, "AccelSensorOn")) { c->accel_sensor_on = (MATCH(result->value, "yes") ? 1 : 0); - _D("AccelSensorOn is %d", c->accel_sensor_on); + _D("'AccelSensorOn' is %d.", c->accel_sensor_on); } else if (MATCH(result->name, "ContinuousSampling")) { c->continuous_sampling = (MATCH(result->value, "yes") ? 1 : 0); - _D("ContinuousSampling is %d", c->continuous_sampling); + _D("'ContinuousSampling' is %d.", c->continuous_sampling); } else if (MATCH(result->name, "TimeoutEnable")) { c->timeout_enable = (MATCH(result->value, "yes") ? true : false); - _D("Timeout is %s", c->timeout_enable ? "enalbed" : "disabled"); + _D("'Timeout' is %s.", c->timeout_enable ? "enalbed" : "disabled"); } else if (MATCH(result->name, "InputSupport")) { c->input_support = (MATCH(result->value, "yes") ? true : false); - _D("Input is %s", c->input_support ? "supported" : "NOT supported"); + _D("'Input' is %s.", c->input_support ? "supported" : "NOT supported"); } return 0; @@ -2139,11 +2138,11 @@ static int display_load_config(struct parse_result *result, void *user_data) static bool check_wm_ready(void) { if (access("/run/.wm_ready", F_OK) == 0) { - _I("Window manager is ready"); + _I("Window manager is ready."); return true; } - _I("Window manager is not ready"); + _I("Window manager is not ready."); return false; } @@ -2177,7 +2176,7 @@ static void add_timer_for_wm_ready(void) { guint id = g_timeout_add(500/* milliseconds */, lcd_on_wm_ready, NULL); if (id == 0) - _E("Failed to add wm_ready timeout"); + _E("Failed to add wm_ready timeout."); } /** @@ -2210,7 +2209,7 @@ static void display_init(void *data) int timeout = 0; bool wm_ready; - _I("Start power manager"); + _I("Start power manager."); signal(SIGHUP, sig_hup); @@ -2219,7 +2218,7 @@ static void display_init(void *data) /* load configutation */ ret = config_parse(DISPLAY_CONF_FILE, display_load_config, &display_conf); if (ret < 0) - _W("Failed to load %s, %d Use default value!", + _W("Failed to load '%s', use default value: %d", DISPLAY_CONF_FILE, ret); register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); @@ -2238,7 +2237,7 @@ static void display_init(void *data) ret = init_sysfs(); break; case INIT_POLL: - _I("input init"); + _I("Input init."); pm_callback = poll_callback; if (display_conf.input_support) ret = init_input(); @@ -2246,12 +2245,12 @@ static void display_init(void *data) ret = 0; break; case INIT_DBUS: - _I("dbus init"); + _I("Dbus init."); ret = init_pm_dbus(); break; } if (ret != 0) { - _E("%s", errMSG[i]); + _E("Failed to init: %s", errMSG[i]); break; } } @@ -2274,11 +2273,11 @@ static void display_init(void *data) add_timer_for_wm_ready(); if (display_conf.lcd_always_on) { - _I("LCD always on!"); + _I("LCD always on."); trans_table[S_NORMAL][EVENT_TIMEOUT] = S_NORMAL; } - _I("Start Power managing without noti"); + _I("Start Power managing without noti."); if (power_ops.get_power_lock_support()) power_ops.power_lock(); @@ -2359,7 +2358,7 @@ static void display_exit(void *data) /* free display service */ display_service_free(); - _I("Stop power manager"); + _I("Stop power manager."); } static int display_start(enum device_flags flags) diff --git a/plugins/tv/display/device-interface.c b/plugins/tv/display/device-interface.c old mode 100644 new mode 100755 index 3e7144f..a9088ac --- a/plugins/tv/display/device-interface.c +++ b/plugins/tv/display/device-interface.c @@ -106,7 +106,7 @@ static int bl_brt(int brightness, int delay) usleep(delay); if (force_brightness > 0) { - _I("brightness(%d), force brightness(%d)", + _I("brightness=%d force brightness=%d", brightness, force_brightness); brightness = force_brightness; } @@ -114,7 +114,7 @@ static int bl_brt(int brightness, int delay) /* Update device brightness */ ret = backlight_ops.set_brightness(brightness); - _I("set brightness %d, %d", brightness, ret); + _I("Set brightness(%d): %d", brightness, ret); return ret; } @@ -125,13 +125,13 @@ static int system_suspend(void) _I("system suspend"); ret = sys_set_str(POWER_STATE_PATH, "mem"); - _I("system resume (result : %d)", ret); + _I("System resume: %d", ret); return 0; } static int system_enable_autosleep(void) { - _I("system autosleep enabled"); + _I("System autosleep enabled."); return sys_set_str(POWER_AUTOSLEEP_PATH, "mem"); } @@ -141,7 +141,7 @@ static int system_power_lock(void) const struct device_ops *dev; int ret; - _I("system power lock"); + _I("system power lock."); ret = sys_set_str(POWER_LOCK_PATH, "mainlock"); /* Devices Resume */ @@ -164,7 +164,7 @@ static int system_power_unlock(void) dev->suspend(); } - _I("system power unlock"); + _I("system power unlock."); return sys_set_str(POWER_UNLOCK_PATH, "mainlock"); } @@ -182,7 +182,7 @@ static int system_get_power_lock_support(void) else power_lock_support = true; - _I("system power lock : %s", + _I("system power lock: %s", (power_lock_support ? "support" : "not support")); out: @@ -235,14 +235,14 @@ void change_brightness(int start, int end, int step) ret = backlight_ops.get_brightness(&prev); if (ret < 0) { - _E("fail to get brightness : %d", ret); + _E("Failed to get brightness: %d", ret); return; } if (prev == end) return; - _D("start %d end %d step %d", start, end, step); + _D("start=%d end=%d step=%d", start, end, step); diff = end - start; @@ -271,7 +271,7 @@ static int backlight_on(enum device_flags flags) ret = bl_onoff(DPMS_ON); if (ret < 0) - _E("Failed to turn on backlight"); + _E("Failed to turn on backlight."); if (flags & LCD_PHASED_TRANSIT_MODE) change_brightness(LCD_PHASED_MIN_BRIGHTNESS, @@ -295,7 +295,7 @@ static int backlight_off(enum device_flags flags) ret = bl_onoff(DPMS_OFF); if (ret < 0) - _E("Failed to turn off backlight"); + _E("Failed to turn off backlight."); return ret; } @@ -306,7 +306,7 @@ static int backlight_dim(void) int brightness; if (vconf_get_int(VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS, &brightness) != 0) { - _E("Failed to get VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS value"); + _E("Failed to get VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS value."); return -EPERM; } @@ -353,7 +353,7 @@ static int custom_backlight_update(void) if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) { ret = backlight_dim(); } else { - _I("custom brightness restored! %d", custom_brightness); + _I("Custom brightness(%d) restored.", custom_brightness); ret = bl_brt(custom_brightness, 0); } @@ -375,7 +375,7 @@ static int backlight_update(void) int ret = 0; if (get_custom_status()) { - _I("custom brightness mode! brt no updated"); + _I("Custom brightness mode. brt no updated."); return 0; } if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) @@ -452,7 +452,7 @@ static int get_max_brightness(void) return max; if (!display_dev) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } @@ -463,7 +463,7 @@ static int get_max_brightness(void) ret = display_dev->get_max_brightness(&max); if (ret < 0) { - _E("Failed to get max brightness (%d)", ret); + _E("Failed to get max brightness: %d", ret); return ret; } @@ -475,13 +475,13 @@ static int set_brightness(int val) int max; if (!display_dev || !display_dev->set_brightness) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } max = get_max_brightness(); if (max < 0) { - _E("Failed to get max brightness"); + _E("Failed to get max brightness."); return max; } @@ -499,7 +499,7 @@ static int get_brt_normalized(int brt_raw) max = get_max_brightness(); if (max < 0) { - _E("Failed to get max brightness"); + _E("Failed to get max brightness."); return max; } @@ -527,13 +527,13 @@ static int get_brightness(int *val) int brt, ret; if (!display_dev || !display_dev->get_brightness) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } ret = display_dev->get_brightness(&brt); if (ret < 0) { - _E("failed to get brightness (%d)", ret); + _E("Failed to get brightness: %d", ret); return ret; } @@ -551,7 +551,7 @@ static int get_brightness_by_light_sensor(float lmax, float lmin, float light, i ret = display_dev->get_auto_brightness(lmax, lmin, light, &brt_raw); if (ret < 0) { - _E("failed to get brightness by light sensor(%d)", ret); + _E("Failed to get brightness by light sensor: %d", ret); return ret; } @@ -583,12 +583,12 @@ static int set_frame_rate(int rate) if (fmin < 0) { ret = display_dev->get_min_frame_rate(&fmin); if (ret < 0) { - _E("Failed to get min frate rate (%d)", ret); + _E("Failed to get min frate rate: %d", ret); return ret; } } if (rate < fmin) { - _E("Invalid rate(%d)! (Valid rate: %d <= rate)", rate, fmin); + _E("Invalid rate(%d). (Valid rate: %d <= rate)", rate, fmin); return -EINVAL; } } @@ -597,12 +597,12 @@ static int set_frame_rate(int rate) if (fmax < 0) { ret = display_dev->get_max_frame_rate(&fmax); if (ret < 0) { - _E("Failed to get max frate rate (%d)", ret); + _E("Failed to get max frate rate: %d", ret); return ret; } } if (rate > fmax) { - _E("Invalid rate(%d)! (Valid rate: rate <= %d)", rate, fmax); + _E("Invalid rate(%d). (Valid rate: rate <= %d)", rate, fmax); return -EINVAL; } } @@ -651,22 +651,22 @@ int display_service_load(void) r = hw_get_info(DISPLAY_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (r < 0) { - _I("display shared library is not supported: %d", r); + _I("Display shared library is not supported: %d", r); return -ENODEV; } if (!info->open) { - _E("fail to open display device : open(NULL)"); + _E("Failed to open display device: open(NULL)"); return -EPERM; } r = info->open(info, NULL, (struct hw_common **)&display_dev); if (r < 0) { - _E("fail to get display device structure : %d", r); + _E("Failed to get display device structure: %d", r); return -EPERM; } - _D("display device structure load success"); + _D("Display device structure load success."); return 0; } diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c old mode 100644 new mode 100755 index 4bffbb8..05505ef --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -234,7 +234,7 @@ static void set_process_active(bool flag, pid_t pid) RESOURCED_METHOD_ACTIVE, g_variant_new("(si)", (flag ? ACTIVE_ACT : INACTIVE_ACT), pid)); if (ret < 0) - _E("Fail to send dbus signal to resourced!!"); + _E("Failed to send dbus signal to resourced."); } bool check_lock_state(int state) @@ -252,37 +252,37 @@ bool check_lock_state(int state) void change_state_action(enum state_t state, int (*func)(int timeout)) { - _I("[%s] action is changed", states[state].name); + _I("[%s] 'action' is changed.", states[state].name); states[state].action = func; } void change_state_trans(enum state_t state, int (*func)(int evt)) { - _I("[%s] trans is changed", states[state].name); + _I("[%s] 'trans' is changed.", states[state].name); states[state].trans = func; } void change_state_check(enum state_t state, int (*func)(int curr, int next)) { - _I("[%s] check is changed", states[state].name); + _I("[%s] 'check' is changed.", states[state].name); states[state].check = func; } void change_state_name(enum state_t state, char *name) { - _I("[%s] name is changed", states[state].name); + _I("[%s] 'name' is changed.", states[state].name); states[state].name = name; } void change_trans_table(enum state_t state, enum state_t next) { - _I("[%s] timeout trans table is changed", states[state].name); + _I("[%s] 'timeout trans table' is changed.", states[state].name); trans_table[state][EVENT_TIMEOUT] = next; } void change_proc_change_state(int (*func)(unsigned int cond, pid_t pid)) { - _I("proc change state is changed"); + _I("'proc change state' is changed."); proc_change_state = func; } @@ -292,7 +292,7 @@ static void broadcast_lcd_on(enum signal_type type, enum device_flags flags) const char *signal; if (type <= SIGNAL_INVALID || type >= SIGNAL_MAX) { - _E("invalid signal type %d", type); + _E("Invalid signal type(%d).", type); return; } @@ -308,7 +308,7 @@ static void broadcast_lcd_on(enum signal_type type, enum device_flags flags) str = UNKNOWN_STR; signal = lcdon_sig_lookup[type]; - _I("lcdstep : broadcast %s %s", signal, str); + _I("lcdstep : Broadcast signal(%s:%s).", signal, str); dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, signal, @@ -321,7 +321,7 @@ static void broadcast_lcd_off(enum signal_type type, enum device_flags flags) const char *signal; if (type <= SIGNAL_INVALID || type >= SIGNAL_MAX) { - _E("invalid signal type %d", type); + _E("Invalid signal type(%d).", type); return; } @@ -336,7 +336,7 @@ static void broadcast_lcd_off(enum signal_type type, enum device_flags flags) else str = UNKNOWN_STR; - _I("lcdstep : broadcast %s", signal); + _I("lcdstep : Broadcast signal(%s).", signal); dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, signal, @@ -471,7 +471,7 @@ inline void lcd_off_procedure(enum device_flags flag) void set_stay_touchscreen_off(int val) { - _D("stay touch screen off : %d", val); + _D("stay touch screen off: %d", val); stay_touchscreen_off = val; lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); @@ -480,7 +480,7 @@ void set_stay_touchscreen_off(int val) void set_lcd_paneloff_mode(int val) { - _D("lcd paneloff mode : %d", val); + _D("lcd paneloff mode: %d", val); lcd_paneloff_mode = val; lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); @@ -546,7 +546,7 @@ static PmLockNode *add_node(enum state_t s_index, pid_t pid, guint timeout_id, n = (PmLockNode *) malloc(sizeof(PmLockNode)); if (n == NULL) { - _E("Not enough memory, add cond. fail"); + _E("Failed to add cond. Not enough memory."); return NULL; } @@ -596,9 +596,9 @@ static void print_node(int next) ctime_r(&n->time, buf); if (diff > LOCK_TIME_WARNING) - _W("over %.0f s, pid: %5d, lock time: %s", diff, n->pid, buf); + _W("over=%.0f s pid=%5d locktime=%s", diff, n->pid, buf); else - _I("pid: %5d, lock time: %s", n->pid, buf); + _I("pid=%5d locktime=%s", n->pid, buf); } } @@ -615,7 +615,7 @@ void get_pname(pid_t pid, char *pname) cmdline = open(buf, O_RDONLY); if (cmdline < 0) { pname[0] = '\0'; - _E("%d does not exist now(may be dead without unlock)", pid); + _E("Process(%d) does not exist now(may be dead without unlock).", pid); return; } @@ -639,7 +639,7 @@ static void del_state_cond(void *data, enum state_t state) /* A passed data is a pid_t type data, not a 64bit data. */ pid = (pid_t)((intptr_t)data); - _I("delete prohibit dim condition by timeout (%d)", pid); + _I("Delete process(%d)'s prohibit dim condition by timeout.", pid); tmp = find_node(state, pid); del_node(state, tmp); @@ -676,7 +676,7 @@ gboolean timeout_handler(void *data) { int run_timeout; - _I("Time out state %s\n", states[pm_cur_state].name); + _I("Time out state %s.\n", states[pm_cur_state].name); /* default setting */ get_run_timeout(&run_timeout); @@ -684,7 +684,7 @@ gboolean timeout_handler(void *data) * if the run_timeout is zero, it regards AlwaysOn state */ if (pm_cur_state == S_NORMAL && (run_timeout == 0 || display_conf.lcd_always_on)) { - _D("run_timeout is always on"); + _D("'run_timeout' is always on."); return G_SOURCE_CONTINUE; } @@ -702,7 +702,7 @@ void reset_timeout(int timeout) if (!display_conf.timeout_enable) return; - _I("Reset Timeout (%d)ms", timeout); + _I("Reset timeout(%d ms)", timeout); if (timeout_src_id != 0) { g_source_remove(timeout_src_id); timeout_src_id = 0; @@ -743,7 +743,7 @@ static int get_lcd_timeout_from_settings(void) if (val > 0) states[i].timeout = val; - _I("%s state : %d ms timeout", states[i].name, + _I("state=%s timeout=%d ms", states[i].name, states[i].timeout); } @@ -757,7 +757,7 @@ static void update_display_time(void) /* first priority : s cover */ if (!hallic_open) { states[S_NORMAL].timeout = S_COVER_TIMEOUT; - _I("S cover closed : timeout is set by normal(%d ms)", + _I("S cover closed: Timeout(%d ms) is set by normal.", S_COVER_TIMEOUT); return; } @@ -766,7 +766,7 @@ static void update_display_time(void) if (custom_normal_timeout > 0) { states[S_NORMAL].timeout = custom_normal_timeout; states[S_LCDDIM].timeout = custom_dim_timeout; - _I("CUSTOM : timeout is set by normal(%d ms), dim(%d ms)", + _I("CUSTOM: Timeout(%d ms) and dim(%d ms) are set by normal.", custom_normal_timeout, custom_dim_timeout); return; } @@ -776,7 +776,7 @@ static void update_display_time(void) !get_lock_screen_bg_state()) { /* timeout is different according to key or event. */ states[S_NORMAL].timeout = lock_screen_timeout; - _I("LOCK : timeout is set by normal(%d ms)", + _I("LOCK: Timeout(%d ms) is set by normal.", lock_screen_timeout); return; } @@ -789,7 +789,7 @@ static void update_display_time(void) */ if (run_timeout == 0 || display_conf.lcd_always_on) { run_timeout = ALWAYS_ON_TIMEOUT; - _I("LCD Always On"); + _I("LCD always on."); } states[S_NORMAL].timeout = run_timeout; @@ -797,8 +797,7 @@ static void update_display_time(void) get_dim_timeout(&val); states[S_LCDDIM].timeout = val; - _I("Normal: NORMAL timeout is set by %d ms", states[S_NORMAL].timeout); - _I("Normal: DIM timeout is set by %d ms", states[S_LCDDIM].timeout); + _I("Normal: timeout(%d ms) and dim(%d ms) are set.", states[S_NORMAL].timeout, states[S_LCDDIM].timeout); } static void update_display_locktime(int time) @@ -810,7 +809,7 @@ static void update_display_locktime(int time) void set_dim_state(bool on) { - _I("dim state is %d", on); + _I("Dim state is %d.", on); update_display_time(); states[pm_cur_state].trans(EVENT_INPUT); } @@ -825,7 +824,7 @@ void lcd_on_direct(enum device_flags flags) power_ops.power_lock(); #ifdef MICRO_DD - _D("lcd is on directly"); + _D("Lcd is on directly."); gettimeofday(&lcdon_tv, NULL); lcd_on_procedure(LCD_NORMAL, flags); reset_timeout(DD_LCDOFF_INPUT_TIMEOUT); @@ -833,7 +832,7 @@ void lcd_on_direct(enum device_flags flags) ret = vconf_get_int(VCONFKEY_CALL_STATE, &call_state); if ((ret >= 0 && call_state != VCONFKEY_CALL_OFF) || (__get_lock_screen_state() == VCONFKEY_IDLE_LOCK)) { - _D("LOCK state, lcd is on directly"); + _D("LOCK state, lcd is on directly."); lcd_on_procedure(LCD_NORMAL, flags); } reset_timeout(display_conf.lcdoff_timeout); @@ -859,7 +858,7 @@ int custom_lcdon(int timeout) if (check_lcd_is_on() == false) lcd_on_direct(LCD_ON_BY_GESTURE); - _I("custom lcd on %d ms", timeout); + _I("Custom lcd on timeout(%d ms).", timeout); if (set_custom_lcdon_timeout(timeout) == true) update_display_time(); @@ -897,7 +896,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) enum state_t next; next = GET_COND_STATE(cond); - _I("Change State to %s (%d)", states[next].name, pid); + _I("Change process(%d) state to %s.", pid, states[next].name); switch (next) { case S_NORMAL: @@ -976,7 +975,7 @@ static void proc_condition_lock(PMMsg *data) states[state].timeout_cb, (void*)((intptr_t)pid)); if (!cond_timeout_id) - _E("Failed to register display timer"); + _E("Failed to register display timer."); } holdkey_block = GET_COND_FLAG(data->cond) & PM_FLAG_BLOCK_HOLDKEY; @@ -993,7 +992,7 @@ static void proc_condition_lock(PMMsg *data) set_process_active(TRUE, pid); /* for debug */ - _SD("[%s] locked by pid %d - process %s holdkeyblock %d\n", + _SD("[%s] Locked by pid=%d process=%s holdkeyblock=%d\n", states[state].name, pid, pname, holdkey_block); set_lock_time(pname, state); @@ -1022,7 +1021,7 @@ static void proc_condition_unlock(PMMsg *data) if (ambient_get_state()) ambient_check_invalid_state(pid); - _SD("[%s] unlocked by pid %d - process %s\n", + _SD("[%s] Unlocked by pid=%d process=%s\n", states[state].name, pid, pname); set_unlock_time(pname, state); @@ -1047,12 +1046,12 @@ static int proc_condition(PMMsg *data) /* guard time for suspend */ if (pm_cur_state == S_LCDOFF) { reset_timeout(states[S_LCDOFF].timeout); - _I("Margin timeout (%d ms)", states[S_LCDOFF].timeout); + _I("Margin timeout(%d ms)", states[S_LCDOFF].timeout); } } else { if (flags & PM_FLAG_RESET_TIMER) { reset_timeout(states[pm_cur_state].timeout); - _I("Reset timeout (%d ms)", states[pm_cur_state].timeout); + _I("Reset timeout(%d ms)", states[pm_cur_state].timeout); } } @@ -1071,8 +1070,8 @@ int check_processes(enum state_t prohibit_state) DD_LIST_FOREACH_SAFE(cond_head[prohibit_state], elem, next, t) { if (t->pid < INTERNAL_LOCK_BASE && kill(t->pid, 0) == -1) { - _E("%d process does not exist, delete the REQ" - " - prohibit state %d ", + _E("Process(%d) does not exist, delete the REQ" + " - prohibit state=%d.", t->pid, prohibit_state); if (t->pid == custom_change_pid) { get_lcd_timeout_from_settings(); @@ -1093,10 +1092,10 @@ int check_holdkey_block(enum state_t state) PmLockNode *t; int ret = 0; - _I("check holdkey block : state of %s", states[state].name); + _I("Check holdkey block: state of %s", states[state].name); if (custom_holdkey_block == true) { - _I("custom hold key blocked by pid(%d)", + _I("Custom hold key blocked by pid(%d).", custom_change_pid); return 1; } @@ -1104,7 +1103,7 @@ int check_holdkey_block(enum state_t state) DD_LIST_FOREACH(cond_head[state], elem, t) { if (t->holdkey_block == true) { ret = 1; - _I("Hold key blocked by pid(%d)!", t->pid); + _I("Hold key blocked by pid(%d).", t->pid); break; } } @@ -1119,7 +1118,7 @@ int delete_condition(enum state_t state) pid_t pid; char pname[PATH_MAX]; - _I("delete condition : state of %s", states[state].name); + _I("Delete condition: state of %s", states[state].name); if (!cond_head[state]) return 0; @@ -1132,7 +1131,7 @@ int delete_condition(enum state_t state) pid = t->pid; if (state == S_LCDOFF) set_process_active(FALSE, pid); - _I("delete node of pid(%d)", pid); + _I("Delete node of pid(%d).", pid); del_node(state, t); get_pname(pid, pname); set_unlock_time(pname, state-1); @@ -1148,13 +1147,13 @@ void update_lcdoff_source(int source) { switch (source) { case VCONFKEY_PM_LCDOFF_BY_TIMEOUT: - _I("LCD OFF by timeout"); + _I("LCD OFF by timeout."); break; case VCONFKEY_PM_LCDOFF_BY_POWERKEY: - _I("LCD OFF by powerkey"); + _I("LCD OFF by powerkey."); break; default: - _E("Invalid value(%d)", source); + _E("Invalid value(%d).", source); return; } vconf_set_int(VCONFKEY_PM_LCDOFF_SOURCE, source); @@ -1227,7 +1226,7 @@ void pm_history_print(int fd, int count) time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); } } #endif @@ -1251,13 +1250,13 @@ void print_info(int fd) "===========================\n"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Timeout Info: Run[%dms] Dim[%dms] Off[%dms]\n", states[S_NORMAL].timeout, states[S_LCDDIM].timeout, states[S_LCDOFF].timeout); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n", (trans_condition & MASK_NORMAL) ? states[S_NORMAL].name : "-", @@ -1265,18 +1264,18 @@ void print_info(int fd) (trans_condition & MASK_OFF) ? states[S_LCDOFF].name : "-"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Current State: %s\n", states[pm_cur_state].name); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "Current Lock Conditions: \n"); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); for (s_index = S_NORMAL; s_index < S_END; s_index++) { DD_LIST_FOREACH(cond_head[s_index], elem, t) { @@ -1287,7 +1286,7 @@ void print_info(int fd) i++, states[s_index].name, t->pid, pname, time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); } } @@ -1305,7 +1304,7 @@ void save_display_log(void) time_t now_time; char time_buf[30]; - _D("internal state is saved!"); + _D("Internal state is saved."); time(&now_time); ctime_r(&now_time, time_buf); @@ -1317,18 +1316,18 @@ void save_display_log(void) (int)now_time, time_buf); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "pm_status_flag: %x\n", pm_status_flag); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); snprintf(buf, sizeof(buf), "screen lock status : %d\n", __get_lock_screen_state()); ret = write(fd, buf, strlen(buf)); if (ret < 0) - _E("write() failed (%d)", errno); + _E("write() failed: %d", errno); print_info(fd); close(fd); } @@ -1371,7 +1370,7 @@ int check_lcdoff_direct(void) if (ret >= 0 && cradle == DOCK_SOUND) return false; - _D("Goto LCDOFF direct(%d,%d,%d)", lock, hdmi_state, cradle); + _D("Goto LCDOFF direct(lock=%d hdmi=%d cradle=%d).", lock, hdmi_state, cradle); return true; } @@ -1400,7 +1399,7 @@ static int default_trans(int evt) /* check conditions */ while (st->check && !st->check(pm_cur_state, next_state)) { /* There is a condition. */ - _I("(%s) locked. Trans to (%s) failed", states[pm_cur_state].name, + _I("%s locked. Trans to %s failed.", states[pm_cur_state].name, states[next_state].name); if (!check_processes(pm_cur_state)) { /* This is valid condition @@ -1504,7 +1503,7 @@ static int default_action(int timeout) struct timeval now_tv; if (status != DEVICE_OPS_STATUS_START) { - _E("display is not started!"); + _E("Display is not started."); return -EINVAL; } @@ -1522,7 +1521,7 @@ static int default_action(int timeout) time(&last_update_time); last_timeout = timeout; } else { - _I("timout set: %s state %d ms", + _I("Timout set: %s state %d ms", states[pm_cur_state].name, timeout); } } @@ -1537,7 +1536,7 @@ static int default_action(int timeout) if (pm_old_state == S_NORMAL && pm_cur_state != S_NORMAL) { time(&now); diff = difftime(now, last_update_time); - _I("S_NORMAL is changed to %s [%d ms, %.0f s]", + _I("S_NORMAL is changed to %s (timeout=%d ms diff=%.0f s).", states[pm_cur_state].name, last_timeout, diff); } @@ -1590,15 +1589,15 @@ static int default_action(int timeout) if (!power_ops.get_power_lock_support()) { /* sleep state : set system mode to SUSPEND */ if (power_ops.get_wakeup_count(&wakeup_count) < 0) - _E("wakeup count read error"); + _E("Wakeup count read error."); if (wakeup_count < 0) { - _I("Wakup Event! Can not enter suspend mode."); + _I("Wakup Event. Can not enter suspend mode."); goto go_lcd_off; } if (power_ops.set_wakeup_count(wakeup_count) < 0) { - _E("wakeup count write error"); + _E("Wakeup count write error."); goto go_lcd_off; } } @@ -1616,7 +1615,7 @@ go_suspend: power_ops.enable_autosleep(); if (power_ops.power_unlock() < 0) - _E("power unlock state error!"); + _E("Power unlock state error."); } else { dd_list *elem, *elem_n; const struct device_ops *dev; @@ -1634,7 +1633,7 @@ go_suspend: dev->resume(); } - _I("system wakeup!!"); + _I("System wakeup."); disp_plgn.system_wakeup_flag = true; /* Resume !! */ if (power_ops.check_wakeup_src() == EVENT_DEVICE) @@ -1710,13 +1709,13 @@ static int poll_callback(int condition, PMMsg *data) time_t now; if (status != DEVICE_OPS_STATUS_START) { - _E("display logic is not started!"); + _E("Display logic is not started."); return -ECANCELED; } if (condition == INPUT_POLL_EVENT) { if (pm_cur_state == S_LCDOFF || pm_cur_state == S_SLEEP) - _I("Power key input"); + _I("Power key input."); time(&now); if (last_t != now || pm_cur_state == S_LCDOFF || @@ -1790,12 +1789,12 @@ static int update_setting(int key_idx, int val) pm_status_flag |= BRTCH_FLAG; vconf_set_bool(VCONFKEY_PM_BRIGHTNESS_CHANGED_IN_LPM, true); - _I("brightness changed in low battery," - "escape dim state"); + _I("Brightness changed in low battery," + "escape dim state."); } backlight_ops.set_default_brt(val); snprintf(buf, sizeof(buf), "%d", val); - _D("Brightness set in bl : %d", val); + _D("Brightness set in bl(%d).", val); launch_evenif_exist(SET_BRIGHTNESS_IN_BOOTLOADER, buf); break; case SETTING_LOCK_SCREEN: @@ -1860,13 +1859,13 @@ static void check_seed_status(void) ret = get_setting_brightness(&tmp); if (ret != 0 || (tmp < PM_MIN_BRIGHTNESS || tmp > PM_MAX_BRIGHTNESS)) { - _I("fail to read vconf value for brightness"); + _I("Failed 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; } - _I("Set brightness from Setting App. %d", tmp); + _I("Set brightness(%d) from setting app.", tmp); backlight_ops.set_default_brt(tmp); vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state); @@ -1882,8 +1881,8 @@ static void check_seed_status(void) set_lock_screen_state(lock_state); if (lock_state == VCONFKEY_IDLE_LOCK) { states[S_NORMAL].timeout = lock_screen_timeout; - _I("LCD NORMAL timeout is set by %d ms" - " for lock screen", lock_screen_timeout); + _I("LCD NORMAL timeout(%d ms) is set" + " for lock screen.", lock_screen_timeout); } return; @@ -1936,13 +1935,13 @@ static const char *errMSG[INIT_END] = { int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) { if (on == 0 && dim == 0) { - _I("LCD timeout changed : default setting"); + _I("LCD timeout changed: default setting"); custom_normal_timeout = custom_dim_timeout = 0; } else if (on < 0 || dim < 0) { - _E("fail to set value (%d,%d)", on, dim); + _E("Failed to set value(on=%d dim=%d).", on, dim); return -EINVAL; } else { - _I("LCD timeout changed : on(%ds), dim(%ds)", on, dim); + _I("LCD timeout changed: on=%ds dim=%ds", on, dim); custom_normal_timeout = SEC_TO_MSEC(on); custom_dim_timeout = SEC_TO_MSEC(dim); } @@ -1953,10 +1952,10 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) if (holdkey_block) { custom_holdkey_block = true; - _I("hold key disabled !"); + _I("Hold key disabled."); } else { custom_holdkey_block = false; - _I("hold key enabled !"); + _I("Hold key enabled."); } if (custom_change_name) { @@ -1971,7 +1970,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) custom_change_name = strndup(name, strlen(name)); if (!custom_change_name) { - _E("Malloc falied!"); + _E("Failed to malloc."); custom_normal_timeout = custom_dim_timeout = 0; custom_holdkey_block = false; return -ENOMEM; @@ -1994,7 +1993,7 @@ void reset_lcd_timeout(GDBusConnection *conn, if (strcmp(sender, custom_change_name)) return; - _I("reset lcd timeout %s: set default timeout", sender); + _I("reset lcd timeout: Set default timeout. sender=%s", sender); free(custom_change_name); custom_change_name = 0; @@ -2017,7 +2016,7 @@ static int booting_done(void *data) if (!done) return done; - _I("booting done. Release display and power lock"); + _I("Booting done. Release display and power lock."); if (disp_plgn.pm_unlock_internal) { disp_plgn.pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN); disp_plgn.pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_NORMAL, PM_SLEEP_MARGIN); @@ -2050,7 +2049,7 @@ static int process_background(void *data) node = find_node(S_NORMAL, pid); if (node) { node->background = true; - _I("%d pid is background, then PM will be unlocked LCD_NORMAL", pid); + _I("Process(%d) is background, then PM will be unlocked LCD_NORMAL.", pid); } return 0; @@ -2066,7 +2065,7 @@ static int process_foreground(void *data) node = find_node(S_NORMAL, pid); if (node) { node->background = false; - _I("%d pid is foreground, then PM will be maintained locked LCD_NORMAL", pid); + _I("Process(%d) is foreground, then PM will be maintained locked LCD_NORMAL.", pid); } return 0; @@ -2076,7 +2075,7 @@ static int display_load_config(struct parse_result *result, void *user_data) { struct display_config *c = user_data; - _D("%s,%s,%s", result->section, result->name, result->value); + _D("display_load_config: section=%s name=%s value=%s", result->section, result->name, result->value); if (!c) return -EINVAL; @@ -2086,49 +2085,49 @@ static int display_load_config(struct parse_result *result, void *user_data) if (MATCH(result->name, "LockScreenWaitingTime")) { SET_CONF(c->lock_wait_time, atof(result->value)); - _D("lock wait time is %.3f", c->lock_wait_time); + _D("'lock wait time' is %.3f.", c->lock_wait_time); } else if (MATCH(result->name, "LongPressInterval")) { SET_CONF(c->longpress_interval, atof(result->value)); - _D("long press interval is %.3f", c->longpress_interval); + _D("'long press interval' is %.3f.", c->longpress_interval); } else if (MATCH(result->name, "LightSensorSamplingInterval")) { SET_CONF(c->lightsensor_interval, atof(result->value)); - _D("lightsensor interval is %.3f", c->lightsensor_interval); + _D("'lightsensor interval' is %.3f.", c->lightsensor_interval); } else if (MATCH(result->name, "LCDOffTimeout")) { SET_CONF(c->lcdoff_timeout, atoi(result->value)); - _D("lcdoff timeout is %d ms", c->lcdoff_timeout); + _D("'lcdoff timeout' is %d ms.", c->lcdoff_timeout); } else if (MATCH(result->name, "BrightnessChangeStep")) { SET_CONF(c->brightness_change_step, atoi(result->value)); - _D("brightness change step is %d", c->brightness_change_step); + _D("'brightness change step' is %d.", c->brightness_change_step); } else if (MATCH(result->name, "LCDAlwaysOn")) { c->lcd_always_on = (MATCH(result->value, "yes") ? 1 : 0); - _D("LCD always on is %d", c->lcd_always_on); + _D("'LCD always on' is %d.", c->lcd_always_on); } else if (MATCH(result->name, "ChangedFrameRateAllowed")) { if (strstr(result->value, "setting")) { c->framerate_app[REFRESH_SETTING] = 1; - _D("framerate app is Setting"); + _D("'framerate app' is setting"); } if (strstr(result->value, "all")) { memset(c->framerate_app, 1, sizeof(c->framerate_app)); - _D("framerate app is All"); + _D("'framerate app' is all"); } } else if (MATCH(result->name, "ControlDisplay")) { c->control_display = (MATCH(result->value, "yes") ? 1 : 0); - _D("ControlDisplay is %d", c->control_display); + _D("'ControlDisplay' is %d.", c->control_display); } else if (MATCH(result->name, "PowerKeyDoublePressSupport")) { c->powerkey_doublepress = (MATCH(result->value, "yes") ? 1 : 0); - _D("PowerKeyDoublePressSupport is %d", c->powerkey_doublepress); + _D("'PowerKeyDoublePressSupport' is %d.", c->powerkey_doublepress); } else if (MATCH(result->name, "AccelSensorOn")) { c->accel_sensor_on = (MATCH(result->value, "yes") ? 1 : 0); - _D("AccelSensorOn is %d", c->accel_sensor_on); + _D("'AccelSensorOn' is %d.", c->accel_sensor_on); } else if (MATCH(result->name, "ContinuousSampling")) { c->continuous_sampling = (MATCH(result->value, "yes") ? 1 : 0); - _D("ContinuousSampling is %d", c->continuous_sampling); + _D("'ContinuousSampling' is %d.", c->continuous_sampling); } else if (MATCH(result->name, "TimeoutEnable")) { c->timeout_enable = (MATCH(result->value, "yes") ? true : false); - _D("Timeout is %s", c->timeout_enable ? "enalbed" : "disabled"); + _D("'Timeout' is %s.", c->timeout_enable ? "enalbed" : "disabled"); } else if (MATCH(result->name, "InputSupport")) { c->input_support = (MATCH(result->value, "yes") ? true : false); - _D("Input is %s", c->input_support ? "supported" : "NOT supported"); + _D("'Input' is %s.", c->input_support ? "supported" : "NOT supported"); } return 0; @@ -2137,11 +2136,11 @@ static int display_load_config(struct parse_result *result, void *user_data) static bool check_wm_ready(void) { if (access("/run/.wm_ready", F_OK) == 0) { - _I("Window manager is ready"); + _I("Window manager is ready."); return true; } - _I("Window manager is not ready"); + _I("Window manager is not ready."); return false; } @@ -2175,7 +2174,7 @@ static void add_timer_for_wm_ready(void) { guint id = g_timeout_add(500/* milliseconds */, lcd_on_wm_ready, NULL); if (id == 0) - _E("Failed to add wm_ready timeout"); + _E("Failed to add wm_ready timeout."); } /** @@ -2208,7 +2207,7 @@ static void display_init(void *data) int timeout = 0; bool wm_ready; - _I("Start power manager"); + _I("Start power manager."); signal(SIGHUP, sig_hup); @@ -2217,7 +2216,7 @@ static void display_init(void *data) /* load configutation */ ret = config_parse(DISPLAY_CONF_FILE, display_load_config, &display_conf); if (ret < 0) - _W("Failed to load %s, %d Use default value!", + _W("Failed to load '%s', use default value: %d", DISPLAY_CONF_FILE, ret); register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); @@ -2236,7 +2235,7 @@ static void display_init(void *data) ret = init_sysfs(); break; case INIT_POLL: - _I("input init"); + _I("Input init."); pm_callback = poll_callback; if (display_conf.input_support) ret = init_input(); @@ -2244,12 +2243,12 @@ static void display_init(void *data) ret = 0; break; case INIT_DBUS: - _I("dbus init"); + _I("Dbus init."); ret = init_pm_dbus(); break; } if (ret != 0) { - _E("%s", errMSG[i]); + _E("Failed to init: %s", errMSG[i]); break; } } @@ -2272,11 +2271,11 @@ static void display_init(void *data) add_timer_for_wm_ready(); if (display_conf.lcd_always_on) { - _I("LCD always on!"); + _I("LCD always on."); trans_table[S_NORMAL][EVENT_TIMEOUT] = S_NORMAL; } - _I("Start Power managing without noti"); + _I("Start Power managing without noti."); if (power_ops.get_power_lock_support()) power_ops.power_lock(); @@ -2353,7 +2352,7 @@ static void display_exit(void *data) /* free display service */ display_service_free(); - _I("Stop power manager"); + _I("Stop power manager."); } static int display_start(enum device_flags flags) diff --git a/plugins/wearable/display/device-interface.c b/plugins/wearable/display/device-interface.c old mode 100644 new mode 100755 index 3e7144f..a9088ac --- a/plugins/wearable/display/device-interface.c +++ b/plugins/wearable/display/device-interface.c @@ -106,7 +106,7 @@ static int bl_brt(int brightness, int delay) usleep(delay); if (force_brightness > 0) { - _I("brightness(%d), force brightness(%d)", + _I("brightness=%d force brightness=%d", brightness, force_brightness); brightness = force_brightness; } @@ -114,7 +114,7 @@ static int bl_brt(int brightness, int delay) /* Update device brightness */ ret = backlight_ops.set_brightness(brightness); - _I("set brightness %d, %d", brightness, ret); + _I("Set brightness(%d): %d", brightness, ret); return ret; } @@ -125,13 +125,13 @@ static int system_suspend(void) _I("system suspend"); ret = sys_set_str(POWER_STATE_PATH, "mem"); - _I("system resume (result : %d)", ret); + _I("System resume: %d", ret); return 0; } static int system_enable_autosleep(void) { - _I("system autosleep enabled"); + _I("System autosleep enabled."); return sys_set_str(POWER_AUTOSLEEP_PATH, "mem"); } @@ -141,7 +141,7 @@ static int system_power_lock(void) const struct device_ops *dev; int ret; - _I("system power lock"); + _I("system power lock."); ret = sys_set_str(POWER_LOCK_PATH, "mainlock"); /* Devices Resume */ @@ -164,7 +164,7 @@ static int system_power_unlock(void) dev->suspend(); } - _I("system power unlock"); + _I("system power unlock."); return sys_set_str(POWER_UNLOCK_PATH, "mainlock"); } @@ -182,7 +182,7 @@ static int system_get_power_lock_support(void) else power_lock_support = true; - _I("system power lock : %s", + _I("system power lock: %s", (power_lock_support ? "support" : "not support")); out: @@ -235,14 +235,14 @@ void change_brightness(int start, int end, int step) ret = backlight_ops.get_brightness(&prev); if (ret < 0) { - _E("fail to get brightness : %d", ret); + _E("Failed to get brightness: %d", ret); return; } if (prev == end) return; - _D("start %d end %d step %d", start, end, step); + _D("start=%d end=%d step=%d", start, end, step); diff = end - start; @@ -271,7 +271,7 @@ static int backlight_on(enum device_flags flags) ret = bl_onoff(DPMS_ON); if (ret < 0) - _E("Failed to turn on backlight"); + _E("Failed to turn on backlight."); if (flags & LCD_PHASED_TRANSIT_MODE) change_brightness(LCD_PHASED_MIN_BRIGHTNESS, @@ -295,7 +295,7 @@ static int backlight_off(enum device_flags flags) ret = bl_onoff(DPMS_OFF); if (ret < 0) - _E("Failed to turn off backlight"); + _E("Failed to turn off backlight."); return ret; } @@ -306,7 +306,7 @@ static int backlight_dim(void) int brightness; if (vconf_get_int(VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS, &brightness) != 0) { - _E("Failed to get VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS value"); + _E("Failed to get VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS value."); return -EPERM; } @@ -353,7 +353,7 @@ static int custom_backlight_update(void) if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) { ret = backlight_dim(); } else { - _I("custom brightness restored! %d", custom_brightness); + _I("Custom brightness(%d) restored.", custom_brightness); ret = bl_brt(custom_brightness, 0); } @@ -375,7 +375,7 @@ static int backlight_update(void) int ret = 0; if (get_custom_status()) { - _I("custom brightness mode! brt no updated"); + _I("Custom brightness mode. brt no updated."); return 0; } if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) @@ -452,7 +452,7 @@ static int get_max_brightness(void) return max; if (!display_dev) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } @@ -463,7 +463,7 @@ static int get_max_brightness(void) ret = display_dev->get_max_brightness(&max); if (ret < 0) { - _E("Failed to get max brightness (%d)", ret); + _E("Failed to get max brightness: %d", ret); return ret; } @@ -475,13 +475,13 @@ static int set_brightness(int val) int max; if (!display_dev || !display_dev->set_brightness) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } max = get_max_brightness(); if (max < 0) { - _E("Failed to get max brightness"); + _E("Failed to get max brightness."); return max; } @@ -499,7 +499,7 @@ static int get_brt_normalized(int brt_raw) max = get_max_brightness(); if (max < 0) { - _E("Failed to get max brightness"); + _E("Failed to get max brightness."); return max; } @@ -527,13 +527,13 @@ static int get_brightness(int *val) int brt, ret; if (!display_dev || !display_dev->get_brightness) { - _E("there is no display device"); + _E("There is no display device."); return -ENOENT; } ret = display_dev->get_brightness(&brt); if (ret < 0) { - _E("failed to get brightness (%d)", ret); + _E("Failed to get brightness: %d", ret); return ret; } @@ -551,7 +551,7 @@ static int get_brightness_by_light_sensor(float lmax, float lmin, float light, i ret = display_dev->get_auto_brightness(lmax, lmin, light, &brt_raw); if (ret < 0) { - _E("failed to get brightness by light sensor(%d)", ret); + _E("Failed to get brightness by light sensor: %d", ret); return ret; } @@ -583,12 +583,12 @@ static int set_frame_rate(int rate) if (fmin < 0) { ret = display_dev->get_min_frame_rate(&fmin); if (ret < 0) { - _E("Failed to get min frate rate (%d)", ret); + _E("Failed to get min frate rate: %d", ret); return ret; } } if (rate < fmin) { - _E("Invalid rate(%d)! (Valid rate: %d <= rate)", rate, fmin); + _E("Invalid rate(%d). (Valid rate: %d <= rate)", rate, fmin); return -EINVAL; } } @@ -597,12 +597,12 @@ static int set_frame_rate(int rate) if (fmax < 0) { ret = display_dev->get_max_frame_rate(&fmax); if (ret < 0) { - _E("Failed to get max frate rate (%d)", ret); + _E("Failed to get max frate rate: %d", ret); return ret; } } if (rate > fmax) { - _E("Invalid rate(%d)! (Valid rate: rate <= %d)", rate, fmax); + _E("Invalid rate(%d). (Valid rate: rate <= %d)", rate, fmax); return -EINVAL; } } @@ -651,22 +651,22 @@ int display_service_load(void) r = hw_get_info(DISPLAY_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (r < 0) { - _I("display shared library is not supported: %d", r); + _I("Display shared library is not supported: %d", r); return -ENODEV; } if (!info->open) { - _E("fail to open display device : open(NULL)"); + _E("Failed to open display device: open(NULL)"); return -EPERM; } r = info->open(info, NULL, (struct hw_common **)&display_dev); if (r < 0) { - _E("fail to get display device structure : %d", r); + _E("Failed to get display device structure: %d", r); return -EPERM; } - _D("display device structure load success"); + _D("Display device structure load success."); return 0; } diff --git a/src/battery/config.c b/src/battery/config.c old mode 100644 new mode 100755 index 7a8fa0f..ac14c99 --- a/src/battery/config.c +++ b/src/battery/config.c @@ -40,7 +40,7 @@ static int load_config(struct parse_result *result, void *user_data) char *name; char *value; - _D("%s,%s,%s", result->section, result->name, result->value); + _D("Load config. section=%s name=%s value=%s", result->section, result->name, result->value); if (!info) return -EINVAL; @@ -71,5 +71,5 @@ void battery_config_load(struct battery_config_info *info) ret = config_parse(BAT_CONF_FILE, load_config, info); if (ret < 0) - _E("Failed to load %s, %d Use default value!", BAT_CONF_FILE, ret); + _E("Failed to load '%s'. Use default value: %d", BAT_CONF_FILE, ret); } diff --git a/src/battery/lowbat-handler.c b/src/battery/lowbat-handler.c old mode 100644 new mode 100755 index 4452836..f54023d --- a/src/battery/lowbat-handler.c +++ b/src/battery/lowbat-handler.c @@ -148,16 +148,16 @@ static int lowbat_add_scenario(int old, int now, int (*func)(void *data)) { struct lowbat_process_entry *scenario; - _D("%d %d, %p", old, now, func); + _D("lowbat_add_scenario: old=%d now=%d func=%p", old, now, func); if (!func) { - _E("invalid func address!"); + _E("Invalid func address."); return -EINVAL; } scenario = malloc(sizeof(struct lowbat_process_entry)); if (!scenario) { - _E("Fail to malloc for notifier!"); + _E("Failed to malloc for notifier."); return -ENOMEM; } @@ -207,14 +207,14 @@ static int booting_done(void *data) done = *(int *)data; if (!done) goto out; - _I("booting done"); + _I("Booting done."); if (popup) { popup = 0; if (battery.charge_now != CHARGER_CHARGING && battery.charge_full != CHARGING_FULL) lowbat_popup(NULL); else - _I("skip low battery popup during charging"); + _I("Skip low battery popup during charging."); } out: return done; @@ -249,19 +249,19 @@ void power_off_timer_start(void) { if (power_off_timer) return; - _I("power off after %d", POWER_OFF_CHECK_TIMER); + _I("Power off after %d.", POWER_OFF_CHECK_TIMER); power_off_pm_lock(); power_off_timer = g_timeout_add_seconds(POWER_OFF_CHECK_TIMER, power_off_cb, NULL); if (power_off_timer == 0) - _E("fail to add battery init timer during booting"); + _E("Failed to add battery init timer during booting."); } void power_off_timer_stop(void) { if (!power_off_timer) return; - _I("cancel power off"); + _I("Cancel power off."); power_off_pm_unlock(); g_source_remove(power_off_timer); power_off_timer = 0; @@ -300,7 +300,7 @@ static int get_lowbat_noti_value(int low_battery_type, char **active_noti, char *event_noti = NULL; } } else { - _E("Invalid power resource type(%s)", battery.power_source_s); + _E("Invalid power resource type(%s).", battery.power_source_s); *active_noti = NULL; *event_noti = NULL; } @@ -314,17 +314,17 @@ static void event_noti_cb(GVariant *var, void *user_data, GError *err) if (!var) { if (err) - _E("%s", err->message); + _E("Failed to notify event: %s", err->message); return; } if (!dh_get_param_from_var(var, "(i)", &id)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to notify event: no message(%s)", g_variant_get_type_string(var)); goto out; } event_noti_num = id; - _D("event noti : %d", event_noti_num); + _D("Event noti. id=%d", event_noti_num); out: g_variant_unref(var); @@ -336,17 +336,17 @@ static void active_noti_cb(GVariant *var, void *user_data, GError *err) if (!var) { if (err) - _E("%s", err->message); + _E("Failed to notify active: %s", err->message); return; } if (!dh_get_param_from_var(var, "(i)", &id)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to notify active: no message(%s)", g_variant_get_type_string(var)); goto out; } active_noti_num = id; - _D("active noti : %d", active_noti_num); + _D("Active noti. id=%d", active_noti_num); out: g_variant_unref(var); @@ -401,17 +401,17 @@ int lowbat_popup(char *option) return -1; direct_launch: - _D("%s", value); + _D("Popup value=%s", value); if (booting_done(NULL)) { if (launched_poweroff == 1) { - _I("will be foreced power off"); + _I("Will be foreced power off."); power_execute(POWER_POWEROFF); return 0; } if (battery.charge_now) { - _I("skip low battery popup during charging"); + _I("Skip low battery popup during charging."); return 0; } @@ -426,33 +426,33 @@ direct_launch: if (disp_plgn.pm_change_internal) disp_plgn.pm_change_internal(INTERNAL_LOCK_LOWBAT, LCD_NORMAL); } else { - _I("block LCD"); + _I("Block LCD."); } if (lowbat_popup_option == LOWBAT_OPT_CHECK || lowbat_popup_option == LOWBAT_OPT_WARNING) { if (power_source) { - _D("active_noti = %d, event_noti = %d", active_noti_num, event_noti_num); + _D("active_noti=%d event_noti=%d", active_noti_num, event_noti_num); return 0; } if (event_noti_num > 0) { ret = remove_notification("BatteryLowCriticalNotiOff", event_noti_num); if (ret < 0) - _E("Failed to remove event_noti : %d", ret); + _E("Failed to remove event_noti: %d", ret); else event_noti_num = -1; } ret = add_async_notification(event_noti, event_noti_cb, NULL, NULL); if (ret < 0) - _E("Failed to launch event_noti : %d", ret); + _E("Failed to launch event_noti: %d", ret); if (active_noti_num > 0) { ret = remove_notification("BatteryLowCriticalNotiOff", active_noti_num); if (ret < 0) - _E("Failed to launch remove active_noti : %d", ret); + _E("Failed to launch remove active_noti: %d", ret); else active_noti_num = -1; } @@ -460,15 +460,15 @@ direct_launch: snprintf(temp, sizeof(temp), "%d", cur_bat_capacity); ret = add_async_notification(active_noti, active_noti_cb, "s", temp); if (ret < 0) - _E("Failed to launch active noti : %d", ret); + _E("Failed to launch active noti: %d", ret); - _D("active_noti = %d, event_noti = %d", active_noti_num, event_noti_num); + _D("active_noti=%d event_noti=%d", active_noti_num, event_noti_num); return 0; } else return launch_system_app(APP_DEFAULT, 2, APP_KEY_TYPE, value); } else { - _D("boot-animation running yet"); + _D("Boot-animation running yet."); return -1; } @@ -580,7 +580,7 @@ void clear_noti_if_needed(const char *old_string, const char *new_string) if (event_noti_num > 0) { ret = remove_notification("BatteryLowCriticalNotiOff", event_noti_num); if (ret < 0) - _E("Failed to launch remove_event_noti : %d", ret); + _E("Failed to launch remove_event_noti: %d", ret); else event_noti_num = -1; } @@ -588,7 +588,7 @@ void clear_noti_if_needed(const char *old_string, const char *new_string) if (active_noti_num > 0) { ret = remove_notification("BatteryLowCriticalNotiOff", active_noti_num); if (ret < 0) - _E("Failed to launch remove_active_noti : %d", ret); + _E("Failed to launch remove_active_noti: %d", ret); active_noti_num = -1; } } @@ -617,7 +617,7 @@ static void battery_level_send_system_event(int bat_percent) prev = str; - _D("system_event(%s)", str); + _D("system_event=%s", str); b = bundle_create(); bundle_add_str(b, EVT_KEY_BATTERY_LEVEL_STATUS, str); @@ -634,7 +634,7 @@ static void change_lowbat_level(int bat_percent) return; if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_LEVEL_STATUS, &prev) < 0) { - _E("vconf_get_int() failed"); + _E("Failed to call vconf_get_int()."); return; } @@ -675,14 +675,14 @@ static int lowbat_process(int bat_percent, void *ad) battery_level_send_system_event(new_bat_capacity); if (new_bat_capacity != cur_bat_capacity) { - _D("[BAT_MON] cur = %d new = %d", cur_bat_capacity, new_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) cur_bat_capacity = new_bat_capacity; power_supply_broadcast(CHARGE_CAPACITY_SIGNAL, new_bat_capacity); } if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &vconf_state) < 0) { - _E("vconf_get_int() failed"); + _E("Failed to call vconf_get_int()."); result = -EIO; goto exit; } @@ -746,7 +746,7 @@ static int lowbat_process(int bat_percent, void *ad) device_notify(DEVICE_NOTIFIER_LOWBAT, (void *)low_bat); if (battery.online == POWER_SUPPLY_TYPE_UNKNOWN) { - _E("battery online is not initialized"); + _E("Battery online is not initialized."); goto exit; } if (cur_bat_state == new_bat_state && @@ -761,7 +761,7 @@ static int lowbat_process(int bat_percent, void *ad) } else { result = lowbat_scenario(cur_bat_state, new_bat_state, NULL); if (result) - _I("cur %d, new %d(capacity %d)", + _I("cur=%d new=%d(capacity=%d)", cur_bat_state, new_bat_state, bat_percent); } if (result == 1) @@ -781,7 +781,7 @@ static int check_lowbat_percent(int *pct) bat_percent = battery.capacity; if (bat_percent < 0) { - _E("[BATMON] Cannot read battery gage. stop read fuel gage"); + _E("[BAT_MON] Cannot read battery gage. Stop read fuel gage."); return -ENODEV; } if (bat_percent > 100) @@ -828,7 +828,7 @@ static int lowbat_monitor_init(void *data) battery_config_load(&battery_info); default_battery_warning = battery_info.warning; - _I("battery conf %d %d %d %d %d", battery_info.normal, battery_info.warning, + _I("Battery conf normal=%d warning=%d critical=%d poweroff=%d realoff=%d", battery_info.normal, battery_info.warning, battery_info.critical, battery_info.poweroff, battery_info.realoff); lowbat_scenario_init(); @@ -850,13 +850,13 @@ static GVariant * dbus_set_lowbat_level(GDBusConnection *conn, status = lowbat_initialized(NULL); if (status != BATTERY_ENABLED) { - _E("invalid lowbat handler"); + _E("Invalid lowbat handler."); ret = -EINVAL; goto out; } if (now <= default_battery_warning && now != BATTERY_UNKNOWN) { - _E("invalid level is requested(%d)", now); + _E("Invalid level is requested(%d).", now); ret = -EINVAL; goto out; } @@ -867,7 +867,7 @@ static GVariant * dbus_set_lowbat_level(GDBusConnection *conn, custom_warning_level = now; vconf_set_int(VCONF_KEY_BATTERY_WARNING_LEVEL, custom_warning_level); - _D("custom warning level is changed to %d", custom_warning_level); + _D("Custom warning level is changed to %d.", custom_warning_level); lowbat_update_scenario(); out: return g_variant_new("(i)", ret); @@ -877,7 +877,7 @@ static GVariant * dbus_get_lowbat_level(GDBusConnection *conn, const gchar *sender, const gchar *path, const gchar *iface, const gchar *name, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { - _D("warning %d", custom_warning_level); + _D("Warning level(%d)", custom_warning_level); return g_variant_new("(i)", custom_warning_level); } @@ -917,7 +917,7 @@ static void lowbat_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_BATTERY, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); } static void lowbat_exit(void *data) diff --git a/src/battery/power-supply.c b/src/battery/power-supply.c old mode 100644 new mode 100755 index f303cbe..4bb2b0e --- a/src/battery/power-supply.c +++ b/src/battery/power-supply.c @@ -124,7 +124,7 @@ static void abnormal_popup_timer_init(void) g_source_remove(abnormal_timer); abnormal_timer = 0; - _I("delete health timer"); + _I("Delete health timer."); } static void health_timer_reset(void) @@ -141,7 +141,7 @@ static gboolean health_timer_cb(void *data) if (battery.health == HEALTH_GOOD) return G_SOURCE_REMOVE; - _I("popup - Battery health status is not good"); + _I("Popup: Battery health status is not good."); device_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)&value); if (disp_plgn.pm_change_internal) disp_plgn.pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); @@ -165,11 +165,11 @@ static void abnormal_popup_dbus_signal_handler(GDBusConnection *conn, { if (battery.health == HEALTH_GOOD) return; - _I("restart health timer"); + _I("Restart health timer."); abnormal_timer = g_timeout_add_seconds(ABNORMAL_CHECK_TIMER_INTERVAL, health_timer_cb, NULL); if (abnormal_timer == 0) - _E("Fail to add abnormal check timer"); + _E("Failed to add abnormal check timer."); } #endif /* TIZEN_FEATURE_BATTERY_OVER_TEMPERATURE */ @@ -181,12 +181,12 @@ static void full_noti_cb(GVariant *var, void *user_data, GError *err) return; if (!dh_get_param_from_var(var, "(i)", &id)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to notify full: no message(%s)", g_variant_get_type_string(var)); goto out; } noti_id = id; - _D("Inserted battery full noti : %d", noti_id); + _D("Inserted battery full noti(%d).", noti_id); out: g_variant_unref(var); @@ -197,11 +197,11 @@ static void noti_off_cb(GVariant *var, void *user_data, GError *err) int ret = 0; if (!dh_get_param_from_var(var, "(i)", &ret)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to off notification: no message(%s)", g_variant_get_type_string(var)); goto out; } - _D("Noti Off : %d", ret); + _D("Noti off: %d", ret); out: g_variant_unref(var); @@ -243,11 +243,11 @@ static int send_full_noti(enum charge_full_type state) METHOD_FULL_NOTI_ON, NULL, NULL, full_noti_cb, -1, NULL); if (ret == 0) { - _D("Created battery full noti"); + _D("Created battery full noti."); return ret; } } - _E("Failed to call dbus method (err: %d)", ret); + _E("Failed to call dbus method: %d", ret); break; case CHARGING_NOT_FULL: if (noti_id <= 0) @@ -260,12 +260,12 @@ static int send_full_noti(enum charge_full_type state) g_variant_new("(i)", noti_id), noti_off_cb, -1, NULL); if (ret == 0) { - _D("Deleted battery full noti"); + _D("Deleted battery full noti."); noti_id = 0; return ret; } } - _E("Failed to call dbus method (err: %d)", ret); + _E("Failed to call dbus method: %d", ret); break; } return ret; @@ -279,11 +279,11 @@ static void charge_noti_on(GVariant *var, void *user_data, GError *err) return; if (!dh_get_param_from_var(var, "(i)", &id)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to notify charge: no message(%s)", g_variant_get_type_string(var)); goto out; } - _D("Inserted battery charge noti : %d", id); + _D("Inserted battery charge noti(%d)", id); out: g_variant_unref(var); @@ -301,11 +301,11 @@ static int send_charge_noti(void) METHOD_CHARGE_NOTI_ON, NULL, NULL, charge_noti_on, -1, NULL); if (ret == 0) { - _D("Created battery charge noti"); + _D("Created battery charge noti."); return ret; } } - _E("Failed to call dbus method (err: %d)", ret); + _E("Failed to call dbus method: %d", ret); return ret; } @@ -343,7 +343,7 @@ void power_supply_broadcast(char *sig, int status) if (strcmp(sig_old, sig) == 0 && old == status) return; - _D("%s %d", sig, status); + _D("signal=%s status=%d", sig, status); old = status; snprintf(sig_old, sizeof(sig_old), "%s", sig); @@ -377,7 +377,7 @@ static void noti_batt_full(void) if (disp_plgn.pm_change_internal) disp_plgn.pm_change_internal(INTERNAL_LOCK_BATTERY_FULL, LCD_NORMAL); } else { - _I("block LCD"); + _I("Block LCD."); } /* on the full charge state */ device_notify(DEVICE_NOTIFIER_FULLBAT, (void *)&bat_full_noti); @@ -411,7 +411,7 @@ static void charger_state_send_system_event(int state) str = EVT_VAL_BATTERY_CHARGER_DISCONNECTED; break; default: - _E("invalid parameter(%d)", state); + _E("Invalid parameter(%d).", state); return; } @@ -430,7 +430,7 @@ static void update_present(enum battery_noti_status status) if (old == status) return; - _I("charge %d present %d", battery.charge_now, battery.present); + _I("charge=%d present=%d", battery.charge_now, battery.present); old = status; if (disp_plgn.pm_change_internal) disp_plgn.pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); @@ -455,14 +455,14 @@ static void update_health(enum battery_noti_status status) if (old == status) return; - _I("charge %d health %d", battery.charge_now, battery.health); + _I("charge=%d health=%d", battery.charge_now, battery.health); old = status; if (disp_plgn.pm_change_internal) disp_plgn.pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); if (status == DEVICE_NOTI_ON) { - _I("popup - Battery health status is not good"); + _I("Popup: Battery health status is not good."); if (disp_plgn.pm_lock_internal) disp_plgn.pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0); @@ -486,7 +486,7 @@ static void update_ovp(enum battery_noti_status status) if (old == status) return; - _I("charge %d ovp %d", battery.charge_now, battery.ovp); + _I("charge=%d ovp=%d", battery.charge_now, battery.ovp); old = status; if (disp_plgn.pm_change_internal) disp_plgn.pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); @@ -702,7 +702,7 @@ static void battery_state(struct battery_info *info) if (!info) return; - _I("%s(%s) %s(%d) Capa(%d) Hth(%s,%s) Pres(%d) OVP(%s) Curr(%d,%d) Volt(%d, %d) Temp(%d)", + _I("status=%s(%s) power_source=%s(%d) capa=%d health=%s(%s) present=%d OVP=%s current=%d(%d) volt=%d(%d) temp=%d", info->status, battery.charge_now == CHARGER_CHARGING ? "Charging" : (battery.charge_now == CHARGER_DISCHARGING ? "Discharging" : "Abnormal"), @@ -789,7 +789,7 @@ static void power_supply_status_init(void) pct = -1; r = battery_dev->get_current_state(battery_get_capacity, &pct); if (r < 0 || pct < 0) { - _E("Failed to get battery capacity (capa:%d, ret:%d)", pct, r); + _E("Failed to get battery capacity. capa=%d: %d", pct, r); return; } @@ -804,7 +804,7 @@ static void power_supply_status_init(void) capacity == battery.capacity) return; - _I("charging %d full %d capacity %d", battery.charge_now, battery.charge_full, battery.capacity); + _I("charging=%d full=%d capacity=%d", battery.charge_now, battery.charge_full, battery.capacity); if (charge_now != battery.charge_now) { vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, battery.charge_now); @@ -828,16 +828,16 @@ static gboolean power_supply_update(void *data) static void power_supply_timer_start(void) { - _D("battery init timer during booting"); + _D("Battery init timer during booting."); power_timer = g_timeout_add_seconds(BATTERY_CHECK_TIMER_INTERVAL, power_supply_update, NULL); if (power_timer == 0) - _E("fail to add battery init timer during booting"); + _E("Failed to add battery init timer during booting."); } static void power_supply_timer_stop(void) { - _D("battery init timer during booting"); + _D("Battery init timer during booting."); if (!power_timer) return; g_source_remove(power_timer); @@ -851,7 +851,7 @@ static GVariant *dbus_get_charger_status(GDBusConnection *conn, int ret; if (vconf_get_int(VCONFKEY_SYSMAN_CHARGER_STATUS, &ret) < 0) { - _E("vconf_get_int() failed"); + _E("Failed to call vconf_get_int()."); ret = -EIO; } return g_variant_new("(i)", ret); @@ -875,7 +875,7 @@ static GVariant *dbus_get_charge_level(GDBusConnection *conn, int ret; if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &ret) < 0) { - _E("vconf_get_int() failed"); + _E("Failed to call vconf_get_int()."); ret = -EIO; } @@ -945,14 +945,14 @@ static GVariant *dbus_power_supply_handler(GDBusConnection *conn, &argv[4]); if (argc < 0) { - _E("message is invalid!"); + _E("Message is invalid."); ret = -EINVAL; goto out; } pid = dbus_connection_get_sender_pid(conn, sender); if (kill(pid, 0) == -1) { - _E("%d process does not exist, dbus ignored!", pid); + _E("Process(%d) does not exist, dbus ignored.", pid); ret = -ESRCH; goto out; } @@ -961,7 +961,7 @@ static GVariant *dbus_power_supply_handler(GDBusConnection *conn, check_health_status(argv[2]); check_online_status(argv[3]); check_present_status(argv[4]); - _I("%d %d %d %d %d %d %d %d", + _I("capa=%d full=%d now=%d health=%d online=%d ovp=%d present=%d temp=%d", battery.capacity, battery.charge_full, battery.charge_now, @@ -1017,7 +1017,7 @@ static GVariant *dbus_get_battery_info(GDBusConnection *conn, ret = battery_dev->get_current_state(battery_get_info, &info); if (ret < 0) - _E("Failed to get battery info (%d)", ret); + _E("Failed to get battery info: %d", ret); battery_changed(&info, NULL); free(info.status); @@ -1068,7 +1068,7 @@ static int booting_done(void *data) if (done == 0) return done; - _I("booting done"); + _I("Booting done."); power_supply_timer_stop(); @@ -1102,29 +1102,29 @@ static int power_supply_probe(void *data) ret = hw_get_info(BATTERY_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (ret < 0) { - _E("Fail to load battery shared library (%d)", ret); + _E("Failed to load battery shared library: %d", ret); goto out; } if (!info->open) { - _E("Failed to open battery device; open(NULL)"); + _E("Failed to open battery device: open(NULL)"); ret = -ENODEV; goto out; } ret = info->open(info, NULL, (struct hw_common**)&battery_dev); if (ret < 0) { - _E("Failed to get battery device structure (%d)", ret); + _E("Failed to get battery device structure: %d", ret); goto out; } if (!battery_dev || !battery_dev->get_current_state) { - _E("get_current_state() is not supported by the Battery HAL"); + _E("get_current_state() is not supported by the Battery HAL."); ret = -ENODEV; goto out; } - _I("battery device structure load success"); + _I("Battery device structure load success."); return 0; out: @@ -1135,7 +1135,7 @@ out: vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS, -ENOTSUP); vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, -ENOTSUP); vconf_set_int(VCONFKEY_SYSMAN_BATTERY_LEVEL_STATUS, -ENOTSUP); - _I("There is no battery device(%d)", ret); + _I("There is no battery device: %d", ret); return -ENODEV; } @@ -1190,14 +1190,14 @@ static void power_supply_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_BATTERY, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); #ifdef TIZEN_FEATURE_BATTERY_OVER_TEMPERATURE ret = subscribe_dbus_signal(NULL, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI, SIGNAL_CHARGEERR_RESPONSE, abnormal_popup_dbus_signal_handler, NULL, NULL); if (ret <= 0) - _E("fail to init dbus signal(%d)", ret); + _E("Failed to init dbus signal: %d", ret); #endif /* TIZEN_FEATURE_BATTERY_OVER_TEMPERATURE */ } diff --git a/src/control/control.c b/src/control/control.c old mode 100644 new mode 100755 index 7ce5662..a2cd0e7 --- a/src/control/control.c +++ b/src/control/control.c @@ -51,12 +51,12 @@ static int control_handler(int argc, char **argv) int ret; const struct device_ops *dev_ops = NULL; - _I("argc : %d", argc); + _I("argc=%d", argc); for (i = 0; i < argc; ++i) - _I("[%2d] %s", i, argv[i]); + _I("argv[%2d]=%s", i, argv[i]); if (argc > 5) { - _E("Invalid argument"); + _E("Invalid argument."); errno = EINVAL; return -1; } @@ -64,7 +64,7 @@ static int control_handler(int argc, char **argv) pid = atoi(argv[0]); device = atoi(argv[1]); enable = atoi(argv[2]); - _I("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) @@ -75,7 +75,7 @@ static int control_handler(int argc, char **argv) FIND_DEVICE(dev_ops, devices[i].name); if (!check_default(dev_ops)) { - _I("Device %s found", devices[i].name); + _I("Device %s found.", devices[i].name); if (enable) ret = device_start(dev_ops); @@ -98,19 +98,19 @@ static int get_control_handler(int argc, char **argv) int device; const struct device_ops *dev_ops = NULL; - _I("argc : %d", argc); + _I("argc=%d", argc); for (i = 0; i < argc; ++i) - _I("[%2d] %s", i, argv[i]); + _I("argv[%2d]=%s", i, argv[i]); if (argc > 4) { - _E("Invalid argument"); + _E("Invalid argument."); errno = EINVAL; return -1; } pid = atoi(argv[0]); device = atoi(argv[1]); - _I("pid : %d, device : %d", pid, device); + _I("pid=%d device=%d", pid, device); for (i = 0; i < ARRAY_SIZE(devices); i++) if (devices[i].id == device) @@ -138,14 +138,14 @@ GVariant *dbus_control_handler(GDBusConnection *conn, g_variant_get(param, "(sisss)", NULL, &argc, &argv[0], &argv[1], &argv[2]); if (argc < 0) { - _E("message is invalid!"); + _E("Message is invalid."); ret = -EINVAL; goto out; } pid = dbus_connection_get_sender_pid(conn, sender); if (kill(pid, 0) == -1) { - _E("%d process does not exist, dbus ignored!", pid); + _E("Process(%d) does not exist. Dbus ignored.", pid); ret = -ESRCH; goto out; } @@ -170,14 +170,14 @@ GVariant *dbus_get_control_handler(GDBusConnection *conn, g_variant_get(param, "(siss)", NULL, &argc, &argv[0], &argv[1]); if (argc < 0) { - _E("message is invalid!"); + _E("Message is invalid."); ret = -EINVAL; goto out; } pid = dbus_connection_get_sender_pid(conn, sender); if (kill(pid, 0) == -1) { - _E("%d process does not exist, dbus ignored!", pid); + _E("Process(%d) does not exist. Dbus ignored.", pid); ret = -ESRCH; goto out; } @@ -208,7 +208,7 @@ static void control_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); } diff --git a/src/core/common.c b/src/core/common.c old mode 100644 new mode 100755 index 1ffd895..0208c5e --- a/src/core/common.c +++ b/src/core/common.c @@ -495,7 +495,7 @@ void print_time(const char *prefix) gettimeofday(&tv, NULL); ret = localtime_r(&(tv.tv_sec), &tm); if (ret) - _D("%s --> %d:%02d:%02d %06ld", + _D("'%s' %d:%02d:%02d %06ld", prefix, tm.tm_hour, tm.tm_min, tm.tm_sec, tv.tv_usec); } @@ -538,7 +538,7 @@ bool is_emulator(void) ret = system_info_get_platform_string(MODEL_NAME, &model_name); if (ret < 0) { - _E("Cannot get model name(%d)", ret); + _E("Cannot get model name: %d", ret); return emul; } diff --git a/src/core/config-parser.c b/src/core/config-parser.c old mode 100644 new mode 100755 index 726d150..070f2ba --- a/src/core/config-parser.c +++ b/src/core/config-parser.c @@ -61,7 +61,7 @@ int config_parse(const char *file_name, int cb(struct parse_result *result, /* open conf file */ f = fopen(file_name, "r"); if (!f) { - _E("Failed to open file %s", file_name); + _E("Failed to open file '%s'.", file_name); ret = -EIO; goto error; } @@ -114,14 +114,14 @@ int config_parse(const char *file_name, int cb(struct parse_result *result, } } } - _D("Success to load %s", file_name); + _D("Success to load '%s'.", file_name); fclose(f); return 0; error: if (f) fclose(f); - _E("Failed to read %s:%d!", file_name, lineno); + _E("Failed to read '%s'. line=%d", file_name, lineno); return ret; } diff --git a/src/core/device-idler.c b/src/core/device-idler.c old mode 100644 new mode 100755 index eaf3894..6275c3b --- a/src/core/device-idler.c +++ b/src/core/device-idler.c @@ -74,7 +74,7 @@ static void process_next_request_in_idle(void) * so it just prints out error log. */ if (!idler) - _E("fail to add request to idler"); + _E("Failed to add request to idler."); } int add_idle_request(void (*func)(void *data), void *data) @@ -82,13 +82,13 @@ int add_idle_request(void (*func)(void *data), void *data) struct device_request *req; if (!func) { - _E("invalid argumet : func(NULL)"); + _E("Invalid argumet: func(NULL)"); return -EINVAL; } req = calloc(1, sizeof(struct device_request)); if (!req) { - _E("fail to allocate request : %d", errno); + _E("Failed to allocate request: %d", errno); return -errno; } diff --git a/src/core/device-notifier.c b/src/core/device-notifier.c old mode 100644 new mode 100755 index 369ac55..c61c583 --- a/src/core/device-notifier.c +++ b/src/core/device-notifier.c @@ -44,22 +44,22 @@ int register_notifier(enum device_notifier_type status, int (*func)(void *data)) dd_list *n; struct device_notifier *notifier; - _I("%d, %p", status, func); + _I("notifier type=%d func=%p", status, func); if (!func) { - _E("invalid func address!"); + _E("Invalid func address."); return -EINVAL; } FIND_NOTIFIER(device_notifier_list, n, notifier, status, func) { - _E("function is already registered! [%d, %p]", + _E("Function is already registered. type=%d func=%p", status, func); return -EINVAL; } notifier = calloc(1, sizeof(struct device_notifier)); if (!notifier) { - _E("Fail to malloc for notifier!"); + _E("Failed to malloc for notifier."); return -ENOMEM; } @@ -77,12 +77,12 @@ int unregister_notifier(enum device_notifier_type status, int (*func)(void *data struct device_notifier *notifier; if (!func) { - _E("invalid func address!"); + _E("Invalid func address."); return -EINVAL; } FIND_NOTIFIER(device_notifier_list, n, notifier, status, func) { - _I("[%d, %p]", status, func); + _I("notifier type=%d func=%p", status, func); notifier->deleted = true; } @@ -173,7 +173,7 @@ static gboolean late_init_timer_cb(void *data) done = booting_done(NULL); if (done) return G_SOURCE_REMOVE; - _I("late booting done"); + _I("Late booting done."); done = TRUE; device_notify_once(DEVICE_NOTIFIER_BOOTING_DONE, (void *)&done); @@ -186,7 +186,7 @@ static void device_notifier_init(void *data) ret = check_systemd_active(); if (ret == TRUE) { - _I("restart booting done"); + _I("Restart booting done."); return; } register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); @@ -194,7 +194,7 @@ static void device_notifier_init(void *data) late_init_timer = g_timeout_add_seconds(LATE_INIT_TIME, late_init_timer_cb, NULL); if (!late_init_timer) - _E("Failed to set late_init_timer"); + _E("Failed to set 'late_init_timer'."); } static void device_notifier_exit(void *data) diff --git a/src/core/devices.c b/src/core/devices.c old mode 100644 new mode 100755 index 4785111..526fd92 --- a/src/core/devices.c +++ b/src/core/devices.c @@ -81,7 +81,7 @@ GVariant *dbus_device_list(GDBusConnection *conn, dd_list *elem; const struct device_ops *dev; - _I("device list!"); + _I("Device list."); DD_LIST_FOREACH(dev_head, elem, dev) _I("%s", dev->name); @@ -109,25 +109,25 @@ void devices_init(void *data) DD_LIST_FOREACH_SAFE(dev_head, elem, elem_n, dev) { if (dev->probe && dev->probe(data) != 0) { - _E("[%s] Failed to probe", dev->name); + _E("[%s] Failed to probe.", dev->name); DD_LIST_REMOVE(dev_head, dev); continue; } } DD_LIST_FOREACH_SAFE(dev_head, elem, elem_n, dev) { - _D("[%s] Initialization", dev->name); + _D("[%s] Initialization.", dev->name); if (dev->init) dev->init(data); } ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_CORE, &dbus_interface); if (ret < 0) - _E("Failed to init dbus method: ret=%d", ret); + _E("Failed to init dbus method: %d", ret); /* register every objects */ if (dbus_handle_register_dbus_object_all(NULL) < 0) - _E("Failed to register dbus method: ret=%d", ret); + _E("Failed to register dbus method: %d", ret); } void devices_exit(void *data) @@ -136,7 +136,7 @@ void devices_exit(void *data) const struct device_ops *dev; DD_LIST_FOREACH(dev_head, elem, dev) { - _D("[%s] deinitialize", dev->name); + _D("[%s] Deinitialize.", dev->name); if (dev->exit) dev->exit(data); } diff --git a/src/core/event-handler.c b/src/core/event-handler.c old mode 100644 new mode 100755 index f8bb1ec..9f819fd --- a/src/core/event-handler.c +++ b/src/core/event-handler.c @@ -33,7 +33,7 @@ GVariant *dbus_start_event_handler(GDBusConnection *conn, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { if (state != DEVICE_NOTIFIER_STATE_START) { - _D("START event-handler"); + _D("Start event-handler."); state = DEVICE_NOTIFIER_STATE_START; device_notify(DEVICE_NOTIFIER_EVENT_HANDLER, (void *)&state); } @@ -45,7 +45,7 @@ GVariant *dbus_stop_event_handler(GDBusConnection *conn, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { if (state != DEVICE_NOTIFIER_STATE_STOP) { - _D("STOP event-handler"); + _D("Stop event-handler."); state = DEVICE_NOTIFIER_STATE_STOP; device_notify(DEVICE_NOTIFIER_EVENT_HANDLER, (void *)&state); } @@ -93,7 +93,7 @@ static void event_handler_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_SYSNOTI, &eh_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); state = DEVICE_NOTIFIER_STATE_START; } diff --git a/src/core/execute.c b/src/core/execute.c old mode 100644 new mode 100755 index 1996c4d..d7b75cd --- a/src/core/execute.c +++ b/src/core/execute.c @@ -36,14 +36,14 @@ static int parent(pid_t pid) if (waitpid(pid, &status, 0) != -1) { /* terminated normally */ if (WIFEXITED(status)) { - _I("%d terminated by exit(%d)", pid, WEXITSTATUS(status)); + _I("Process(%d) terminated by exit(%d).", pid, WEXITSTATUS(status)); return WEXITSTATUS(status); } else if (WIFSIGNALED(status)) - _I("%d terminated by signal %d", pid, WTERMSIG(status)); + _I("Process(%d) terminated by signal(%d).", pid, WTERMSIG(status)); else if (WIFSTOPPED(status)) - _I("%d stopped by signal %d", pid, WSTOPSIG(status)); + _I("Process(%d) stopped by signal(%d).", pid, WSTOPSIG(status)); } else - _I("%d waitpid() failed : %d", pid, errno); + _I("Process(%d) failed to call waitpid(): %d", pid, errno); return -EAGAIN; } @@ -72,7 +72,7 @@ int run_child(int argc, const char *argv[]) fp = fopen(argv[0], "r"); if (fp == NULL) { - _E("fail %s (%d)", argv[0], errno); + _E("Failed to open '%s': %d", argv[0], errno); return -errno; } fclose(fp); @@ -88,7 +88,7 @@ int run_child(int argc, const char *argv[]) pid = fork(); if (pid < 0) { - _E("failed to fork"); + _E("Failed to fork."); r = -errno; } else if (pid == 0) { child(argc, argv); @@ -96,7 +96,7 @@ int run_child(int argc, const char *argv[]) r = parent(pid); if (sigaction(SIGCHLD, &oldact, NULL) < 0) - _E("failed to restore sigaction"); + _E("Failed to restore sigaction."); return r; } diff --git a/src/core/launch.c b/src/core/launch.c old mode 100644 new mode 100755 index 57f4f88..1ceb4ed --- a/src/core/launch.c +++ b/src/core/launch.c @@ -136,7 +136,7 @@ int launch_app_with_nice(const char *file, char *const argv[], pid_t *pid, int _ int _pid; if (file == NULL || access(file, X_OK) != 0) { - _E("launch app error: Invalid input"); + _E("Launch app error: Invalid input"); errno = EINVAL; return -1; } @@ -147,7 +147,7 @@ int launch_app_with_nice(const char *file, char *const argv[], pid_t *pid, int _ _pid = fork(); if (_pid == -1) { - _E("fork error: %d", errno); + _E("Failed to fork: %d", errno); /* keep errno */ return -1; } @@ -164,12 +164,12 @@ int launch_app_with_nice(const char *file, char *const argv[], pid_t *pid, int _ ret = nice(_nice); if (ret == -1 && errno != 0) - _E("nice error: %d", errno); + _E("Failed to nice: %d", errno); ret = execvp(file, argv); /* If failed... */ - _E("exec. error: %d", errno); + _E("Failed to exec: %d", errno); return -2; } @@ -182,7 +182,7 @@ int launch_app_cmd_with_nice(const char *cmdline, int _nice) nargs = parse_cmd(cmdline, argv, MAX_ARGS + 1); if (nargs == -1) { - _E("launch app error: Invalid input"); + _E("Launch app error: Invalid input"); errno = EINVAL; return -1; } @@ -277,7 +277,7 @@ int launch_evenif_exist(const char *execpath, const char *arg, ...) buf_size = strlen(execpath) + strlen(arg) + 10; buf = malloc(buf_size); if (buf == NULL) { - _E("Malloc failed"); + _E("Failed to malloc."); return -1; } diff --git a/src/core/main.c b/src/core/main.c old mode 100644 new mode 100755 index 9ff0cd1..0ff129b --- a/src/core/main.c +++ b/src/core/main.c @@ -51,12 +51,12 @@ static void writepid(char *pidpath) static void sig_quit(int signo) { - _D("received SIGTERM signal %d", signo); + _D("Received SIGTERM signal(%d).", signo); } static void sig_usr1(int signo) { - _D("received SIGUSR1 signal %d, deviced'll be finished!", signo); + _D("Received SIGUSR1 signal(%d), deviced'll be finished.", signo); if (mainloop && g_main_loop_is_running(mainloop)) g_main_loop_quit(mainloop); } @@ -72,7 +72,7 @@ static void deviced_dbus_name_acquired(GDBusConnection *connection, const gchar ret = booting_finished(); if (ret == 1) { /* Restarted: deviced was terminated */ - _I("notify relaunch"); + _I("Notify relaunch."); device_notify_once(DEVICE_NOTIFIER_BOOTING_DONE, &ret); } @@ -104,7 +104,7 @@ static int deviced_main(int argc, char **argv) handle = dbus_handle_get_connection(G_BUS_TYPE_SYSTEM, FALSE); if (!handle) - _E("Fail to get dbus connection"); + _E("Failed to get dbus connection."); load_plugins(); @@ -112,7 +112,7 @@ static int deviced_main(int argc, char **argv) ret = dbus_handle_request_bus_name(handle, DEVICED_BUS_NAME, deviced_dbus_name_acquired, NULL); if (ret <= 0) { - _E("Fail to request bus name"); + _E("Failed to request bus name."); dbus_handle_check_owner_name(NULL, DEVICED_BUS_NAME); } diff --git a/src/core/sig-handler.c b/src/core/sig-handler.c old mode 100644 new mode 100755 index 17b0dfc..e48f1ec --- a/src/core/sig-handler.c +++ b/src/core/sig-handler.c @@ -38,11 +38,11 @@ static void sig_child_handler(int signo, siginfo_t *info, void *data) pid = waitpid(info->si_pid, &status, 0); if (pid == -1) { - _E("SIGCHLD received\n"); + _E("SIGCHLD received.\n"); return; } - _D("sig child actend call - %d\n", info->si_pid); + _D("Sig child actend call - %d\n", info->si_pid); } static void sig_pipe_handler(int signo, siginfo_t *info, void *data) diff --git a/src/core/udev.c b/src/core/udev.c old mode 100644 new mode 100755 index 07ac8e1..d9e2e7c --- a/src/core/udev.c +++ b/src/core/udev.c @@ -116,14 +116,14 @@ static int uevent_control_start(const char *type, return -EINVAL; if (info->mon) { - _E("%s uevent control routine is alreay started", type); + _E("%s Uevent control routine is alreay started.", type); return -EINVAL; } if (!udev) { udev = udev_new(); if (!udev) { - _E("error create udev"); + _E("Failed to create udev."); return -EINVAL; } } else @@ -131,15 +131,15 @@ static int uevent_control_start(const char *type, info->mon = udev_monitor_new_from_netlink(udev, type); if (info->mon == NULL) { - _E("error udev_monitor create"); + _E("Failed to create udev_monitor."); goto stop; } - _I("Set udev monitor buffer size %d", UDEV_MONITOR_SIZE); + _I("Set udev monitor buffer size(%d).", UDEV_MONITOR_SIZE); ret = udev_monitor_set_receive_buffer_size(info->mon, UDEV_MONITOR_SIZE); if (ret != 0) { - _E("fail to set receive buffer size"); + _E("Failed to set receive buffer size."); goto stop; } @@ -148,18 +148,18 @@ static int uevent_control_start(const char *type, info->mon, l->subsystem, NULL); if (ret < 0) { - _E("error apply subsystem filter"); + _E("Failed to apply subsystem filter."); goto stop; } } ret = udev_monitor_filter_update(info->mon); if (ret < 0) - _E("error udev_monitor_filter_update"); + _E("Failed to call 'udev_monitor_filter_update'."); fd = udev_monitor_get_fd(info->mon); if (fd == -1) { - _E("error udev_monitor_get_fd"); + _E("Failed to call 'udev_monitor_get_fd'."); goto stop; } @@ -167,14 +167,14 @@ static int uevent_control_start(const char *type, info->fdh = g_unix_fd_add(fd, G_IO_IN, uevent_control_cb, info); if (!info->fdh) { - _E("error g_unix_fd_add"); + _E("Failed to call 'error g_unix_fd_add'."); close(fd); info->fd = -1; goto stop; } if (udev_monitor_enable_receiving(info->mon) < 0) { - _E("error unable to subscribe to udev events"); + _E("Failed to call 'udev_monitor_enable_receiving'."); goto stop; } @@ -214,14 +214,14 @@ static int register_uevent_control(struct uevent_info *info, r = udev_monitor_filter_add_match_subsystem_devtype(info->mon, uh->subsystem, NULL); if (r < 0) { - _E("fail to add %s subsystem : %d", uh->subsystem, r); + _E("Failed to add subsystem(%s): %d", uh->subsystem, r); return -EPERM; } } r = udev_monitor_filter_update(info->mon); if (r < 0) - _E("fail to update udev monitor filter : %d", r); + _E("Failed to update udev monitor filter: %d", r); add_list: DD_LIST_APPEND(info->event_list, uh); @@ -298,10 +298,10 @@ static void udev_init(void *data) register_notifier(DEVICE_NOTIFIER_EVENT_HANDLER, device_event_handler); if (uevent_control_start(KERNEL, &kevent) != 0) - _E("fail uevent kernel control init"); + _E("Failed to init uevent kernel control."); if (uevent_control_start(UDEV, &uevent) != 0) - _E("fail uevent udev control init"); + _E("Failed to init uevent udev control."); } static void udev_exit(void *data) -- 2.7.4 From 8588a18ac34af5d0752af3b20abccf04ca5b16b8 Mon Sep 17 00:00:00 2001 From: Yunmi Ha Date: Fri, 22 Feb 2019 15:21:39 +0900 Subject: [PATCH 11/16] Apply consistent log messages. 1. First letter to uppercase. 2. Period at the end. 3. Rearrange parameters. Change-Id: Ic28e18d4f09a2b3a89517db25498c7b8c191a61f Signed-off-by: Yunmi Ha --- src/cpu/pmqos-plugin.c | 8 ++--- src/cpu/pmqos.c | 36 +++++++++---------- src/devicectl/devicectl.c | 36 +++++++++---------- src/devicectl/usb.c | 18 +++++----- src/dump/dump.c | 10 +++--- src/extcon/cradle.c | 10 +++--- src/extcon/earjack.c | 4 +-- src/extcon/extcon.c | 50 +++++++++++++------------- src/extcon/hdmi.c | 8 ++--- src/ir/ir.c | 16 ++++----- src/led/noti.c | 8 ++--- src/led/rgb.c | 50 +++++++++++++------------- src/led/torch.c | 18 +++++----- src/led/touch-key.c | 14 ++++---- src/libdeviced/deviced-noti.c | 24 ++++++------- src/libdeviced/deviced-util.c | 4 +-- src/libdeviced/display.c | 28 +++++++-------- src/libdeviced/haptic.c | 10 +++--- src/libdeviced/led.c | 6 ++-- src/libdeviced/usbhost.c | 12 +++---- src/power/low-power.c | 26 +++++++------- src/power/power-handler.c | 82 +++++++++++++++++++++---------------------- 22 files changed, 239 insertions(+), 239 deletions(-) mode change 100644 => 100755 src/cpu/pmqos-plugin.c mode change 100644 => 100755 src/cpu/pmqos.c mode change 100644 => 100755 src/devicectl/devicectl.c mode change 100644 => 100755 src/devicectl/usb.c mode change 100644 => 100755 src/dump/dump.c mode change 100644 => 100755 src/extcon/cradle.c mode change 100644 => 100755 src/extcon/earjack.c mode change 100644 => 100755 src/extcon/extcon.c mode change 100644 => 100755 src/extcon/hdmi.c mode change 100644 => 100755 src/ir/ir.c mode change 100644 => 100755 src/led/noti.c mode change 100644 => 100755 src/led/rgb.c mode change 100644 => 100755 src/led/torch.c mode change 100644 => 100755 src/led/touch-key.c mode change 100644 => 100755 src/libdeviced/deviced-noti.c mode change 100644 => 100755 src/libdeviced/deviced-util.c mode change 100644 => 100755 src/libdeviced/display.c mode change 100644 => 100755 src/libdeviced/haptic.c mode change 100644 => 100755 src/libdeviced/led.c mode change 100644 => 100755 src/libdeviced/usbhost.c mode change 100644 => 100755 src/power/low-power.c mode change 100644 => 100755 src/power/power-handler.c diff --git a/src/cpu/pmqos-plugin.c b/src/cpu/pmqos-plugin.c old mode 100644 new mode 100755 index 775fa79..be46494 --- a/src/cpu/pmqos-plugin.c +++ b/src/cpu/pmqos-plugin.c @@ -59,7 +59,7 @@ static int pmqos_parse_scenario(struct parse_result *result, void *data) scenarios->num = SCENARIO_MAX; scenarios->list = malloc(sizeof(struct scenario)*scenarios->num); if (!scenarios->list) { - _E("failed to allocat memory for scenario"); + _E("Failed to allocat memory for scenario."); return -errno; } } @@ -116,7 +116,7 @@ static int pmqos_load_config(struct parse_result *result, void *user_data) if (MATCH(result->section, "PmqosScenario")) { ret = pmqos_parse_scenario(result, user_data); if (ret < 0) - _E("failed to parse [PmqosScenario] section : %d", ret); + _E("Failed to parse 'PmqosScenario' section: %d", ret); return ret; } @@ -127,7 +127,7 @@ static int pmqos_load_config(struct parse_result *result, void *user_data) if (MATCH(result->section, name)) { ret = pmqos_parse_each_scenario(result, user_data, index); if (ret < 0) - _E("failed to parse [Scenario%d] section : %d", index, ret); + _E("Failed to parse 'Scenario%d' section: %d", index, ret); return ret; } } @@ -153,7 +153,7 @@ int get_pmqos_table(const char *path, struct pmqos_scenario *scenarios) /* get configuration file */ ret = config_parse(path, pmqos_load_config, scenarios); if (ret < 0) { - _E("failed to load conficuration file(%s) : %d", path, ret); + _E("Failed to load conficuration file(%s): %d", path, ret); release_pmqos_table(scenarios); return ret; } diff --git a/src/cpu/pmqos.c b/src/cpu/pmqos.c old mode 100644 new mode 100755 index 66f12df..af9a681 --- a/src/cpu/pmqos.c +++ b/src/cpu/pmqos.c @@ -59,7 +59,7 @@ int set_cpu_pmqos(const char *name, int val) if (!cpu_dev || !cpu_dev->start_boost || !cpu_dev->stop_boost) { - _E("cpu device HAL does not exist"); + _E("Cpu device HAL does not exist."); return -ENODEV; } @@ -67,11 +67,11 @@ int set_cpu_pmqos(const char *name, int val) return -EINVAL; if (val) { - _D("Set pm scenario : [Lock ]%s", name); + _D("Set pm scenario. Lock %s.", name); return cpu_dev->start_boost((void *)name); } - _D("Set pm scenario : [Unlock]%s", name); + _D("Set pm scenario. Unlock %s.", name); return cpu_dev->stop_boost((void *)name); } @@ -129,7 +129,7 @@ static int pmqos_unlock_timer_start(void) clock_gettime(CLOCK_REALTIME, &unlock_timer_start_st); unlock_timer = g_timeout_add(unlock_timer_owner.timeout, pmqos_cpu_timer, NULL); if (unlock_timer == 0) { - _E("fail init pmqos unlock %s %d", cpu->name, cpu->timeout); + _E("Failed to init pmqos unlock. name=%s timeout=%d", cpu->name, cpu->timeout); return -EPERM; } break; @@ -178,7 +178,7 @@ static gboolean pmqos_cpu_timer(gpointer data) ret = pmqos_cpu_cancel(unlock_timer_owner.name); if (ret < 0) - _E("Can not find %s request", unlock_timer_owner.name); + _E("Can not find %s request.", unlock_timer_owner.name); unlock_timer = 0; return G_SOURCE_REMOVE; @@ -210,7 +210,7 @@ static int pmqos_cpu_request(const char *name, int val) /* Check valid parameter */ if (val > DEFAULT_PMQOS_TIMER) { - _I("The timer value cannot be higher than default time value(%dms)", DEFAULT_PMQOS_TIMER); + _I("The timer value cannot be higher than default time value(%dms).", DEFAULT_PMQOS_TIMER); val = DEFAULT_PMQOS_TIMER; } @@ -340,7 +340,7 @@ static int get_methods_from_conf(const char *path, dbus_method_s **dbus_methods) /* allocate dbus methods structure */ methods = malloc(sizeof(dbus_method_s) * scenarios.num); if (!methods) { - _E("failed to allocate methods memory : %d", errno); + _E("Failed to allocate methods memory: %d", errno); /* release scenarios memory */ release_pmqos_table(&scenarios); return -errno; @@ -351,7 +351,7 @@ static int get_methods_from_conf(const char *path, dbus_method_s **dbus_methods) /* if this scenario does not support */ if (!scenarios.list[i].support) { - _I("do not support [%s] scenario", scenarios.list[i].name); + _I("Do not support '%s' scenario.", scenarios.list[i].name); continue; } @@ -359,7 +359,7 @@ static int get_methods_from_conf(const char *path, dbus_method_s **dbus_methods) methods[i].signature_in = "i"; methods[i].signature_out = "i"; methods[i].func = dbus_pmqos_handler; - _D("support [%s] scenario", scenarios.list[i].name); + _D("Support '%s' scenario.", scenarios.list[i].name); } *dbus_methods = methods; @@ -447,17 +447,17 @@ static int booting_done(void *data) done = *(int *)data; if (!done) goto out; - _I("booting done"); + _I("Booting done."); /* register dbus methods */ ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_PMQOS, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); /* get methods from config file */ size = get_methods_from_conf(PMQOS_CONF_PATH, &methods); if (size < 0) - _E("failed to load configuration file(%s)", PMQOS_CONF_PATH); + _E("Failed to load configuration file(%s).", PMQOS_CONF_PATH); /* register dbus methods for pmqos */ if (methods) { @@ -465,12 +465,12 @@ static int booting_done(void *data) dbus_interface_conf.nr_methods = size; ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_PMQOS, &dbus_interface_conf); if (ret < 0) - _E("fail to init dbus method from conf(%d)", ret); + _E("Failed to init dbus method from conf: %d", ret); free(methods); } if (dbus_handle_register_dbus_object_all(NULL) < 0) - _E("Failed to register dbus method! %d", ret); + _E("Failed to register dbus method: %d", ret); /* register notifier for each event */ register_notifier(DEVICE_NOTIFIER_CPU_BOOST_LOWBAT, pmqos_lowbat); @@ -491,22 +491,22 @@ static int pmqos_probe(void *data) r = hw_get_info(CPU_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (r < 0) { - _I("cpu shared library is not supported: %d", r); + _I("Cpu shared library is not supported: %d", r); return -ENODEV; } if (!info->open) { - _E("fail to open cpu device : open(NULL)"); + _E("Failed to open cpu device: open(NULL)"); return -EPERM; } r = info->open(info, NULL, (struct hw_common **)&cpu_dev); if (r < 0) { - _E("fail to get cpu device structure : %d", r); + _E("Failed to get cpu device structure: %d", r); return -EPERM; } - _D("cpu device structure load success"); + _D("Cpu device structure load success."); return 0; } diff --git a/src/devicectl/devicectl.c b/src/devicectl/devicectl.c old mode 100644 new mode 100755 index 52455f2..4b820d5 --- a/src/devicectl/devicectl.c +++ b/src/devicectl/devicectl.c @@ -68,7 +68,7 @@ static int start_device(char **args) if (!args[1]) return -EINVAL; - printf("start %s device!\n", args[1]); + printf("Start %s device.\n", args[1]); msg = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME, devices[arg_id].path, @@ -90,7 +90,7 @@ static int stop_device(char **args) if (!args[1]) return -EINVAL; - printf("stop %s device!\n", args[1]); + printf("Stop %s device.\n", args[1]); msg = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME, devices[arg_id].path, @@ -112,7 +112,7 @@ static int dump_mode(char **args) if (!args[1] || !args[2] || !args[3]) return -EINVAL; - printf("%s (%s %s)!\n", args[1], args[2], args[3]); + printf("%s (%s %s).\n", args[1], args[2], args[3]); ret = dbus_handle_method_async_var(DEVICED_BUS_NAME, devices[arg_id].path, @@ -120,7 +120,7 @@ static int dump_mode(char **args) "Dumpmode", g_variant_new("(s)", args[3])); if (ret < 0) - printf("failed to set dump mode (%d)", ret); + printf("Failed to set dump mode: %d", ret); return ret; } @@ -132,7 +132,7 @@ static int save_log(char **args) if (!args[1]) return -EINVAL; - printf("save log %s device!\n", args[1]); + printf("Save log %s device.\n", args[1]); ret = dbus_handle_method_async(DEVICED_BUS_NAME, devices[arg_id].path, @@ -140,7 +140,7 @@ static int save_log(char **args) "SaveLog", NULL, NULL); if (ret < 0) - printf("failed to save log (%d)", ret); + printf("Failed to save log: %d", ret); return ret; } @@ -177,7 +177,7 @@ static int save_dbus_name(char **args) if (!args[1]) return -EINVAL; - printf("save dbus name!\n"); + printf("Save dbus name.\n"); msg = dbus_handle_method_sync_with_reply_var(DBUS_BUS_NAME, DBUS_OBJECT_PATH, @@ -185,17 +185,17 @@ static int save_dbus_name(char **args) "ListNames", NULL); if (!msg) { - printf("failed to get list names"); + printf("Failed to get list names."); return -EBADMSG; } if (!dh_get_param_from_var(msg, "(as)", &iter)) { - printf("invalid list name arguments!"); + printf("Invalid list name arguments."); g_variant_unref(msg); return -EINVAL; } - printf("%" G_GSIZE_FORMAT " connections\n", g_variant_iter_n_children(iter)); + printf("%" G_GSIZE_FORMAT " connections.\n", g_variant_iter_n_children(iter)); while (g_variant_iter_loop(iter, "s", &str)) { pid = dbus_handle_get_sender_pid(NULL, str); @@ -216,7 +216,7 @@ static int device_list(char **args) if (!args[1]) return -EINVAL; - printf("print %s to dlog!\n", args[1]); + printf("Print %s to dlog.\n", args[1]); msg = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME, devices[arg_id].path, @@ -248,7 +248,7 @@ static int enable_device(char **args) if (!args[3]) return -EINVAL; - printf("enable %s device!\n", args[3]); + printf("Enable %s device.\n", args[3]); msg = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME, devices[arg_id].path, @@ -270,7 +270,7 @@ static int disable_device(char **args) if (!args[3]) return -EINVAL; - printf("disable %s device!\n", args[3]); + printf("Disable %s device.\n", args[3]); msg = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME, devices[arg_id].path, @@ -292,7 +292,7 @@ static int power_operation(char **args, char *type) if (!args[1] || !type) return -EINVAL; - printf("Power %s device!\n", args[2]); + printf("Power %s device.\n", args[2]); msg = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME, devices[arg_id].path, @@ -342,7 +342,7 @@ static const struct action { static inline void usage() { printf("[usage] devicectl \n"); - printf("Please use option --help to check options\n"); + printf("Please use option --help to check options.\n"); } static void help() @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) break; if (i >= ARRAY_SIZE(devices)) { - printf("invalid device name! %s\n", argv[1]); + printf("Invalid device name. %s\n", argv[1]); usage(); return -EINVAL; } @@ -400,13 +400,13 @@ int main(int argc, char *argv[]) break; if (i >= ARRAY_SIZE(actions)) { - printf("invalid action name! %s\n", argv[2]); + printf("Invalid action name. %s\n", argv[2]); usage(); return -EINVAL; } if (actions[i].argc != argc) { - printf("invalid arg count!\n"); + printf("Invalid arg count.\n"); usage(); return -EINVAL; } diff --git a/src/devicectl/usb.c b/src/devicectl/usb.c old mode 100644 new mode 100755 index 9c3403f..37bc468 --- a/src/devicectl/usb.c +++ b/src/devicectl/usb.c @@ -56,7 +56,7 @@ static int launch_app(char **argv) pid = fork(); if (pid < 0) { - printf("fork() failed\n"); + printf("Failed to call fork().\n"); return -ENOMEM; } @@ -67,7 +67,7 @@ static int launch_app(char **argv) /*child*/ if (execvp(argv[0], argv) < 0) - printf("execvp failed (%d)\n", errno); + printf("Failed to call execvp: %d\n", errno); return 0; } @@ -82,14 +82,14 @@ static int write_sysfs(char *path, char *value) fp = fopen(path, "w"); if (!fp) { - printf("FAIL: fopen(%s)\n", path); + printf("Failed to open '%s'.\n", path); return -ENOMEM; } ret = fwrite(value, sizeof(char), strlen(value), fp); fclose(fp); if (ret < strlen(value)) { - printf("FAIL: fwrite(%s)\n", value); + printf("Failed to write '%s'.\n", value); ret = -ENOMEM; } @@ -107,7 +107,7 @@ static int set_usb_configuration(char *idproduct, char *fconf, char *sconf) for (i = 0; i < ARRAY_SIZE(usb_confs); i++) { ret = write_sysfs(usb_confs[i].path, usb_confs[i].value); if (ret < 0) { - printf("usb setting fails (%s), (%s)\n", usb_confs[i].path, usb_confs[i].value); + printf("Failed to write usb setting. path=%s value=%s\n", usb_confs[i].path, usb_confs[i].value); return ret; } } @@ -251,7 +251,7 @@ static int unload_ssh(void) int load_usb_mode(char *opt) { if (!opt) { - printf("Failed: Forth parameter is NULL\n"); + printf("Failed: Forth parameter is NULL.\n"); return -EINVAL; } @@ -261,14 +261,14 @@ int load_usb_mode(char *opt) if (!strncmp(opt, USB_SSH, strlen(opt))) return load_ssh(); - printf("Failed: Forth parameter is invalid (%s)\n", opt); + printf("Failed: Forth parameter(%s) is invalid.\n", opt); return -EINVAL; } int unload_usb_mode(char *opt) { if (!opt) { - printf("Failed: Forth parameter is NULL\n"); + printf("Failed: Forth parameter is NULL.\n"); return -EINVAL; } @@ -278,6 +278,6 @@ int unload_usb_mode(char *opt) if (!strncmp(opt, USB_SSH, strlen(opt))) return unload_ssh(); - printf("Failed: Forth parameter is invalid (%s)\n", opt); + printf("Failed: Forth parameter(%s) is invalid.\n", opt); return -EINVAL; } diff --git a/src/dump/dump.c b/src/dump/dump.c old mode 100644 new mode 100755 index f16e617..b89ecc2 --- a/src/dump/dump.c +++ b/src/dump/dump.c @@ -63,12 +63,12 @@ static void dump_all_devices(int mode, char *path) if (path) fp = fopen(fname, "w+"); if (!fp) - _I("Failed to open %s, print to DLOG", fname); + _I("Failed to open '%s', print to DLOG.", fname); /* save dump each device ops */ DD_LIST_FOREACH(head, elem, dev) { if (dev->dump) { - _D("[%s] get dump", dev->name); + _D("[%s] Get dump.", dev->name); LOG_DUMP(fp, "\n==== %s\n\n", dev->name); dev->dump(fp, mode, dev->dump_data); } @@ -81,7 +81,7 @@ static void dump_all_devices(int mode, char *path) /* send finish signal to dump service */ send_dump_signal(DUMP_FINISH_SIGNAL); - _D("%s(%d) dump is saved!", fname, mode); + _D("Dump(%s:%d) is saved!", fname, mode); } static void dump_signal_handler(GDBusConnection *conn, @@ -97,7 +97,7 @@ static void dump_signal_handler(GDBusConnection *conn, char *log_path = NULL; g_variant_get(param, "(is)", &mode, &log_path); - _D("mode(%d) path(%s)", mode, log_path); + _D("mode=%d path=%s", mode, log_path); dump_all_devices(mode, log_path); g_free(log_path); @@ -115,7 +115,7 @@ static void dump_init(void *data) dump_signal_handler, NULL, NULL); if (ret <= 0) - _E("Failed to register signal handler! %d", ret); + _E("Failed to register signal handler: %d", ret); } static const struct device_ops dump_device_ops = { diff --git a/src/extcon/cradle.c b/src/extcon/cradle.c old mode 100644 new mode 100755 index f8d2c41..f212081 --- a/src/extcon/cradle.c +++ b/src/extcon/cradle.c @@ -40,7 +40,7 @@ static void cradle_send_broadcast(int status) if (old == status) return; - _I("broadcast cradle status %d", status); + _I("Broadcast cradle status(%d).", status); old = status; dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_SYSNOTI, @@ -51,12 +51,12 @@ static void cradle_send_broadcast(int status) static int cradle_update(int status) { - _I("jack - cradle changed %d", status); + _I("Cradle changed. status=%d", status); if (disp_plgn.pm_change_internal) disp_plgn.pm_change_internal(INTERNAL_LOCK_CRADLE, LCD_NORMAL); cradle_send_broadcast(status); if (vconf_set_int(VCONFKEY_SYSMAN_CRADLE_STATUS, status) != 0) { - _E("failed to set vconf status"); + _E("Failed to set vconf status."); return -EIO; } @@ -87,7 +87,7 @@ static int display_changed(void *data) if (cradle == DOCK_SOUND) { if (disp_plgn.pm_lock_internal) disp_plgn.pm_lock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0); - _I("sound dock is connected! dim lock is on."); + _I("Sound dock is connected. Dim lock is on."); } return 0; @@ -120,7 +120,7 @@ static void cradle_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); } static void cradle_exit(void *data) diff --git a/src/extcon/earjack.c b/src/extcon/earjack.c old mode 100644 new mode 100755 index fcb9d52..0928cb6 --- a/src/extcon/earjack.c +++ b/src/extcon/earjack.c @@ -37,7 +37,7 @@ static void earjack_send_broadcast(int status) if (old == status) return; - _I("broadcast earjack status %d", status); + _I("Broadcast earjack status(%d).", status); old = status; dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_SYSNOTI, @@ -64,7 +64,7 @@ static void earjack_send_system_event(int status) static int earjack_update(int status) { - _I("jack - earjack changed %d", status); + _I("Earjack changed. status=%d", status); vconf_set_int(VCONFKEY_SYSMAN_EARJACK, status); earjack_send_broadcast(status); earjack_send_system_event(status); diff --git a/src/extcon/extcon.c b/src/extcon/extcon.c old mode 100644 new mode 100755 index a54f1d2..881e355 --- a/src/extcon/extcon.c +++ b/src/extcon/extcon.c @@ -104,7 +104,7 @@ static int extcon_update(const char *name, const char *value) if (dev->status == status) return 0; - _I("Changed %s device : %d -> %d", name, dev->status, status); + _I("Changed %s device: %d to %d.", name, dev->status, status); dev->status = status; @@ -117,7 +117,7 @@ static int extcon_update(const char *name, const char *value) METHOD_SYSPOPUP_SHOW, g_variant_new("(s)", buf)); if (ret < 0) - _E("Failed to launch USB restricted popup(%d)", ret); + _E("Failed to launch USB restricted popup: %d", ret); return ret; } else return 0; @@ -139,7 +139,7 @@ int extcon_enable_device(const char *name) return -ENODEV; if (dev->enabled) { - _I("extcon(%s) already enabled", name); + _I("Extcon(%s) already enabled.", name); return 0; } @@ -149,13 +149,13 @@ int extcon_enable_device(const char *name) if (strncmp(name, "USB", strlen("USB")) == 0) { ret = extcon_update("USB", "0"); if (ret != 0) - _E("fail to disconnect USB"); + _E("Failed to disconnect USB."); ret = extcon_update("USB", "1"); if (ret != 0) - _E("fail to connect USB"); + _E("Failed to connect USB."); } - _I("extcon(%s) enabled", name); + _I("Extcon(%s) enabled.", name); return 0; } @@ -177,17 +177,17 @@ int extcon_disable_device(const char *name) METHOD_SYSPOPUP_SHOW, g_variant_new("(s)", buf)); if (ret < 0) - _E("Failed to launch USB restricted popup(%d)", ret); + _E("Failed to launch USB restricted popup: %d", ret); if (!dev->enabled) { - _I("extcon(%s) already disabled", name); + _I("Extcon(%s) already disabled.", name); return 0; } dev->exit(NULL); dev->enabled = false; - _I("extcon(%s) disabled", name); + _I("Extcon(%s) disabled.", name); return 0; } @@ -229,7 +229,7 @@ static void uevent_extcon_handler(struct udev_device *dev) ret = extcon_parsing_value(env_value); if (ret < 0) - _E("fail to parse extcon value : %d", ret); + _E("Failed to parse extcon value: %d", ret); } static int extcon_load_uevent(struct parse_result *result, void *user_data) @@ -255,7 +255,7 @@ static int get_extcon_init_state(void) dir = opendir(EXTCON_PATH); if (!dir) { ret = -errno; - _E("Cannot open dir (%s, errno:%d)", EXTCON_PATH, ret); + _E("Cannot open dir(%s): %d", EXTCON_PATH, ret); return ret; } @@ -265,13 +265,13 @@ static int get_extcon_init_state(void) continue; snprintf(node, sizeof(node), "%s/%s/state", EXTCON_PATH, result->d_name); - _I("checking node (%s)", node); + _I("Checking node(%s).", node); if (access(node, F_OK) != 0) continue; ret = config_parse(node, extcon_load_uevent, NULL); if (ret < 0) - _E("fail to parse %s data : %d", node, ret); + _E("Failed to parse %s data: %d", node, ret); } if (dir) @@ -292,13 +292,13 @@ static GVariant * dbus_get_extcon_status(GDBusConnection *conn, dev = find_extcon(str); if (!dev) { - _E("fail to matched extcon device : %s", str); + _E("Failed to matched extcon(%s) device.", str); ret = -ENOENT; goto error; } ret = dev->status; - _D("Extcon device : %s, status : %d", dev->name, dev->status); + _D("Extcon(%s) device status=%d", dev->name, dev->status); error: g_free(str); @@ -380,17 +380,17 @@ static int extcon_probe(void *data) (const struct hw_info **)&info); if (ret == 0) { if (!info->open) { - _E("Failed to open extcon device; open(NULL)"); + _E("Failed to open extcon device: open(NULL)"); return -ENODEV; } ret = info->open(info, NULL, (struct hw_common **)&extcon_dev); if (ret < 0) { - _E("Failed to get extcon device structure (%d)", ret); + _E("Failed to get extcon device structure: %d", ret); return ret; } - _I("extcon device structure load success"); + _I("Extcon device structure load success."); return 0; } @@ -400,7 +400,7 @@ static int extcon_probe(void *data) * deviced does not control extcon devices. */ if (access(EXTCON_PATH, R_OK) != 0) { - _E("there is no extcon class"); + _E("There is no extcon class."); return -ENODEV; } @@ -422,12 +422,12 @@ static void add_extcon_event_handler(void) /* register extcon uevent */ ret = register_kernel_uevent_control(&uh); if (ret < 0) - _E("fail to register extcon uevent : %d", ret); + _E("Failed to register extcon uevent: %d", ret); /* load the initialize value by accessing the node directly */ ret = get_extcon_init_state(); if (ret < 0) - _E("fail to init extcon nodes : %d", ret); + _E("Failed to init extcon nodes: %d", ret); } } @@ -442,7 +442,7 @@ static void remove_extcon_event_handler(void) /* unreigster extcon uevent */ ret = unregister_kernel_uevent_control(&uh); if (ret < 0) - _E("fail to unregister extcon uevent : %d", ret); + _E("Failed to unregister extcon uevent: %d", ret); } } @@ -476,7 +476,7 @@ static void extcon_init(void *data) /* initialize extcon devices */ DD_LIST_FOREACH(extcon_list, l, dev) { - _I("[extcon] init (%s)", dev->name); + _I("Extcon(%s) init.", dev->name); if (dev->init) dev->init(data); dev->enabled = true; @@ -486,7 +486,7 @@ static void extcon_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_EXTCON, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); register_notifier(DEVICE_NOTIFIER_EVENT_HANDLER, event_handler_state_changed); @@ -504,7 +504,7 @@ static void extcon_exit(void *data) /* deinitialize extcon devices */ DD_LIST_FOREACH(extcon_list, l, dev) { - _I("[extcon] deinit (%s)", dev->name); + _I("Extcon(%s) deinit.", dev->name); if (dev->exit) dev->exit(data); dev->enabled = false; diff --git a/src/extcon/hdmi.c b/src/extcon/hdmi.c old mode 100644 new mode 100755 index 5e2612e..cc6e747 --- a/src/extcon/hdmi.c +++ b/src/extcon/hdmi.c @@ -37,7 +37,7 @@ static void hdmi_send_broadcast(int status) if (old == status) return; - _I("broadcast hdmi status %d", status); + _I("Broadcast hdmi status(%d)", status); old = status; dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_SYSNOTI, @@ -48,7 +48,7 @@ static void hdmi_send_broadcast(int status) static int hdmi_update(int status) { - _I("jack - hdmi changed %d", status); + _I("Hdmi changed. status=%d", status); if (disp_plgn.pm_change_internal) disp_plgn.pm_change_internal(INTERNAL_LOCK_HDMI, LCD_NORMAL); vconf_set_int(VCONFKEY_SYSMAN_HDMI, status); @@ -81,7 +81,7 @@ static int display_changed(void *data) if (hdmi == 0) { if (disp_plgn.pm_lock_internal) disp_plgn.pm_lock_internal(INTERNAL_LOCK_HDMI, LCD_DIM, STAY_CUR_STATE, 0); - _I("hdmi is connected! dim lock is on."); + _I("Hdmi is connected. Dim lock is on."); } return 0; } @@ -113,7 +113,7 @@ static void hdmi_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); } static void hdmi_exit(void *data) diff --git a/src/ir/ir.c b/src/ir/ir.c old mode 100644 new mode 100755 index 4132ff7..7197411 --- a/src/ir/ir.c +++ b/src/ir/ir.c @@ -81,7 +81,7 @@ static GVariant *dbus_ir_transmit(GDBusConnection *conn, g_variant_iter_free(iter); - _I("frequency : %d, pattern_size: %d", freq_pattern[0], size); + _I("frequency=%d pattern_size=%d", freq_pattern[0], size); ret = ir_dev->transmit(freq_pattern, size); @@ -96,7 +96,7 @@ static GVariant *dbus_set_ir_command(GDBusConnection *conn, { int ret = -ENOTSUP; - _E("The method is not supported. Use device_ir_transmit() of capi-system-device"); + _E("The method is not supported. Use device_ir_transmit() of capi-system-device."); return g_variant_new("(i)", ret); } @@ -139,22 +139,22 @@ static int ir_probe(void *data) (const struct hw_info **)&info); if (ret < 0) { - _E("Fail to load ir(%d)", ret); + _E("Failed to load ir: %d", ret); return -ENODEV; } if (!info->open) { - _E("Failed to open ir device; open(NULL)"); + _E("Failed to open ir device: open(NULL)"); return -ENODEV; } ret = info->open(info, NULL, (struct hw_common**)&ir_dev); if (ret < 0) { - _E("Failed to get ir device structure (%d)", ret); + _E("Failed to get ir device structure: %d", ret); return ret; } - _I("ir device structure load success"); + _I("Ir device structure load success."); return 0; } @@ -164,11 +164,11 @@ static void ir_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_IR, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_LED, &dbus_interface_legacy); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); } diff --git a/src/led/noti.c b/src/led/noti.c old mode 100644 new mode 100755 index ffc4002..522cf99 --- a/src/led/noti.c +++ b/src/led/noti.c @@ -33,7 +33,7 @@ int ongoing_show(void) int ret_val; if (noti_h > 0) { - _D("already ongoing noti show : handle(%d)", noti_h); + _D("Already ongoing noti show handle(%d).", noti_h); return 0; } @@ -44,7 +44,7 @@ int ongoing_show(void) NULL, NULL); noti_h = ret_val; - _D("insert noti handle : %d", noti_h); + _D("Insert noti handle(%d).", noti_h); return (ret_val < 0) ? ret_val : 0; } @@ -53,7 +53,7 @@ int ongoing_clear(void) int ret_val; if (noti_h <= 0) { - _D("already ongoing noti clear"); + _D("Already ongoing noti clear."); return 0; } @@ -63,7 +63,7 @@ int ongoing_clear(void) METHOD_TORCH_NOTI_OFF, g_variant_new("(i)", noti_h)); - _D("delete noti handle : %d", noti_h); + _D("Delete noti handle(%d).", noti_h); noti_h = 0; return ret_val; } diff --git a/src/led/rgb.c b/src/led/rgb.c old mode 100644 new mode 100755 index 2c320f2..59fb9f5 --- a/src/led/rgb.c +++ b/src/led/rgb.c @@ -70,7 +70,7 @@ static int remove_req_from_list(pid_t pid) DD_LIST_FOREACH(rgb_list, l, req) { if (req->pid == pid) { - _I("remove rgb play request from pid (%d)", pid); + _I("Remove rgb play request from pid(%d).", pid); if (req == top) top = NULL; DD_LIST_REMOVE(rgb_list, req); @@ -94,7 +94,7 @@ static int add_req_to_list(pid_t pid, struct led_state *state) if (ret < 0) { req = calloc(1, sizeof(struct rgb_request)); if (!req) { - _E("calloc() failed"); + _E("Failed to call calloc()."); return -ENOMEM; } req->pid = pid; @@ -116,12 +116,12 @@ static int rgb_play(struct led_state *state) struct led_state off = { 0, }; if (!rgb_dev) { - _E("There is NO HAL"); + _E("There is NO HAL."); return -ENODEV; } if (!rgb_dev->set_state) { - _E("LED HAL does not support set_state()"); + _E("LED HAL does not support set_state()."); return -ENOTSUP; } @@ -141,14 +141,14 @@ static gboolean remove_not_handled_req(gpointer data) if (kill(req->pid, 0) == -1) { ret = remove_req_from_list(req->pid); if (ret < 0) - _E("Failed to remove rgb request (%d)", ret); + _E("Failed to remove rgb request: %d", ret); } } if (!top) { ret = rgb_play(NULL); if (ret < 0) - _E("Failed to turn off removed request (%d)", ret); + _E("Failed to turn off removed request: %d", ret); } if (DD_LIST_LENGTH(rgb_list) == 0) { @@ -166,7 +166,7 @@ static void add_timer_to_check_invalid_req(void) timer = g_timeout_add(5000, remove_not_handled_req, NULL); if (timer == 0) - _E("Failed to add timer"); + _E("Failed to add timer."); } static int get_led_num(void) @@ -179,20 +179,20 @@ static int get_led_num(void) return num_of_leds; if (!rgb_dev) { - _E("There is NO HAL"); + _E("There is NO HAL."); ret = -ENODEV; goto out; } if (!rgb_dev->get_number) { - _E("LED HAL does not support get_number()"); + _E("LED HAL does not support get_number()."); ret = -ENOTSUP; goto out; } ret = rgb_dev->get_number(); if (ret < 0) { - _E("Failed to get LED number : %d", ret); + _E("Failed to get LED number: %d", ret); goto out; } @@ -217,7 +217,7 @@ static GVariant *dbus_playcustom(GDBusConnection *conn, pid = dbus_connection_get_sender_pid(conn, sender); - _I("pid %d led play custom %d, %d, %x", pid, on, off, color); + _I("Pid(%d) led play custom on=%d off=%d color=%x.", pid, on, off, color); state.color = color; state.duty_on = on; @@ -229,7 +229,7 @@ static GVariant *dbus_playcustom(GDBusConnection *conn, ret = rgb_play(&state); if (ret < 0) { - _E("Failed to play LED notification (%d)", ret); + _E("Failed to play LED notification: %d", ret); goto out; } @@ -249,18 +249,18 @@ static GVariant *dbus_stopcustom(GDBusConnection *conn, pid = dbus_connection_get_sender_pid(conn, sender); - _I("pid %d led stop custom", pid); + _I("Pid(%d) led stop custom.", pid); ret = remove_req_from_list(pid); if (ret < 0) { - _E("There is no request from pid (%d) to remove", pid); + _E("There is no request from pid(%d) to remove.", pid); goto out; } if (!top) { ret = rgb_play(NULL); if (ret < 0) { - _E("Failed to play LED notification (%d)", ret); + _E("Failed to play LED notification: %d", ret); goto out; } } @@ -293,7 +293,7 @@ static GVariant *dbus_multi_led_control(GDBusConnection *conn, pid = dbus_connection_get_sender_pid(conn, sender); - _I("pid %d multi led play control", pid); + _I("Pid(%d) multi led play control.", pid); ret = get_led_num(); if (ret < 0) @@ -304,7 +304,7 @@ static GVariant *dbus_multi_led_control(GDBusConnection *conn, g_variant_get(param, "(au)", &iter); size = g_variant_iter_n_children(iter); if (num_of_leds != size) { - _E("Led number is not matched"); + _E("Led number is not matched."); ret = -EINVAL; goto out; } @@ -324,7 +324,7 @@ static GVariant *dbus_multi_led_control(GDBusConnection *conn, state.color = color[i]; ret = rgb_play(&state); if (ret < 0) - _E("Failed to play LED notification (%d)", ret); + _E("Failed to play LED notification: %d.", ret); ++i; } @@ -359,18 +359,18 @@ static void rgb_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_LED, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); ret = rgb_play(NULL); if (ret < 0) - _E("Failed to turn off rgb play during init"); + _E("Failed to turn off rgb play during init."); } static void rgb_exit(void *data) { int ret = rgb_play(NULL); if (ret < 0) - _E("Failed to turn off rgb play during exit"); + _E("Failed to turn off rgb play during exit."); } static int rgb_probe(void *data) @@ -384,22 +384,22 @@ static int rgb_probe(void *data) ret = hw_get_info(LED_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (ret < 0) { - _E("There is no LED HAL"); + _E("There is no LED HAL."); return -ENOTSUP; } if (!info->open) { - _E("Failed to open led device; open(NULL)"); + _E("Failed to open led device: open(NULL)"); return -ENODEV; } ret = info->open(info, LED_ID_NOTIFICATION, (struct hw_common **)&rgb_dev); if (ret < 0) { - _E("Failed to get LED NOTIFICATION device structure (%d)", ret); + _E("Failed to get LED NOTIFICATION device structure: %d", ret); return ret; } - _I("LED NOTIFICATION device structure load success"); + _I("LED NOTIFICATION device structure load success."); return 0; } diff --git a/src/led/torch.c b/src/led/torch.c old mode 100644 new mode 100755 index 719d673..0d9e887 --- a/src/led/torch.c +++ b/src/led/torch.c @@ -57,7 +57,7 @@ static GVariant *dbus_get_brightness(GDBusConnection *conn, int ret, alpha; if (!led_dev) { - _E("there is no led device"); + _E("There is no led device."); ret = -ENOENT; goto error; } @@ -66,7 +66,7 @@ static GVariant *dbus_get_brightness(GDBusConnection *conn, ret = alpha * 100.f / 255; if (alpha != 0 && alpha != 0xFF) ret += 1; - _D("color : val(%d), color(%x)", ret, led_state.color); + _D("Get brightness. color=%x: %d", led_state.color, ret); error: return g_variant_new("(i)", ret); @@ -93,13 +93,13 @@ static GVariant *dbus_set_brightness(GDBusConnection *conn, g_variant_get(param, "(ii)", &val, &enable); if (!led_dev) { - _E("there is no led device"); + _E("There is no led device."); ret = -ENOENT; goto error; } tmp.color = (((int)(val * 255.f) / LED_MAX_BRIGHTNESS) & 0xFF) << 24; - _D("color : val(%d), color(%x)", val, tmp.color); + _D("Set brightness. val=%d color=%x", val, tmp.color); ret = led_dev->set_state(&tmp); if (ret < 0) @@ -152,23 +152,23 @@ static int led_service_load(void) r = hw_get_info(LED_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (r < 0) { - _E("fail to load led shared library : %d", r); + _E("Failed to load led shared library: %d", r); return -ENOENT; } if (!info->open) { - _E("fail to open camera led device : open(NULL)"); + _E("Fail to open camera led device: open(NULL)"); return -EPERM; } r = info->open(info, LED_ID_CAMERA_BACK, (struct hw_common **)&led_dev); if (r < 0) { - _E("fail to get camera led device : %d", r); + _E("Failed to get camera led device: %d", r); return -EPERM; } - _D("camera led device structure load success"); + _D("Camera led device structure load success."); return 0; } @@ -201,7 +201,7 @@ static void torch_init(void *data) /* init dbus interface */ ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_LED, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); } static void torch_exit(void *data) diff --git a/src/led/touch-key.c b/src/led/touch-key.c old mode 100644 new mode 100755 index fcc9141..0f1ac2f --- a/src/led/touch-key.c +++ b/src/led/touch-key.c @@ -54,7 +54,7 @@ static int touchled_set_state(bool on) int r; if (!touchled_dev || !touchled_dev->set_state) { - _E("there is no led device"); + _E("There is no led device."); return -ENOENT; } @@ -65,7 +65,7 @@ static int touchled_set_state(bool on) r = touchled_dev->set_state(&tmp); if (r < 0) { - _E("fail to set touch led state : %d", r); + _E("Failed to set touch led state: %d", r); return r; } @@ -212,23 +212,23 @@ static int touchled_service_load(void) r = hw_get_info(LED_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (r < 0) { - _E("fail to load led shared library : %d", r); + _E("Failed to load led shared library: %d", r); return -ENOENT; } if (!info->open) { - _E("fail to open touch led device : open(NULL)"); + _E("Failed to open touch led device: open(NULL)"); return -EPERM; } r = info->open(info, LED_ID_TOUCH_KEY, (struct hw_common **)&touchled_dev); if (r < 0) { - _E("fail to get touch led device : %d", r); + _E("Failed to get touch led device: %d", r); return -EPERM; } - _D("touch led device structure load success"); + _D("Touch led device structure load success."); return 0; } @@ -262,7 +262,7 @@ static void touchled_init(void *data) { /* get touchkey light duration setting */ if (vconf_get_int(VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION, &hardkey_duration) < 0) { - _W("Fail to get VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION!!"); + _W("Failed to get VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION."); hardkey_duration = KEYBACKLIGHT_TIME_90; } diff --git a/src/libdeviced/deviced-noti.c b/src/libdeviced/deviced-noti.c old mode 100644 new mode 100755 index c217cab..5741fe6 --- a/src/libdeviced/deviced-noti.c +++ b/src/libdeviced/deviced-noti.c @@ -68,12 +68,12 @@ static int dbus_proc_handler(char* type, char *buf) return -EBADMSG; if (!dh_get_param_from_var(msg, "(i)", &val)) { - _E("fail (signature:%s): no message", g_variant_get_type_string(msg)); + _E("Failed to get signature(%s): no message", g_variant_get_type_string(msg)); val = -EBADMSG; goto out; } - _D("%s-%s : %d", DEVICED_INTERFACE_PROCESS, type, val); + _D("%s-%s: %d", DEVICED_INTERFACE_PROCESS, type, val); out: g_variant_unref(msg); @@ -122,12 +122,12 @@ static int dbus_power_handler(char* type) return -EBADMSG; if (!dh_get_param_from_var(msg, "(i)", &val)) { - _E("fail (signature:%s): no message", g_variant_get_type_string(msg)); + _E("Failed to get signature(%s): no message", g_variant_get_type_string(msg)); val = -EBADMSG; goto out; } - _D("%s-%s : %d", DEVICED_INTERFACE_POWER, type, val); + _D("%s-%s: %d", DEVICED_INTERFACE_POWER, type, val); out: g_variant_unref(msg); @@ -166,12 +166,12 @@ static int dbus_time_handler(char* type, char* buf) return -EBADMSG; if (!dh_get_param_from_var(msg, "(i)", &val)) { - _E("fail (signature:%s): no message", g_variant_get_type_string(msg)); + _E("Failed to get signature(%s): no message", g_variant_get_type_string(msg)); val = -EBADMSG; goto out; } - _SI("[%s] %s-%s(%s) : %d", name, DEVICED_INTERFACE_SYSNOTI, type, buf, val); + _SI("[%s] %s-%s(%s): %d", name, DEVICED_INTERFACE_SYSNOTI, type, buf, val); out: g_variant_unref(msg); @@ -189,7 +189,7 @@ static int alarm_set_time(time_t timet) ret = deviced_get_cmdline_name(pid, name, sizeof(name)); if (ret != 0) snprintf(name, sizeof(name), "%d", pid); - _SI("[%s]start %s %ld", name, ALARM_INTERFACE_NAME, timet); + _SI("[%s]start %s %ld.", name, ALARM_INTERFACE_NAME, timet); msg = dbus_handle_method_sync_with_reply_var(ALARM_BUS_NAME, ALARM_PATH_NAME, @@ -197,17 +197,17 @@ static int alarm_set_time(time_t timet) ALARM_SET_TIME_METHOD, g_variant_new("(i)", timet)); if (!msg) { - _E("dbus_message_new_method_call(%s:%s-%s)", + _E("Failed to call dbus_message_new_method_call(%s:%s-%s).", ALARM_PATH_NAME, ALARM_INTERFACE_NAME, ALARM_SET_TIME_METHOD); return -EBADMSG; } if (!dh_get_param_from_var(msg, "(i)", &val)) { - _E("no message : type(%s)", g_variant_get_type_string(msg)); + _E("Failed to get type(%s): no message", g_variant_get_type_string(msg)); val = -EBADMSG; } - _SI("[%s]end %s %ld, %d", name, ALARM_INTERFACE_NAME, timet, val); + _SI("[%s]End %s %ld: %d", name, ALARM_INTERFACE_NAME, timet, val); g_variant_unref(msg); @@ -244,12 +244,12 @@ static int dbus_cpu_handler(char* type, char* buf_pid, char* buf_freq) return -EBADMSG; if (!dh_get_param_from_var(msg, "(i)", &val)) { - _E("fail (signature:%s): no message", g_variant_get_type_string(msg)); + _E("Failed to get signature(%s): no message", g_variant_get_type_string(msg)); val = -EBADMSG; goto out; } - _D("%s-%s : %d", DEVICED_INTERFACE_SYSNOTI, type, val); + _D("%s-%s: %d", DEVICED_INTERFACE_SYSNOTI, type, val); out: g_variant_unref(msg); return val; diff --git a/src/libdeviced/deviced-util.c b/src/libdeviced/deviced-util.c old mode 100644 new mode 100755 index 044b0bf..6f73b5f --- a/src/libdeviced/deviced-util.c +++ b/src/libdeviced/deviced-util.c @@ -45,7 +45,7 @@ API int deviced_get_pid(const char *execpath) dp = opendir("/proc"); if (!dp) { - _E("open /proc"); + _E("Failed to open '/proc'."); return -1; } @@ -101,7 +101,7 @@ API int deviced_get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size) close(fd); if (ret < 0) { ret = -errno; - _E("read() failed (%d)", ret); + _E("Failed to read(): %d", ret); return ret; } buf[PATH_MAX] = '\0'; diff --git a/src/libdeviced/display.c b/src/libdeviced/display.c old mode 100644 new mode 100755 index 73a2ec5..4f3eebd --- a/src/libdeviced/display.c +++ b/src/libdeviced/display.c @@ -71,7 +71,7 @@ API int display_get_max_brightness(void) if (ret < 0) return DISPLAY_MAX_BRIGHTNESS; - _D("get max brightness : %d", ret); + _D("Get max brightness: %d", ret); return ret; } @@ -88,7 +88,7 @@ API int display_set_brightness_with_setting(int val) METHOD_SET_BRIGHTNESS, g_variant_new("(ii)", DISPLAY_STATE_NORMAL, val)); if (ret < 0) - _E("no message : failed to setting"); + _E("Failed to set brightness: no message."); return ret; } @@ -117,14 +117,14 @@ static void display_change_cb(GVariant *var, void *user_data, GError *err) return; if (!dh_get_param_from_var(var, "(i)", &val)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to get(%s): no message", g_variant_get_type_string(var)); g_variant_unref(var); return; } g_variant_unref(var); - _D("%s-%s : %d", DEVICED_INTERFACE_DISPLAY, METHOD_CHANGE_STATE, val); + _D("%s-%s: %d", DEVICED_INTERFACE_DISPLAY, METHOD_CHANGE_STATE, val); } API int display_change_state(unsigned int s_bits) @@ -145,9 +145,9 @@ API int display_change_state(unsigned int s_bits) -1, NULL); if (ret < 0) - _E("no message : failed to change state"); + _E("Failed to change state: no message"); - _D("%s-%s : %d", DEVICED_INTERFACE_DISPLAY, METHOD_CHANGE_STATE, ret); + _D("%s-%s: %d", DEVICED_INTERFACE_DISPLAY, METHOD_CHANGE_STATE, ret); return ret; } @@ -160,11 +160,11 @@ static void display_lock_cb(GVariant *var, void *user_data, GError *err) return; if (!dh_get_param_from_var(var, "(i)", &val)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to get(%s): no message", g_variant_get_type_string(var)); goto out; } - _D("%s-%s : %d", DEVICED_INTERFACE_DISPLAY, METHOD_LOCK_STATE, val); + _D("%s-%s: %d", DEVICED_INTERFACE_DISPLAY, METHOD_LOCK_STATE, val); out: g_variant_unref(var); @@ -203,9 +203,9 @@ API int display_lock_state(unsigned int s_bits, unsigned int flag, -1, NULL); if (ret < 0) - _E("no message : failed to lock state"); + _E("Failed to lock state: no message"); - _D("%s-%s : %d", DEVICED_INTERFACE_DISPLAY, METHOD_LOCK_STATE, ret); + _D("%s-%s: %d", DEVICED_INTERFACE_DISPLAY, METHOD_LOCK_STATE, ret); return ret; } @@ -218,11 +218,11 @@ static void display_unlock_cb(GVariant *var, void *user_data, GError *err) return; if (!dh_get_param_from_var(var, "(i)", &val)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to get(%s): no message", g_variant_get_type_string(var)); goto out; } - _D("%s-%s : %d", DEVICED_INTERFACE_DISPLAY, METHOD_UNLOCK_STATE, val); + _D("%s-%s: %d", DEVICED_INTERFACE_DISPLAY, METHOD_UNLOCK_STATE, val); out: g_variant_unref(var); @@ -262,9 +262,9 @@ API int display_unlock_state(unsigned int s_bits, unsigned int flag) -1, NULL); if (ret < 0) - _E("no message : failed to unlock state"); + _E("Failed to unlock state: no message"); - _D("%s-%s : %d", DEVICED_INTERFACE_DISPLAY, METHOD_UNLOCK_STATE, ret); + _D("%s-%s: %d", DEVICED_INTERFACE_DISPLAY, METHOD_UNLOCK_STATE, ret); return ret; } diff --git a/src/libdeviced/haptic.c b/src/libdeviced/haptic.c old mode 100644 new mode 100755 index c788c4a..9fc789c --- a/src/libdeviced/haptic.c +++ b/src/libdeviced/haptic.c @@ -34,30 +34,30 @@ API int haptic_get_count(int *device_number) { - _E("Not Supported, Please use capi-system-device apis"); + _E("Not Supported. Please use capi-system-device apis."); return HAPTIC_ERROR_OPERATION_FAILED; } API int haptic_open(haptic_device_e device_index, haptic_device_h *device_handle) { - _E("Not Supported, Please use capi-system-device apis"); + _E("Not Supported. Please use capi-system-device apis."); return HAPTIC_ERROR_OPERATION_FAILED; } API int haptic_close(haptic_device_h device_handle) { - _E("Not Supported, Please use capi-system-device apis"); + _E("Not Supported. Please use capi-system-device apis."); return HAPTIC_ERROR_OPERATION_FAILED; } API int haptic_vibrate_monotone(haptic_device_h device_handle, int duration, haptic_effect_h *effect_handle) { - _E("Not Supported, Please use capi-system-device apis"); + _E("Not Supported. Please use capi-system-device apis."); return HAPTIC_ERROR_OPERATION_FAILED; } API int haptic_stop_all_effects(haptic_device_h device_handle) { - _E("Not Supported, Please use capi-system-device apis"); + _E("Not Supported. Please use capi-system-device apis."); return HAPTIC_ERROR_OPERATION_FAILED; } diff --git a/src/libdeviced/led.c b/src/libdeviced/led.c old mode 100644 new mode 100755 index bf152b4..dd93631 --- a/src/libdeviced/led.c +++ b/src/libdeviced/led.c @@ -44,7 +44,7 @@ API int led_get_brightness(void) return -EBADMSG; if (!dh_get_param_from_var(msg, "(i)", &ret_val)) { - _E("fail (signature:%s): no message", g_variant_get_type_string(msg)); + _E("Failed to get signature(%s): no message", g_variant_get_type_string(msg)); ret_val = -EBADMSG; } @@ -67,7 +67,7 @@ API int led_get_max_brightness(void) return -EBADMSG; if (!dh_get_param_from_var(msg, "(i)", &ret_val)) { - _E("fail (signature:%s): no message", g_variant_get_type_string(msg)); + _E("Failed to get signature(%s): no message", g_variant_get_type_string(msg)); ret_val = -EBADMSG; } @@ -90,7 +90,7 @@ API int led_set_brightness_with_noti(int val, bool enable) return -EBADMSG; if (!dh_get_param_from_var(msg, "(i)", &ret_val)) { - _E("fail (signature:%s): no message", g_variant_get_type_string(msg)); + _E("Failed to get signature(%s): no message", g_variant_get_type_string(msg)); ret_val = -EBADMSG; } diff --git a/src/libdeviced/usbhost.c b/src/libdeviced/usbhost.c old mode 100644 new mode 100755 index c36aa46..94396bf --- a/src/libdeviced/usbhost.c +++ b/src/libdeviced/usbhost.c @@ -59,7 +59,7 @@ static int register_signal_handler(const char *path, const char *iface, const ch handler = (struct signal_handler *)calloc(1, sizeof(struct signal_handler)); if (!handler) { - _E("No memory"); + _E("Failed to calloc: No memory"); ret = -1; goto out; } @@ -68,7 +68,7 @@ static int register_signal_handler(const char *path, const char *iface, const ch handler->data = data; handler->id = subscribe_dbus_signal(NULL, path, iface, name, cb, NULL, NULL); if (!handler->id) { - _E("fail to add dbus handler"); + _E("Failed to add dbus handler."); ret = -1; goto out; } @@ -150,7 +150,7 @@ static void device_signal_handler(GDBusConnection *conn, API int init_usbhost_signal(void) { - _D("init"); + _D("Init."); return 0; } @@ -329,15 +329,15 @@ API int open_usb_device(char *path, int *out_fd) &fdlist, &size); if (!reply) { - _E("Unable to open USB device"); + _E("Unable to open USB device."); return -1; } if (size == 0) { - _E("failed to get fd list"); + _E("Failed to get fd list."); return -1; } if (!dh_get_param_from_var(reply, "(i)", &ret)) { - _E("no message [%s]", g_variant_get_type_string(reply)); + _E("Failed to get(%s): no message.", g_variant_get_type_string(reply)); ret = -1; goto out; } diff --git a/src/power/low-power.c b/src/power/low-power.c old mode 100644 new mode 100755 index ab1719a..27ba800 --- a/src/power/low-power.c +++ b/src/power/low-power.c @@ -48,12 +48,12 @@ static int low_power_start(void *data) ret = vconf_set_int(VCONFKEY_SYSMAN_LOW_POWER_MODE, VCONFKEY_SYSMAN_LOW_POWER_MODE_ON); if (ret != 0) { - _E("Failed to enable low power mode"); + _E("Failed to enable low power mode."); return -ENOMEM; } low_power_enabled = true; - _I("Low Power Mode Start"); + _I("Low Power Mode Start."); return 0; } @@ -68,12 +68,12 @@ static int low_power_stop(void *data) ret = vconf_set_int(VCONFKEY_SYSMAN_LOW_POWER_MODE, VCONFKEY_SYSMAN_LOW_POWER_MODE_OFF); if (ret != 0) { - _E("Failed to disable low power mode"); + _E("Failed to disable low power mode."); return -ENOMEM; } low_power_enabled = false; - _I("Low Power Mode Stop"); + _I("Low Power Mode Stop."); return 0; } @@ -92,7 +92,7 @@ static int booting_done(void *data) ret = vconf_get_int(VCONFKEY_SYSMAN_LOW_POWER_MODE, &mode); if (ret == 0 && mode == VCONFKEY_SYSMAN_LOW_POWER_MODE_ON) { - _I("Low Power Mode Start"); + _I("Low Power Mode Start."); low_power_enabled = true; } @@ -108,17 +108,17 @@ GVariant *dbus_low_power_start(GDBusConnection *conn, pid_t pid; if (!booting_done(NULL)) { - _I("Booting is not done yet"); + _I("Booting is not done yet."); ret = -EAGAIN; goto out; } pid = dbus_connection_get_sender_pid(conn, sender); - _I("Low Power Mode started by PID(%d)", pid); + _I("Low Power Mode started by PID(%d).", pid); ret = low_power_start(NULL); if (ret < 0) - _E("Failed to start Low Power Mode(%d)", ret); + _E("Failed to start Low Power Mode(%d).", ret); out: return g_variant_new("(i)", ret); @@ -131,17 +131,17 @@ GVariant *dbus_low_power_stop(GDBusConnection *conn, pid_t pid; if (!booting_done(NULL)) { - _I("Booting is not done yet"); + _I("Booting is not done yet."); ret = -EAGAIN; goto out; } pid = dbus_connection_get_sender_pid(conn, sender); - _I("Low Power Mode stopped by PID(%d)", pid); + _I("Low Power Mode stopped by PID(%d).", pid); ret = low_power_stop(NULL); if (ret < 0) - _E("Failed to stop Low Power Mode(%d)", ret); + _E("Failed to stop Low Power Mode(%d).", ret); out: return g_variant_new("(i)", ret); @@ -175,7 +175,7 @@ static void low_power_init(void *data) /* init dbus interface */ ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_LOWPOWER, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method(%d).", ret); register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); } @@ -186,7 +186,7 @@ static void low_power_exit(void *data) ret = low_power_stop(NULL); if (ret < 0) - _E("Failed to stop Low Power Mode(%d)", ret); + _E("Failed to stop Low Power Mode(%d).", ret); unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); } diff --git a/src/power/power-handler.c b/src/power/power-handler.c old mode 100644 new mode 100755 index 6d35ec1..7dafc14 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -113,14 +113,14 @@ static void poweroff_start_animation(void) ret = systemd_start_unit_async("shutdown-animation.service", NULL); if (ret < 0) - _E("Failed to start shutdown animation"); + _E("Failed to start shutdown animation."); gettimeofday(&tv_start_poweroff, NULL); } static void poweroff_notify_resourced(void) { - _I("Request to stop systemd service to resourced"); + _I("Request to stop systemd service to resourced."); dbus_handle_method_sync_timeout(RESOURCED_BUS_NAME, RESOURCED_PATH_PROCESS, RESOURCED_INTERFACE_PROCESS, @@ -158,13 +158,13 @@ static int disable_systemd_journald(void) ret = systemd_stop_unit_async("systemd-journald.socket", NULL); if (ret < 0) { - _E("failed to stop 'systemd-journald.socket'"); + _E("Failed to stop 'systemd-journald.socket'."); return ret; } ret = systemd_stop_unit_async("systemd-journald.service", NULL); if (ret < 0) { - _E("failed to stop 'systemd-journald.service'"); + _E("Failed to stop 'systemd-journald.service'."); return ret; } return 0; @@ -186,14 +186,14 @@ static bool disable_coredump_handler(void) } bool is_ok = ret > 0; - _I("Disabling core dumps %s", is_ok ? "succeeded" : "failed"); + _I("Disabling core dumps %s.", is_ok ? "succeeded" : "failed"); return is_ok; } static void poweroff_request_shutdown() { - _I("Requested power off via systemd"); + _I("Requested power off via systemd."); char *method; @@ -204,7 +204,7 @@ static void poweroff_request_shutdown() else if (poweroff_opt.type == POWER_OFF_EXIT) method = "Exit"; else { - _E("poweroff invalid type (%d)", poweroff_opt.type); + _E("Poweroff invalid type(%d).", poweroff_opt.type); return; } @@ -240,7 +240,7 @@ void powerdown(void) check_duration = now.tv_sec - tv_start_poweroff.tv_sec; while (check_duration < poweroff_duration) { if (wait == 0) { - _I("wait poweroff %d %d", check_duration, poweroff_duration); + _I("Wait poweroff %d %d.", check_duration, poweroff_duration); wait = 1; } usleep(100000); @@ -283,14 +283,14 @@ static void make_power_flag(enum poweroff_type type, char *option) fd = open(path, O_RDWR|O_CREAT, S_IRUSR | S_IWUSR); if (fd < 0) { - _E("Failed to create (%s)", path); + _E("Failed to create '%s'.", path); return; } if (option) { len = write(fd, option, strlen(option)); if (len <= 0) - _E("Failed to store option (%zd)", len < 0 ? errno : len); + _E("Failed to store option: %zd", len < 0 ? errno : len); } close(fd); @@ -308,7 +308,7 @@ static void poweroff_remove_handle(pid_t pid) assert(handle); - _D("Remove handle pid(%d) timeout(%d) timeout_id(%d)", handle->pid, handle->timeout, handle->timeout_id); + _D("Remove handle pid=%d timeout=%d timeout_id=%d.", handle->pid, handle->timeout, handle->timeout_id); DD_LIST_REMOVE(poweroff_handles, handle); if (handle->timeout_id) { @@ -327,14 +327,14 @@ static gboolean poweroff_timeout_cb(void *data) poweroff_remove_handle(pid); if (DD_LIST_LENGTH(poweroff_handles)) { - _D("Timer is left"); + _D("Timer is left."); return G_SOURCE_REMOVE; } - _D("No timer left"); + _D("No timer left."); char *name = poweroff_type_to_name(poweroff_opt.type); if (!name) { - _E("Invalid type (%d)", poweroff_opt.type); + _E("Invalid type(%d).", poweroff_opt.type); goto out; } @@ -371,11 +371,11 @@ void poweroff_start_timers() DD_LIST_FOREACH(poweroff_handles, l, handle) { pid_alive = kill(handle->pid, 0); if (pid_alive == -1) { - _D("Pid(%d) is dead", handle->pid); + _D("Pid(%d) is dead.", handle->pid); handle->timeout = 0; } - _D("Run timer, pid(%d) timeout(%d) timeout_id(%d)", handle->pid, handle->timeout, handle->timeout_id); + _D("Run timer, pid=%d timeout=%d timeout_id=%d.", handle->pid, handle->timeout, handle->timeout_id); handle->timeout_id = g_timeout_add_seconds(handle->timeout, poweroff_timeout_cb, (void *)((intptr_t)(handle->pid))); @@ -386,7 +386,7 @@ void poweroff_start_timers() if (timer_exist) { return; } else { - _D("handle is NULL"); + _D("Handle is NULL."); handle = (struct poweroff_handle *)malloc(sizeof(struct poweroff_handle)); if (handle == NULL) { _E("Not enough memory."); @@ -400,7 +400,7 @@ void poweroff_start_timers() (void *)((intptr_t)(handle->pid))); if (!handle->timeout_id) { - _E("timer_add failed"); + _E("Failed to timer_add."); free(handle); return; } @@ -408,7 +408,7 @@ void poweroff_start_timers() DD_LIST_APPEND(poweroff_handles, handle); } - _D("Last Timer : timer_id(%d) pid(%d) timeout(%d)", handle->timeout_id, handle->pid, handle->timeout); + _D("Last Timer: timer_id=%d pid=%d timeout=%d", handle->timeout_id, handle->pid, handle->timeout); return; } @@ -459,7 +459,7 @@ static void poweroff_send_broadcast(int status) if (old == status) return; - _D("broadcast poweroff %d", status); + _D("Broadcast poweroff %d.", status); old = status; @@ -473,13 +473,13 @@ static void poweroff_send_broadcast(int status) static int power_execute_pid(char *type, char *option, pid_t pid) { if (during_poweroff) { - _E("during poweroff"); + _E("During poweroff."); return -EINVAL; } enum poweroff_type type_e = poweroff_name_to_type(type); if (type_e == POWER_OFF_INVALID) { - _E("Failed to get type enum value (%d)", type_e); + _E("Failed to get type enum value(%d).", type_e); return -EINVAL; } if (poweroff_option_valid(type_e, option)) { @@ -489,12 +489,12 @@ static int power_execute_pid(char *type, char *option, pid_t pid) if (option) poweroff_opt.option = strdup(option); } else { - _E("Failed to find supported %s option %s", type, (option ? option : "NULL")); + _E("Failed to find supported type(%s). option=%s", type, (option ? option : "NULL")); return -EINVAL; } if (poweroff_opt.type == POWER_OFF_POPUP) { - _D("request popup"); + _D("Request popup."); vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, poweroff_opt.type); pwroff_popup(); return 0; @@ -525,19 +525,19 @@ GVariant *dbus_power_handler(GDBusConnection *conn, g_variant_get(param, "(si)", &type_str, &argc); if (argc < 0) { - _E("message is invalid!"); + _E("Message is invalid."); ret = -EINVAL; goto out; } pid = dbus_connection_get_sender_pid(conn, sender); if (kill(pid, 0) == -1) { - _E("%d process does not exist, dbus ignored!", pid); + _E("Process(%d) does not exist, dbus ignored.", pid); ret = -ESRCH; goto out; } - _I("poweroff PID(%d) requests %s", pid, type_str); + _I("Poweroff PID(%d) requests %s.", pid, type_str); ret = power_execute_pid(type_str, NULL, pid); out: @@ -557,12 +557,12 @@ GVariant *dbus_power_option_handler(GDBusConnection *conn, pid = dbus_connection_get_sender_pid(conn, sender); if (kill(pid, 0) == -1) { - _E("%d process does not exist, dbus ignored!", pid); + _E("Process(%d) does not exist, dbus ignored.", pid); ret = -ESRCH; goto out; } - _I("poweroff PID(%d) requests %s %s", pid, type, option); + _I("Poweroff PID(%d) requests type=%s option=%s.", pid, type, option); ret = power_execute_pid(type, option, pid); out: @@ -583,7 +583,7 @@ GVariant *request_reboot(GDBusConnection *conn, pid = dbus_connection_get_sender_pid(conn, sender); - _I("poweroff PID(%d) requests reboot with command : %s", pid, str); + _I("Poweroff PID(%d) requests reboot with command(%s).", pid, str); ret = power_execute_pid(POWER_REBOOT, NULL, pid); g_free(str); @@ -600,7 +600,7 @@ static GVariant *add_poweroff_time(GDBusConnection *conn, dd_list *l; pid = dbus_connection_get_sender_pid(conn, sender); - _D("add_poweroff_timer(%d)", pid); + _D("add_poweroff_timer pid=%d", pid); if (pid == -1) { _E("Failed to get sender's pid."); ret = -1; @@ -615,7 +615,7 @@ static GVariant *add_poweroff_time(GDBusConnection *conn, if (handle) poweroff_remove_handle(pid); - _D("Make a new handle"); + _D("Make a new handle."); handle = (struct poweroff_handle *)malloc(sizeof(struct poweroff_handle)); if (handle == NULL) { _E("Not enough memory."); @@ -628,7 +628,7 @@ static GVariant *add_poweroff_time(GDBusConnection *conn, handle->timeout = POWEROFF_WAIT_MAX; DD_LIST_APPEND(poweroff_handles, handle); - _D("Add a new poweroff timer(%d %d %d)", handle->pid, handle->timeout, handle->timeout_id); + _D("Add a new poweroff timer. pid=%d timeout=%d timeout_id=%d)", handle->pid, handle->timeout, handle->timeout_id); ret = 0; @@ -646,7 +646,7 @@ static GVariant *remove_poweroff_time(GDBusConnection *conn, pid_t pid; pid = dbus_connection_get_sender_pid(conn, sender); - _D("remove_poweroff_timer(%d)", pid); + _D("Remove_poweroff_timer pid=%d", pid); if (pid == -1) { _E("Failed to get sender's pid."); ret = -1; @@ -669,7 +669,7 @@ static GVariant *remove_poweroff_time(GDBusConnection *conn, (void *)((intptr_t)(handle->pid))); } } else { - _E("Invalid pid(%d)", pid); + _E("Invalid pid(%d).", pid); ret = -1; } @@ -701,13 +701,13 @@ static int add_poweroff_option(enum poweroff_type type, char *option) name = poweroff_type_to_name(type); if (!name) { - _E("Invalid type (%d)", type); + _E("Invalid type(%d).", type); return -EINVAL; } opt = calloc(1, sizeof(struct power_option)); if (!opt) { - _E("calloc() failed"); + _E("Failed to calloc()."); return -ENOMEM; } @@ -716,7 +716,7 @@ static int add_poweroff_option(enum poweroff_type type, char *option) DD_LIST_APPEND(poweroff_options, opt); - _D("Add %s option (%s)", name, opt->option); + _D("Add %s option=%s", name, opt->option); return 0; } @@ -738,7 +738,7 @@ static int load_config(struct parse_result *result, void *user_data) ret = add_poweroff_option(type, result->value); if (ret < 0) { - _E("Failed to add %s option (%s)", result->section, result->value); + _E("Failed to add %s option=%s", result->section, result->value); return ret; } @@ -764,7 +764,7 @@ static void power_init(void *data) /* init dbus interface */ ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_REBOOT, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); add_booting_done_handler(NULL); @@ -777,7 +777,7 @@ static void power_init(void *data) ret = config_parse(POWER_CONF_FILE, load_config, NULL); if (ret < 0) - _E("Failed to load power off config (%d)", ret); + _E("Failed to load power off config: %d", ret); } static const struct device_ops power_device_ops = { -- 2.7.4 From 6b324b8ee4b140179edf7b73a31c0290b7d52e8a Mon Sep 17 00:00:00 2001 From: Yunmi Ha Date: Fri, 22 Feb 2019 18:31:58 +0900 Subject: [PATCH 12/16] Apply consistent log messages. 1. First letter to uppercase. 2. Period at the end. 3. Rearrange parameters. Change-Id: I957a3e820eb713128add0a787270f9c0cc083031 Signed-off-by: Yunmi Ha --- src/proc/cpu-info.c | 16 +-- src/shared/deviced-systemd.c | 16 +-- src/thermal/thermal.c | 62 ++++---- src/time/time-handler.c | 46 +++--- src/touchscreen/sensitivity.c | 28 ++-- src/touchscreen/touchscreen.c | 20 +-- src/tzip/tzip-utility.c | 154 ++++++++++---------- src/tzip/tzip.c | 160 ++++++++++----------- src/usb-host-ffs-test-daemon/descs_gen.c | 8 +- .../usb-host-ffs-test-daemon.c | 14 +- src/usb-host-test/usb-host-test.c | 18 +-- src/usb/usb-dbus.c | 26 ++-- src/usb/usb-debug.c | 10 +- src/usb/usb-state.c | 16 +-- src/usb/usb-tethering.c | 6 +- src/usb/usb.c | 62 ++++---- src/usbhost/usb-host.c | 96 ++++++------- 17 files changed, 379 insertions(+), 379 deletions(-) mode change 100644 => 100755 src/proc/cpu-info.c mode change 100644 => 100755 src/shared/deviced-systemd.c mode change 100644 => 100755 src/thermal/thermal.c mode change 100644 => 100755 src/time/time-handler.c mode change 100644 => 100755 src/touchscreen/sensitivity.c mode change 100644 => 100755 src/touchscreen/touchscreen.c mode change 100644 => 100755 src/tzip/tzip-utility.c mode change 100644 => 100755 src/tzip/tzip.c mode change 100644 => 100755 src/usb-host-ffs-test-daemon/descs_gen.c mode change 100644 => 100755 src/usb-host-ffs-test-daemon/usb-host-ffs-test-daemon.c mode change 100644 => 100755 src/usb-host-test/usb-host-test.c mode change 100644 => 100755 src/usb/usb-dbus.c mode change 100644 => 100755 src/usb/usb-debug.c mode change 100644 => 100755 src/usb/usb-state.c mode change 100644 => 100755 src/usb/usb-tethering.c mode change 100644 => 100755 src/usb/usb.c mode change 100644 => 100755 src/usbhost/usb-host.c diff --git a/src/proc/cpu-info.c b/src/proc/cpu-info.c old mode 100644 new mode 100755 index 352b191..041c966 --- a/src/proc/cpu-info.c +++ b/src/proc/cpu-info.c @@ -45,7 +45,7 @@ static int read_from_file(const char *path, char *buf, size_t size) fd = open(path, O_RDONLY, 0); if (fd == -1) { - _E("Could not open '%s'", path); + _E("Failed to open '%s'.", path); return -1; } @@ -75,31 +75,31 @@ static int get_revision(char *rev, int len) const int radix = 16; if (rev == NULL || len <= 0) { - _E("Invalid argument !\n"); + _E("Invalid argument.\n"); return -1; } if (read_from_file(PATH_NAME, buf, FILE_BUFF_MAX) < 0) { - _E("fail to read %s\n", PATH_NAME); + _E("Failed to read '%s'.\n", PATH_NAME); return -1; } tag = strstr(buf, REVISION_NAME); if (tag == NULL) { - _E("cannot find Hardware in %s\n", PATH_NAME); + _E("Failed to find hardware in '%s'.\n", PATH_NAME); return -1; } start = strstr(tag, TOK_DELIMITER); if (start == NULL) { - _E("cannot find Hardware in %s\n", PATH_NAME); + _E("Failed to find hardware in '%s'.\n", PATH_NAME); return -1; } start++; ptr = strtok_r(start, END_DELIMITER, &saveptr); if (!ptr) { - _E("fail to extract tokens"); + _E("Failed to extract tokens."); return -1; } ptr += strlen(ptr); @@ -126,7 +126,7 @@ GVariant *dbus_revision_handler(GDBusConnection *conn, if (ret == 0) ret = strtol(rev, &ptr, CONVERT_TYPE); out: - _D("rev : %d", ret); + _D("Revision: %d", ret); return g_variant_new("(i)", ret); } @@ -150,7 +150,7 @@ static void cpu_info_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); } static const struct device_ops cpu_info_device_ops = { diff --git a/src/shared/deviced-systemd.c b/src/shared/deviced-systemd.c old mode 100644 new mode 100755 index 8484dc8..cc475be --- a/src/shared/deviced-systemd.c +++ b/src/shared/deviced-systemd.c @@ -115,7 +115,7 @@ static int deviced_systemd_start_or_stop_unit(char *method, char *name) gchar *objpath = NULL; int ret = 0; - _I("Starting: %s %s", method, name); + _I("Starting: method=%s name=%s", method, name); reply = dbus_handle_method_sync_with_reply_var(SYSTEMD_DBUS_DEST, SYSTEMD_DBUS_PATH, SYSTEMD_DBUS_IFACE_MANAGER, @@ -123,12 +123,12 @@ static int deviced_systemd_start_or_stop_unit(char *method, char *name) g_variant_new("(ss)", name, "replace")); if (!reply || !dh_get_param_from_var(reply, "(o)", &objpath)) { - _E("fail (%s): no message", method); + _E("Failed to get %s: no message", method); ret = -EBADMSG; goto finish; } - _I("Finished: %s %s", method, name); + _I("Finished: method=%s name=%s", method, name); finish: if (reply) g_variant_unref(reply); @@ -140,7 +140,7 @@ finish: int deviced_systemd_start_unit(char *name) { if (name == NULL) { - _E("Wrong name : %s", name); + _E("Wrong name(%s)", name); return -1; } @@ -150,7 +150,7 @@ int deviced_systemd_start_unit(char *name) int deviced_systemd_stop_unit(char *name) { if (name == NULL) { - _E("Wrong name : %s", name); + _E("Wrong name(%s)", name); return -1; } @@ -236,7 +236,7 @@ GVariant * deviced_systemd_get_manager_property(const char *property) "Get", g_variant_new("(ss)", SYSTEMD_DBUS_IFACE_MANAGER, property)); if (!reply || !dh_get_param_from_var(reply, "(v)", &val)) - _E("Failed to get variant"); + _E("Failed to get variant."); if (reply) g_variant_unref(reply); @@ -262,7 +262,7 @@ GVariant * deviced_systemd_get_unit_property(const char *unit, g_variant_new("(ss)", SYSTEMD_DBUS_IFACE_UNIT, property)); if (!reply || !dh_get_param_from_var(reply, "(v)", &val)) - _E("Failed to get variant"); + _E("Failed to get variant."); if (reply) g_variant_unref(reply); free(escaped); @@ -288,7 +288,7 @@ GVariant * deviced_systemd_get_service_property(const char *unit, "Get", g_variant_new("(ss)", SYSTEMD_DBUS_IFACE_SERVICE, property)); if (!reply || !dh_get_param_from_var(reply, "(v)", &val)) - _E("Failed to get variant"); + _E("Failed to get variant."); if (reply) g_variant_unref(reply); free(escaped); diff --git a/src/thermal/thermal.c b/src/thermal/thermal.c old mode 100644 new mode 100755 index d9a5e9f..78195e9 --- a/src/thermal/thermal.c +++ b/src/thermal/thermal.c @@ -61,7 +61,7 @@ static void thermal_remove_noti(void) if (noti) { ret = remove_notification("TempCooldownNotiOff", noti); if (ret < 0) - _E("Fail to remove cooldown noti : %d", noti); + _E("Failed to remove cooldown noti(%d).", noti); else noti = 0; } @@ -74,7 +74,7 @@ static void thermal_remove_popup(void) temp = launch_system_app(APP_DEFAULT, 2, APP_KEY_TYPE, "remove_cooldown_popups"); if (temp < 0) - _E("Fail to launch remove_cooldown_popups"); + _E("Failed to launch remove_cooldown_popups."); } static void thermal_noti_cb(GVariant *var, void *user_data, GError *err) @@ -88,12 +88,12 @@ static void thermal_noti_cb(GVariant *var, void *user_data, GError *err) } if (!dh_get_param_from_var(var, "(i)", &id)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to get var(%s): no message", g_variant_get_type_string(var)); goto out; } noti = id; - _D("thermal noti : %d", noti); + _D("Thermal noti(%d).", noti); out: g_variant_unref(var); @@ -107,14 +107,14 @@ static void thermal_add_noti(void) if (!noti) { ret = add_async_notification("TempCooldownNotiOn", thermal_noti_cb, NULL, NULL); if (ret < 0) - _E("Failed to show notification for temperature"); + _E("Failed to show notification for temperature."); } } static void broadcast_thermal_state_legacy(const char *action_type) { if (!action_type) { - _E("Invalid action type"); + _E("Invalid action type."); return; } @@ -134,7 +134,7 @@ static gboolean thermal_overheat_time_broadcast(void *data) ret = dbus_handle_broadcast_dbus_signal_var(POPUP_OVERHEAT_PATH, POPUP_OVERHEAT_INTERFACE, SIGNAL_OVERHEAT_TIME, g_variant_new("(i)", time)); if (ret < 0) - _E("Fail in updating overheat time"); + _E("Failed in updating overheat time."); time -= 1; if (time < 0) { @@ -142,11 +142,11 @@ static gboolean thermal_overheat_time_broadcast(void *data) ret = launch_system_app(APP_OVERHEAT, 2, APP_KEY_TYPE, "remove_overheat_popups"); if (ret < 0) - _E("Fail to remove overheat popups"); + _E("Failed to remove overheat popups."); ret = power_off(); if (ret < 0) - _E("Fail to power off"); + _E("Failed to power off."); return G_SOURCE_REMOVE; } else return G_SOURCE_CONTINUE; @@ -161,11 +161,11 @@ static void thermal_overheat_popup(void) APP_KEY_TYPE, "overheat"); if (ret < 0) - _E("error to launch Overheat popup"); + _E("Failed to launch overheat popup."); else { timer = g_timeout_add_seconds(OVERHEAT_CALLBACK_TIME, thermal_overheat_time_broadcast, NULL); if (!timer) - _E("Fail to set over temp timer"); + _E("Failed to set over temp timer."); } } @@ -176,7 +176,7 @@ static void thermal_add_recovery_popup(void) temp = launch_system_app(APP_DEFAULT, 2, APP_KEY_TYPE, "cooled_down"); if (temp < 0) - _E("Fail to launch recovery popup"); + _E("Failed to launch recovery popup."); } static void thermal_action(int state) @@ -191,7 +191,7 @@ static void thermal_action(int state) break; case WARNING: - _I("State is WARNING"); + _I("State is WARNING."); action = strdup(WARNING_ACTION); break; @@ -300,12 +300,12 @@ static void thermal_handler(struct thermal_info *info, void *data) avg_temp = thermal_get_average(info->temp); new_state = thermal_get_temp_enum(avg_temp); if (new_state == -1) { - _I("Keep current state : %d", old_state); + _I("Keep current state: %d", old_state); return; } action_needed = is_action_needed(old_state, new_state); - _I("Action(%d) old_state(%d) new_state(%d)", action_needed, old_state, new_state); + _I("Action=%d old_state=%d new_state=%d", action_needed, old_state, new_state); if (action_needed) thermal_action(new_state); @@ -317,13 +317,13 @@ static int thermal_service_start(void) int ret; if (!thermal_dev) { - _E("Thermal service is not supported"); + _E("Thermal service is not supported."); return -ENOTSUP; } ret = thermal_dev->register_changed_event(thermal_handler, NULL); if (ret < 0) - _E("Failed to register thermal event (%d)", ret); + _E("Failed to register thermal event: %d", ret); return ret; } @@ -333,13 +333,13 @@ static int thermal_service_stop(void) int ret; if (!thermal_dev) { - _E("Thermal service is not supported"); + _E("Thermal service is not supported."); return -ENOTSUP; } ret = thermal_dev->unregister_changed_event(thermal_handler); if (ret < 0) - _E("Failed to unregister thermal event (%d)", ret); + _E("Failed to unregister thermal event: %d", ret); return ret; } @@ -388,7 +388,7 @@ static int booting_done(void *data) if (done == 0) return done; - _I("booting done"); + _I("Booting done."); thermal_service_start(); return done; @@ -400,7 +400,7 @@ static int load_config(struct parse_result *result, void *user_data) char *name; char *value; - _D("%s,%s,%s", result->section, result->name, result->value); + _D("Load config. section=%s name=%s value=%s", result->section, result->name, result->value); if (!info) return -EINVAL; @@ -429,18 +429,18 @@ static void thermal_init(void *data) /* load thermal configuration file */ ret = config_parse(THERMAL_CONF_FILE, load_config, &thermal_table); if (ret < 0) - _E("Failed to load power off config (%d)", ret); + _E("Failed to load power off config: %d", ret); - _I("temperature conf %d %d %d %d", thermal_table.normal, thermal_table.warning, + _I("Temperature conf normal=%d warning=%d limit=%d shutdown=%d", thermal_table.normal, thermal_table.warning, thermal_table.limit, thermal_table.shutdown); ret = register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); if (ret < 0) - _E("Fail to register booting done Notifier"); + _E("Failed to register booting done notifier."); ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_TEMPERATURE, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); } static void thermal_exit(void *data) @@ -449,7 +449,7 @@ static void thermal_exit(void *data) ret = unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); if (ret < 0) - _E("Fail to unregister booting done Notifier"); + _E("Failed to unregister booting done notifier."); thermal_service_stop(); } @@ -465,18 +465,18 @@ static int thermal_probe(void *data) ret = hw_get_info(THERMAL_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (ret < 0) { - _E("There is no HAL for Thermal"); + _E("There is no HAL for Thermal."); return ret; } if (!info->open) { - _E("Failed to open thermal device; open(NULL)"); + _E("Failed to open thermal device: open(NULL)"); return -ENODEV; } ret = info->open(info, NULL, (struct hw_common**)&thermal_dev); if (ret < 0) { - _E("Failed to get thermal device structure (%d)", ret); + _E("Failed to get thermal device structure: %d", ret); return ret; } @@ -484,11 +484,11 @@ static int thermal_probe(void *data) !thermal_dev->get_info || !thermal_dev->register_changed_event || !thermal_dev->unregister_changed_event) { - _E("Thermal HAL does not support event handler"); + _E("Thermal HAL does not support event handler."); return -ENODEV; } - _I("Thermal device structure load success"); + _I("Thermal device structure load success."); return 0; } diff --git a/src/time/time-handler.c b/src/time/time-handler.c old mode 100644 new mode 100755 index d0be7c5..bca84bc --- a/src/time/time-handler.c +++ b/src/time/time-handler.c @@ -97,10 +97,10 @@ int handle_timezone(char *str) tzpath = str; sympath = tzplatform_mkpath(TZ_SYS_ETC, "localtime"); - _D("TZPATH = %s", tzpath); + _D("TZPATH=%s", tzpath); if (stat(tzpath, &sts) == -1 && errno == ENOENT) { - _E("invalid tzpath(%s)", tzpath); + _E("Invalid tzpath(%s).", tzpath); return -EINVAL; } @@ -109,7 +109,7 @@ int handle_timezone(char *str) ts2 = localtime_r(&now, &ts); if (ts2) { asctime_r(&ts, buf); - _D("cur local time is %s", buf); + _D("Current local time is %s.", buf); } /* unlink current link @@ -119,20 +119,20 @@ int handle_timezone(char *str) } else { ret = unlink(sympath); if (ret < 0) { - _E("unlink error : [%d](errno:%d)", ret, errno); + _E("Failed to unlink. ret=%d errno=%d", ret, errno); return -1; } - _D("unlink success"); + _D("Unlink success."); } /* symlink new link * eg. ln -s /usr/share/zoneinfo/Asia/Seoul /opt/etc/localtime */ ret = symlink(tzpath, sympath); if (ret < 0) { - _E("symlink error : [%d](errno:%d)", ret, errno); + _E("Failed to symlink. ret=%d errno=%d", ret, errno); return -1; } - _D("symlink success"); + _D("Symlink success."); tzset(); @@ -140,7 +140,7 @@ int handle_timezone(char *str) ts2 = localtime_r(&now, &ts); if (ts2) { asctime_r(&ts, buf); - _D("new local time is %s", buf); + _D("New local time is %s.", buf); } return 0; } @@ -159,7 +159,7 @@ int handle_date(char *str) tmp = (long int)atoi(str); timet = (time_t) tmp; - _D("ctime = %s", ctime(&timet)); + _D("ctime=%s", ctime(&timet)); vconf_set_int(VCONFKEY_SYSTEM_TIMECHANGE, timet); return 0; @@ -172,7 +172,7 @@ int set_datetime_action(int argc, char **argv) if (argc < 1) return -1; if (vconf_get_int(VCONFKEY_PM_STATE, &ret) != 0) - _E("Fail to get vconf value for pm state\n"); + _E("Failed to get vconf value for pm state.\n"); if (ret == 1) pm_state = 0x1; else if (ret == 2) @@ -198,7 +198,7 @@ int set_timezone_action(int argc, char **argv) if (argc < 1) return -1; if (vconf_get_int(VCONFKEY_PM_STATE, &ret) != 0) - _E("Fail to get vconf value for pm state\n"); + _E("Failed to get vconf value for pm state.\n"); if (ret == 1) pm_state = 0x1; else if (ret == 2) @@ -230,21 +230,21 @@ static int timerfd_check_start(void) tfd = timerfd_create(CLOCK_REALTIME, TFD_NONBLOCK|TFD_CLOEXEC); if (tfd == -1) { - _E("error timerfd_create() %d", errno); + _E("Failed to timerfd_create(): %d", errno); tfdh = 0; return -1; } tfdh = g_unix_fd_add(tfd, G_IO_IN, tfd_cb, NULL); if (!tfdh) { - _E("error g_unix_fd_add"); + _E("Failed to g_unix_fd_add."); return -1; } memset(&tmr, 0, sizeof(tmr)); tmr.it_value.tv_sec = default_time; ret = timerfd_settime(tfd, TFD_TIMER_ABSTIME|TFD_TIMER_CANCELON_SET, &tmr, NULL); if (ret < 0) { - _E("error timerfd_settime() %d", errno); + _E("Failed to timerfd_settime(): %d", errno); return -1; } return 0; @@ -269,7 +269,7 @@ static gboolean tfd_cb(gint fd, GIOCondition condition, gpointer user_data) int ret = -1; if (tfd == -1) { - _E("error ecore_main_fd_handler_fd_get()"); + _E("Failed to ecore_main_fd_handler_fd_get()."); goto out; } @@ -278,10 +278,10 @@ static gboolean tfd_cb(gint fd, GIOCondition condition, gpointer user_data) vconf_set_int(VCONFKEY_SYSMAN_STIME, VCONFKEY_SYSMAN_STIME_CHANGED); time_changed_broadcast(); timerfd_check_stop(tfd); - _D("NOTIFICATION here"); + _D("Notification here."); timerfd_check_start(); } else { - _E("unexpected read (err:%d)", errno); + _E("Failed to read: %d", errno); } out: return G_SOURCE_CONTINUE; @@ -300,14 +300,14 @@ GVariant *dbus_time_handler(GDBusConnection *conn, g_variant_get(param, "(sis)", &type_str, &argc, &argv); if (argc < 0) { - _E("message is invalid!"); + _E("Message is invalid."); ret = -EINVAL; goto out; } pid = dbus_connection_get_sender_pid(conn, sender); if (kill(pid, 0) == -1) { - _E("%d process does not exist, dbus ignored!", pid); + _E("Process(%d) does not exist, dbus ignored.", pid); ret = -ESRCH; goto out; } @@ -355,13 +355,13 @@ static int time_lcd_changed_cb(void *data) if (lcd_state || !tfdh || tfd == -1) goto out; - _D("stop tfd"); + _D("Stop tfd."); timerfd_check_stop(tfd); goto out; restart: if (tfdh) return 0; - _D("restart tfd"); + _D("Restart tfd."); timerfd_check_start(); out: return 0; @@ -373,10 +373,10 @@ static void time_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); if (timerfd_check_start() == -1) - _E("fail system time change detector init"); + _E("Failed system time change detector init."); register_notifier(DEVICE_NOTIFIER_LCD, time_lcd_changed_cb); } diff --git a/src/touchscreen/sensitivity.c b/src/touchscreen/sensitivity.c old mode 100644 new mode 100755 index 8f1bd25..fd96660 --- a/src/touchscreen/sensitivity.c +++ b/src/touchscreen/sensitivity.c @@ -62,7 +62,7 @@ static gboolean disable_sensitivity(void *data) int status; if (check_dev() < 0) { - _E("touch sensitivity HAL does not exist"); + _E("Touch sensitivity HAL does not exist."); return G_SOURCE_REMOVE; } @@ -71,7 +71,7 @@ static gboolean disable_sensitivity(void *data) return G_SOURCE_REMOVE; ret = touchsensitivity_dev->glove_mode_set_state(TOUCHSENSITIVITY_GLOVE_MODE_OFF); - _I("%s change auto touch sensitivity disable", ret ? "fail" : "set"); + _I("Change auto touch sensitivity disable: %s", ret ? "fail" : "set"); return G_SOURCE_REMOVE; } @@ -85,7 +85,7 @@ static void disable_touch_sensitivity_handler(GDBusConnection *conn, { disable_timer = g_timeout_add_seconds(TOUCH_SENSITIVITY_DISABLE_INTERVAL, disable_sensitivity, NULL); if (disable_timer == 0) - _E("fail to add battery init timer during booting"); + _E("Failed to add battery init timer during booting."); } static GVariant *get_touch_sensitivity(GDBusConnection *conn, @@ -95,11 +95,11 @@ static GVariant *get_touch_sensitivity(GDBusConnection *conn, int val = -1, ret; if (check_dev() < 0) { - _E("touch sensitivity HAL does not exist"); + _E("Touch sensitivity HAL does not exist."); goto out; } ret = touchsensitivity_dev->glove_mode_get_state(&val); - _I("%s touch sensitivity %d", ret ? "fail" : "get", val); + _I("Touch sensitivity(%d): %s", val, ret ? "fail" : "get"); out: return g_variant_new("(i)", val); } @@ -117,14 +117,14 @@ static GVariant *set_touch_sensitivity(GDBusConnection *conn, disable_timer = 0; } if (check_dev() < 0) { - _E("touch sensitivity HAL does not exist"); + _E("Touch sensitivity HAL does not exist."); ret = -EINVAL; goto error; } ret = touchsensitivity_dev->glove_mode_set_state(val); error: - _I("%s touch sensitivity %d", ret ? "fail" : "set", val); + _I("Touch sensitivity(%d): %s", val, ret ? "fail" : "set"); return g_variant_new("(i)", ret); } @@ -158,11 +158,11 @@ static int booting_done(void *data) goto out; if (check_dev() < 0) { - _E("touch sensitivity HAL does not exist"); + _E("Touch sensitivity HAL does not exist."); goto out; } ret = touchsensitivity_dev->glove_mode_set_state(TOUCHSENSITIVITY_GLOVE_MODE_ON); - _I("%s change auto touch sensitivity enable", ret ? "fail" : "set"); + _I("Change auto touch sensitivity enable: %s", ret ? "fail" : "set"); unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); out: return done; @@ -179,27 +179,27 @@ static void sensitivity_init(void *data) ret = hw_get_info(TOUCHSENSITIVITY_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (ret < 0) { - _E("Fail to load touch sensitivity shared library (%d)", ret); + _E("Failed to load touch sensitivity shared library: %d", ret); return; } if (!info->open) { - _E("fail to open touch sensitivity device : open(NULL)"); + _E("Failed to open touch sensitivity device: open(NULL)"); return; } ret = info->open(info, NULL, (struct hw_common **)&touchsensitivity_dev); if (ret < 0) { - _E("fail to get touch sensitivity device structure : (%d)", ret); + _E("Failed to get touch sensitivity device structure: %d", ret); return; } - _I("touch sensitivity device structure load success"); + _I("Touch sensitivity device structure load success."); /* init dbus interface */ ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_TOUCH, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); subscribe_dbus_signal(NULL, DEVICED_PATH_TOUCH, diff --git a/src/touchscreen/touchscreen.c b/src/touchscreen/touchscreen.c old mode 100644 new mode 100755 index 1621c00..5d696c2 --- a/src/touchscreen/touchscreen.c +++ b/src/touchscreen/touchscreen.c @@ -36,22 +36,22 @@ static int touchscreen_probe(void *data) ret = hw_get_info(TOUCHSCREEN_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); if (ret < 0) { - _E("Fail to load touchscreen shared library (%d)", ret); + _E("Failed to load touchscreen shared library: %d", ret); return -ENODEV; } if (!info->open) { - _E("fail to open touchscreen device : open(NULL)"); + _E("Failed to open touchscreen device: open(NULL)"); return -EPERM; } ret = info->open(info, NULL, (struct hw_common **)&touchscreen_dev); if (ret < 0) { - _E("fail to get touchscreen device structure : (%d)", ret); + _E("Failed to get touchscreen device structure: %d", ret); return -EPERM; } - _I("touchscreen device structure load success"); + _I("Touchscreen device structure load success."); return 0; } @@ -75,17 +75,17 @@ static int touchscreen_set_state(enum touchscreen_state state) char *act; if (!touchscreen_dev) { - _E("touchscreen device structure is not loaded"); + _E("Touchscreen device structure is not loaded."); return -ENOENT; } if (state != TOUCHSCREEN_ON && state != TOUCHSCREEN_OFF) { - _E("Invalid parameter"); + _E("Invalid parameter."); return -EINVAL; } if (!touchscreen_dev->set_state) { - _E("touchscreen state change is not supported"); + _E("Touchscreen state change is not supported."); return -ENOTSUP; } @@ -93,9 +93,9 @@ static int touchscreen_set_state(enum touchscreen_state state) ret = touchscreen_dev->set_state(state); if (ret == 0) - _I("Success to %s touchscreen", act); + _I("Success to %s touchscreen.", act); else - _E("Failed to %s touchscreen (%d)", act, ret); + _E("Failed to %s touchscreen: %d", act, ret); return ret; } @@ -122,7 +122,7 @@ static int touchscreen_dump(FILE *fp, int mode, void *dump_data) ret = touchscreen_dev->get_state(&state); if (ret < 0) - _E("Failed to get touchscreen state : %d", ret); + _E("Failed to get touchscreen state: %d", ret); if (state == TOUCHSCREEN_ON) LOG_DUMP(fp, "Touchscreen is enabled\n"); diff --git a/src/tzip/tzip-utility.c b/src/tzip/tzip-utility.c old mode 100644 new mode 100755 index 6cd5335..4a2ca5f --- a/src/tzip/tzip-utility.c +++ b/src/tzip/tzip-utility.c @@ -111,7 +111,7 @@ struct tzip_dir_info *get_dir_list( entry->dir_hash, dir_name); if (!dinfo) - _D("Empty Folder %s", dir_name); + _D("Empty Folder '%s'.", dir_name); return dinfo; } @@ -170,7 +170,7 @@ static int add_path_dirs_info(struct tzip_mount_entry *entry, const char *path, /* add info about each directory in path */ parent_dir = malloc(strlen(path) + 1); if (!parent_dir) { - _E("Malloc failed"); + _E("Failed to malloc."); return -ENOMEM; } @@ -178,7 +178,7 @@ static int add_path_dirs_info(struct tzip_mount_entry *entry, const char *path, cpy_path = strndup(path, strlen(path) + 1); if (!cpy_path) { free(parent_dir); - _E("Malloc failed"); + _E("Failed to malloc."); return -ENOMEM; } @@ -231,14 +231,14 @@ static int add_dir_info(struct tzip_mount_entry *entry, const char *parent_dir, dinfo = (struct tzip_dir_info *)malloc( sizeof(struct tzip_dir_info)); if (!dinfo) { - _E("Malloc failed"); + _E("Failed to malloc."); return -ENOMEM; } dinfo->file_hash = g_hash_table_new_full( g_str_hash, g_str_equal, NULL, NULL); if (!dinfo->file_hash) { - _E("Malloc failed"); + _E("Failed to malloc."); free(dinfo); return -ENOMEM; } @@ -246,7 +246,7 @@ static int add_dir_info(struct tzip_mount_entry *entry, const char *parent_dir, len = strlen(parent_dir) + 1; dinfo->name = (char *)malloc(len); if (!dinfo->name) { - _E("Malloc failed"); + _E("Failed to malloc."); g_hash_table_unref(dinfo->file_hash); free(dinfo); return -ENOMEM; @@ -264,7 +264,7 @@ static int add_dir_info(struct tzip_mount_entry *entry, const char *parent_dir, /* add dir info in parent dir node */ finfo = (struct tzip_file_info *)malloc(sizeof(struct tzip_file_info)); if (!finfo) { - _E("Malloc failed"); + _E("Failed to malloc."); return -ENOMEM; } @@ -272,7 +272,7 @@ static int add_dir_info(struct tzip_mount_entry *entry, const char *parent_dir, finfo->name = (char *)malloc(len); if (!finfo->name) { free(finfo); - _E("Malloc failed"); + _E("Failed to malloc."); return -ENOMEM; } strncpy(finfo->name, filename, len); @@ -291,19 +291,19 @@ static int extract_zipfile_details( int ret = 0; mode_t mode; - _D("Adding mount (%s, %s) to list", entry->path, zip_path); + _D("Adding mount ('%s', '%s') to list.", entry->path, zip_path); /* Open the zip file */ unzFile *zipfile = unzOpen(zip_path); if (!zipfile) { - _E("unzOpen Failed %s ", zip_path); + _E("Failed to unzOpen '%s'.", zip_path); return -EINVAL ; } /* Get info about the zip file */ unz_global_info global_info; if (unzGetGlobalInfo(zipfile, &global_info) != UNZ_OK) { - _E("unzGetGlobalInfo Failed"); + _E("Failed to unzGetGlobalInfo."); ret = -EINVAL; goto out; } @@ -317,22 +317,22 @@ static int extract_zipfile_details( ret = unzGetCurrentFileInfo(zipfile, &file_info, filename, MAX_FILENAME_LEN, NULL, 0, NULL, 0); if (ret != UNZ_OK) { - _E("unzGetCurrentFileInfo Failed"); + _E("Failed to unzGetCurrentFileInfo."); ret = -EINVAL; goto out; } - _D("unzGetCurrentFileInfo file name - %s", filename); + _D("unzGetCurrentFileInfo filename=%s", filename); /* Check if this entry is a directory or file. */ const size_t filename_length = strlen(filename); if (filename[filename_length - 1] == DIR_DELIMETER) { - _D("Entry is a directory"); + _D("Entry is a directory."); filename[filename_length - 1] = 0; mode = S_IFDIR; } else { - _D("Entry is a file"); + _D("Entry is a file."); mode = S_IFREG; } @@ -344,7 +344,7 @@ static int extract_zipfile_details( if ((i + 1) < global_info.number_entry) { ret = unzGoToNextFile(zipfile); if (ret != UNZ_OK) { - _E("unzGoToNextFile Failed"); + _E("Failed to unzGoToNextFile."); ret = -EINVAL ; break; } @@ -365,14 +365,14 @@ int add_mount_entry(const char *zip_path, const char *mount_path) /* check if this mount path is already there, return error if yes */ entry = get_mount_entry(mount_path); if (entry) { - _E("mount_path : %s already exists ", mount_path); + _E("Failed to mount '%s': already exists.", mount_path); return -EEXIST; } entry = (struct tzip_mount_entry *)malloc( sizeof(struct tzip_mount_entry)); if (!entry) { - _E("Malloc failed"); + _E("Failed to malloc."); return -ENOMEM; } entry->dir_hash = NULL; @@ -380,7 +380,7 @@ int add_mount_entry(const char *zip_path, const char *mount_path) len = strlen(mount_path) + 1; entry->path = (char *)malloc(len); if (!entry->path) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -389,7 +389,7 @@ int add_mount_entry(const char *zip_path, const char *mount_path) len = strlen(zip_path) + 1; entry->zip_path = (char *)malloc(len); if (!entry->zip_path) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -431,43 +431,43 @@ static int get_file_info(const char *file_path, struct tzip_file_info *flist) int file_index = 0; int dir_status; - _D("File path : %s ", file_path); + _D("Get file(%s) info.", file_path); /* return file_info for a given file and mount path */ entry = find_mount_entry(file_path, &dir_status); if (!entry) { - _E("mount_path : %s is not mounted, dir_status %d", file_path, dir_status); + _E("Failed to find mount_path(%s): is not mounted, dir_status=%d", file_path, dir_status); return dir_status; } - _D("Got mount path : %s", entry->path); + _D("Got mount path=%s", entry->path); file_index = strlen(entry->path); file_name = strrchr(&file_path[file_index], '/'); if (!file_name) { - _D("Parent Directory"); + _D("Parent Directory."); return 1; } else if (strlen(file_name) == strlen(&file_path[file_index])) { - _D("Checking dir : %s", "."); + _D("Checking dir=%s", "."); dinfo = get_dir_list(entry, "."); } else { *file_name = 0; - _D("Checking dir : %s", &file_path[file_index + 1]); + _D("Checking dir=%s", &file_path[file_index + 1]); dinfo = get_dir_list(entry, &file_path[file_index + 1]); *file_name = '/'; } if (!dinfo) { - _D(" Empty Folder %s", file_path); + _D("Empty Folder=%s", file_path); return -ENOENT; } file_name = file_name + 1; - _D("File name : %s ", file_name); + _D("File name=%s", file_name); finfo = (struct tzip_file_info *)g_hash_table_lookup( dinfo->file_hash, file_name); if (!finfo) { - _E("File %s not found", file_name); + _E("File(%s) is not found.", file_name); return -ENOENT; } @@ -484,7 +484,7 @@ int get_path_prop(const char *path, struct stat *stbuf) ret = get_file_info(path, &file); if (ret < 0) { - _E("File not found : %s ", path); + _E("File(%s) not found.", path); return -ENOENT; } @@ -512,27 +512,27 @@ struct tzip_dir_info *get_dir_files(const char *dir) int dir_status; int dir_len = 0; - _D("Dir path : %s ", dir); + _D("Dir path=%s", dir); entry = find_mount_entry(dir, &dir_status); if (!entry) { - _E("mount_path : %s is not mounted, dir_status %d", dir, dir_status); + _E("Failed to find mount_path(%s): is not mounted, dir_status=%d", dir, dir_status); return NULL; } - _D("Mount path : %s", entry->path); + _D("Mount path=%s", entry->path); file_index = strlen(entry->path); dir_len = strlen(dir); if (file_index == dir_len) { - _D("Checking dir : %s", "."); + _D("Checking dir=%s", "."); dinfo = get_dir_list(entry, "."); } else { - _D("Checking dir : %s", &dir[file_index + 1]); + _D("Checking dir=%s", &dir[file_index + 1]); dinfo = get_dir_list(entry, &dir[file_index + 1]); } if (!dinfo) { - _D(" Empty Folder %s ", dir); + _D("Empty Folder=%s", dir); return NULL; } @@ -544,13 +544,13 @@ int remove_mount_entry(const char *mount_path) struct tzip_mount_entry *entry; if (!mount_path) { - _E("Invalid mount path "); + _E("Invalid mount path."); return -ENOENT; } entry = (struct tzip_mount_entry *)get_mount_entry(mount_path); if (!entry) { - _D("Mount path : %s not found", mount_path); + _D("Mount path(%s) is not found.", mount_path); return -ENOENT; } @@ -601,13 +601,13 @@ out: void tzip_lock_init(void) { if (sem_init(&tzip_sem, 0, 1) == -1) - _E("sem_init failed"); + _E("Failed to sem_init."); } void tzip_lock_deinit(void) { if (sem_destroy(&tzip_sem) == -1) - _E("sem_destroy failed"); + _E("Failed to sem_destroy."); } void tzip_lock(void) @@ -626,16 +626,16 @@ static int reset_zipfile(struct tzip_handle *handle) ret = unzCloseCurrentFile(handle->zipfile); if (ret != UNZ_OK) { - _E("unzOpenCurrentFile Failed"); + _E("Failed to unzOpenCurrentFile."); return -EINVAL; } if (unzLocateFile(handle->zipfile, handle->file, CASE_SENSITIVE) != UNZ_OK) { - _E("File :[%s] Not Found : unzLocateFile failed", handle->file); + _E("Failed to unzLocateFile: '%s' is not Found", handle->file); return -ENOENT; } ret = unzOpenCurrentFile(handle->zipfile); if (ret != UNZ_OK) { - _E("unzOpenCurrentFile Failed"); + _E("Failed to unzOpenCurrentFile."); return -EINVAL; } return 0; @@ -649,7 +649,7 @@ int read_zipfile(struct tzip_handle *handle, char *buf, if (offset > handle->file_info->uncompressed_size || offset < 0) { - _E("Invalid Offset (%jd) for file size (%lu)", offset, handle->file_info->uncompressed_size); + _E("Invalid Offset (%jd) for file size (%lu).", offset, handle->file_info->uncompressed_size); return -EINVAL; } @@ -658,16 +658,16 @@ int read_zipfile(struct tzip_handle *handle, char *buf, int fill_cache = 0; /* seek and read buffer */ - _D("offset (%jd) handle->from(%jd) (offset + size) (%jd) handle->to (%jd) handle->offset (%jd)", + _D("Offset (%jd) handle->from(%jd) (offset + size) (%jd) handle->to (%jd) handle->offset (%jd).", offset, handle->from, (offset + size), handle->to, handle->offset); /* cache hits and release onetime cache */ if (handle->pbuf && offset >= handle->from && (offset + size) <= handle->to) { - _D("Have already read this chunk"); + _D("Have already read this chunk."); memcpy(buf, handle->pbuf + (offset - handle->from), size); if (offset == handle->from && (offset + size) == handle->to) { - _D("Cache free"); + _D("Cache free."); handle->from = 0; handle->to = 0; free(handle->pbuf); @@ -678,7 +678,7 @@ int read_zipfile(struct tzip_handle *handle, char *buf, if (offset > handle->offset) { /* read from current position */ - _D("Read from current position (%jd) till offset (%jd)", handle->offset, offset); + _D("Read from current position (%jd) till offset (%jd).", handle->offset, offset); diff_size = offset - handle->offset; @@ -686,25 +686,25 @@ int read_zipfile(struct tzip_handle *handle, char *buf, fill_cache = 1; } else if (offset < handle->offset) { /* read from the begining*/ - _D("Read from the begining till offset (%jd)", offset); + _D("Read from the begining till offset (%jd).", offset); diff_size = offset; if (reset_zipfile(handle)) { - _E("reset_zipfile Failed"); + _E("Failed to reset_zipfile."); return -EINVAL; } } if (fill_cache) { - _D("Fill cache current position (%jd) till offset (%jd)", handle->offset, offset); + _D("Fill cache current position (%jd) till offset (%jd).", handle->offset, offset); if (handle->pbuf) free(handle->pbuf); handle->pbuf = (char *)malloc(diff_size); if (!handle->pbuf) { - _E("Malloc failed"); + _E("Failed to malloc."); return -ENOMEM; } @@ -713,7 +713,7 @@ int read_zipfile(struct tzip_handle *handle, char *buf, ret = unzReadCurrentFile(handle->zipfile, handle->pbuf+bytes_read, diff_size - bytes_read); if (ret < 0) { - _E("unzReadCurrentFile Failed"); + _E("Failed to unzReadCurrentFile."); free(handle->pbuf); handle->pbuf = NULL; return -EINVAL; @@ -725,7 +725,7 @@ int read_zipfile(struct tzip_handle *handle, char *buf, handle->from = handle->offset; handle->to = offset; } else { - _E("Fill cache fail"); + _E("Failed to fill cache."); free(handle->pbuf); handle->pbuf = NULL; } @@ -743,7 +743,7 @@ int read_zipfile(struct tzip_handle *handle, char *buf, tmp_buf = (char *)malloc(buf_size); if (!tmp_buf) { - _E("Malloc failed"); + _E("Failed to malloc."); return -ENOMEM; } @@ -761,14 +761,14 @@ int read_zipfile(struct tzip_handle *handle, char *buf, ret = unzReadCurrentFile(handle->zipfile, tmp_buf+bytes_read, buf_size - bytes_read); if (ret < 0) { - _E("unzReadCurrentFile Failed"); + _E("Failed to unzReadCurrentFile."); free(tmp_buf); return -EINVAL; } bytes_read += ret; } while (bytes_read < buf_size && ret != 0); if (!ret) { - _E("EOF reached"); + _E("EOF reached."); break; } } @@ -781,7 +781,7 @@ int read_zipfile(struct tzip_handle *handle, char *buf, ret = unzReadCurrentFile(handle->zipfile, buf + bytes_read, size - bytes_read); if (ret < 0) { - _E("unzReadCurrentFile Failed"); + _E("Failed to unzReadCurrentFile."); return -EINVAL; } bytes_read += ret; @@ -790,7 +790,7 @@ int read_zipfile(struct tzip_handle *handle, char *buf, /* store current zip position for subsequent read */ handle->offset = offset + bytes_read; - _D("bytes_read : %d [offset : %jd, total size : %lu]", bytes_read, handle->offset, handle->file_info->uncompressed_size); + _D("bytes_read=%d offset=%jd total size=%lu", bytes_read, handle->offset, handle->file_info->uncompressed_size); return bytes_read; } @@ -814,21 +814,21 @@ int tzip_store_mount_info(const char *zip_path, const char *mount_path) char *file_entry; if (!zip_path || !mount_path) { - _E("Invalid Arguments path : %p buf %p ", zip_path, mount_path); + _E("Invalid arguments path=%p buf=%p ", zip_path, mount_path); return -ENOENT; } - _D("zip_path - : [%s] mount_path : [%s] ", zip_path, mount_path); + _D("zip_path=%s mount_path=%s", zip_path, mount_path); fp = fopen(TZIP_INFO_FILE, "a+"); if (fp == NULL) { - _E("fopen() Failed!!!"); + _E("Failed to fopen()."); return -EIO; } len = sizeof(char) * (strlen(zip_path) + strlen(mount_path) + 3); file_entry = (char *)malloc(len); if (!file_entry) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -836,7 +836,7 @@ int tzip_store_mount_info(const char *zip_path, const char *mount_path) len = strlen(file_entry); if (fwrite(file_entry, sizeof(char), len, fp) != len) { - _E(" fwrite Failed !!!! "); + _E("Failed to fwrite."); ret = -EIO; goto out; } @@ -861,14 +861,14 @@ int tzip_clear_mount_info(void) if (g_hash_table_size(hashmap) == 0) { ret = unlink(TZIP_INFO_FILE); if (ret < 0) - _E("unlink fail %s, %d", TZIP_INFO_FILE, errno); + _E("Failed to unlink(%s): %d", TZIP_INFO_FILE, errno); return ret; } fp = fopen(TZIP_INFO_TMP_FILE, "w"); if (fp == NULL) { - _E("fopen() Failed!!!"); + _E("Failed to fopen()."); return -EIO; } @@ -879,7 +879,7 @@ int tzip_clear_mount_info(void) len = strlen(entry->zip_path) + strlen(entry->path) + 3; file_entry = (char *)malloc(len); if (!file_entry) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -887,7 +887,7 @@ int tzip_clear_mount_info(void) len = strlen(file_entry); if (fwrite(file_entry, sizeof(char), len, fp) != len) { - _E(" fwrite Failed !!!! "); + _E("Failed to fwrite."); free(file_entry); ret = -EIO; goto out; @@ -902,11 +902,11 @@ out: if (ret == 0) { ret = unlink(TZIP_INFO_FILE); if (ret < 0) - _E("unlink fail %s, %d", TZIP_INFO_FILE, errno); + _E("Failed to unlink(%s): %d", TZIP_INFO_FILE, errno); ret = rename(TZIP_INFO_TMP_FILE, TZIP_INFO_FILE); if (ret < 0) - _E("rename fail %s, %s, %d", TZIP_INFO_TMP_FILE, TZIP_INFO_FILE, errno); + _E("Failed to rename(%s:%s): %d", TZIP_INFO_TMP_FILE, TZIP_INFO_FILE, errno); } return ret; @@ -919,13 +919,13 @@ int tzip_remount_zipfs(const char *src_file, const char *mount_point) int path_len, mp_len; if (!src_file || !mount_point) { - _E("Invalid Arguments src_file : %p mount_point %p ", src_file, mount_point); + _E("Invalid Arguments src_file=%p mount_point=%p.", src_file, mount_point); return -EINVAL; } ret = add_mount_entry(src_file, mount_point); if (ret) { - _E("Failed to add_mount_entry %s", mount_point); + _E("Failed to add_mount_entry '%s'.", mount_point); return ret; } @@ -933,25 +933,25 @@ int tzip_remount_zipfs(const char *src_file, const char *mount_point) mp_len = strlen(mount_point); tzip_path = (char *)malloc(path_len + mp_len + 1); if (!tzip_path) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } strncpy(tzip_path, TZIP_ROOT_PATH, path_len); strncat(tzip_path, mount_point, mp_len + 1); - _D("creating sym link : %s and %s", tzip_path, mount_point); + _D("Creating sym link. '%s' and '%s'.", tzip_path, mount_point); ret = unlink(mount_point); if (ret) { ret = -errno; - _E("unlink failed"); + _E("Failed to unlink."); goto out; } ret = symlink(tzip_path, mount_point); if (ret) { ret = -errno; - _E("symlink failed"); + _E("Failed to symlink."); goto out; } @@ -959,6 +959,6 @@ out: if (ret < 0) remove_mount_entry(mount_point); free(tzip_path); - _D("Exit : %d", ret); + _D("Exit: %d", ret); return ret; } diff --git a/src/tzip/tzip.c b/src/tzip/tzip.c old mode 100644 new mode 100755 index 5f75fb2..929c021 --- a/src/tzip/tzip.c +++ b/src/tzip/tzip.c @@ -74,7 +74,7 @@ static int check_smack_label(pid_t pid) ret = get_privilege(pid, attr, sizeof(attr)); if (ret < 0) { - _E("Failed to get privilege of PID(%d)", pid); + _E("Failed to get privilege of PID(%d).", pid); return 0; } @@ -116,13 +116,13 @@ static int is_app_privileged(pid_t pid, char *mountpath) priv = check_path_available(mountpath); if (priv == 0) { - _E("TZIP mount path is invalid (%s)", mountpath); + _E("TZIP mount path(%s) is invalid.", mountpath); return priv; } priv = check_smack_label(pid); if (priv == 0) - _E("PID (%d) cannot use TZIP due to smack label", (int)pid); + _E("PID(%d) cannot use TZIP due to smack label.", (int)pid); return priv; } @@ -132,17 +132,17 @@ static int tzip_getattr(const char *path, struct stat *stbuf) int res = 0; if (!path || !stbuf) { - _E("Invalid Arguments path : %p stbuf %p ", path, stbuf); + _E("Invalid Arguments path=%p stbuf=%p.", path, stbuf); return -EINVAL; } - _D("Get ATTR path [%s]", path); + _D("Get ATTR path(%s).", path); tzip_lock(); res = get_path_prop(path, stbuf); tzip_unlock(); - _D("Exit : %d \n", res); + _D("Exit: %d\n", res); return res; } @@ -157,7 +157,7 @@ static int tzip_readdir(const char *path, void *buf, fuse_fill_dir_t filler, int ret; if (!path || !buf) { - _E("Invalid Arguments path : %p buf %p ", path, buf); + _E("Invalid Arguments path=%p buf=%p.", path, buf); return -EINVAL; } @@ -167,7 +167,7 @@ static int tzip_readdir(const char *path, void *buf, fuse_fill_dir_t filler, tzip_lock(); flist = get_dir_files(path); if (flist == NULL) { - _E("No Files in Dir : %s ", path); + _E("No Files in Dir(%s).", path); ret = 0; goto out_unlock; } @@ -201,15 +201,15 @@ static int tzip_open(const char *path, struct fuse_file_info *fi) int file_len; if (!path || !fi) { - _E("Invalid Arguments path : %p fi : %p", path, fi); + _E("Invalid Arguments path=%p fi=%p.", path, fi); return -EINVAL; } - _D("Open - Path : %s", path); + _D("Open path=%s", path); tzip_lock(); entry = find_mount_entry(path, &dir_status); if (!entry) { - _E("Mount Entry Not Found "); + _E("Failed to find mount entry."); ret = -ENOENT; goto out_unlock; } @@ -217,7 +217,7 @@ static int tzip_open(const char *path, struct fuse_file_info *fi) len = strlen(entry->zip_path) + 1; zippath = (char *)malloc(len); if (!zippath) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out_unlock; } @@ -227,7 +227,7 @@ static int tzip_open(const char *path, struct fuse_file_info *fi) file_len = strlen(path) - len + 1; file = (char *)malloc(file_len); if (!file) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out_unlock; } @@ -236,27 +236,27 @@ static int tzip_open(const char *path, struct fuse_file_info *fi) zipfile = unzOpen(zippath); if (!zipfile) { - _E("unzOpen Failed"); + _E("Failed to unzOpen."); ret = -ENOENT; goto out; } /* Get info about the zip file */ if (unzGetGlobalInfo(zipfile, &global_info) != UNZ_OK) { - _E("unzGetGlobalInfo Failed"); + _E("Failed to unzGetGlobalInfo."); ret = -EINVAL; goto out; } if (unzLocateFile(zipfile, file, CASE_SENSITIVE) != UNZ_OK) { - _E("File :[%s] Not Found : unzLocateFile failed", file); + _E("Failed to unzLocateFile: file(%s) is not Found", file); ret = -ENOENT; goto out; } file_info = (unz_file_info *)malloc(sizeof(unz_file_info)); if (!file_info) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -264,21 +264,21 @@ static int tzip_open(const char *path, struct fuse_file_info *fi) ret = unzGetCurrentFileInfo(zipfile, file_info, (char *)file, strlen(file), NULL, 0, NULL, 0); if (ret != UNZ_OK) { - _E("unzGetCurrentFileInfo Failed"); + _E("Failed to unzGetCurrentFileInfo."); ret = -EINVAL; goto out; } ret = unzOpenCurrentFile(zipfile); if (ret != UNZ_OK) { - _E("unzOpenCurrentFile Failed"); + _E("Failed to unzOpenCurrentFile."); ret = -EINVAL; goto out; } handle = (struct tzip_handle *)malloc(sizeof(struct tzip_handle)); if (!handle) { unzCloseCurrentFile(zipfile); - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -291,7 +291,7 @@ static int tzip_open(const char *path, struct fuse_file_info *fi) handle->from = 0; handle->to = 0; if (sem_init(&handle->lock, 0, 1) == -1) - _E("sem_init failed"); + _E("Failed to sem_init."); fi->fh = (uint64_t)(unsigned long)handle; @@ -315,21 +315,21 @@ static int tzip_read(const char *path, char *buf, size_t size, off_t offset, int ret; if (!path || !buf) { - _E("Invalid Arguments path : %p buf %p ", path, buf); + _E("Invalid Arguments path=%p buf=%p.", path, buf); return -EINVAL; } if (!fi || fi->fh == 0) { - _E("Invalid Zip Handle "); + _E("Invalid Zip Handle."); return -EINVAL; } handle = (struct tzip_handle *)(unsigned long)(fi->fh); - _D("Read - Path : %s size : %zd offset : %jd ", path, size, offset); + _D("Read Path=%s size=%zd offset=%jd.", path, size, offset); sem_wait(&handle->lock); ret = read_zipfile(handle, buf, size, offset); sem_post(&handle->lock); - _D("Read ret = %d", ret); + _D("Read ret=%d.", ret); return ret; } @@ -338,18 +338,18 @@ static int tzip_release(const char *path, struct fuse_file_info *fi) struct tzip_handle *handle; if (!path) { - _E("Invalid Arguments path : %p", path); + _E("Invalid arguments path=%p.", path); return -EINVAL; } if (!fi || fi->fh == 0) { - _E("Invalid Zip Handle "); + _E("Invalid zip handle."); return -EINVAL; } handle = (struct tzip_handle *)(unsigned long)(fi->fh); if (sem_destroy(&handle->lock) == -1) - _E("sem_destroy failed"); + _E("Failed to sem_destroy."); unzCloseCurrentFile(handle->zipfile); unzClose(handle->zipfile); @@ -386,32 +386,32 @@ static void *tzip_thread(void *arg) ret = mkdir(TZIP_ROOT_PATH, 0755); if (ret < 0 && errno != EEXIST) { - _E("fail to make dir %s", TZIP_ROOT_PATH); + _E("Failed to make dir(%s).", TZIP_ROOT_PATH); goto out; } tzip_lock(); channel = fuse_mount(TZIP_ROOT_PATH, &args); if (!channel) { - _E("Trying to mount after cleaning up previous instance %p ", TZIP_ROOT_PATH); + _E("Trying to mount after cleaning up previous instance '%p'.", TZIP_ROOT_PATH); fuse_unmount(TZIP_ROOT_PATH, NULL); channel = fuse_mount(TZIP_ROOT_PATH, NULL); if (!channel) { - _E("Failed at mount_point %p ", TZIP_ROOT_PATH); + _E("Failed to fuse mount(%p).", TZIP_ROOT_PATH); goto out_unlock; } } fuse_handle = fuse_new(channel, &args, &tzip_oper, sizeof(tzip_oper), NULL); if (!fuse_handle) { - _E("Failed at fuse_new"); + _E("Failed to fuse_new."); goto out_unlock; } /* initialize string hash table */ if (!hashmap_init()) { - _E("Failed at hashmap_init"); + _E("Failed to hashmap_init."); goto out_unlock; } @@ -440,7 +440,7 @@ static void *tzip_thread(void *arg) pthread_mutex_unlock(&thread_cond_mutex); if (fuse_loop_mt(fuse_handle)) { - _E("Failed at fuse_loop_mt"); + _E("Failed to fuse_loop_mt."); g_atomic_int_set(&stop_or_error, TZIP_ERROR_STATE); return NULL; /* already send pthread_cond_signal() */ } @@ -525,9 +525,9 @@ static void *tzip_mount_thread(void *arg) } if (ret < 0) - _E("Failed %s operation: %s, %d", TZIP_MSGTYPE_STR(msgdata->type), msgdata->mountpath, ret); + _E("Failed to %s operation. path=%s: %d", TZIP_MSGTYPE_STR(msgdata->type), msgdata->mountpath, ret); else - _D("Successful %s operation: %s", TZIP_MSGTYPE_STR(msgdata->type), msgdata->mountpath); + _D("Successful %s operation. path=%s.", TZIP_MSGTYPE_STR(msgdata->type), msgdata->mountpath); if (msgdata->invocation) { /* g_object_unref(msgdata->invocation) is called within this function */ @@ -555,22 +555,22 @@ static void tzip_server_init(void) /* for tzip_mount_thread */ async_queue = g_async_queue_new(); if (!async_queue) { - _E("async_queue creation fail"); + _E("Failed to create async_queue."); goto error; } if (pthread_attr_init(&attr) != 0) { - _E("pthread_attr_init Failed"); + _E("Failed to pthread_attr_init."); goto error; } if (pthread_create(&thread, &attr, &tzip_thread, NULL)) { - _E("pthread_create Failed"); + _E("Failed to pthread_create."); goto error; } if (pthread_create(&mount_thread, &attr, &tzip_mount_thread, NULL)) { - _E("pthread_create Failed"); + _E("Failed to pthread_create."); goto error; } @@ -592,7 +592,7 @@ static void tzip_server_exit(void) tzip_unlock(); if (pthread_join(thread, NULL) != 0) - _E("pthread_join Failed"); + _E("Failed to pthread_join."); } static int tzip_check_mount_point(const char *mount_point) @@ -606,7 +606,7 @@ static int tzip_check_mount_point(const char *mount_point) if (ret == ENOENT) return 0; - _E("Failed to remove previous symlink file(errno:%d)", ret); + _E("Failed to remove previous symlink file: %d", ret); return ret; } @@ -619,13 +619,13 @@ static int tzip_mount_zipfs(const char *src_file, const char *mount_point, const tzip_lock(); ret = add_mount_entry(src_file, mount_point); if (ret) { - _E("Failed to add_mount_entry %s", mount_point); + _E("Failed to add_mount_entry '%s'.", mount_point); goto out; } ret = tzip_check_mount_point(mount_point); if (ret < 0) { - _E("Failed to mount via tzip (ret:%d)", ret); + _E("Failed to mount via tzip: %d", ret); remove_mount_entry(mount_point); goto out; } @@ -634,7 +634,7 @@ static int tzip_mount_zipfs(const char *src_file, const char *mount_point, const mp_len = strlen(mount_point); tzip_path = (char *)malloc(path_len + mp_len + 1); if (!tzip_path) { - _E("Malloc failed"); + _E("Failed to malloc."); remove_mount_entry(mount_point); ret = -ENOMEM; goto out; @@ -642,35 +642,35 @@ static int tzip_mount_zipfs(const char *src_file, const char *mount_point, const strncpy(tzip_path, TZIP_ROOT_PATH, path_len); strncat(tzip_path, mount_point, mp_len + 1); - _D("creating sym link : %s and %s", tzip_path, mount_point); + _D("Creating sym link: '%s' and '%s'.", tzip_path, mount_point); ret = symlink(tzip_path, mount_point); if (ret) { ret = -errno; - _E("symlink failed"); + _E("Failed to symlink."); remove_mount_entry(mount_point); goto out; } ret = tzip_store_mount_info(src_file, mount_point); if (ret != 0) - _E("Failed to store_mount_info %s", mount_point); + _E("Failed to store_mount_info '%s'.", mount_point); ret = lsetxattr(mount_point, "security.SMACK64", smack, strlen(smack), 0); if (ret < 0) { ret = -errno; - _E("setting smack label using lsetxattr() failed"); + _E("Failed to set smack label using lsetxattr()."); remove_mount_entry(mount_point); ret = unlink(mount_point); if (ret) { ret = -errno; - _E("unlink failed : %s", mount_point); + _E("Failed to unlink '%s'.", mount_point); } } out: tzip_unlock(); free(tzip_path); - _D("Exit : %d", ret); + _D("Exit: %d", ret); return ret; } @@ -683,7 +683,7 @@ static int tzip_unmount_zipfs(const char *mount_point) tzip_lock(); ret = remove_mount_entry(mount_point); if (ret) { - _E("Failed to remove_mount_entry %s", mount_point); + _E("Failed to remove_mount_entry '%s'.", mount_point); goto out_unlock; } @@ -691,27 +691,27 @@ static int tzip_unmount_zipfs(const char *mount_point) mp_len = strlen(mount_point); tzip_path = (char *)malloc(path_len + mp_len + 1); if (!tzip_path) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out_unlock; } strncpy(tzip_path, TZIP_ROOT_PATH, path_len); strncat(tzip_path, mount_point, mp_len + 1); - _D("deleting sym link : %s and %s", tzip_path, mount_point); + _D("Deleting sym link: '%s' and '%s'.", tzip_path, mount_point); ret = unlink(mount_point); if (ret) { ret = -errno; - _E("unlink failed"); + _E("Failed to unlink."); } if (tzip_clear_mount_info()) - _E("Failed to clear_mount_info %s", mount_point); + _E("Failed to clear_mount_info '%s'.", mount_point); out_unlock: tzip_unlock(); free(tzip_path); - _D("Exit : %d", ret); + _D("Exit: %d", ret); return ret; } @@ -729,13 +729,13 @@ static int tzip_is_mounted(const char *mount_point) tzip_lock(); if (!get_hashmap()) { - _E("tzip init is not done yet"); + _E("Tzip init is not done yet."); ret = -EOWNERDEAD; goto out_unlock; } if (!get_mount_entry(mount_point)) { - _E("mount_path : %s does not exists ", mount_point); + _E("mount_path(%s) does not exists.", mount_point); ret = 0; goto out_unlock; } @@ -745,7 +745,7 @@ static int tzip_is_mounted(const char *mount_point) mp_len = strlen(mount_point); tzip_path = (char *)malloc(path_len + mp_len + 1); if (!tzip_path) { - _E("Malloc failed"); + _E("Failed to malloc."); return -ENOMEM; } strncpy(tzip_path, TZIP_ROOT_PATH, path_len); @@ -777,7 +777,7 @@ static GVariant *dbus_request_mount_tzip_internal(GDBusConnection *conn, const g tzip_server_init(); if (g_atomic_int_get(&stop_or_error) != TZIP_RUNNING_STATE) { - _E("tzip is not running state"); + _E("Tzip is not running state."); ret = -EOWNERDEAD; goto out; } @@ -785,20 +785,20 @@ static GVariant *dbus_request_mount_tzip_internal(GDBusConnection *conn, const g g_variant_get(param, "(&s&s&s)", &mountpath, &zippath, &smack); if (!mountpath || !zippath || !smack) { - _E("g_variant_get failed"); + _E("Failed to g_variant_get."); ret = -ENOMEM; goto out; } if (!*mountpath || !*zippath || !*smack) { - _E("invalid input"); + _E("Invalid input."); ret = -EINVAL; goto out; } pid = dbus_connection_get_sender_pid(conn, sender); if (!is_app_privileged(pid, mountpath)) { - _E("PID (%d) is not privileged to use tzip", pid); + _E("PID(%d) is not privileged to use tzip.", pid); ret = -EPERM; goto out; } @@ -811,7 +811,7 @@ static GVariant *dbus_request_mount_tzip_internal(GDBusConnection *conn, const g msgdata = calloc(1, sizeof(struct tzip_msg_data)); if (!msgdata) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -821,7 +821,7 @@ static GVariant *dbus_request_mount_tzip_internal(GDBusConnection *conn, const g msgdata->zippath = strdup(zippath); msgdata->mountpath = strdup(mountpath); if (!msgdata->smack || !msgdata->zippath || !msgdata->mountpath) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -856,7 +856,7 @@ static GVariant *dbus_request_unmount_tzip_internal(GDBusConnection *conn, const tzip_server_init(); if (g_atomic_int_get(&stop_or_error) != TZIP_RUNNING_STATE) { - _E("tzip is not running state"); + _E("Tzip is not running state."); ret = -EOWNERDEAD; goto out; } @@ -864,20 +864,20 @@ static GVariant *dbus_request_unmount_tzip_internal(GDBusConnection *conn, const g_variant_get(param, "(&s)", &mountpath); if (!mountpath) { - _E("g_variant_get failed"); + _E("Failed to g_variant_get."); ret = -ENOMEM; goto out; } if (!*mountpath) { - _E("invalid input"); + _E("Invalid input."); ret = -EINVAL; goto out; } pid = dbus_connection_get_sender_pid(conn, sender); if (!is_app_privileged(pid, mountpath)) { - _E("PID (%d) is not privileged to use tzip", pid); + _E("PID(%d) is not privileged to use tzip.", pid); ret = -EPERM; goto out; } @@ -890,7 +890,7 @@ static GVariant *dbus_request_unmount_tzip_internal(GDBusConnection *conn, const msgdata = calloc(1, sizeof(struct tzip_msg_data)); if (!msgdata) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -898,7 +898,7 @@ static GVariant *dbus_request_unmount_tzip_internal(GDBusConnection *conn, const msgdata->type = 'u'; msgdata->mountpath = strdup(mountpath); if (!msgdata->mountpath) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -960,7 +960,7 @@ static GVariant *dbus_request_ismounted_tzip(GDBusConnection *conn, tzip_server_init(); if (g_atomic_int_get(&stop_or_error) != TZIP_RUNNING_STATE) { - _E("tzip is not running state"); + _E("Tzip is not running state."); ret = -EOWNERDEAD; goto out; } @@ -968,20 +968,20 @@ static GVariant *dbus_request_ismounted_tzip(GDBusConnection *conn, g_variant_get(param, "(&s)", &mountpath); if (!mountpath) { - _E("g_variant_get failed"); + _E("Failed to g_variant_get."); ret = -ENOMEM; goto out; } if (!*mountpath) { - _E("invalid input"); + _E("Invalid input."); ret = -EINVAL; goto out; } msgdata = calloc(1, sizeof(struct tzip_msg_data)); if (!msgdata) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -990,7 +990,7 @@ static GVariant *dbus_request_ismounted_tzip(GDBusConnection *conn, msgdata->mountpath = strdup(mountpath); msgdata->invocation = invocation; if (!msgdata->mountpath) { - _E("Malloc failed"); + _E("Failed to malloc."); ret = -ENOMEM; goto out; } @@ -1031,7 +1031,7 @@ static int booting_done(void *data) static int tzip_poweroff(void *data) { - _I("TZIP poweroff"); + _I("TZIP poweroff."); tzip_server_exit(); return 0; } @@ -1049,11 +1049,11 @@ static void tzip_init(void *data) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_TZIP, &dbus_interface); if (ret < 0) - _E("Failed to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); ret = mkdir(FREEZER_TZIP_PATH, 0755); if (ret < 0 && errno != EEXIST) - _E("Failed to create freezer tzip"); + _E("Failed to create freezer tzip."); } static void tzip_exit(void *data) diff --git a/src/usb-host-ffs-test-daemon/descs_gen.c b/src/usb-host-ffs-test-daemon/descs_gen.c old mode 100644 new mode 100755 index 4abfca1..363fb01 --- a/src/usb-host-ffs-test-daemon/descs_gen.c +++ b/src/usb-host-ffs-test-daemon/descs_gen.c @@ -165,26 +165,26 @@ int main() dfp = fopen("descs", "w"); if (!dfp) { - perror("Could not open descritptors file"); + perror("Could not open descritptors file."); return -1; } sfp = fopen("strs", "w"); if (!sfp) { - perror("Could not open strings file"); + perror("Could not open strings file."); fclose(dfp); return -1; } ret = fwrite(&descriptors, sizeof(descriptors), 1, dfp); if (ret < 0) { - perror("Could not write descriptors"); + perror("Could not write descriptors."); goto out; } ret = fwrite(&strings, sizeof(strings), 1, sfp); if (ret < 0) { - perror("Could not write strings"); + perror("Could not write strings."); goto out; } diff --git a/src/usb-host-ffs-test-daemon/usb-host-ffs-test-daemon.c b/src/usb-host-ffs-test-daemon/usb-host-ffs-test-daemon.c old mode 100644 new mode 100755 index 48051be..e60e579 --- a/src/usb-host-ffs-test-daemon/usb-host-ffs-test-daemon.c +++ b/src/usb-host-ffs-test-daemon/usb-host-ffs-test-daemon.c @@ -81,7 +81,7 @@ void *loop_ep0(void *data) while (1) { ret = read(ep[0], &event, sizeof(event)); if (!ret) { - report_error("unable to read event from ep0"); + report_error("Unable to read event from ep0."); return NULL; } @@ -90,10 +90,10 @@ void *loop_ep0(void *data) /* stall for all setuo requests */ if (event.u.setup.bRequestType & USB_DIR_IN) { if (write(ep[0], NULL, 0) < 0) - report_error("write error %d", errno); + report_error("write error: %d", errno); } else { if (read(ep[0], NULL, 0) < 0) - report_error("read error %d", errno); + report_error("read error: %d", errno); } fprintf(stderr, "Functionfs setup request\n"); @@ -104,7 +104,7 @@ void *loop_ep0(void *data) pthread_mutex_lock(&ready_lock); fprintf(stderr, "Functionfs enable request\n"); if (connected) { - report_error("Already enabled!\n"); + report_error("Already enabled.\n"); pthread_cond_broadcast(&disable_cond); } @@ -118,7 +118,7 @@ void *loop_ep0(void *data) fprintf(stderr, "Functionfs disable request\n"); exit(0); if (!connected) { - report_error("Already disabled!\n"); + report_error("Already disabled.\n"); pthread_cond_broadcast(&enable_cond); } @@ -156,7 +156,7 @@ void *loop_thread(void *data) while (1) { ret = read(d->ep_out, d->buf, BUFSIZE); if (ret < 0) { - report_error("read error on fd %d: %m\n", d->ep_out); + report_error("Read error on fd %d: %m\n", d->ep_out); usleep(200000); if (errno != ECONNRESET && errno != ESHUTDOWN && errno != EINTR) exit(ret); @@ -169,7 +169,7 @@ void *loop_thread(void *data) ret = write(d->ep_in, d->buf, ret); if (ret < 0) { - report_error("write error on fd %d: %m\n", d->ep_in); + report_error("Write error on fd %d: %m\n", d->ep_in); if (errno != ECONNRESET && errno != ESHUTDOWN && errno != EINTR) exit(ret); diff --git a/src/usb-host-test/usb-host-test.c b/src/usb-host-test/usb-host-test.c old mode 100644 new mode 100755 index 7ea07c8..c961639 --- a/src/usb-host-test/usb-host-test.c +++ b/src/usb-host-test/usb-host-test.c @@ -65,27 +65,27 @@ static int load_module(const char *name, const char *options) ret = kmod_module_new_from_lookup(ctx, name, &list); if (ret < 0) { - _E("Module %s lookup error", name); + _E("Module(%s) lookup error.", name); goto out; } kmod_list_foreach(l, list) { mod = kmod_module_get_module(l); if (!mod) { - _E("Module %s load error", name); + _E("Module(%s) load error.", name); ret = -1; goto out; } ret = kmod_module_get_initstate(mod); if (ret >= 0) { - _I("module %s already loaded", name); + _I("module(%s) already loaded.", name); goto out; /* already loaded */ } ret = kmod_module_insert_module(mod, 0, options); if (ret < 0) { - _E("Module %s insert error", name); + _E("Module(%s) insert error.", name); goto out; } @@ -93,12 +93,12 @@ static int load_module(const char *name, const char *options) } if (n == 0) { - _E("Module %s not found", name); + _E("Module(%s) is not found.", name); ret = -1; goto out; } - _I("Module %s loaded\n", name); + _I("Module(%s) is loaded.\n", name); ret = 0; out: @@ -122,14 +122,14 @@ static int unload_module(const char *name) ret = kmod_module_new_from_lookup(ctx, name, &list); if (ret < 0) { - _E("Module %s lookup error", name); + _E("Module(%s) lookup error.", name); goto out; } kmod_list_foreach(l, list) { mod = kmod_module_get_module(l); if (!mod) { - _E("Module %s unload error", name); + _E("Module(%s) unload error.", name); ret = -1; goto out; } @@ -140,7 +140,7 @@ static int unload_module(const char *name) ret = kmod_module_remove_module(mod, 0); if (ret < 0) { - _E("Module %s remove error", name); + _E("Module(%s) remove error.", name); goto out; } diff --git a/src/usb/usb-dbus.c b/src/usb/usb-dbus.c old mode 100644 new mode 100755 index 2b4f38f..db6e0dd --- a/src/usb/usb-dbus.c +++ b/src/usb/usb-dbus.c @@ -40,7 +40,7 @@ static int get_usb_current_mode(void) ret = vconf_get_int(VCONFKEY_USB_CUR_MODE, &val); if (ret != 0) { - _E("Failed to get current mode (%d)", ret); + _E("Failed to get current mode: %d.", ret); return ret; } @@ -54,7 +54,7 @@ static int get_usb_state(void) ret = vconf_get_int(VCONFKEY_SYSMAN_USB_STATUS, &val); if (ret != 0) { - _E("Failed to get usb_state (%d)", ret); + _E("Failed to get usb_state: %d", ret); return ret; } @@ -74,13 +74,13 @@ void broadcast_usb_config_enabled(int state) { int ret; - _I("USB config enabled (%d)", state); + _I("USB config(%d) enabled.", state); ret = dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_USB, DEVICED_INTERFACE_USB, SIGNAL_CONFIG_ENABLED, g_variant_new("(i)", state)); if (ret < 0) - _E("Failed to send dbus signal"); + _E("Failed to send dbus signal."); } void broadcast_usb_state_changed(void) @@ -94,13 +94,13 @@ void broadcast_usb_state_changed(void) return; prev_state = state; - _I("USB state changed (%u)", state); + _I("USB state(%u) changed.", state); ret = dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_USB, DEVICED_INTERFACE_USB, SIGNAL_STATE_CHANGED, g_variant_new("(u)", state)); if (ret < 0) - _E("Failed to send dbus signal"); + _E("Failed to send dbus signal."); } void broadcast_usb_mode_changed(void) @@ -114,13 +114,13 @@ void broadcast_usb_mode_changed(void) return; prev_mode = mode; - _I("USB mode changed (%u)", mode); + _I("USB mode(%u) changed.", mode); ret = dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_USB, DEVICED_INTERFACE_USB, SIGNAL_MODE_CHANGED, g_variant_new("(u)", mode)); if (ret < 0) - _E("Failed to send dbus signal"); + _E("Failed to send dbus signal."); } static void change_usb_client_mode(GDBusConnection *conn, @@ -155,16 +155,16 @@ static void change_usb_client_mode(GDBusConnection *conn, case 11: /* SET_USB_DIAG_RMNET */ case 12: /* SET_USB_ACM_SDB_DM */ default: - _E("(%d) is unknown usb mode", req); + _E("(%d) is unknown usb mode.", req); goto out; } if (vconf_set_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, debug) != 0) - _E("Failed to set usb debug toggle (%d)", debug); + _E("Failed to set usb debug toggle(%d).", debug); ret = usb_change_mode(mode); if (ret < 0) - _E("Failed to change usb mode (%d)", ret); + _E("Failed to change usb mode: %d", ret); out: return ; @@ -213,13 +213,13 @@ int usb_dbus_init(void) ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_USB, &dbus_interface); if (ret < 0) - _E("fail to init dbus method(%d)", ret); + _E("Failed to init dbus method: %d", ret); ret = subscribe_dbus_signal(NULL, DEVICED_PATH_USB, DEVICED_INTERFACE_USB, "ChangeUsbMode", change_usb_client_mode, NULL, NULL); if (ret <= 0) { - _E("fail to subscribe dbus signal(%d)", ret); + _E("Failed to subscribe dbus signal: %d", ret); return ret; } diff --git a/src/usb/usb-debug.c b/src/usb/usb-debug.c old mode 100644 new mode 100755 index 6310ef5..05d7582 --- a/src/usb/usb-debug.c +++ b/src/usb/usb-debug.c @@ -57,7 +57,7 @@ static void usb_debug_changed(keynode_t *key, void *data) debug_state = mode; - _I("USB debug %s", mode ? "ON" : "OFF"); + _I("USB debug %s.", mode ? "ON" : "OFF"); device_notify(DEVICE_NOTIFIER_USB_DEBUG_MODE, (void *)&mode); } @@ -74,18 +74,18 @@ static int usb_debug_mode_changed(void *data) if (mode == 0) mode = usb_state_get_selected_mode(); - _I("Previous mode (%d)", mode); + _I("Previous mode(%d).", mode); if (on) mode |= USB_FUNCTION_SDB; else mode &= ~USB_FUNCTION_SDB; - _I("New mode (%d)", mode); + _I("New mode(%d).", mode); ret = usb_change_mode(mode); if (ret < 0) - _E("Failed to change usb mode to (%d)", mode); + _E("Failed to change usb mode to (%d).", mode); return ret; } @@ -96,7 +96,7 @@ void add_usb_debug_handler(void) if (vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, usb_debug_changed, NULL) != 0) - _E("Failed to add usb debug handler"); + _E("Failed to add usb debug handler."); register_notifier(DEVICE_NOTIFIER_USB_DEBUG_MODE, usb_debug_mode_changed); diff --git a/src/usb/usb-state.c b/src/usb/usb-state.c old mode 100644 new mode 100755 index 19f6d8c..c7bcbeb --- a/src/usb/usb-state.c +++ b/src/usb/usb-state.c @@ -59,7 +59,7 @@ static void usb_state_send_system_event(int status) return; } - _I("system_event (%s)", str); + _I("system_event(%s)", str); b = bundle_create(); bundle_add_str(b, EVT_KEY_USB_STATUS, str); @@ -84,7 +84,7 @@ void usb_state_retrieve_selected_mode(void) ret = vconf_get_int(VCONFKEY_USB_SEL_MODE, &mode); if (ret != 0) { - _E("Failed to retrieve selected mode"); + _E("Failed to retrieve selected mode."); return; } @@ -99,7 +99,7 @@ void usb_state_retrieve_selected_mode(void) usb_selected_mode = (unsigned int)mode; if (snprintf(buf, PATH_MAX, "%s", MTP_RESPONDER_PATH) < 0) { - _E("Fail to copy MTP_RESPONDER_PATH"); + _E("Fail to copy MTP_RESPONDER_PATH."); return; } @@ -197,17 +197,17 @@ static void media_noti_cb(GVariant *var, void *user_data, GError *err) if (!var) { if (err) - _E("%s", err->message); + _E("Error: %s", err->message); return; } if (!dh_get_param_from_var(var, "(i)", &id)) { - _E("no message [%s]", g_variant_get_type_string(var)); + _E("Failed to get variant(%s): no message", g_variant_get_type_string(var)); goto out; } noti_id = id; - _D("media noti : %d", noti_id); + _D("Media noti(%d)", noti_id); out: g_variant_unref(var); @@ -229,7 +229,7 @@ void usb_state_update_state(extcon_usb_state_e state, unsigned int mode) if (noti_id >= 0) { int ret = remove_notification("MediaDeviceNotiOff", noti_id); if (ret < 0) - _E("Failed to remove event_noti : %d", ret); + _E("Failed to remove event_noti: %d", ret); else noti_id = -1; } @@ -237,7 +237,7 @@ void usb_state_update_state(extcon_usb_state_e state, unsigned int mode) if (noti_id < 0) { ret = add_async_notification("MediaDeviceNotiOn", media_noti_cb, NULL, NULL); if (ret < 0) - _E("Failed to show notification for usb connection"); + _E("Failed to show notification for usb connection."); } } diff --git a/src/usb/usb-tethering.c b/src/usb/usb-tethering.c old mode 100644 new mode 100755 index 911a3b7..6e939e0 --- a/src/usb/usb-tethering.c +++ b/src/usb/usb-tethering.c @@ -51,7 +51,7 @@ static void usb_tethering_changed(keynode_t *key, void *data) tethering_state = curr; - _I("USB tethering %s", curr ? "ON" : "OFF"); + _I("USB tethering %s.", curr ? "ON" : "OFF"); device_notify(DEVICE_NOTIFIER_USB_TETHERING_MODE, (void *)curr); } @@ -76,7 +76,7 @@ static int usb_tethering_mode_changed(void *data) ret = usb_change_mode(mode); if (ret < 0) - _E("Failed to change usb mode to (%d)", mode); + _E("Failed to change usb mode to (%d).", mode); return ret; } @@ -85,7 +85,7 @@ void add_usb_tethering_handler(void) { if (vconf_notify_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE, usb_tethering_changed, NULL) != 0) - _E("Failed to add usb tethering handler"); + _E("Failed to add usb tethering handler."); register_notifier(DEVICE_NOTIFIER_USB_TETHERING_MODE, usb_tethering_mode_changed); diff --git a/src/usb/usb.c b/src/usb/usb.c old mode 100644 new mode 100755 index a171007..9eb86c9 --- a/src/usb/usb.c +++ b/src/usb/usb.c @@ -46,23 +46,23 @@ static struct usb_gadget_translator *gadget_translator_probe(void) struct usb_gadget_translator *gadget; if (hw_get_info(USB_GADGET_DEVICE_ID, (const struct hw_info **)&info)) { - _E("No usb gadget translator"); + _E("No usb gadget translator."); return NULL; } if (!info->open) { - _E("Failed to open usb gadget translator; open(NULL)"); + _E("Failed to open usb gadget translator: open(NULL)"); return NULL; } if (info->open(info, NULL, &common) < 0) { - _E("Failed to open usb gadget translator"); + _E("Failed to open usb gadget translator."); return NULL; } gadget = container_of(common, struct usb_gadget_translator, common); if (!gadget->id_to_gadget || !gadget->cleanup_gadget) { - _E("Invalid usb gadget translator"); + _E("Invalid usb gadget translator."); if (gadget->common.info) gadget->common.info->close(&gadget->common); @@ -79,26 +79,26 @@ static struct usb_client *usb_client_probe(const char *id) struct hw_common *common; struct usb_client *client; - _I("Loading usb client: %s", id); + _I("Loading usb client. id=%s", id); if (hw_get_info(id, (const struct hw_info **)&info)) { - _I("No usb_client: %s", id); + _I("No usb_client. id=%s", id); return NULL; } if (!info->open) { - _E("Failed to open usb client open(NULL): %s", id); + _E("Failed to open usb client(%s): open(NULL)", id); return NULL; } if (info->open(info, NULL, &common) < 0) { - _E("Failed to open usb client: %s", id); + _E("Failed to open usb client. id=%s", id); return NULL; } client = container_of(common, struct usb_client, common); if (!client->reconfigure_gadget || !client->enable || !client->disable) { - _E("Invalid usb client: %s", id); + _E("Invalid usb client. id=%s", id); if (client->common.info->close) client->common.info->close(&client->common); @@ -106,7 +106,7 @@ static struct usb_client *usb_client_probe(const char *id) return NULL; } - _I("Success lodging usb client: %s", id); + _I("Success lodging usb client. id=%s", id); return client; } @@ -171,7 +171,7 @@ static int usb_config_init(void) gadget_id.function_mask = usb_state_get_selected_mode(); ret = gadget_translator->id_to_gadget(&gadget_id, &gadget); if (ret) { - _E("Unable to translate id into gadget (%d)", ret); + _E("Unable to translate id into gadget: %d", ret); return ret; } @@ -179,7 +179,7 @@ static int usb_config_init(void) ret = usb_client->reconfigure_gadget(usb_client, gadget); gadget_translator->cleanup_gadget(gadget); if (ret) - _E("Unable to configure gadget (%d)", ret); + _E("Unable to configure gadget: %d", ret); return ret; no_hal: @@ -239,7 +239,7 @@ static int usb_change_gadget(unsigned mode) ret = gadget_translator->id_to_gadget(&gadget_id, &gadget); if (ret) { - _E("Unable to translate id into gadget (%d)", ret); + _E("Unable to translate id into gadget: %d", ret); return ret; } @@ -247,11 +247,11 @@ static int usb_change_gadget(unsigned mode) ret = usb_client->reconfigure_gadget(usb_client, gadget); gadget_translator->cleanup_gadget(gadget); if (ret) { - _E("Unable to configure gadget (%d)", ret); + _E("Unable to configure gadget: %d", ret); goto out; } - _I("USB gadget changed (%d)", mode); + _I("USB gadget changed to %d.", mode); out: return ret; @@ -265,7 +265,7 @@ static int usb_enable(unsigned int mode) int ret; if (usb_state_get_connection() != USB_CONNECTED) { - _E("Failed to enable usb gadget (USB cable is not connected)"); + _E("Failed to enable usb gadget (USB cable is not connected)."); return -ENOTSUP; } @@ -275,7 +275,7 @@ static int usb_enable(unsigned int mode) if (!is_emulator()) { ret = usb_config_enable(); if (ret < 0) { - _E("Failed to enable usb config (%d)", ret); + _E("Failed to enable usb config: %d", ret); return ret; } } @@ -302,7 +302,7 @@ static int usb_disable(void) if (!is_emulator()) { ret = usb_config_disable(); if (ret != 0) - _E("Failed to disable usb config (%d)", ret); + _E("Failed to disable usb config: %d", ret); } if (disp_plgn.pm_unlock_internal) @@ -319,7 +319,7 @@ int usb_change_mode(unsigned mode) if (curr != USB_FUNCTION_NONE) { ret = usb_disable(); if (ret < 0) { - _E("Failed to disable current usb mode"); + _E("Failed to disable current usb mode."); return ret; } } @@ -327,7 +327,7 @@ int usb_change_mode(unsigned mode) if (!is_emulator()) { ret = usb_change_gadget(mode); if (ret < 0) { - _E("Failed to change gadget (%d)", ret); + _E("Failed to change gadget: %d", ret); mode = usb_state_get_selected_mode(); } } @@ -336,7 +336,7 @@ int usb_change_mode(unsigned mode) if (usb_state_get_connection() == USB_CONNECTED) { ret = usb_enable(mode); if (ret < 0) { - _E("Failed to enable usb mode (%d)", ret); + _E("Failed to enable usb mode: %d", ret); return ret; } } @@ -353,7 +353,7 @@ static int usb_connected(void) ret = usb_enable(mode); if (ret < 0) { - _E("Failed to enable usb gadget (gadget:%d, ret:%d)", mode, ret); + _E("Failed to enable usb gadget(%d): %d", mode, ret); return ret; } @@ -372,26 +372,26 @@ static int usb_state_changed(int status) static int old = -1; /* to update at the first time */ int ret; - _I("USB state is changed from (%d) to (%d)", old, status); + _I("USB state is changed from (%d) to (%d).", old, status); if (old == status) return 0; switch (status) { case USB_CONNECTED: - _I("USB cable is connected"); + _I("USB cable is connected."); ret = usb_connected(); break; case USB_DISCONNECTED: - _I("USB cable is disconnected"); + _I("USB cable is disconnected."); ret = usb_disconnected(); break; default: - _E("Invalid USB state(%d)", status); + _E("Invalid USB state(%d).", status); return -EINVAL; } if (ret < 0) - _E("Failed to operate usb connection(%d)", ret); + _E("Failed to operate usb connection: %d", ret); else old = status; @@ -407,25 +407,25 @@ static void usb_init(void *data) if (!is_emulator()) { ret = usb_probe(); if (ret < 0) { - _E("USB client cannot be used (%d)", ret); + _E("USB client cannot be used: %d", ret); return; } ret = usb_config_init(); if (ret < 0) - _E("Failed to initialize usb configuation"); + _E("Failed to initialize usb configuation."); } ret = usb_dbus_init(); if (ret < 0) - _E("Failed to init dbus (%d)", ret); + _E("Failed to init dbus: %d", ret); add_usb_tethering_handler(); add_usb_debug_handler(); ret = usb_state_changed(extcon_usb_ops.status); if (ret < 0) - _E("Failed to update usb status(%d)", ret); + _E("Failed to update usb status: %d", ret); } static void usb_exit(void *data) diff --git a/src/usbhost/usb-host.c b/src/usbhost/usb-host.c old mode 100644 new mode 100755 index a692c25..3d4451b --- a/src/usbhost/usb-host.c +++ b/src/usbhost/usb-host.c @@ -203,7 +203,7 @@ static int add_usbhost_list(struct udev_device *dev, const char *devpath) /* allocate new usbhost device */ usbhost = calloc(1, sizeof(struct usbhost_device)); if (!usbhost) { - _E("fail to allocate usbhost memory : %d", errno); + _E("Fail to allocate usbhost memory: %d", errno); return -errno; } @@ -225,7 +225,7 @@ static int add_usbhost_list(struct udev_device *dev, const char *devpath) /* parent has a lot of information about usb_interface */ parent = udev_device_get_parent(dev); if (!parent) { - _E("fail to get parent"); + _E("Failed to get parent."); free(usbhost); return -EPERM; } @@ -255,7 +255,7 @@ static int add_usbhost_list(struct udev_device *dev, const char *devpath) disp_plgn.pm_change_internal(INTERNAL_LOCK_USB, LCD_NORMAL); /* for debugging */ - _I("USB HOST Added"); + _I("USB HOST Added."); print_usbhost(usbhost); return 0; @@ -274,7 +274,7 @@ static int remove_usbhost_list(const char *devpath) } if (!usbhost) { - _E("fail to find the matched usbhost device"); + _E("Failed to find the matched usbhost device."); return -ENODEV; } @@ -284,8 +284,8 @@ static int remove_usbhost_list(const char *devpath) disp_plgn.pm_change_internal(INTERNAL_LOCK_USB, LCD_NORMAL); /* for debugging */ - _I("USB HOST Removed"); - _I("devpath : %s", usbhost->devpath); + _I("USB HOST Removed."); + _I("Devpath=%s", usbhost->devpath); DD_LIST_REMOVE(usbhost_list, usbhost); free(usbhost->manufacturer); @@ -304,8 +304,8 @@ static void remove_all_usbhost_list(void) DD_LIST_FOREACH_SAFE(usbhost_list, n, next, usbhost) { /* for debugging */ - _I("USB HOST Removed"); - _I("devpath : %s", usbhost->devpath); + _I("USB HOST Removed."); + _I("Devpath=%s", usbhost->devpath); DD_LIST_REMOVE(usbhost_list, usbhost); free(usbhost->manufacturer); @@ -331,19 +331,19 @@ static void uevent_usbhost_handler(struct udev_device *dev) subsystem = udev_device_get_subsystem(dev); devtype = udev_device_get_devtype(dev); if (!subsystem || !devtype) { - _E("fail to get subsystem or devtype"); + _E("Failed to get subsystem or devtype."); return; } /* devpath is an unique information among usb host devices */ devpath = udev_device_get_devpath(dev); if (!devpath) { - _E("fail to get devpath from udev_device"); + _E("Failed to get devpath from udev_device."); return; } action = udev_device_get_action(dev); - _I("subsystem : %s, devtype : %s, action : %s", subsystem, devtype, action); + _I("Subsystem=%s devtype=%s action=%s", subsystem, devtype, action); /* Policy is valid for entire device, thus we check this devtype here */ if (strncmp(subsystem, USB_SUBSYSTEM, sizeof(USB_SUBSYSTEM)) == 0 && strncmp(devtype, USB_DEVICE_DEVTYPE, sizeof(USB_DEVICE_DEVTYPE)) == 0 && @@ -351,7 +351,7 @@ static void uevent_usbhost_handler(struct udev_device *dev) DD_LIST_FOREACH_SAFE(access_list, n, next, entry) { if (is_policy_temporary(entry) && strcmp(devpath, entry->devpath) == 0) { - _I("removed temporary policy for %s", devpath); + _I("Removed temporary policy for '%s'", devpath); DD_LIST_REMOVE(access_list, entry); free(entry->creds.sec_label); free(entry); @@ -384,14 +384,14 @@ static int usbhost_init_from_udev_enumerate(void) udev = udev_new(); if (!udev) { - _E("fail to create udev library context"); + _E("Failed to create udev library context."); return -EPERM; } /* create a list of the devices in the 'usb' subsystem */ enumerate = udev_enumerate_new(udev); if (!enumerate) { - _E("fail to create an enumeration context"); + _E("Failed to create an enumeration context."); return -EPERM; } @@ -414,7 +414,7 @@ static int usbhost_init_from_udev_enumerate(void) /* devpath is an unique information among usb host devices */ devpath = udev_device_get_devpath(dev); if (!devpath) { - _E("fail to get devpath from %s device", syspath); + _E("Failed to get devpath from '%s' device.", syspath); continue; } @@ -460,7 +460,7 @@ static GVariant *get_device_list(GDBusConnection *conn, builder = g_variant_builder_new(G_VARIANT_TYPE("a(siiiiisss)")); if (!builder) { - _E("failed to new builder"); + _E("Failed to new builder."); goto out; } @@ -676,7 +676,7 @@ static int read_policy(void) entry->value = get_policy_value_from_str(value_str); if (entry->value < 0) { - _E("Invalid policy value: %s", value_str); + _E("Invalid policy value=%s", value_str); ret = -EINVAL; free(entry->creds.sec_label); free(entry); @@ -690,7 +690,7 @@ static int read_policy(void) count++; } - _I("Found %d policy entries", count); + _I("Found %d policy entries.", count); ret = 0; out: @@ -720,20 +720,20 @@ static int get_device_desc(const char *filepath, struct usb_device_descriptor *d if (!S_ISCHR(st.st_mode) || major(st.st_rdev) != USB_DEVICE_MAJOR) { ret = -EINVAL; - _E("Not an USB device"); + _E("Not an USB device."); goto out; } udev = udev_new(); if (!udev) { - _E("Could not create udev contect"); + _E("Could not create udev contect."); ret = -ENOMEM; goto out; } udev_device = udev_device_new_from_devnum(udev, 'c', st.st_rdev); if (!udev_device) { - _E("udev could not find device"); + _E("Udev could not find device."); ret = -ENOENT; goto out; } @@ -744,22 +744,22 @@ static int get_device_desc(const char *filepath, struct usb_device_descriptor *d ret = asprintf(&path, "/sys/dev/char/%d:%d/descriptors", major(st.st_rdev), minor(st.st_rdev)); if (ret < 0) { ret = -ENOMEM; - _E("asprintf failed"); + _E("Failed to asprintf."); goto out; } - _I("Opening descriptor at %s", path); + _I("Opening descriptor at '%s'", path); fd = open(path, O_RDONLY); if (fd < 0) { ret = -errno; - _E("Failed to open %s: %m", path); + _E("Failed to open '%s': %m", path); goto out; } ret = read(fd, desc, sizeof(*desc)); if (ret < 0) { ret = -errno; - _E("Failed to read %s: %m", path); + _E("Failed to read '%s': %m", path); goto out; } @@ -783,7 +783,7 @@ static void store_idler_cb(void *data) static void destroy_open_request(struct usbhost_open_request *req) { - _D("Destroing request structure"); + _D("Destroing request structure."); free(req->path); req->path = NULL; } @@ -806,7 +806,7 @@ static void finish_opening(struct usbhost_open_request *req, int policy) if (fd < 0) { ret = -errno; err = "org.freedesktop.DBus.Error.Failed";//"org.freedesktop.DBus.Error.Failed"; - _E("Unable to open file (%s): %m", req->path); + _E("Unable to open file(%s): %m", req->path); } else ret = 0; break; @@ -831,7 +831,7 @@ static void finish_opening(struct usbhost_open_request *req, int policy) */ fd_list = g_unix_fd_list_new(); if (g_unix_fd_list_append(fd_list, fd, &error) < 0) { - _E("appending fd in unix fd list failied with error: %s\n", error->message); + _E("Failed to append fd in unix fd list: %s\n", error->message); g_error_free(error); goto out; } @@ -844,7 +844,7 @@ out: destroy_open_request(req); if (fd >= 0) close(fd); - _I("Popup destroyed"); + _I("Popup destroyed."); } static int spawn_popup(struct usbhost_open_request *req) @@ -862,12 +862,12 @@ static int spawn_popup(struct usbhost_open_request *req) current_request = NULL; } - _I("Launching popup"); + _I("Launching popup."); snprintf(pid_str, sizeof(pid_str), "%d", req->cred.pid); ret = launch_system_app(APP_DEFAULT, 4, APP_KEY_TYPE, "usbhost", "_APP_PID_", pid_str); if (ret < 0) { - _E("could not launch system popup"); + _E("Could not launch system popup."); return ret; } @@ -910,14 +910,14 @@ static void popup_result_signal_handler(GDBusConnection *conn, entry = calloc(sizeof(*entry), 1); if (!entry) { - _E("No memory"); + _E("No memory."); goto out; } entry->creds.uid = req->cred.uid; entry->creds.sec_label = calloc(strlen(req->cred.sec_label)+1, 1); if (!entry->creds.sec_label) { - _E("No memory"); + _E("No memory."); free(entry); goto out; } @@ -963,7 +963,7 @@ static void popup_result_signal_handler(GDBusConnection *conn, ret = add_idle_request(store_idler_cb, NULL); if (ret < 0) { - _E("fail to add store idle request : %d", ret); + _E("Failed to add store idle request: %d", ret); store_idler_cb(NULL); } @@ -981,10 +981,10 @@ static int get_policy_value(struct usbhost_open_request *req) memset(&req->desc, 0, sizeof(req->desc)); - _I("Requested access from user %d to %s", req->cred.uid, req->path); + _I("Requested access from user %d to '%s'.", req->cred.uid, req->path); ret = get_device_desc(req->path, &req->desc, req->devpath); if (ret < 0) { - _E("Could not get device descriptor"); + _E("Could not get device descriptor."); return ret; } @@ -1003,7 +1003,7 @@ static int get_policy_value(struct usbhost_open_request *req) || (entry->device.bcdDevice && entry->device.bcdDevice != le16toh(req->desc.bcdDevice))) continue; - _I("Found matching policy entry: %s", policy_value_str(entry->value)); + _I("Found matching policy entry(%s)", policy_value_str(entry->value)); return entry->value; } @@ -1034,7 +1034,7 @@ static GVariant *open_device(GDBusConnection *conn, req = calloc(sizeof(*req), 1); if (!req) { - _E("no memory"); + _E("No memory."); g_dbus_method_invocation_return_dbus_error(invocation, "org.freedesktop.DBus.Error.Failed", "no memory"); return NULL; } @@ -1043,7 +1043,7 @@ static GVariant *open_device(GDBusConnection *conn, ret = dbus_handle_get_sender_credentials(NULL, sender, &req->cred); if (ret < 0) { - _E("Unable to get credentials for caller : %d", ret); + _E("Unable to get credentials for caller: %d", ret); goto out; } @@ -1052,7 +1052,7 @@ static GVariant *open_device(GDBusConnection *conn, req->path = path; policy = get_policy_value(req); if (policy < 0) { - _E("Could not get policy value (%d)", policy); + _E("Could not get policy value(%d).", policy); ret = -1; goto out; } @@ -1072,7 +1072,7 @@ static GVariant *open_device(GDBusConnection *conn, } /* The policy exists for the app */ - _D("Policy exists"); + _D("Policy exists."); finish_opening(req, policy); free(req->cred.sec_label); free(req); @@ -1125,19 +1125,19 @@ static void usbhost_init(void *data) /* register usbhost uevent */ ret = register_kernel_uevent_control(&uh); if (ret < 0) - _E("fail to register usb uevent : %d", ret); + _E("Failed to register usb uevent: %d", ret); /* register usbhost interface and method */ ret = dbus_handle_add_dbus_object(NULL, DEVICED_PATH_USBHOST, &dbus_interface); if (ret < 0) - _E("fail to register dbus interface and method! %d", ret); + _E("Failed to register dbus interface and method: %d", ret); /* register notifier */ register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); ret = asprintf(&POLICY_FILEPATH, "%s/%s", ROOTPATH, POLICY_FILENAME); if (ret < 0) { - _E("no memory for policy path"); + _E("No memory for policy path."); return; } @@ -1145,7 +1145,7 @@ static void usbhost_init(void *data) POPUP_INTERFACE_SYSTEM, USB_HOST_RESULT_SIGNAL, popup_result_signal_handler, NULL, NULL); if (ret < 0) { - _E("could not register popup signal handler"); + _E("Could not register popup signal handler."); return; } @@ -1159,7 +1159,7 @@ static void usbhost_exit(void *data) /* unreigset usbhost uevent */ ret = unregister_kernel_uevent_control(&uh); if (ret < 0) - _E("fail to unregister usb uevent : %d", ret); + _E("Failed to unregister usb uevent: %d", ret); /* remove all usbhost list */ remove_all_usbhost_list(); @@ -1181,11 +1181,11 @@ DEVICE_OPS_REGISTER(&usbhost_device_ops) static int extcon_usbhost_state_changed(int status) { if (status == USBHOST_DISCONNECTED) { - _I("USB host connector disconnected"); + _I("USB host connector disconnected."); if (disp_plgn.pm_unlock_internal) disp_plgn.pm_unlock_internal(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE); } else { - _I("USB host connector connected"); + _I("USB host connector connected."); if (disp_plgn.pm_lock_internal) disp_plgn.pm_lock_internal(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE, 0); } -- 2.7.4 From 3a43964853aaf1d58778195004e19d435c1fc99b Mon Sep 17 00:00:00 2001 From: Yunmi Ha Date: Tue, 26 Feb 2019 18:40:07 +0900 Subject: [PATCH 13/16] Restore permission of source files. Change-Id: I02a1c1324215a0e0d887c3c8434b22607e05e38f Signed-off-by: Yunmi Ha --- src/apps/apps.c | 0 src/auto-test/battery.c | 0 src/battery/battery-time.c | 0 src/battery/config.c | 0 src/battery/lowbat-handler.c | 0 src/battery/power-supply.c | 0 src/control/control.c | 0 src/core/common.c | 0 src/core/config-parser.c | 0 src/core/device-idler.c | 0 src/core/device-notifier.c | 0 src/core/devices.c | 0 src/core/event-handler.c | 0 src/core/execute.c | 0 src/core/launch.c | 0 src/core/main.c | 0 src/core/sig-handler.c | 0 src/core/udev.c | 0 src/cpu/pmqos-plugin.c | 0 src/cpu/pmqos.c | 0 src/devicectl/devicectl.c | 0 src/devicectl/usb.c | 0 src/dump/dump.c | 0 src/extcon/cradle.c | 0 src/extcon/earjack.c | 0 src/extcon/extcon.c | 0 src/extcon/hdmi.c | 0 src/ir/ir.c | 0 src/led/noti.c | 0 src/led/rgb.c | 0 src/led/torch.c | 0 src/led/touch-key.c | 0 src/libdeviced/deviced-noti.c | 0 src/libdeviced/deviced-util.c | 0 src/libdeviced/display.c | 0 src/libdeviced/haptic.c | 0 src/libdeviced/led.c | 0 src/libdeviced/usbhost.c | 0 src/power/boot.c | 0 src/power/low-power.c | 0 src/power/power-handler.c | 0 src/proc/cpu-info.c | 0 src/shared/deviced-systemd.c | 0 src/thermal/thermal.c | 0 src/time/time-handler.c | 0 src/touchscreen/sensitivity.c | 0 src/touchscreen/touchscreen.c | 0 src/tzip/tzip-utility.c | 0 src/tzip/tzip.c | 0 src/usb-host-ffs-test-daemon/descs_gen.c | 0 src/usb-host-ffs-test-daemon/usb-host-ffs-test-daemon.c | 0 src/usb-host-test/usb-host-test.c | 0 src/usb/usb-dbus.c | 0 src/usb/usb-debug.c | 0 src/usb/usb-state.c | 0 src/usb/usb-tethering.c | 0 src/usb/usb.c | 0 src/usbhost/usb-host.c | 0 58 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/apps/apps.c mode change 100755 => 100644 src/auto-test/battery.c mode change 100755 => 100644 src/battery/battery-time.c mode change 100755 => 100644 src/battery/config.c mode change 100755 => 100644 src/battery/lowbat-handler.c mode change 100755 => 100644 src/battery/power-supply.c mode change 100755 => 100644 src/control/control.c mode change 100755 => 100644 src/core/common.c mode change 100755 => 100644 src/core/config-parser.c mode change 100755 => 100644 src/core/device-idler.c mode change 100755 => 100644 src/core/device-notifier.c mode change 100755 => 100644 src/core/devices.c mode change 100755 => 100644 src/core/event-handler.c mode change 100755 => 100644 src/core/execute.c mode change 100755 => 100644 src/core/launch.c mode change 100755 => 100644 src/core/main.c mode change 100755 => 100644 src/core/sig-handler.c mode change 100755 => 100644 src/core/udev.c mode change 100755 => 100644 src/cpu/pmqos-plugin.c mode change 100755 => 100644 src/cpu/pmqos.c mode change 100755 => 100644 src/devicectl/devicectl.c mode change 100755 => 100644 src/devicectl/usb.c mode change 100755 => 100644 src/dump/dump.c mode change 100755 => 100644 src/extcon/cradle.c mode change 100755 => 100644 src/extcon/earjack.c mode change 100755 => 100644 src/extcon/extcon.c mode change 100755 => 100644 src/extcon/hdmi.c mode change 100755 => 100644 src/ir/ir.c mode change 100755 => 100644 src/led/noti.c mode change 100755 => 100644 src/led/rgb.c mode change 100755 => 100644 src/led/torch.c mode change 100755 => 100644 src/led/touch-key.c mode change 100755 => 100644 src/libdeviced/deviced-noti.c mode change 100755 => 100644 src/libdeviced/deviced-util.c mode change 100755 => 100644 src/libdeviced/display.c mode change 100755 => 100644 src/libdeviced/haptic.c mode change 100755 => 100644 src/libdeviced/led.c mode change 100755 => 100644 src/libdeviced/usbhost.c mode change 100755 => 100644 src/power/boot.c mode change 100755 => 100644 src/power/low-power.c mode change 100755 => 100644 src/power/power-handler.c mode change 100755 => 100644 src/proc/cpu-info.c mode change 100755 => 100644 src/shared/deviced-systemd.c mode change 100755 => 100644 src/thermal/thermal.c mode change 100755 => 100644 src/time/time-handler.c mode change 100755 => 100644 src/touchscreen/sensitivity.c mode change 100755 => 100644 src/touchscreen/touchscreen.c mode change 100755 => 100644 src/tzip/tzip-utility.c mode change 100755 => 100644 src/tzip/tzip.c mode change 100755 => 100644 src/usb-host-ffs-test-daemon/descs_gen.c mode change 100755 => 100644 src/usb-host-ffs-test-daemon/usb-host-ffs-test-daemon.c mode change 100755 => 100644 src/usb-host-test/usb-host-test.c mode change 100755 => 100644 src/usb/usb-dbus.c mode change 100755 => 100644 src/usb/usb-debug.c mode change 100755 => 100644 src/usb/usb-state.c mode change 100755 => 100644 src/usb/usb-tethering.c mode change 100755 => 100644 src/usb/usb.c mode change 100755 => 100644 src/usbhost/usb-host.c diff --git a/src/apps/apps.c b/src/apps/apps.c old mode 100755 new mode 100644 diff --git a/src/auto-test/battery.c b/src/auto-test/battery.c old mode 100755 new mode 100644 diff --git a/src/battery/battery-time.c b/src/battery/battery-time.c old mode 100755 new mode 100644 diff --git a/src/battery/config.c b/src/battery/config.c old mode 100755 new mode 100644 diff --git a/src/battery/lowbat-handler.c b/src/battery/lowbat-handler.c old mode 100755 new mode 100644 diff --git a/src/battery/power-supply.c b/src/battery/power-supply.c old mode 100755 new mode 100644 diff --git a/src/control/control.c b/src/control/control.c old mode 100755 new mode 100644 diff --git a/src/core/common.c b/src/core/common.c old mode 100755 new mode 100644 diff --git a/src/core/config-parser.c b/src/core/config-parser.c old mode 100755 new mode 100644 diff --git a/src/core/device-idler.c b/src/core/device-idler.c old mode 100755 new mode 100644 diff --git a/src/core/device-notifier.c b/src/core/device-notifier.c old mode 100755 new mode 100644 diff --git a/src/core/devices.c b/src/core/devices.c old mode 100755 new mode 100644 diff --git a/src/core/event-handler.c b/src/core/event-handler.c old mode 100755 new mode 100644 diff --git a/src/core/execute.c b/src/core/execute.c old mode 100755 new mode 100644 diff --git a/src/core/launch.c b/src/core/launch.c old mode 100755 new mode 100644 diff --git a/src/core/main.c b/src/core/main.c old mode 100755 new mode 100644 diff --git a/src/core/sig-handler.c b/src/core/sig-handler.c old mode 100755 new mode 100644 diff --git a/src/core/udev.c b/src/core/udev.c old mode 100755 new mode 100644 diff --git a/src/cpu/pmqos-plugin.c b/src/cpu/pmqos-plugin.c old mode 100755 new mode 100644 diff --git a/src/cpu/pmqos.c b/src/cpu/pmqos.c old mode 100755 new mode 100644 diff --git a/src/devicectl/devicectl.c b/src/devicectl/devicectl.c old mode 100755 new mode 100644 diff --git a/src/devicectl/usb.c b/src/devicectl/usb.c old mode 100755 new mode 100644 diff --git a/src/dump/dump.c b/src/dump/dump.c old mode 100755 new mode 100644 diff --git a/src/extcon/cradle.c b/src/extcon/cradle.c old mode 100755 new mode 100644 diff --git a/src/extcon/earjack.c b/src/extcon/earjack.c old mode 100755 new mode 100644 diff --git a/src/extcon/extcon.c b/src/extcon/extcon.c old mode 100755 new mode 100644 diff --git a/src/extcon/hdmi.c b/src/extcon/hdmi.c old mode 100755 new mode 100644 diff --git a/src/ir/ir.c b/src/ir/ir.c old mode 100755 new mode 100644 diff --git a/src/led/noti.c b/src/led/noti.c old mode 100755 new mode 100644 diff --git a/src/led/rgb.c b/src/led/rgb.c old mode 100755 new mode 100644 diff --git a/src/led/torch.c b/src/led/torch.c old mode 100755 new mode 100644 diff --git a/src/led/touch-key.c b/src/led/touch-key.c old mode 100755 new mode 100644 diff --git a/src/libdeviced/deviced-noti.c b/src/libdeviced/deviced-noti.c old mode 100755 new mode 100644 diff --git a/src/libdeviced/deviced-util.c b/src/libdeviced/deviced-util.c old mode 100755 new mode 100644 diff --git a/src/libdeviced/display.c b/src/libdeviced/display.c old mode 100755 new mode 100644 diff --git a/src/libdeviced/haptic.c b/src/libdeviced/haptic.c old mode 100755 new mode 100644 diff --git a/src/libdeviced/led.c b/src/libdeviced/led.c old mode 100755 new mode 100644 diff --git a/src/libdeviced/usbhost.c b/src/libdeviced/usbhost.c old mode 100755 new mode 100644 diff --git a/src/power/boot.c b/src/power/boot.c old mode 100755 new mode 100644 diff --git a/src/power/low-power.c b/src/power/low-power.c old mode 100755 new mode 100644 diff --git a/src/power/power-handler.c b/src/power/power-handler.c old mode 100755 new mode 100644 diff --git a/src/proc/cpu-info.c b/src/proc/cpu-info.c old mode 100755 new mode 100644 diff --git a/src/shared/deviced-systemd.c b/src/shared/deviced-systemd.c old mode 100755 new mode 100644 diff --git a/src/thermal/thermal.c b/src/thermal/thermal.c old mode 100755 new mode 100644 diff --git a/src/time/time-handler.c b/src/time/time-handler.c old mode 100755 new mode 100644 diff --git a/src/touchscreen/sensitivity.c b/src/touchscreen/sensitivity.c old mode 100755 new mode 100644 diff --git a/src/touchscreen/touchscreen.c b/src/touchscreen/touchscreen.c old mode 100755 new mode 100644 diff --git a/src/tzip/tzip-utility.c b/src/tzip/tzip-utility.c old mode 100755 new mode 100644 diff --git a/src/tzip/tzip.c b/src/tzip/tzip.c old mode 100755 new mode 100644 diff --git a/src/usb-host-ffs-test-daemon/descs_gen.c b/src/usb-host-ffs-test-daemon/descs_gen.c old mode 100755 new mode 100644 diff --git a/src/usb-host-ffs-test-daemon/usb-host-ffs-test-daemon.c b/src/usb-host-ffs-test-daemon/usb-host-ffs-test-daemon.c old mode 100755 new mode 100644 diff --git a/src/usb-host-test/usb-host-test.c b/src/usb-host-test/usb-host-test.c old mode 100755 new mode 100644 diff --git a/src/usb/usb-dbus.c b/src/usb/usb-dbus.c old mode 100755 new mode 100644 diff --git a/src/usb/usb-debug.c b/src/usb/usb-debug.c old mode 100755 new mode 100644 diff --git a/src/usb/usb-state.c b/src/usb/usb-state.c old mode 100755 new mode 100644 diff --git a/src/usb/usb-tethering.c b/src/usb/usb-tethering.c old mode 100755 new mode 100644 diff --git a/src/usb/usb.c b/src/usb/usb.c old mode 100755 new mode 100644 diff --git a/src/usbhost/usb-host.c b/src/usbhost/usb-host.c old mode 100755 new mode 100644 -- 2.7.4 From 78129922508e82a8304ef5b1add270e2ff93fb67 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Tue, 26 Feb 2019 17:59:01 +0900 Subject: [PATCH 14/16] Add bezel for wearable target Change-Id: Iee31a5a0d8b37feb8cd162caadd8ee73fc931968 Signed-off-by: lokilee73 --- plugins/wearable/display/bezel.c | 130 ++++++++++++++++++++++++++++++++++ plugins/wearable/display/core.c | 4 ++ plugins/wearable/display/key-filter.c | 48 +++++++++++-- src/core/device-notifier.h | 1 + src/core/devices.h | 9 +-- 5 files changed, 181 insertions(+), 11 deletions(-) create mode 100644 plugins/wearable/display/bezel.c diff --git a/plugins/wearable/display/bezel.c b/plugins/wearable/display/bezel.c new file mode 100644 index 0000000..d5b0005 --- /dev/null +++ b/plugins/wearable/display/bezel.c @@ -0,0 +1,130 @@ +/* + * deviced + * + * Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "core/devices.h" +#include "core/common.h" +#include "core/device-notifier.h" +#include "display/util.h" +#include "display/poll.h" +#include "display-ops.h" +#include +#include +#include + +#ifndef VCONFKEY_SETAPPL_WAKEUP_BY_BEZEL_ENABLE +#define VCONFKEY_SETAPPL_WAKEUP_BY_BEZEL_ENABLE "db/setting/wakeup_by_bezel_enable" +#endif + +static struct bezel_device *bezel_dev; +static int bezel_wakeup = -1; + +static void bezel_changed_cb(keynode_t *key_nodes, void *data) +{ + assert(key_nodes); + + bezel_wakeup = vconf_keynode_get_bool(key_nodes); + + _I("bezel wakeup condition is %d", bezel_wakeup); + if (disp_plgn.pm_change_internal) + disp_plgn.pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL); + + device_notify(DEVICE_NOTIFIER_BEZEL_WAKEUP, (void *)bezel_wakeup); +} + +static void bezel_init(void *data) +{ + struct hw_info *info; + int r; + + if (bezel_dev) + return; + + r = hw_get_info(BEZEL_HARDWARE_DEVICE_ID, (const struct hw_info **)&info); + if (r < 0) { + _I("bezel shared library is not supported: %d", r); + return; + } + + if (!info->open) { + _E("Fail to open bezel device : open(NULL)"); + return; + } + + r = info->open(info, NULL, (struct hw_common **)&bezel_dev); + if (r < 0) { + _E("Fail to get bezel device structure: %d", r); + return; + } + + vconf_notify_key_changed(VCONFKEY_SETAPPL_WAKEUP_BY_BEZEL_ENABLE, + bezel_changed_cb, NULL); + + if (vconf_get_bool(VCONFKEY_SETAPPL_WAKEUP_BY_BEZEL_ENABLE, &bezel_wakeup) < 0) + bezel_wakeup = 1; + + _I("bezel wakeup condition is %d", bezel_wakeup); +} + +static void bezel_exit(void *data) +{ + struct hw_info *info; + + if (!bezel_dev) + return; + + info = bezel_dev->common.info; + + assert(info); + + info->close((struct hw_common *)bezel_dev); +} + +static int bezel_start(enum device_flags flags) +{ + if (!bezel_dev) + return 0; + + return bezel_dev->set_state(BEZEL_TURNON); +} + +static int bezel_stop(enum device_flags flags) +{ + enum bezel_state state; + + if (!bezel_dev) + return 0; + + state = (bezel_wakeup ? BEZEL_TURNON : BEZEL_TURNOFF); + _I("set bezel state: %d", state); + + return bezel_dev->set_state(state); +} + +/* + * 'bezel' device_ops should be initialize before init key-filter. + */ +static const struct device_ops bezel_device_ops = { + .priority = DEVICE_PRIORITY_HIGH, + .name = "bezel", + .init = bezel_init, + .exit = bezel_exit, + .start = bezel_start, + .stop = bezel_stop, +}; + +DEVICE_OPS_REGISTER(&bezel_device_ops) diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index 05505ef..11fab78 100755 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -1903,6 +1903,10 @@ static void init_lcd_operation(void) ops = find_device("touchscreen"); if (!check_default(ops)) DD_LIST_APPEND(lcdon_ops, ops); + + ops = find_device("bezel"); + if (!check_default(ops)) + DD_LIST_APPEND(lcdon_ops, ops); } static void exit_lcd_operation(void) diff --git a/plugins/wearable/display/key-filter.c b/plugins/wearable/display/key-filter.c index ce14ce2..02d8a48 100644 --- a/plugins/wearable/display/key-filter.c +++ b/plugins/wearable/display/key-filter.c @@ -90,8 +90,16 @@ static double combination_pressed_time; static bool touch_pressed = false; static int skip_lcd_off = false; static int skip_combination = false; +static int bezel_wakeup = true; static const struct device_ops *touchled; +static int bezel_wakeup_cb(void *data) +{ + bezel_wakeup = (int)data; + + return 0; +} + static int booting_done(void *data) { static int done = 0; @@ -199,7 +207,7 @@ static inline void broadcast_lcdoff_by_powerkey(void) NULL, NULL); } -static inline bool switch_on_lcd(void) +static inline bool switch_on_lcd(enum device_flags flags) { if (current_state_in_on()) return false; @@ -211,7 +219,7 @@ static inline bool switch_on_lcd(void) broadcast_lcdon_by_powerkey(); - lcd_on_direct(LCD_ON_BY_POWER_KEY); + lcd_on_direct(flags); return true; } @@ -305,7 +313,7 @@ static int process_menu_key(struct input_event *pinput) _D("No lcd-on capability!"); return true; } else if (pinput->value == KEY_PRESSED) { - switch_on_lcd(); + switch_on_lcd(LCD_ON_BY_POWER_KEY); } return false; @@ -394,6 +402,19 @@ static bool release_short_powerkey(void) return true; } +static int process_back_key(struct input_event *pinput) +{ + int ignore = true; + + if (pinput->value == KEY_PRESSED) { + switch_on_lcd(LCD_ON_BY_POWER_KEY); + _I("back key pressed"); + ignore = false; + } + + return ignore; +} + static int process_power_key(struct input_event *pinput) { int ignore = true; @@ -419,7 +440,7 @@ static int process_power_key(struct input_event *pinput) break; case KEY_PRESSED: if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) { - skip_lcd_off = switch_on_lcd(); + skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); } else { _D("No lcdon capability!"); skip_lcd_off = false; @@ -536,6 +557,13 @@ static int check_key(struct input_event *pinput, int fd) ignore = process_screenlock_key(pinput); break; case KEY_BACK: + ignore = process_back_key(pinput); + stop_key_combination(NULL); + if (current_state_in_on()) { + process_hardkey_backlight(pinput); + ignore = false; + } + break; case KEY_PHONE: stop_key_combination(NULL); if (current_state_in_on()) { @@ -615,14 +643,19 @@ static int check_key_filter(void *data, int fd) break; case EV_REL: - ignore = false; + if (pm_cur_state == S_LCDOFF && bezel_wakeup) { + switch_on_lcd(LCD_ON_BY_BEZEL); + ignore = false; + } else if (pm_cur_state != S_LCDOFF) { + ignore = false; + } break; case EV_ABS: if (current_state_in_on()) ignore = false; - if (ambient_get_condition() == true) { - switch_on_lcd(); + if (ambient_get_condition() && pinput->value == KEY_PRESSED) { + switch_on_lcd(LCD_ON_BY_TOUCH); ignore = false; } @@ -672,6 +705,7 @@ static void keyfilter_init(void) touchled = find_device(TOUCHLED_NAME); register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); + register_notifier(DEVICE_NOTIFIER_BEZEL_WAKEUP, bezel_wakeup_cb); } static void keyfilter_exit(void) diff --git a/src/core/device-notifier.h b/src/core/device-notifier.h index cb0ce1f..771941c 100644 --- a/src/core/device-notifier.h +++ b/src/core/device-notifier.h @@ -69,6 +69,7 @@ enum device_notifier_type { DEVICE_NOTIFIER_MONOTONE_HAPTIC, DEVICE_NOTIFIER_UPSM, DEVICE_NOTIFIER_UDEV, + DEVICE_NOTIFIER_BEZEL_WAKEUP, DEVICE_NOTIFIER_MAX, }; diff --git a/src/core/devices.h b/src/core/devices.h index 9e90422..5ee2713 100644 --- a/src/core/devices.h +++ b/src/core/devices.h @@ -40,10 +40,11 @@ enum device_flags { LCD_ON_BY_POWER_KEY = 0x00200000, LCD_ON_BY_EVENT = 0x00400000, LCD_ON_BY_TOUCH = 0x00800000, - LCD_OFF_BY_POWER_KEY = 0x01000000, - LCD_OFF_BY_TIMEOUT = 0x02000000, - LCD_OFF_BY_EVENT = 0x04000000, - LCD_OFF_LATE_MODE = 0x08000000, + LCD_ON_BY_BEZEL = 0x01000000, + LCD_OFF_BY_POWER_KEY = 0x02000000, + LCD_OFF_BY_TIMEOUT = 0x04000000, + LCD_OFF_BY_EVENT = 0x08000000, + LCD_OFF_LATE_MODE = 0x10000000, }; struct device_ops { -- 2.7.4 From 35801216cf7224ff32b5d45bea7846462752aba7 Mon Sep 17 00:00:00 2001 From: "sanghyeok.oh" Date: Wed, 27 Feb 2019 10:03:56 +0900 Subject: [PATCH 15/16] power: cleanup Change-Id: I10a9f006d08535f9c5d8eba77d3e073733e6c180 Signed-off-by: sanghyeok.oh --- plugins/iot/display/core.c | 8 +- plugins/mobile/display/core.c | 8 +- plugins/tv/display/core.c | 8 +- plugins/wearable/display/core.c | 8 +- src/power/power-handler.c | 175 +++++++++++++++++++++------------------- src/power/power-handler.h | 28 +++---- 6 files changed, 121 insertions(+), 114 deletions(-) diff --git a/plugins/iot/display/core.c b/plugins/iot/display/core.c index 05505ef..b3b3885 100755 --- a/plugins/iot/display/core.c +++ b/plugins/iot/display/core.c @@ -1822,12 +1822,12 @@ static int update_setting(int key_idx, int val) break; case SETTING_POWEROFF: switch (val) { - case POWER_OFF_NONE: - case POWER_OFF_POPUP: + case POWEROFF_TYPE_NONE: + case POWEROFF_TYPE_POPUP: pm_status_flag &= ~PWROFF_FLAG; break; - case POWER_OFF_DIRECT: - case POWER_OFF_RESTART: + case POWEROFF_TYPE_DIRECT: + case POWEROFF_TYPE_RESTART: pm_status_flag |= PWROFF_FLAG; break; } diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index 05505ef..b3b3885 100755 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -1822,12 +1822,12 @@ static int update_setting(int key_idx, int val) break; case SETTING_POWEROFF: switch (val) { - case POWER_OFF_NONE: - case POWER_OFF_POPUP: + case POWEROFF_TYPE_NONE: + case POWEROFF_TYPE_POPUP: pm_status_flag &= ~PWROFF_FLAG; break; - case POWER_OFF_DIRECT: - case POWER_OFF_RESTART: + case POWEROFF_TYPE_DIRECT: + case POWEROFF_TYPE_RESTART: pm_status_flag |= PWROFF_FLAG; break; } diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index 639b8c7..d0a28ad 100755 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -1824,12 +1824,12 @@ static int update_setting(int key_idx, int val) break; case SETTING_POWEROFF: switch (val) { - case POWER_OFF_NONE: - case POWER_OFF_POPUP: + case POWEROFF_TYPE_NONE: + case POWEROFF_TYPE_POPUP: pm_status_flag &= ~PWROFF_FLAG; break; - case POWER_OFF_DIRECT: - case POWER_OFF_RESTART: + case POWEROFF_TYPE_DIRECT: + case POWEROFF_TYPE_RESTART: pm_status_flag |= PWROFF_FLAG; break; } diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index 11fab78..a00965b 100755 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -1822,12 +1822,12 @@ static int update_setting(int key_idx, int val) break; case SETTING_POWEROFF: switch (val) { - case POWER_OFF_NONE: - case POWER_OFF_POPUP: + case POWEROFF_TYPE_NONE: + case POWEROFF_TYPE_POPUP: pm_status_flag &= ~PWROFF_FLAG; break; - case POWER_OFF_DIRECT: - case POWER_OFF_RESTART: + case POWEROFF_TYPE_DIRECT: + case POWEROFF_TYPE_RESTART: pm_status_flag |= PWROFF_FLAG; break; } diff --git a/src/power/power-handler.c b/src/power/power-handler.c index 7dafc14..3656762 100644 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -73,28 +73,28 @@ static struct power_option poweroff_opt; static bool during_poweroff; static dd_list *poweroff_handles; -static char *poweroff_type_flagpaths[] = { // index denotes type - [POWER_OFF_POWEROFF] = POWER_FLAG_POWEROFF, - [POWER_OFF_REBOOT] = POWER_FLAG_REBOOT, - [POWER_OFF_EXIT] = POWER_FLAG_EXIT, +static const char *poweroff_type_flagpaths[] = { // index denotes type + [POWEROFF_TYPE_POWEROFF] = POWER_FLAG_POWEROFF, + [POWEROFF_TYPE_REBOOT] = POWER_FLAG_REBOOT, + [POWEROFF_TYPE_EXIT] = POWER_FLAG_EXIT, }; -static char *poweroff_type_names[] = { // index denotes type - [POWER_OFF_POWEROFF] = POWER_POWEROFF, - [POWER_OFF_POPUP] = PWROFF_POPUP, - [POWER_OFF_REBOOT] = POWER_REBOOT, - [POWER_OFF_EXIT] = POWER_EXIT, +static const char *poweroff_type_names[] = { // index denotes type + [POWEROFF_TYPE_POWEROFF] = POWER_POWEROFF, + [POWEROFF_TYPE_POPUP] = POWER_OFF_POPUP, + [POWEROFF_TYPE_REBOOT] = POWER_REBOOT, + [POWEROFF_TYPE_EXIT] = POWER_EXIT, }; -static char *poweroff_type_to_name(enum poweroff_type type) +static const char *poweroff_type_to_name(enum poweroff_type type) { - if (type >= ARRAY_SIZE(poweroff_type_names)) + if (type <= 0 || type >= ARRAY_SIZE(poweroff_type_names)) return NULL; return poweroff_type_names[type]; } -static enum poweroff_type poweroff_name_to_type(char *name) +static enum poweroff_type poweroff_name_to_type(const char *name) { if (!name) goto out; @@ -104,7 +104,7 @@ static enum poweroff_type poweroff_name_to_type(char *name) return i; } out: - return POWER_OFF_INVALID; + return POWEROFF_TYPE_INVALID; } static void poweroff_start_animation(void) @@ -195,13 +195,13 @@ static void poweroff_request_shutdown() { _I("Requested power off via systemd."); - char *method; + const char *method; - if (poweroff_opt.type == POWER_OFF_REBOOT) + if (poweroff_opt.type == POWEROFF_TYPE_REBOOT) method = "Reboot"; - else if (poweroff_opt.type == POWER_OFF_POWEROFF) + else if (poweroff_opt.type == POWEROFF_TYPE_POWEROFF) method = "PowerOff"; - else if (poweroff_opt.type == POWER_OFF_EXIT) + else if (poweroff_opt.type == POWEROFF_TYPE_RESTART) method = "Exit"; else { _E("Poweroff invalid type(%d).", poweroff_opt.type); @@ -234,18 +234,23 @@ void powerdown(void) buf = getenv("PWROFF_DUR"); if (buf != NULL && strlen(buf) < 1024) poweroff_duration = atoi(buf); + if (poweroff_duration < 0 || poweroff_duration > 60) poweroff_duration = POWEROFF_DURATION; + gettimeofday(&now, NULL); check_duration = now.tv_sec - tv_start_poweroff.tv_sec; + while (check_duration < poweroff_duration) { if (wait == 0) { _I("Wait poweroff %d %d.", check_duration, poweroff_duration); wait = 1; } usleep(100000); + gettimeofday(&now, NULL); check_duration = now.tv_sec - tv_start_poweroff.tv_sec; + if (check_duration < 0) break; } @@ -268,7 +273,7 @@ int check_power_flag(void) return 0; } -static void make_power_flag(enum poweroff_type type, char *option) +static void make_power_flag(enum poweroff_type type, const char *option) { const char *path; int fd; @@ -332,8 +337,7 @@ static gboolean poweroff_timeout_cb(void *data) } _D("No timer left."); - char *name = poweroff_type_to_name(poweroff_opt.type); - if (!name) { + if (!poweroff_type_to_name(poweroff_opt.type)) { _E("Invalid type(%d).", poweroff_opt.type); goto out; } @@ -376,6 +380,7 @@ void poweroff_start_timers() } _D("Run timer, pid=%d timeout=%d timeout_id=%d.", handle->pid, handle->timeout, handle->timeout_id); + handle->timeout_id = g_timeout_add_seconds(handle->timeout, poweroff_timeout_cb, (void *)((intptr_t)(handle->pid))); @@ -387,6 +392,7 @@ void poweroff_start_timers() return; } else { _D("Handle is NULL."); + handle = (struct poweroff_handle *)malloc(sizeof(struct poweroff_handle)); if (handle == NULL) { _E("Not enough memory."); @@ -409,16 +415,16 @@ void poweroff_start_timers() } _D("Last Timer: timer_id=%d pid=%d timeout=%d", handle->timeout_id, handle->pid, handle->timeout); + return; } static void system_shutdown_send_system_event(void) { bundle *b; - const char *str = EVT_VAL_SYSTEM_SHUTDOWN_TRUE; b = bundle_create(); - bundle_add_str(b, EVT_KEY_SYSTEM_SHUTDOWN, str); + bundle_add_str(b, EVT_KEY_SYSTEM_SHUTDOWN, EVT_VAL_SYSTEM_SHUTDOWN_TRUE); eventsystem_send_system_event(SYS_EVENT_SYSTEM_SHUTDOWN, b); bundle_free(b); } @@ -428,7 +434,7 @@ static int pwroff_popup(void) return launch_system_app(APP_POWERKEY, 2, APP_KEY_TYPE, APP_POWERKEY); } -static int poweroff_option_valid(enum poweroff_type type_e, char *option) +static int poweroff_option_valid(enum poweroff_type type_e, const char *option) { dd_list *l; struct power_option *elem; @@ -463,22 +469,22 @@ static void poweroff_send_broadcast(int status) old = status; - /* Need to notify to deviced-vibrator. deviced-vibrator receives ChangeState signal for POWER_OFF_DIRECT and POWER_OFF_RESTART */ + /* Need to notify to deviced-vibrator. deviced-vibrator receives ChangeState signal for POWEROFF_TYPE_DIRECT and POWEROFF_TYPE_RESTART */ dbus_handle_broadcast_dbus_signal_var(DEVICED_PATH_POWEROFF, DEVICED_INTERFACE_POWEROFF, SIGNAL_POWEROFF_STATE, g_variant_new("(i)", status)); } -static int power_execute_pid(char *type, char *option, pid_t pid) +static int power_execute_pid(const char *typename, const char *option) { if (during_poweroff) { _E("During poweroff."); return -EINVAL; } - enum poweroff_type type_e = poweroff_name_to_type(type); - if (type_e == POWER_OFF_INVALID) { + enum poweroff_type type_e = poweroff_name_to_type(typename); + if (type_e == POWEROFF_TYPE_INVALID) { _E("Failed to get type enum value(%d).", type_e); return -EINVAL; } @@ -489,11 +495,11 @@ static int power_execute_pid(char *type, char *option, pid_t pid) if (option) poweroff_opt.option = strdup(option); } else { - _E("Failed to find supported type(%s). option=%s", type, (option ? option : "NULL")); + _E("Failed to find supported type(%s). option=%s", typename, (option ? option : "NULL")); return -EINVAL; } - if (poweroff_opt.type == POWER_OFF_POPUP) { + if (poweroff_opt.type == POWEROFF_TYPE_POPUP) { _D("Request popup."); vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, poweroff_opt.type); pwroff_popup(); @@ -510,60 +516,63 @@ static int power_execute_pid(char *type, char *option, pid_t pid) static int power_execute(void *data) { - return power_execute_pid((char *)data, NULL, getpid()); + return power_execute_pid((char *)data, NULL); } -GVariant *dbus_power_handler(GDBusConnection *conn, - const gchar *sender, const gchar *path, const gchar *iface, const gchar *name, - GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) +static int check_sender_process(GDBusConnection *conn, const char *sender) { pid_t pid; - int ret; - int argc; - char *type_str; - - g_variant_get(param, "(si)", &type_str, &argc); - if (argc < 0) { - _E("Message is invalid."); - ret = -EINVAL; - goto out; + if (sender == NULL || g_dbus_is_name(sender) == FALSE) { + _E("Invalid sender"); + return -EINVAL; } pid = dbus_connection_get_sender_pid(conn, sender); if (kill(pid, 0) == -1) { _E("Process(%d) does not exist, dbus ignored.", pid); - ret = -ESRCH; - goto out; + return -ESRCH; } - _I("Poweroff PID(%d) requests %s.", pid, type_str); - ret = power_execute_pid(type_str, NULL, pid); + return pid; +} + +static GVariant *dbus_power_handler(GDBusConnection *conn, + const gchar *sender, const gchar *path, const gchar *iface, const gchar *name, + GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) +{ + int ret; + char *type_str; + + g_variant_get(param, "(si)", &type_str, NULL); + + ret = check_sender_process(conn, sender); + if (ret < 0) + goto out; + + _I("Poweroff PID(%d) requests %s.", ret, type_str); + ret = power_execute_pid(type_str, NULL); out: g_free(type_str); return g_variant_new("(i)", ret); } -GVariant *dbus_power_option_handler(GDBusConnection *conn, +static GVariant *dbus_power_option_handler(GDBusConnection *conn, const gchar *sender, const gchar *path, const gchar *iface, const gchar *name, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { - pid_t pid; int ret; char *type, *option; g_variant_get(param, "(ss)", &type, &option); - pid = dbus_connection_get_sender_pid(conn, sender); - if (kill(pid, 0) == -1) { - _E("Process(%d) does not exist, dbus ignored.", pid); - ret = -ESRCH; + ret = check_sender_process(conn, sender); + if (ret < 0) goto out; - } - _I("Poweroff PID(%d) requests type=%s option=%s.", pid, type, option); - ret = power_execute_pid(type, option, pid); + _I("Poweroff PID(%d) requests type=%s option=%s.", ret, type, option); + ret = power_execute_pid(type, option); out: g_free(type); @@ -571,21 +580,23 @@ out: return g_variant_new("(i)", ret); } -GVariant *request_reboot(GDBusConnection *conn, +static GVariant *request_reboot(GDBusConnection *conn, const gchar *sender, const gchar *path, const gchar *iface, const gchar *name, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { char *str; int ret; - pid_t pid; g_variant_get(param, "(s)", &str); - pid = dbus_connection_get_sender_pid(conn, sender); + ret = check_sender_process(conn, sender); + if (ret < 0) + goto out; - _I("Poweroff PID(%d) requests reboot with command(%s).", pid, str); - ret = power_execute_pid(POWER_REBOOT, NULL, pid); + _I("Poweroff PID(%d) requests reboot with command(%s).", ret, str); + ret = power_execute_pid(POWER_REBOOT, NULL); +out: g_free(str); return g_variant_new("(i)", ret); } @@ -599,13 +610,13 @@ static GVariant *add_poweroff_time(GDBusConnection *conn, pid_t pid; dd_list *l; - pid = dbus_connection_get_sender_pid(conn, sender); + ret = check_sender_process(conn, sender); + if (ret < 0) + goto out; + + pid = (pid_t)ret; + _D("add_poweroff_timer pid=%d", pid); - if (pid == -1) { - _E("Failed to get sender's pid."); - ret = -1; - goto add_out; - } DD_LIST_FOREACH(poweroff_handles, l, handle) { if (handle->pid == pid) @@ -620,7 +631,7 @@ static GVariant *add_poweroff_time(GDBusConnection *conn, if (handle == NULL) { _E("Not enough memory."); ret = -1; - goto add_out; + goto out; } handle->pid = pid; @@ -632,7 +643,7 @@ static GVariant *add_poweroff_time(GDBusConnection *conn, ret = 0; -add_out: +out: return g_variant_new("(i)", ret); } @@ -645,13 +656,13 @@ static GVariant *remove_poweroff_time(GDBusConnection *conn, int ret = 0; pid_t pid; - pid = dbus_connection_get_sender_pid(conn, sender); + ret = check_sender_process(conn, sender); + if (ret < 0) + goto out; + + pid = (pid_t)ret; + _D("Remove_poweroff_timer pid=%d", pid); - if (pid == -1) { - _E("Failed to get sender's pid."); - ret = -1; - goto remove_out; - } DD_LIST_FOREACH(poweroff_handles, l, handle) { if (handle->pid == pid) @@ -673,7 +684,7 @@ static GVariant *remove_poweroff_time(GDBusConnection *conn, ret = -1; } -remove_out: +out: return g_variant_new("(i)", ret); } @@ -694,7 +705,7 @@ static const dbus_interface_u dbus_interface = { .nr_methods = ARRAY_SIZE(dbus_methods), }; -static int add_poweroff_option(enum poweroff_type type, char *option) +static int add_poweroff_option(enum poweroff_type type, const char *option) { struct power_option *opt; char *name; @@ -727,9 +738,9 @@ static int load_config(struct parse_result *result, void *user_data) int ret; if (MATCH(result->section, "Poweroff")) - type = POWER_OFF_DIRECT; + type = POWEROFF_TYPE_DIRECT; else if (MATCH(result->section, "Reboot")) - type = POWER_OFF_RESTART; + type = POWEROFF_TYPE_RESTART; else return 0; @@ -770,10 +781,10 @@ static void power_init(void *data) register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); - add_poweroff_option(POWER_OFF_POWEROFF, NULL); - add_poweroff_option(POWER_OFF_RESTART, NULL); - add_poweroff_option(POWER_OFF_POPUP, NULL); - add_poweroff_option(POWER_OFF_EXIT, NULL); + add_poweroff_option(POWEROFF_TYPE_POWEROFF, NULL); + add_poweroff_option(POWEROFF_TYPE_RESTART, NULL); + add_poweroff_option(POWEROFF_TYPE_POPUP, NULL); + add_poweroff_option(POWEROFF_TYPE_RESTART, NULL); ret = config_parse(POWER_CONF_FILE, load_config, NULL); if (ret < 0) diff --git a/src/power/power-handler.h b/src/power/power-handler.h index ae726f8..781279b 100644 --- a/src/power/power-handler.h +++ b/src/power/power-handler.h @@ -22,27 +22,23 @@ #define POWER_OPS_NAME "power" #define POWER_POWEROFF "poweroff" -#define POWER_POWEROFF_LEN 8 #define POWER_REBOOT "reboot" -#define POWER_REBOOT_LEN 6 -#define PWROFF_POPUP "pwroff-popup" -#define PWROFF_POPUP_LEN 12 - +#define POWER_OFF_POPUP "pwroff-popup" #define POWER_EXIT "exit" -#define POWER_FLAG_POWEROFF "/run/"POWER_POWEROFF -#define POWER_FLAG_REBOOT "/run/"POWER_REBOOT -#define POWER_FLAG_EXIT "/run/deviced-shutdown-exit" +#define POWER_FLAG_POWEROFF "/run/"POWER_POWEROFF +#define POWER_FLAG_REBOOT "/run/"POWER_REBOOT +#define POWER_FLAG_EXIT "/run/deviced-shutdown-exit" enum poweroff_type { - POWER_OFF_INVALID = 0, - POWER_OFF_NONE = POWER_OFF_INVALID, // compat only - POWER_OFF_POPUP, - POWER_OFF_POWEROFF, /* replaces POWER_OFF_DIRECT */ - POWER_OFF_DIRECT = POWER_OFF_POWEROFF, // compat only - POWER_OFF_REBOOT, - POWER_OFF_RESTART = POWER_OFF_REBOOT, // compat only - POWER_OFF_EXIT, + POWEROFF_TYPE_INVALID = 0, + POWEROFF_TYPE_NONE = POWEROFF_TYPE_INVALID, // compat only + POWEROFF_TYPE_POPUP, + POWEROFF_TYPE_POWEROFF, /* replaces POWEROFF_TYPE_DIRECT */ + POWEROFF_TYPE_DIRECT = POWEROFF_TYPE_POWEROFF, // compat only + POWEROFF_TYPE_REBOOT, + POWEROFF_TYPE_RESTART = POWEROFF_TYPE_REBOOT, // compat only + POWEROFF_TYPE_EXIT, }; struct power_option { -- 2.7.4 From 9bdc60bbd0f5c32eabadfe77694b3ad20fbcf931 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Wed, 27 Feb 2019 20:52:55 +0900 Subject: [PATCH 16/16] To give permission to 3rd party If there is no permission for 3rd party, Dbus request by temperature API can be failed Change-Id: I48cae55a1331020c4291be4ce683da2abb039246 Signed-off-by: lokilee73 --- conf/org.tizen.system.deviced.conf | 1 + 1 file changed, 1 insertion(+) mode change 100755 => 100644 conf/org.tizen.system.deviced.conf diff --git a/conf/org.tizen.system.deviced.conf b/conf/org.tizen.system.deviced.conf old mode 100755 new mode 100644 index 83f4d1a..f8c03e0 --- a/conf/org.tizen.system.deviced.conf +++ b/conf/org.tizen.system.deviced.conf @@ -59,5 +59,6 @@ + -- 2.7.4