From de5c013e377d6bfded6c891b93fa71ec67c9b69e Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 3 Jul 2020 12:50:11 +0200 Subject: [PATCH] Added compile time urbdrc debug option (cherry picked from commit 5244efadcfb158c813d79b8e8c068fc33198f79b) --- channels/urbdrc/CMakeLists.txt | 6 +----- channels/urbdrc/common/urbdrc_helpers.c | 6 +++++- config.h.in | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/channels/urbdrc/CMakeLists.txt b/channels/urbdrc/CMakeLists.txt index 54d983f..bc570e0 100644 --- a/channels/urbdrc/CMakeLists.txt +++ b/channels/urbdrc/CMakeLists.txt @@ -21,11 +21,7 @@ include_directories(common) add_subdirectory(common) if(WITH_CLIENT_CHANNELS) - option(WITH_URBDRC_DEBUG "Dump data send/received in URBDRC channel" OFF) - - if (WITH_URBDRC_DEBUG) - add_definitions(-DWITH_URBDRC_DEBUG=1) - endif() + option(WITH_DEBUG_URBDRC "Dump data send/received in URBDRC channel" OFF) find_package(libusb-1.0 REQUIRED) include_directories(${LIBUSB_1_INCLUDE_DIRS}) diff --git a/channels/urbdrc/common/urbdrc_helpers.c b/channels/urbdrc/common/urbdrc_helpers.c index 0df6e59..80d6149 100644 --- a/channels/urbdrc/common/urbdrc_helpers.c +++ b/channels/urbdrc/common/urbdrc_helpers.c @@ -17,6 +17,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "urbdrc_helpers.h" #include "urbdrc_types.h" #include @@ -406,7 +410,7 @@ void urbdrc_dump_message(wLog* log, BOOL client, BOOL write, wStream* s) ", FunctionId=%08" PRIx32 ", length=%" PRIdz, type, call_to_string(client, InterfaceId, FunctionId), FunctionId, InterfaceId, MessageId, FunctionId, length); -#if defined(WITH_URBDRC_DEBUG) +#if defined(WITH_DEBUG_URBDRC) if (write) WLog_Print(log, WLOG_TRACE, "-------------------------- URBDRC sent: ---"); else diff --git a/config.h.in b/config.h.in index 7e6fdfd..2264e59 100644 --- a/config.h.in +++ b/config.h.in @@ -160,6 +160,7 @@ #cmakedefine WITH_DEBUG_RDPEI #cmakedefine WITH_DEBUG_TIMEZONE #cmakedefine WITH_DEBUG_THREADS +#cmakedefine WITH_DEBUG_URBDRC #cmakedefine WITH_DEBUG_MUTEX #cmakedefine WITH_DEBUG_TRANSPORT #cmakedefine WITH_DEBUG_WND -- 2.7.4