This change makes it considerably easier to debug issues in UI applications which don't necessarily have a console connected to stderr.
Outputting to the debugger shouldn't occur in normal situations so this change has to be explicitly enabled by a build-time config flag. --- libusb/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libusb/core.c b/libusb/core.c index 53f716f..c567398 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -2019,6 +2019,16 @@ int usbi_gettimeofday(struct timeval *tp, void *tzp) static void usbi_log_str(struct libusb_context *ctx, const char * str) { +#ifdef ENABLE_DEBUG_LOGGING +#if defined(OS_WINDOWS) + OutputDebugStringA(str); +#elif defined(OS_WINCE) + /* Windows CE only supports the unicode version of OutputDebugString. */ + WCHAR wbuf[USBI_MAX_LOG_LEN]; + MultiByteToWideChar(CP_ACP, 0, str, -1, wbuf, sizeof(wbuf)); + OutputDebugStringW(wbuf); +#endif +#endif /* ENABLE_DEBUG_LOGGING */ UNUSED(ctx); fprintf(stderr, str); } -- 1.7.9.5 ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel