Dump USB channel data with log-level trace

(cherry picked from commit e32ba76deb8e16834a5bb0d099cc08d1ed44c04d)
This commit is contained in:
akallabeth 2020-07-03 12:41:59 +02:00
parent 01f7644e4c
commit f621d2efea
2 changed files with 15 additions and 0 deletions

View File

@ -21,6 +21,12 @@ 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()
find_package(libusb-1.0 REQUIRED)
include_directories(${LIBUSB_1_INCLUDE_DIRS})

View File

@ -19,6 +19,7 @@
*/
#include "urbdrc_helpers.h"
#include "urbdrc_types.h"
#include <winpr/print.h>
const char* mask_to_string(UINT32 mask)
{
@ -405,4 +406,12 @@ 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 (write)
WLog_Print(log, WLOG_TRACE, "-------------------------- URBDRC sent: ---");
else
WLog_Print(log, WLOG_TRACE, "-------------------------- URBDRC received:");
winpr_HexLogDump(log, WLOG_TRACE, Stream_Buffer(s), length);
WLog_Print(log, WLOG_TRACE, "-------------------------- URBDRC end -----");
#endif
}