From 41b29f86a21f1ddfee9db74ed62462f1cd550222 Mon Sep 17 00:00:00 2001 From: Simo Piiroinen Date: Tue, 14 Feb 2017 12:16:43 +0200 Subject: [PATCH] [usb-moded] Silence wakelock related logging in normal builds Having possibility to log wakelocking activity is useful in some special circumstance, but it creates a lot of noise and usb-moded is lacking fine tuned logging control. Disable wakelock logging altogether by default. Signed-off-by: Simo Piiroinen --- src/usb_moded.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/usb_moded.c b/src/usb_moded.c index 9962920..151b876 100644 --- a/src/usb_moded.c +++ b/src/usb_moded.c @@ -59,6 +59,11 @@ #include "usb_moded-dsme.h" #endif +/* Wakelogging is noisy, do not log it by default */ +#ifndef VERBOSE_WAKELOCKING +# define VERBOSE_WAKELOCKING 0 +#endif + /* global definitions */ static int usb_moded_exitcode = EXIT_FAILURE; @@ -978,7 +983,9 @@ void acquire_wakelock(const char *wakelock_name) USB_MODED_SUSPEND_DELAY_MAXIMUM_MS * 1000000LL); write_to_sysfs_file("/sys/power/wake_lock", buff); +#if VERBOSE_WAKELOCKING log_debug("acquire_wakelock %s", wakelock_name); +#endif } /** Release wakelock via sysfs @@ -987,7 +994,9 @@ void acquire_wakelock(const char *wakelock_name) */ void release_wakelock(const char *wakelock_name) { +#if VERBOSE_WAKELOCKING log_debug("release_wakelock %s", wakelock_name); +#endif write_to_sysfs_file("/sys/power/wake_unlock", wakelock_name); }