diff --git a/channels/audin/client/alsa/audin_alsa.c b/channels/audin/client/alsa/audin_alsa.c index 1b7c3b3e9..d75435407 100644 --- a/channels/audin/client/alsa/audin_alsa.c +++ b/channels/audin/client/alsa/audin_alsa.c @@ -72,8 +72,8 @@ static BOOL audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_hand if ((error = snd_pcm_hw_params_malloc(&hw_params)) < 0) { - CLOG_ERR("snd_pcm_hw_params_malloc (%s)", - snd_strerror(error)); + WLog_ERR(TAG, "snd_pcm_hw_params_malloc (%s)", + snd_strerror(error)); return FALSE; } @@ -206,7 +206,7 @@ static void* audin_alsa_thread_func(void* arg) { if ((error = snd_pcm_open(&capture_handle, alsa->device_name, SND_PCM_STREAM_CAPTURE, 0)) < 0) { - CLOG_ERR("snd_pcm_open (%s)", snd_strerror(error)); + WLog_ERR(TAG, "snd_pcm_open (%s)", snd_strerror(error)); break; } @@ -226,7 +226,7 @@ static void* audin_alsa_thread_func(void* arg) } else if (error < 0) { - CLOG_ERR("snd_pcm_readi (%s)", snd_strerror(error)); + WLog_ERR(TAG, "snd_pcm_readi (%s)", snd_strerror(error)); break; } diff --git a/channels/audin/client/audin_main.c b/channels/audin/client/audin_main.c index c2b366a4d..15ee80d33 100644 --- a/channels/audin/client/audin_main.c +++ b/channels/audin/client/audin_main.c @@ -133,7 +133,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w DEBUG_DVC("NumFormats %d", NumFormats); if ((NumFormats < 1) || (NumFormats > 1000)) { - CLOG_ERR("bad NumFormats %d", NumFormats); + WLog_ERR(TAG, "bad NumFormats %d", NumFormats); return 1; } Stream_Seek_UINT32(s); /* cbSizeFormatsPacket */ @@ -262,8 +262,8 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, wStr if (initialFormat >= (UINT32) callback->formats_count) { - CLOG_ERR("invalid format index %d (total %d)", - initialFormat, callback->formats_count); + WLog_ERR(TAG, "invalid format index %d (total %d)", + initialFormat, callback->formats_count); return 1; } @@ -293,8 +293,8 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb if (NewFormat >= (UINT32) callback->formats_count) { - CLOG_ERR("invalid format index %d (total %d)", - NewFormat, callback->formats_count); + WLog_ERR(TAG, "invalid format index %d (total %d)", + NewFormat, callback->formats_count); return 1; } @@ -340,7 +340,7 @@ static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, break; default: - CLOG_ERR("unknown MessageId=0x%x", MessageId); + WLog_ERR(TAG, "unknown MessageId=0x%x", MessageId); error = 1; break; } @@ -429,7 +429,7 @@ static void audin_register_device_plugin(IWTSPlugin* pPlugin, IAudinDevice* devi if (audin->device) { - CLOG_ERR("existing device, abort."); + WLog_ERR(TAG, "existing device, abort."); return; } @@ -454,7 +454,7 @@ static BOOL audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, ADDI if (entry(&entryPoints) != 0) { - CLOG_ERR("%s entry returns error.", name); + WLog_ERR(TAG, "%s entry returns error.", name); return FALSE; } @@ -613,7 +613,7 @@ int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) if (audin->device == NULL) { - CLOG_ERR("no sound device."); + WLog_ERR(TAG, "no sound device."); } return error; diff --git a/channels/audin/client/audin_main.h b/channels/audin/client/audin_main.h index 53c82b289..05dd637a0 100644 --- a/channels/audin/client/audin_main.h +++ b/channels/audin/client/audin_main.h @@ -30,10 +30,12 @@ #include #include +#define TAG CHANNELS_TAG("audin.client") + #ifdef WITH_DEBUG_DVC -#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) WLog_DBG(TAG, fmt, ## __VA_ARGS__) #else -#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) do { } while (0) #endif #endif /* FREERDP_AUDIN_CLIENT_MAIN_H */ diff --git a/channels/audin/client/opensles/audin_opensl_es.c b/channels/audin/client/opensles/audin_opensl_es.c index 936e453f8..54d601d20 100644 --- a/channels/audin/client/opensles/audin_opensl_es.c +++ b/channels/audin/client/opensles/audin_opensl_es.c @@ -96,7 +96,7 @@ static void* audin_opensles_thread_func(void* arg) int rc = android_RecIn(opensles->stream, buffer.s, raw_size); if (rc < 0) { - CLOG_ERR("android_RecIn %d", rc); + WLog_ERR(TAG, "android_RecIn %d", rc); continue; } @@ -250,9 +250,9 @@ static void audin_opensles_set_format(IAudinDevice* device, break; default: - CLOG_ERR("Encoding '%d' [%08X] not supported", - (format->wFormatTag), - format->wFormatTag); + WLog_ERR(TAG, "Encoding '%d' [%08X] not supported", + (format->wFormatTag), + format->wFormatTag); return; } @@ -309,7 +309,7 @@ static void audin_opensles_close(IAudinDevice* device) * ignore duplicate requests. */ if (!opensles->stopEvent) { - CLOG_ERR("[ERROR] function called without matching open."); + WLog_ERR(TAG, "[ERROR] function called without matching open."); return; } diff --git a/channels/audin/client/opensles/opensl_io.c b/channels/audin/client/opensles/opensl_io.c index 970ee8265..5b650be87 100644 --- a/channels/audin/client/opensles/opensl_io.c +++ b/channels/audin/client/opensles/opensl_io.c @@ -362,7 +362,7 @@ int android_RecIn(OPENSL_STREAM *p,short *buffer,int size) e = Queue_Dequeue(p->queue); if (!e) { - CLOG_ERR("[ERROR] got e=%p from queue", e); + WLog_ERR(TAG, "[ERROR] got e=%p from queue", e); return -1; } diff --git a/channels/audin/client/pulse/audin_pulse.c b/channels/audin/client/pulse/audin_pulse.c index 6642b4701..90e9cdb7c 100644 --- a/channels/audin/client/pulse/audin_pulse.c +++ b/channels/audin/client/pulse/audin_pulse.c @@ -94,16 +94,16 @@ static BOOL audin_pulse_connect(IAudinDevice* device) if (pa_context_connect(pulse->context, NULL, 0, NULL)) { - CLOG_ERR("pa_context_connect failed (%d)", - pa_context_errno(pulse->context)); + WLog_ERR(TAG, "pa_context_connect failed (%d)", + pa_context_errno(pulse->context)); return FALSE; } pa_threaded_mainloop_lock(pulse->mainloop); if (pa_threaded_mainloop_start(pulse->mainloop) < 0) { pa_threaded_mainloop_unlock(pulse->mainloop); - CLOG_ERR("pa_threaded_mainloop_start failed (%d)", - pa_context_errno(pulse->context)); + WLog_ERR(TAG, "pa_threaded_mainloop_start failed (%d)", + pa_context_errno(pulse->context)); return FALSE; } for (;;) @@ -113,8 +113,8 @@ static BOOL audin_pulse_connect(IAudinDevice* device) break; if (!PA_CONTEXT_IS_GOOD(state)) { - CLOG_ERR("bad context state (%d)", - pa_context_errno(pulse->context)); + WLog_ERR(TAG, "bad context state (%d)", + pa_context_errno(pulse->context)); break; } pa_threaded_mainloop_wait(pulse->mainloop); @@ -297,7 +297,7 @@ static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length */ if (pulse->buffer == NULL) { - /* CLOG_ERR( "%s: ignoring input, pulse buffer not ready.\n", __func__); */ + /* WLog_ERR(TAG, "%s: ignoring input, pulse buffer not ready.\n", __func__); */ return; } @@ -415,8 +415,8 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u &buffer_attr, PA_STREAM_ADJUST_LATENCY) < 0) { pa_threaded_mainloop_unlock(pulse->mainloop); - CLOG_ERR("pa_stream_connect_playback failed (%d)", - pa_context_errno(pulse->context)); + WLog_ERR(TAG, "pa_stream_connect_playback failed (%d)", + pa_context_errno(pulse->context)); return; } @@ -427,8 +427,8 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u break; if (!PA_STREAM_IS_GOOD(state)) { - CLOG_ERR("bad stream state (%d)", - pa_context_errno(pulse->context)); + WLog_ERR(TAG, "bad stream state (%d)", + pa_context_errno(pulse->context)); break; } pa_threaded_mainloop_wait(pulse->mainloop); @@ -512,7 +512,7 @@ int freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEnt if (!pulse->mainloop) { - CLOG_ERR("pa_threaded_mainloop_new failed"); + WLog_ERR(TAG, "pa_threaded_mainloop_new failed"); audin_pulse_free((IAudinDevice*) pulse); return 1; } @@ -521,7 +521,7 @@ int freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEnt if (!pulse->context) { - CLOG_ERR("pa_context_new failed"); + WLog_ERR(TAG, "pa_context_new failed"); audin_pulse_free((IAudinDevice*) pulse); return 1; } diff --git a/channels/audin/server/audin.c b/channels/audin/server/audin.c index 67f2e4c8f..3f6e1ab0c 100644 --- a/channels/audin/server/audin.c +++ b/channels/audin/server/audin.c @@ -36,6 +36,7 @@ #include #include +#define TAG CHANNELS_TAG("audin.server") #define MSG_SNDIN_VERSION 0x01 #define MSG_SNDIN_FORMATS 0x02 #define MSG_SNDIN_OPEN 0x03 @@ -386,7 +387,7 @@ static void* audin_server_thread_func(void* arg) break; default: - CLOG_ERR( "audin_server_thread_func: unknown MessageId %d\n", MessageId); + WLog_ERR(TAG, "audin_server_thread_func: unknown MessageId %d\n", MessageId); break; } } diff --git a/channels/cliprdr/client/cliprdr_format.c b/channels/cliprdr/client/cliprdr_format.c index 1453f1cda..495bfa9d7 100644 --- a/channels/cliprdr/client/cliprdr_format.c +++ b/channels/cliprdr/client/cliprdr_format.c @@ -140,7 +140,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT } if (num_formats * 36 != length) - CLOG_ERR("dataLen %d not divided by 36!", length); + WLog_ERR(TAG, "dataLen %d not divided by 36!", length); ascii = (flags & CB_ASCII_NAMES) ? TRUE : FALSE; diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index b612289cc..3642c7ddd 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -30,15 +30,12 @@ #include #include -#include #include #include #include "cliprdr_main.h" #include "cliprdr_format.h" -#define TAG CHANNELS_TAG("cliprdr.client") - #ifdef WITH_DEBUG_CLIPRDR static const char* const CB_MSG_TYPE_STRINGS[] = { @@ -86,7 +83,7 @@ void cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s) Stream_Write_UINT32(s, dataLen); Stream_SetPosition(s, pos); #ifdef WITH_DEBUG_CLIPRDR - CLOG_DBG("Cliprdr Sending (%d bytes)\n", dataLen + 8); + WLog_DBG(TAG, "Cliprdr Sending (%d bytes)", dataLen + 8); winpr_HexDump(TAG, WLOG_DEBUG, Stream_Buffer(s), dataLen + 8); #endif svc_plugin_send((rdpSvcPlugin*) cliprdr, s); @@ -99,21 +96,21 @@ static void cliprdr_process_connect(rdpSvcPlugin* plugin) void cliprdr_print_general_capability_flags(UINT32 flags) { - CLOG_ERR("generalFlags (0x%08X) {\n", flags); + WLog_INFO(TAG, "generalFlags (0x%08X) {", flags); if (flags & CB_USE_LONG_FORMAT_NAMES) - CLOG_ERR("\tCB_USE_LONG_FORMAT_NAMES\n"); + WLog_INFO(TAG, "\tCB_USE_LONG_FORMAT_NAMES"); if (flags & CB_STREAM_FILECLIP_ENABLED) - CLOG_ERR("\tCB_STREAM_FILECLIP_ENABLED\n"); + WLog_INFO(TAG, "\tCB_STREAM_FILECLIP_ENABLED"); if (flags & CB_FILECLIP_NO_FILE_PATHS) - CLOG_ERR("\tCB_FILECLIP_NO_FILE_PATHS\n"); + WLog_INFO(TAG, "\tCB_FILECLIP_NO_FILE_PATHS"); if (flags & CB_CAN_LOCK_CLIPDATA) - CLOG_ERR("\tCB_CAN_LOCK_CLIPDATA\n"); + WLog_INFO(TAG, "\tCB_CAN_LOCK_CLIPDATA"); - CLOG_ERR("}\n"); + WLog_INFO(TAG, "}"); } static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, wStream* s) @@ -187,7 +184,7 @@ static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, wStream* s, UINT16 cliprdr_process_general_capability(cliprdr, s); break; default: - CLOG_ERR("unknown cliprdr capability set: %d", capabilitySetType); + WLog_ERR(TAG, "unknown cliprdr capability set: %d", capabilitySetType); break; } } @@ -338,7 +335,7 @@ static void cliprdr_process_receive(rdpSvcPlugin* plugin, wStream* s) cliprdr_process_unlock_clipdata(cliprdr, s, dataLen, msgFlags); break; default: - CLOG_ERR("unknown msgType %d", msgType); + WLog_ERR(TAG, "unknown msgType %d", msgType); break; } } @@ -433,7 +430,7 @@ static void cliprdr_process_event(rdpSvcPlugin* plugin, wMessage* event) cliprdr_process_tempdir_event((cliprdrPlugin*) plugin, (RDP_CB_TEMPDIR_EVENT*) event); break; default: - CLOG_ERR("unknown event type %d", GetMessageType(event->id)); + WLog_ERR(TAG, "unknown event type %d", GetMessageType(event->id)); break; } diff --git a/channels/cliprdr/client/cliprdr_main.h b/channels/cliprdr/client/cliprdr_main.h index 29cc9b08d..4a8d60ae2 100644 --- a/channels/cliprdr/client/cliprdr_main.h +++ b/channels/cliprdr/client/cliprdr_main.h @@ -26,6 +26,8 @@ #include #include +#define TAG CHANNELS_TAG("cliprdr.client") + struct cliprdr_plugin { rdpSvcPlugin plugin; @@ -45,9 +47,9 @@ void cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* data_out); CliprdrClientContext* cliprdr_get_client_interface(cliprdrPlugin* cliprdr); #ifdef WITH_DEBUG_CLIPRDR -#define DEBUG_CLIPRDR(fmt, ...) CLOG_CLASS(CLIPRDR, fmt, ## __VA_ARGS__) +#define DEBUG_CLIPRDR(fmt, ...) WLog_DBG(TAG, fmt, ## __VA_ARGS__) #else -#define DEBUG_CLIPRDR(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__) +#define DEBUG_CLIPRDR(fmt, ...) do { } while (0) #endif #endif /* __CLIPRDR_MAIN_H */ diff --git a/channels/cliprdr/server/cliprdr_main.c b/channels/cliprdr/server/cliprdr_main.c index a72f014a4..4d20e4ada 100644 --- a/channels/cliprdr/server/cliprdr_main.c +++ b/channels/cliprdr/server/cliprdr_main.c @@ -70,9 +70,7 @@ static int cliprdr_server_send_capabilities(CliprdrServerContext* context) UINT32 generalFlags; CLIPRDR_HEADER header; ULONG written; - - CLOG_DBG("CliprdrServerSendCapabilities\n"); - + WLog_DBG(TAG, "CliprdrServerSendCapabilities"); header.msgType = CB_CLIP_CAPS; header.msgFlags = 0; header.dataLen = 16; @@ -111,9 +109,7 @@ static int cliprdr_server_send_monitor_ready(CliprdrServerContext* context) BOOL status; CLIPRDR_HEADER header; ULONG written; - - CLOG_DBG("CliprdrServerSendMonitorReady\n"); - + WLog_DBG(TAG, "CliprdrServerSendMonitorReady"); header.msgType = CB_MONITOR_READY; header.msgFlags = 0; header.dataLen = 0; @@ -139,9 +135,7 @@ static int cliprdr_server_send_format_list_response(CliprdrServerContext* contex BOOL status; CLIPRDR_HEADER header; ULONG written; - - CLOG_DBG("CliprdrServerSendFormatListResponse\n"); - + WLog_DBG(TAG, "CliprdrServerSendFormatListResponse"); header.msgType = CB_FORMAT_LIST_RESPONSE; header.msgFlags = CB_RESPONSE_OK; header.dataLen = 0; @@ -206,10 +200,8 @@ static int cliprdr_server_receive_temporary_directory(CliprdrServerContext* cont return -1; ConvertFromUnicode(CP_UTF8, 0, wszTempDir, -1, - &(context->priv->ClientTemporaryDirectory), 0, NULL, NULL); - - CLOG_DBG("ClientTemporaryDirectory: %s\n", context->priv->ClientTemporaryDirectory); - + &(context->priv->ClientTemporaryDirectory), 0, NULL, NULL); + WLog_DBG(TAG, "ClientTemporaryDirectory: %s", context->priv->ClientTemporaryDirectory); return 0; } @@ -252,9 +244,7 @@ static int cliprdr_server_receive_long_format_list(CliprdrServerContext* context WCHAR* end; int length; int position; - - CLOG_DBG("%s\n", __FUNCTION__); - + WLog_DBG(TAG, ""); position = Stream_GetPosition(s); Stream_SetPosition(s, Stream_Length(s)); end = (WCHAR*) Stream_Pointer(s); @@ -306,10 +296,10 @@ static int cliprdr_server_receive_long_format_list(CliprdrServerContext* context for (i = 0; i < context->priv->ClientFormatNameCount; i++) { - CLOG_DBG("Format %d: Id: 0x%04X Name: %s Length: %d\n", i, - context->priv->ClientFormatNames[i].id, - context->priv->ClientFormatNames[i].name, - context->priv->ClientFormatNames[i].length); + WLog_DBG(TAG, "Format %d: Id: 0x%04X Name: %s Length: %d", i, + context->priv->ClientFormatNames[i].id, + context->priv->ClientFormatNames[i].name, + context->priv->ClientFormatNames[i].length); } return 0; @@ -317,7 +307,7 @@ static int cliprdr_server_receive_long_format_list(CliprdrServerContext* context static int cliprdr_server_receive_short_format_list(CliprdrServerContext* context, wStream* s, CLIPRDR_HEADER* header) { - CLOG_DBG("%s: unimplemented\n", __FUNCTION__); + WLog_ERR(TAG, "%s: unimplemented"); return 0; } @@ -341,8 +331,8 @@ static int cliprdr_server_receive_format_list(CliprdrServerContext* context, wSt static int cliprdr_server_receive_pdu(CliprdrServerContext* context, wStream* s, CLIPRDR_HEADER* header) { - CLOG_DBG("CliprdrServerReceivePdu: msgType: %d msgFlags: 0x%08X dataLen: %d\n", - header->msgType, header->msgFlags, header->dataLen); + WLog_DBG(TAG, "CliprdrServerReceivePdu: msgType: %d msgFlags: 0x%08X dataLen: %d", + header->msgType, header->msgFlags, header->dataLen); switch (header->msgType) { @@ -380,7 +370,7 @@ static int cliprdr_server_receive_pdu(CliprdrServerContext* context, wStream* s, break; default: - CLOG_DBG("Unexpected clipboard PDU type: %d\n", header->msgType); + WLog_DBG(TAG, "Unexpected clipboard PDU type: %d", header->msgType); break; } diff --git a/channels/cliprdr/server/cliprdr_main.h b/channels/cliprdr/server/cliprdr_main.h index 71165045b..fd026336b 100644 --- a/channels/cliprdr/server/cliprdr_main.h +++ b/channels/cliprdr/server/cliprdr_main.h @@ -25,7 +25,9 @@ #include #include +#include +#define TAG CHANNELS_TAG("cliprdr.server") #define CLIPRDR_HEADER_LENGTH 8 struct _cliprdr_server_private diff --git a/channels/disp/client/disp_main.c b/channels/disp/client/disp_main.c index 283ef4b9d..bb378860a 100644 --- a/channels/disp/client/disp_main.c +++ b/channels/disp/client/disp_main.c @@ -101,7 +101,7 @@ int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback Stream_Write_UINT32(s, NumMonitors); /* NumMonitors (4 bytes) */ - //CLOG_ERR( "NumMonitors: %d\n", NumMonitors); + //WLog_ERR(TAG, "NumMonitors: %d\n", NumMonitors); for (index = 0; index < NumMonitors; index++) { @@ -125,14 +125,14 @@ int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback Stream_Write_UINT32(s, Monitors[index].DeviceScaleFactor); /* DeviceScaleFactor (4 bytes) */ #if 0 - CLOG_ERR( "\t: Flags: 0x%04X\n", Monitors[index].Flags); - CLOG_ERR( "\t: Left: %d\n", Monitors[index].Left); - CLOG_ERR( "\t: Top: %d\n", Monitors[index].Top); - CLOG_ERR( "\t: Width: %d\n", Monitors[index].Width); - CLOG_ERR( "\t: Height: %d\n", Monitors[index].Height); - CLOG_ERR( "\t: PhysicalWidth: %d\n", Monitors[index].PhysicalWidth); - CLOG_ERR( "\t: PhysicalHeight: %d\n", Monitors[index].PhysicalHeight); - CLOG_ERR( "\t: Orientation: %d\n", Monitors[index].Orientation); + WLog_ERR(TAG, "\t: Flags: 0x%04X\n", Monitors[index].Flags); + WLog_ERR(TAG, "\t: Left: %d\n", Monitors[index].Left); + WLog_ERR(TAG, "\t: Top: %d\n", Monitors[index].Top); + WLog_ERR(TAG, "\t: Width: %d\n", Monitors[index].Width); + WLog_ERR(TAG, "\t: Height: %d\n", Monitors[index].Height); + WLog_ERR(TAG, "\t: PhysicalWidth: %d\n", Monitors[index].PhysicalWidth); + WLog_ERR(TAG, "\t: PhysicalHeight: %d\n", Monitors[index].PhysicalHeight); + WLog_ERR(TAG, "\t: Orientation: %d\n", Monitors[index].Orientation); #endif } @@ -157,8 +157,7 @@ int disp_recv_display_control_caps_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* Stream_Read_UINT32(s, disp->MaxNumMonitors); /* MaxNumMonitors (4 bytes) */ Stream_Read_UINT32(s, disp->MaxMonitorAreaFactorA); /* MaxMonitorAreaFactorA (4 bytes) */ Stream_Read_UINT32(s, disp->MaxMonitorAreaFactorB); /* MaxMonitorAreaFactorB (4 bytes) */ - - //CLOG_ERR( "DisplayControlCapsPdu: MaxNumMonitors: %d MaxMonitorWidth: %d MaxMonitorHeight: %d\n", + //WLog_ERR(TAG, "DisplayControlCapsPdu: MaxNumMonitors: %d MaxMonitorWidth: %d MaxMonitorHeight: %d\n", // disp->MaxNumMonitors, disp->MaxMonitorWidth, disp->MaxMonitorHeight); return 0; @@ -175,7 +174,7 @@ int disp_recv_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* s) Stream_Read_UINT32(s, type); /* Type (4 bytes) */ Stream_Read_UINT32(s, length); /* Length (4 bytes) */ - //CLOG_ERR( "Type: %d Length: %d\n", type, length); + //WLog_ERR(TAG, "Type: %d Length: %d\n", type, length); switch (type) { diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index 3b885097d..2662f8be7 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -130,7 +130,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UIN if (status != CHANNEL_RC_OK) { drdynvc->channel_error = status; - CLOG_ERR("VirtualChannelWrite failed %d", status); + WLog_ERR(TAG, "VirtualChannelWrite failed %d", status); return 1; } @@ -145,7 +145,7 @@ int drdynvc_push_event(drdynvcPlugin* drdynvc, wMessage* event) if (status != CHANNEL_RC_OK) { - CLOG_ERR("pVirtualChannelEventPush failed %d", status); + WLog_ERR(TAG, "pVirtualChannelEventPush failed %d", status); return 1; } @@ -165,7 +165,7 @@ static int drdynvc_send_capability_response(drdynvcPlugin* drdynvc) if (status != CHANNEL_RC_OK) { - CLOG_ERR("VirtualChannelWrite failed %d", status); + WLog_ERR(TAG, "VirtualChannelWrite failed %d", status); return 1; } @@ -270,7 +270,7 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb if (status != CHANNEL_RC_OK) { - CLOG_ERR("VirtualChannelWrite failed %d", status); + WLog_ERR(TAG, "VirtualChannelWrite failed %d", status); return 1; } @@ -329,7 +329,7 @@ static int drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cbC if (error != CHANNEL_RC_OK) { - CLOG_ERR("VirtualChannelWrite failed %d", error); + WLog_ERR(TAG, "VirtualChannelWrite failed %d", error); return 1; } @@ -376,7 +376,7 @@ static void drdynvc_process_receive(rdpSvcPlugin* plugin, wStream* s) break; default: - CLOG_ERR("unknown drdynvc cmd 0x%x", Cmd); + WLog_ERR(TAG, "unknown drdynvc cmd 0x%x", Cmd); break; } } diff --git a/channels/drdynvc/client/drdynvc_types.h b/channels/drdynvc/client/drdynvc_types.h index 2010cab65..3160b8f35 100644 --- a/channels/drdynvc/client/drdynvc_types.h +++ b/channels/drdynvc/client/drdynvc_types.h @@ -28,10 +28,11 @@ #include #include +#define TAG CHANNELS_TAG("dvcman.client") #ifdef WITH_DEBUG_DVC -#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) WLog_DBG(TAG, fmt, ## __VA_ARGS__) #else -#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) do { } while (0) #endif #endif diff --git a/channels/drdynvc/client/dvcman.c b/channels/drdynvc/client/dvcman.c index f9e4873b8..6849ef9c7 100644 --- a/channels/drdynvc/client/dvcman.c +++ b/channels/drdynvc/client/dvcman.c @@ -71,7 +71,7 @@ static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr, } else { - CLOG_ERR("Maximum DVC listener number reached."); + WLog_ERR(TAG, "Maximum DVC listener number reached."); return 1; } } @@ -89,7 +89,7 @@ static int dvcman_push_event(IWTSVirtualChannelManager* pChannelMgr, wMessage* p } else { - CLOG_ERR("event_type %d push failed.", GetMessageType(pEvent->id)); + WLog_ERR(TAG, "event_type %d push failed.", GetMessageType(pEvent->id)); } return status; @@ -108,7 +108,7 @@ static int dvcman_register_plugin(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const cha } else { - CLOG_ERR("Maximum DVC plugin number reached."); + WLog_ERR(TAG, "Maximum DVC plugin number reached."); return 1; } } @@ -217,9 +217,7 @@ int dvcman_load_addin(IWTSVirtualChannelManager* pChannelMgr, ADDIN_ARGV* args, { DVCMAN_ENTRY_POINTS entryPoints; PDVC_PLUGIN_ENTRY pDVCPluginEntry = NULL; - - CLOG_ERR( "Loading Dynamic Virtual Channel %s\n", args->argv[0]); - + WLog_ERR(TAG, "Loading Dynamic Virtual Channel %s", args->argv[0]); pDVCPluginEntry = (PDVC_PLUGIN_ENTRY) freerdp_load_channel_addin_entry(args->argv[0], NULL, NULL, FREERDP_ADDIN_CHANNEL_DYNAMIC); @@ -388,8 +386,7 @@ int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 Channel } else { - CLOG_ERR("channel rejected by plugin"); - + WLog_ERR(TAG, "channel rejected by plugin"); free(channel); return 1; } @@ -409,7 +406,7 @@ int dvcman_open_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId if (!channel) { - CLOG_ERR("ChannelId %d not found!", ChannelId); + WLog_ERR(TAG, "ChannelId %d not found!", ChannelId); return 1; } @@ -434,7 +431,7 @@ int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelI if (!channel) { - CLOG_ERR("ChannelId %d not found!", ChannelId); + WLog_ERR(TAG, "ChannelId %d not found!", ChannelId); return 1; } @@ -468,7 +465,7 @@ int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, UI if (!channel) { - CLOG_ERR("ChannelId %d not found!", ChannelId); + WLog_ERR(TAG, "ChannelId %d not found!", ChannelId); return 1; } @@ -491,7 +488,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 C if (!channel) { - CLOG_ERR("ChannelId %d not found!", ChannelId); + WLog_ERR(TAG, "ChannelId %d not found!", ChannelId); return 1; } @@ -500,7 +497,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 C /* Fragmented data */ if (Stream_GetPosition(channel->dvc_data) + dataSize > (UINT32) Stream_Capacity(channel->dvc_data)) { - CLOG_ERR("data exceeding declared length!"); + WLog_ERR(TAG, "data exceeding declared length!"); Stream_Release(channel->dvc_data); channel->dvc_data = NULL; return 1; diff --git a/channels/echo/client/echo_main.h b/channels/echo/client/echo_main.h index fc7d88de6..1ce6a1f1d 100644 --- a/channels/echo/client/echo_main.h +++ b/channels/echo/client/echo_main.h @@ -29,10 +29,11 @@ #include #include +#define DVC_TAG CHANNELS_TAG("echo.client") #ifdef WITH_DEBUG_DVC -#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) WLog_DBG(DVC_TAG, fmt, ## __VA_ARGS__) #else -#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) do { } while (0) #endif #endif /* __ECHO_MAIN_H */ diff --git a/channels/encomsp/client/encomsp_main.c b/channels/encomsp/client/encomsp_main.c index 4752c028d..cb5d67c6b 100644 --- a/channels/encomsp/client/encomsp_main.c +++ b/channels/encomsp/client/encomsp_main.c @@ -83,7 +83,7 @@ int encomsp_virtual_channel_write(encomspPlugin* encomsp, wStream* s) return -1; #if 0 - printf("EncomspWrite (%d)\n", Stream_Length(s)); + WLog_INFO(TAG, "EncomspWrite (%d)", Stream_Length(s)); winpr_HexDump(Stream_Buffer(s), Stream_Length(s)); #endif @@ -92,7 +92,7 @@ int encomsp_virtual_channel_write(encomspPlugin* encomsp, wStream* s) if (status != CHANNEL_RC_OK) { - fprintf(stderr, "encomsp_virtual_channel_write: VirtualChannelWrite failed %d\n", status); + WLog_ERR(TAG, "encomsp_virtual_channel_write: VirtualChannelWrite failed %d", status); return -1; } @@ -591,7 +591,7 @@ static int encomsp_process_receive(encomspPlugin* encomsp, wStream* s) if (encomsp_read_header(s, &header) < 0) return -1; - //CLOG_DBG("EncomspReceive: Type: %d Length: %d\n", header.Type, header.Length); + //WLog_DBG(TAG, "EncomspReceive: Type: %d Length: %d", header.Type, header.Length); switch (header.Type) { @@ -723,7 +723,7 @@ int encomsp_send(encomspPlugin* encomsp, wStream* s) if (status != CHANNEL_RC_OK) { Stream_Free(s, TRUE); - CLOG_ERR( "encomsp_send: VirtualChannelWrite failed %d\n", status); + WLog_ERR(TAG, "encomsp_send: VirtualChannelWrite failed %d", status); } return status; @@ -755,7 +755,7 @@ static void encomsp_virtual_channel_event_data_received(encomspPlugin* encomsp, { if (Stream_Capacity(data_in) != Stream_GetPosition(data_in)) { - CLOG_ERR( "encomsp_plugin_process_received: read error\n"); + WLog_ERR(TAG, "encomsp_plugin_process_received: read error"); } encomsp->data_in = NULL; @@ -775,7 +775,7 @@ static VOID VCAPITYPE encomsp_virtual_channel_open_event(DWORD openHandle, UINT if (!encomsp) { - CLOG_ERR( "encomsp_virtual_channel_open_event: error no match\n"); + WLog_ERR(TAG, "encomsp_virtual_channel_open_event: error no match"); return; } @@ -835,7 +835,7 @@ static void encomsp_virtual_channel_event_connected(encomspPlugin* encomsp, LPVO if (status != CHANNEL_RC_OK) { - CLOG_ERR( "encomsp_virtual_channel_event_connected: open failed: status: %d\n", status); + WLog_ERR(TAG, "encomsp_virtual_channel_event_connected: open failed: status: %d", status); return; } @@ -873,7 +873,7 @@ static VOID VCAPITYPE encomsp_virtual_channel_init_event(LPVOID pInitHandle, UIN if (!encomsp) { - CLOG_ERR( "encomsp_virtual_channel_init_event: error no match\n"); + WLog_ERR(TAG, "encomsp_virtual_channel_init_event: error no match"); return; } diff --git a/channels/encomsp/client/encomsp_main.h b/channels/encomsp/client/encomsp_main.h index d67c92fac..3da59b883 100644 --- a/channels/encomsp/client/encomsp_main.h +++ b/channels/encomsp/client/encomsp_main.h @@ -27,11 +27,14 @@ #include #include +#include #include #include #include +#define TAG CHANNELS_TAG("encomsp.client") + struct encomsp_plugin { CHANNEL_DEF channelDef; diff --git a/channels/encomsp/server/encomsp_main.c b/channels/encomsp/server/encomsp_main.c index 18e8c44bf..b3689f598 100644 --- a/channels/encomsp/server/encomsp_main.c +++ b/channels/encomsp/server/encomsp_main.c @@ -25,8 +25,12 @@ #include #include +#include + #include "encomsp_main.h" +#define TAG CHANNELS_TAG("encomsp.server") + static int encomsp_read_header(wStream* s, ENCOMSP_ORDER_HEADER* header) { if (Stream_GetRemainingLength(s) < ENCOMSP_ORDER_HEADER_SIZE) @@ -116,7 +120,7 @@ static int encomsp_server_receive_pdu(EncomspServerContext* context, wStream* s) if (encomsp_read_header(s, &header) < 0) return -1; - printf("EncomspReceive: Type: %d Length: %d\n", header.Type, header.Length); + WLog_INFO(TAG, "EncomspReceive: Type: %d Length: %d", header.Type, header.Length); switch (header.Type) { diff --git a/channels/printer/client/printer_win.h b/channels/printer/client/printer_win.h index 68c9e7995..7f0660af5 100644 --- a/channels/printer/client/printer_win.h +++ b/channels/printer/client/printer_win.h @@ -20,17 +20,20 @@ #ifndef __PRINTER_WIN_H #define __PRINTER_WIN_H +#include + rdpPrinterDriver* printer_win_get_driver(void); +#define PRINTER_TAG CHANNELS_TAG("printer.client") #ifdef WITH_DEBUG_WINPR -#define DEBUG_WINPR(fmt, ...) CLOG_CLASS(WINPR, fmt, ## __VA_ARGS__) +#define DEBUG_WINPR(fmt, ...) WLog_DBG(PRINTER_TAG, fmt, ## __VA_ARGS__) #else -#define DEBUG_WINPR(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__) +#define DEBUG_WINPR(fmt, ...) do { } while (0) #endif #endif #ifdef WIN32 #define snprintf _snprintf -#endif +#endif diff --git a/channels/rail/client/rail_orders.c b/channels/rail/client/rail_orders.c index 6e5e0428c..eb3b371c5 100644 --- a/channels/rail/client/rail_orders.c +++ b/channels/rail/client/rail_orders.c @@ -523,7 +523,7 @@ BOOL rail_order_recv(railPlugin* rail, wStream* s) } default: - CLOG_ERR( "Unknown RAIL PDU order reveived."); + WLog_ERR(TAG, "Unknown RAIL PDU order reveived."); break; } diff --git a/channels/rail/client/rail_orders.h b/channels/rail/client/rail_orders.h index 217c967d4..78e6a0762 100644 --- a/channels/rail/client/rail_orders.h +++ b/channels/rail/client/rail_orders.h @@ -21,8 +21,11 @@ #ifndef __RAIL_ORDERS_H #define __RAIL_ORDERS_H +#include #include "rail_main.h" +#define TAG CHANNELS_TAG("rail.client") + BOOL rail_read_server_exec_result_order(wStream* s, RAIL_EXEC_RESULT_ORDER* exec_result); BOOL rail_read_server_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam); BOOL rail_read_server_minmaxinfo_order(wStream* s, RAIL_MINMAXINFO_ORDER* minmaxinfo); diff --git a/channels/rdpdr/client/devman.c b/channels/rdpdr/client/devman.c index 784117499..35fb742b9 100644 --- a/channels/rdpdr/client/devman.c +++ b/channels/rdpdr/client/devman.c @@ -123,7 +123,7 @@ BOOL devman_load_device_service(DEVMAN* devman, RDPDR_DEVICE* device) if (!ServiceName) return FALSE; - CLOG_ERR( "Loading device service %s (static)\n", ServiceName); + WLog_INFO(TAG, "Loading device service %s (static)", ServiceName); entry = (PDEVICE_SERVICE_ENTRY) freerdp_load_channel_addin_entry(ServiceName, NULL, "DeviceServiceEntry", 0); if (!entry) diff --git a/channels/rdpdr/client/rdpdr_main.c b/channels/rdpdr/client/rdpdr_main.c index 4d053c14e..14ee6d78f 100644 --- a/channels/rdpdr/client/rdpdr_main.c +++ b/channels/rdpdr/client/rdpdr_main.c @@ -452,7 +452,7 @@ static void* drive_hotplug_thread_func(void* arg) if (mfd < 0) { - CLOG_ERR( "ERROR: Unable to open /proc/mounts."); + WLog_ERR(TAG, "ERROR: Unable to open /proc/mounts."); return NULL; } @@ -662,9 +662,8 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use Stream_Write(s, Stream_Buffer(device->data), data_len); count++; - - CLOG_ERR( "registered device #%d: %s (type=%d id=%d)\n", - count, device->name, device->type, device->id); + WLog_INFO(TAG, "registered device #%d: %s (type=%d id=%d)\n", + count, device->name, device->type, device->id); } } @@ -846,7 +845,7 @@ int rdpdr_send(rdpdrPlugin* rdpdr, wStream* s) if (status != CHANNEL_RC_OK) { Stream_Free(s, TRUE); - CLOG_ERR( "rdpdr_send: VirtualChannelWrite failed %d\n", status); + WLog_ERR(TAG, "rdpdr_send: VirtualChannelWrite failed %d\n", status); } return status; @@ -884,7 +883,7 @@ static void rdpdr_virtual_channel_event_data_received(rdpdrPlugin* rdpdr, { if (Stream_Capacity(data_in) != Stream_GetPosition(data_in)) { - CLOG_ERR( "svc_plugin_process_received: read error\n"); + WLog_ERR(TAG, "svc_plugin_process_received: read error\n"); } rdpdr->data_in = NULL; @@ -904,7 +903,7 @@ static VOID VCAPITYPE rdpdr_virtual_channel_open_event(DWORD openHandle, UINT ev if (!rdpdr) { - CLOG_ERR( "rdpdr_virtual_channel_open_event: error no match\n"); + WLog_ERR(TAG, "rdpdr_virtual_channel_open_event: error no match\n"); return; } @@ -964,7 +963,7 @@ static void rdpdr_virtual_channel_event_connected(rdpdrPlugin* rdpdr, LPVOID pDa if (status != CHANNEL_RC_OK) { - CLOG_ERR( "rdpdr_virtual_channel_event_connected: open failed: status: %d\n", status); + WLog_ERR(TAG, "rdpdr_virtual_channel_event_connected: open failed: status: %d\n", status); return; } @@ -1010,7 +1009,7 @@ static VOID VCAPITYPE rdpdr_virtual_channel_init_event(LPVOID pInitHandle, UINT if (!rdpdr) { - CLOG_ERR( "rdpdr_virtual_channel_init_event: error no match\n"); + WLog_ERR(TAG, "rdpdr_virtual_channel_init_event: error no match\n"); return; } diff --git a/channels/rdpdr/client/rdpdr_main.h b/channels/rdpdr/client/rdpdr_main.h index c29846c80..f74a135f4 100644 --- a/channels/rdpdr/client/rdpdr_main.h +++ b/channels/rdpdr/client/rdpdr_main.h @@ -32,6 +32,9 @@ #include #include +#include + +#define TAG CHANNELS_TAG("rdprd.client") typedef struct rdpdr_plugin rdpdrPlugin; diff --git a/channels/rdpdr/server/rdpdr_main.c b/channels/rdpdr/server/rdpdr_main.c index 9c342fa08..71aab4f75 100644 --- a/channels/rdpdr/server/rdpdr_main.c +++ b/channels/rdpdr/server/rdpdr_main.c @@ -38,7 +38,7 @@ static int rdpdr_server_send_announce_request(RdpdrServerContext* context) BOOL status; RDPDR_HEADER header; ULONG written; - CLOG_DBG("RdpdrServerSendAnnounceRequest\n"); + WLog_DBG(TAG, "RdpdrServerSendAnnounceRequest"); header.Component = RDPDR_CTYP_CORE; header.PacketId = PAKID_CORE_SERVER_ANNOUNCE; s = Stream_New(NULL, RDPDR_HEADER_LENGTH + 8); @@ -61,7 +61,7 @@ static int rdpdr_server_receive_announce_response(RdpdrServerContext* context, w Stream_Read_UINT16(s, VersionMajor); /* VersionMajor (2 bytes) */ Stream_Read_UINT16(s, VersionMinor); /* VersionMinor (2 bytes) */ Stream_Read_UINT32(s, ClientId); /* ClientId (4 bytes) */ - CLOG_DBG("Client Announce Response: VersionMajor: 0x%04X VersionMinor: 0x%04X ClientId: 0x%04X\n", + WLog_DBG(TAG, "Client Announce Response: VersionMajor: 0x%04X VersionMinor: 0x%04X ClientId: 0x%04X", VersionMajor, VersionMinor, ClientId); context->priv->ClientId = ClientId; return 0; @@ -97,7 +97,7 @@ static int rdpdr_server_receive_client_name_request(RdpdrServerContext* context, } Stream_Seek(s, ComputerNameLen); - CLOG_DBG("ClientComputerName: %s\n", context->priv->ClientComputerName); + WLog_DBG(TAG, "ClientComputerName: %s", context->priv->ClientComputerName); return 0; } @@ -262,7 +262,7 @@ static int rdpdr_server_send_core_capability_request(RdpdrServerContext* context RDPDR_HEADER header; UINT16 numCapabilities; ULONG written; - CLOG_DBG("RdpdrServerSendCoreCapabilityRequest\n"); + WLog_DBG(TAG, "RdpdrServerSendCoreCapabilityRequest"); header.Component = RDPDR_CTYP_CORE; header.PacketId = PAKID_CORE_SERVER_CAPABILITY; numCapabilities = 5; @@ -317,7 +317,7 @@ static int rdpdr_server_receive_core_capability_response(RdpdrServerContext* con break; default: - CLOG_DBG("Unknown capabilityType %d\n", capabilityHeader.CapabilityType); + WLog_DBG(TAG, "Unknown capabilityType %d", capabilityHeader.CapabilityType); Stream_Seek(s, capabilityHeader.CapabilityLength - RDPDR_CAPABILITY_HEADER_LENGTH); break; } @@ -332,7 +332,7 @@ static int rdpdr_server_send_client_id_confirm(RdpdrServerContext* context) BOOL status; RDPDR_HEADER header; ULONG written; - CLOG_DBG("RdpdrServerSendClientIdConfirm\n"); + WLog_DBG(TAG, "RdpdrServerSendClientIdConfirm"); header.Component = RDPDR_CTYP_CORE; header.PacketId = PAKID_CORE_CLIENTID_CONFIRM; s = Stream_New(NULL, RDPDR_HEADER_LENGTH + 8); @@ -357,7 +357,7 @@ static int rdpdr_server_receive_device_list_announce_request(RdpdrServerContext* UINT32 DeviceDataLength; PreferredDosName[8] = 0; Stream_Read_UINT32(s, DeviceCount); /* DeviceCount (4 bytes) */ - CLOG_DBG("%s: DeviceCount: %d\n", __FUNCTION__, DeviceCount); + WLog_DBG(TAG, "DeviceCount: %d", DeviceCount); for (i = 0; i < DeviceCount; i++) { @@ -365,7 +365,7 @@ static int rdpdr_server_receive_device_list_announce_request(RdpdrServerContext* Stream_Read_UINT32(s, DeviceId); /* DeviceId (4 bytes) */ Stream_Read(s, PreferredDosName, 8); /* PreferredDosName (8 bytes) */ Stream_Read_UINT32(s, DeviceDataLength); /* DeviceDataLength (4 bytes) */ - CLOG_DBG("Device %d Name: %s Id: 0x%04X DataLength: %d\n", + WLog_DBG(TAG, "Device %d Name: %s Id: 0x%04X DataLength: %d", i, PreferredDosName, DeviceId, DeviceDataLength); switch (DeviceId) @@ -401,7 +401,7 @@ static int rdpdr_server_send_user_logged_on(RdpdrServerContext* context) BOOL status; RDPDR_HEADER header; ULONG written; - CLOG_DBG("%s\n", __FUNCTION__); + WLog_DBG(TAG, "%s"); header.Component = RDPDR_CTYP_CORE; header.PacketId = PAKID_CORE_USER_LOGGEDON; s = Stream_New(NULL, RDPDR_HEADER_LENGTH); @@ -415,7 +415,7 @@ static int rdpdr_server_send_user_logged_on(RdpdrServerContext* context) static int rdpdr_server_receive_pdu(RdpdrServerContext* context, wStream* s, RDPDR_HEADER* header) { - CLOG_DBG("RdpdrServerReceivePdu: Component: 0x%04X PacketId: 0x%04X\n", + WLog_DBG(TAG, "RdpdrServerReceivePdu: Component: 0x%04X PacketId: 0x%04X", header->Component, header->PacketId); winpr_HexDump(TAG, WLOG_DEBUG, Stream_Buffer(s), Stream_Length(s)); @@ -477,7 +477,7 @@ static int rdpdr_server_receive_pdu(RdpdrServerContext* context, wStream* s, RDP } else { - CLOG_DBG("Unknown RDPDR_HEADER.Component: 0x%04X\n", header->Component); + WLog_WARN(TAG, "Unknown RDPDR_HEADER.Component: 0x%04X", header->Component); return -1; } diff --git a/channels/rdpei/client/rdpei_main.c b/channels/rdpei/client/rdpei_main.c index 46729f028..c8a153f7f 100644 --- a/channels/rdpei/client/rdpei_main.c +++ b/channels/rdpei/client/rdpei_main.c @@ -201,8 +201,8 @@ int rdpei_send_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s, UINT16 eventId, status = callback->channel->Write(callback->channel, (UINT32) Stream_Length(s), Stream_Buffer(s), NULL); #ifdef WITH_DEBUG_RDPEI - CLOG_ERR( "rdpei_send_pdu: eventId: %d (%s) length: %d status: %d\n", - eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength, status); + WLog_DBG(TAG, "rdpei_send_pdu: eventId: %d (%s) length: %d status: %d", + eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength, status); #endif return status; @@ -239,17 +239,22 @@ int rdpei_send_cs_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback) void rdpei_print_contact_flags(UINT32 contactFlags) { if (contactFlags & CONTACT_FLAG_DOWN) - CLOG_DBG(" CONTACT_FLAG_DOWN"); + WLog_DBG(TAG, " CONTACT_FLAG_DOWN"); + if (contactFlags & CONTACT_FLAG_UPDATE) - CLOG_DBG(" CONTACT_FLAG_UPDATE"); + WLog_DBG(TAG, " CONTACT_FLAG_UPDATE"); + if (contactFlags & CONTACT_FLAG_UP) - CLOG_DBG(" CONTACT_FLAG_UP"); + WLog_DBG(TAG, " CONTACT_FLAG_UP"); + if (contactFlags & CONTACT_FLAG_INRANGE) - CLOG_DBG(" CONTACT_FLAG_INRANGE"); + WLog_DBG(TAG, " CONTACT_FLAG_INRANGE"); + if (contactFlags & CONTACT_FLAG_INCONTACT) - CLOG_DBG(" CONTACT_FLAG_INCONTACT"); + WLog_DBG(TAG, " CONTACT_FLAG_INCONTACT"); + if (contactFlags & CONTACT_FLAG_CANCELED) - CLOG_DBG(" CONTACT_FLAG_CANCELED"); + WLog_DBG(TAG, " CONTACT_FLAG_CANCELED"); } int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame) @@ -259,8 +264,8 @@ int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame) RDPINPUT_CONTACT_DATA* contact; #ifdef WITH_DEBUG_RDPEI - CLOG_DBG("contactCount: %d\n", frame->contactCount); - CLOG_DBG("frameOffset: 0x%08X\n", (UINT32) frame->frameOffset); + WLog_DBG(TAG, "contactCount: %d", frame->contactCount); + WLog_DBG(TAG, "frameOffset: 0x%08X", (UINT32) frame->frameOffset); #endif rdpei_write_2byte_unsigned(s, frame->contactCount); /* contactCount (TWO_BYTE_UNSIGNED_INTEGER) */ @@ -284,13 +289,12 @@ int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame) contact->contactRectBottom = contact->y + rectSize; #ifdef WITH_DEBUG_RDPEI - CLOG_DBG("contact[%d].contactId: %d\n", index, contact->contactId); - CLOG_DBG("contact[%d].fieldsPresent: %d\n", index, contact->fieldsPresent); - CLOG_DBG("contact[%d].x: %d\n", index, contact->x); - CLOG_DBG("contact[%d].y: %d\n", index, contact->y); - CLOG_DBG("contact[%d].contactFlags: 0x%04X", index, contact->contactFlags); + WLog_DBG(TAG, "contact[%d].contactId: %d", index, contact->contactId); + WLog_DBG(TAG, "contact[%d].fieldsPresent: %d", index, contact->fieldsPresent); + WLog_DBG(TAG, "contact[%d].x: %d", index, contact->x); + WLog_DBG(TAG, "contact[%d].y: %d", index, contact->y); + WLog_DBG(TAG, "contact[%d].contactFlags: 0x%04X", index, contact->contactFlags); rdpei_print_contact_flags(contact->contactFlags); - CLOG_DBG("\n"); #endif Stream_Write_UINT8(s, contact->contactId); /* contactId (1 byte) */ @@ -371,7 +375,7 @@ int rdpei_recv_sc_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s) #if 0 if (protocolVersion != RDPINPUT_PROTOCOL_V10) { - CLOG_ERR( "Unknown [MS-RDPEI] protocolVersion: 0x%08X\n", protocolVersion); + WLog_ERR(TAG, "Unknown [MS-RDPEI] protocolVersion: 0x%08X", protocolVersion); return -1; } #endif @@ -408,8 +412,8 @@ int rdpei_recv_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s) Stream_Read_UINT32(s, pduLength); /* pduLength (4 bytes) */ #ifdef WITH_DEBUG_RDPEI - CLOG_ERR( "rdpei_recv_pdu: eventId: %d (%s) length: %d\n", - eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength); + WLog_ERR(TAG, "rdpei_recv_pdu: eventId: %d (%s) length: %d", + eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength); #endif switch (eventId) diff --git a/channels/rdpei/client/rdpei_main.h b/channels/rdpei/client/rdpei_main.h index 509517bb6..4da19ee84 100644 --- a/channels/rdpei/client/rdpei_main.h +++ b/channels/rdpei/client/rdpei_main.h @@ -31,6 +31,8 @@ #include +#define TAG CHANNELS_TAG("rdpei.client") + #define RDPINPUT_HEADER_LENGTH 6 /* Protocol Version */ @@ -100,9 +102,9 @@ struct _RDPINPUT_CONTACT_POINT typedef struct _RDPINPUT_CONTACT_POINT RDPINPUT_CONTACT_POINT; #ifdef WITH_DEBUG_DVC -#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) WLog_DBG(TAG, fmt, ## __VA_ARGS__) #else -#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) do { } while (0) #endif #endif /* FREERDP_CHANNEL_RDPEI_CLIENT_MAIN_H */ diff --git a/channels/rdpgfx/client/rdpgfx_codec.c b/channels/rdpgfx/client/rdpgfx_codec.c index d621eea42..cc02f3b4a 100644 --- a/channels/rdpgfx/client/rdpgfx_codec.c +++ b/channels/rdpgfx/client/rdpgfx_codec.c @@ -23,11 +23,14 @@ #include #include +#include #include "rdpgfx_common.h" #include "rdpgfx_codec.h" +#define TAG CHANNELS_TAG("rdpgfx.client") + int rdpgfx_decode_uncompressed(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd) { return 1; @@ -72,19 +75,14 @@ int rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s, RDPGFX_H264_METAB if (!meta->quantQualityVals) return -1; -#if 0 - printf("H264_METABLOCK: numRegionRects: %d\n", (int) meta->numRegionRects); -#endif + WLog_DBG(TAG, "H264_METABLOCK: numRegionRects: %d", (int) meta->numRegionRects); for (index = 0; index < meta->numRegionRects; index++) { regionRect = &(meta->regionRects[index]); rdpgfx_read_rect16(s, regionRect); - -#if 0 - printf("regionRects[%d]: left: %d top: %d right: %d bottom: %d\n", - index, regionRect->left, regionRect->top, regionRect->right, regionRect->bottom); -#endif + WLog_DBG(TAG, "regionRects[%d]: left: %d top: %d right: %d bottom: %d", + index, regionRect->left, regionRect->top, regionRect->right, regionRect->bottom); } if (Stream_GetRemainingLength(s) < (meta->numRegionRects * 2)) @@ -99,11 +97,8 @@ int rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s, RDPGFX_H264_METAB quantQualityVal->qp = quantQualityVal->qpVal & 0x3F; quantQualityVal->r = (quantQualityVal->qpVal >> 6) & 1; quantQualityVal->p = (quantQualityVal->qpVal >> 7) & 1; - -#if 0 - printf("quantQualityVals[%d]: qp: %d r: %d p: %d qualityVal: %d\n", - index, quantQualityVal->qp, quantQualityVal->r, quantQualityVal->p, quantQualityVal->qualityVal); -#endif + WLog_DBG(TAG, "quantQualityVals[%d]: qp: %d r: %d p: %d qualityVal: %d", + index, quantQualityVal->qp, quantQualityVal->r, quantQualityVal->p, quantQualityVal->qualityVal); } return 1; diff --git a/channels/rdpgfx/client/rdpgfx_main.c b/channels/rdpgfx/client/rdpgfx_main.c index 3b75fa789..7e0c518c8 100644 --- a/channels/rdpgfx/client/rdpgfx_main.c +++ b/channels/rdpgfx/client/rdpgfx_main.c @@ -816,8 +816,8 @@ int rdpgfx_recv_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s) if (status < 0) { - CLOG_ERR( "Error while parsing GFX cmdId: %s (0x%04X)\n", - rdpgfx_get_cmd_id_string(header.cmdId), header.cmdId); + WLog_ERR(TAG, "Error while parsing GFX cmdId: %s (0x%04X)", + rdpgfx_get_cmd_id_string(header.cmdId), header.cmdId); return -1; } @@ -825,9 +825,8 @@ int rdpgfx_recv_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s) if (end != (beg + header.pduLength)) { - CLOG_ERR( "Unexpected gfx pdu end: Actual: %d, Expected: %d\n", - end, (beg + header.pduLength)); - + WLog_ERR(TAG, "Unexpected gfx pdu end: Actual: %d, Expected: %d", + end, (beg + header.pduLength)); Stream_SetPosition(s, (beg + header.pduLength)); } @@ -847,7 +846,7 @@ static int rdpgfx_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, if (status < 0) { - CLOG_DBG("zgfx_decompress failure! status: %d\n", status); + WLog_DBG(TAG, "zgfx_decompress failure! status: %d", status); return 0; } @@ -1065,11 +1064,7 @@ int rdpgfx_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) if (!gfx) return -1; - gfx->log = WLog_Get("com.freerdp.gfx.client"); -#if 0 - WLog_SetLogLevel(gfx->log, WLOG_DEBUG); -#endif - + gfx->log = WLog_Get(TAG); gfx->settings = (rdpSettings*) pEntryPoints->GetRdpSettings(pEntryPoints); gfx->iface.Initialize = rdpgfx_plugin_initialize; diff --git a/channels/rdpgfx/client/rdpgfx_main.h b/channels/rdpgfx/client/rdpgfx_main.h index db897c93e..96d91b4b9 100644 --- a/channels/rdpgfx/client/rdpgfx_main.h +++ b/channels/rdpgfx/client/rdpgfx_main.h @@ -28,9 +28,11 @@ #include #include - +#include #include +#define TAG CHANNELS_TAG("rdpgfx.client") + struct _RDPGFX_CHANNEL_CALLBACK { IWTSVirtualChannelCallback iface; diff --git a/channels/rdpsnd/client/alsa/rdpsnd_alsa.c b/channels/rdpsnd/client/alsa/rdpsnd_alsa.c index 70ad41c76..569822349 100644 --- a/channels/rdpsnd/client/alsa/rdpsnd_alsa.c +++ b/channels/rdpsnd/client/alsa/rdpsnd_alsa.c @@ -68,7 +68,7 @@ struct rdpsnd_alsa_plugin #define SND_PCM_CHECK(_func, _status) \ if (_status < 0) \ { \ - CLOG_ERR( "%s: %d\n", _func, _status); \ + WLog_ERR(TAG, "%s: %d\n", _func, _status); \ return -1; \ } @@ -106,8 +106,8 @@ static int rdpsnd_alsa_set_hw_params(rdpsndAlsaPlugin* alsa) if (alsa->buffer_size > buffer_size_max) { - CLOG_ERR( "Warning: requested sound buffer size %d, got %d instead\n", - (int) alsa->buffer_size, (int) buffer_size_max); + WLog_ERR(TAG, "Warning: requested sound buffer size %d, got %d instead\n", + (int) alsa->buffer_size, (int) buffer_size_max); alsa->buffer_size = buffer_size_max; } @@ -262,7 +262,7 @@ static void rdpsnd_alsa_open_mixer(rdpsndAlsaPlugin* alsa) if (status < 0) { - CLOG_ERR("snd_mixer_open failed"); + WLog_ERR(TAG, "snd_mixer_open failed"); return; } @@ -270,7 +270,7 @@ static void rdpsnd_alsa_open_mixer(rdpsndAlsaPlugin* alsa) if (status < 0) { - CLOG_ERR("snd_mixer_attach failed"); + WLog_ERR(TAG, "snd_mixer_attach failed"); snd_mixer_close(alsa->mixer_handle); return; } @@ -279,7 +279,7 @@ static void rdpsnd_alsa_open_mixer(rdpsndAlsaPlugin* alsa) if (status < 0) { - CLOG_ERR("snd_mixer_selem_register failed"); + WLog_ERR(TAG, "snd_mixer_selem_register failed"); snd_mixer_close(alsa->mixer_handle); return; } @@ -288,7 +288,7 @@ static void rdpsnd_alsa_open_mixer(rdpsndAlsaPlugin* alsa) if (status < 0) { - CLOG_ERR("snd_mixer_load failed"); + WLog_ERR(TAG, "snd_mixer_load failed"); snd_mixer_close(alsa->mixer_handle); return; } @@ -310,7 +310,7 @@ static void rdpsnd_alsa_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format, i if (status < 0) { - CLOG_ERR("snd_pcm_open failed"); + WLog_ERR(TAG, "snd_pcm_open failed"); } else { @@ -579,7 +579,7 @@ static void rdpsnd_alsa_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave) } else if (status < 0) { - CLOG_ERR( "status: %d\n", status); + WLog_ERR(TAG, "status: %d\n", status); snd_pcm_close(alsa->pcm_handle); alsa->pcm_handle = NULL; rdpsnd_alsa_open((rdpsndDevicePlugin*) alsa, NULL, alsa->latency); @@ -599,8 +599,7 @@ static void rdpsnd_alsa_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave) wave->wLocalTimeB += wave->wPlaybackDelay; wave->wLatency = (UINT16) (wave->wLocalTimeB - wave->wLocalTimeA); wave->wTimeStampB = wave->wTimeStampA + wave->wLatency; - - //CLOG_ERR( "wTimeStampA: %d wTimeStampB: %d wLatency: %d\n", wave->wTimeStampA, wave->wTimeStampB, wave->wLatency); + //WLog_ERR(TAG, "wTimeStampA: %d wTimeStampB: %d wLatency: %d\n", wave->wTimeStampA, wave->wTimeStampB, wave->wLatency); } static COMMAND_LINE_ARGUMENT_A rdpsnd_alsa_args[] = diff --git a/channels/rdpsnd/client/ios/TPCircularBuffer.c b/channels/rdpsnd/client/ios/TPCircularBuffer.c index 44949e2e8..137ec789f 100644 --- a/channels/rdpsnd/client/ios/TPCircularBuffer.c +++ b/channels/rdpsnd/client/ios/TPCircularBuffer.c @@ -37,7 +37,7 @@ #define reportResult(result,operation) (_reportResult((result),(operation),__FILE__,__LINE__)) static inline bool _reportResult(kern_return_t result, const char *operation, const char* file, int line) { if ( result != ERR_SUCCESS ) { - CLOG_DBG("%s:%d: %s: %s\n", file, line, operation, mach_error_string(result)); + WLog_DBG(TAG, "%s:%d: %s: %s\n", file, line, operation, mach_error_string(result)); return false; } return true; @@ -108,7 +108,7 @@ bool TPCircularBufferInit(TPCircularBuffer *buffer, int length) { if ( virtualAddress != bufferAddress+buffer->length ) { // If the memory is not contiguous, clean up both allocated buffers and try again if ( retries-- == 0 ) { - CLOG_DBG("Couldn't map buffer memory to end of buffer\n"); + WLog_DBG(TAG, "Couldn't map buffer memory to end of buffer"); return false; } diff --git a/channels/rdpsnd/client/mac/rdpsnd_mac.c b/channels/rdpsnd/client/mac/rdpsnd_mac.c index 8bff23b0f..cfcfa51ad 100644 --- a/channels/rdpsnd/client/mac/rdpsnd_mac.c +++ b/channels/rdpsnd/client/mac/rdpsnd_mac.c @@ -121,7 +121,7 @@ static void rdpsnd_mac_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format, in if (status != 0) { - CLOG_ERR( "AudioQueueNewOutput failure\n"); + WLog_ERR(TAG, "AudioQueueNewOutput failure\n"); return; } @@ -135,7 +135,7 @@ static void rdpsnd_mac_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format, in if (status != 0) { - CLOG_DBG("AudioQueueGetProperty failure: kAudioQueueProperty_DecodeBufferSizeFrames\n"); + WLog_DBG(TAG, "AudioQueueGetProperty failure: kAudioQueueProperty_DecodeBufferSizeFrames\n"); } for (index = 0; index < MAC_AUDIO_QUEUE_NUM_BUFFERS; index++) @@ -144,7 +144,7 @@ static void rdpsnd_mac_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format, in if (status != 0) { - CLOG_ERR( "AudioQueueAllocateBuffer failed\n"); + WLog_ERR(TAG, "AudioQueueAllocateBuffer failed\n"); } } @@ -219,7 +219,7 @@ static void rdpsnd_mac_set_volume(rdpsndDevicePlugin* device, UINT32 value) if (status != 0) { - CLOG_ERR( "AudioQueueSetParameter kAudioQueueParam_Volume failed: %f\n", fVolume); + WLog_ERR(TAG, "AudioQueueSetParameter kAudioQueueParam_Volume failed: %f\n", fVolume); } } @@ -238,7 +238,7 @@ static void rdpsnd_mac_start(rdpsndDevicePlugin* device) if (status != 0) { - CLOG_ERR( "AudioQueueStart failed\n"); + WLog_ERR(TAG, "AudioQueueStart failed\n"); } mac->isPlaying = TRUE; diff --git a/channels/rdpsnd/client/opensles/rdpsnd_opensles.c b/channels/rdpsnd/client/opensles/rdpsnd_opensles.c index 7047e46e2..b709ad8f1 100644 --- a/channels/rdpsnd/client/opensles/rdpsnd_opensles.c +++ b/channels/rdpsnd/client/opensles/rdpsnd_opensles.c @@ -187,7 +187,7 @@ static void rdpsnd_opensles_open(rdpsndDevicePlugin* device, assert(opensles->stream); if (!opensles->stream) - CLOG_ERR("android_OpenAudioDevice failed"); + WLog_ERR(TAG, "android_OpenAudioDevice failed"); else rdpsnd_opensles_set_volume(device, opensles->volume); @@ -364,7 +364,7 @@ static void rdpsnd_opensles_play(rdpsndDevicePlugin* device, ret = android_AudioOut(opensles->stream, src.s, size / 2); if (ret < 0) - CLOG_ERR("android_AudioOut failed (%d)", ret); + WLog_ERR(TAG, "android_AudioOut failed (%d)", ret); } static void rdpsnd_opensles_start(rdpsndDevicePlugin* device) diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c index b7e9eaef5..06c7bde74 100644 --- a/channels/rdpsnd/client/rdpsnd_main.c +++ b/channels/rdpsnd/client/rdpsnd_main.c @@ -195,13 +195,12 @@ void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd) } #if 0 - CLOG_ERR( "Server "); + WLog_ERR(TAG, "Server "); rdpsnd_print_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats); - CLOG_ERR( "\n"); - - CLOG_ERR( "Client "); + WLog_ERR(TAG, "\n"); + WLog_ERR(TAG, "Client "); rdpsnd_print_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats); - CLOG_ERR( "\n"); + WLog_ERR(TAG, "\n"); #endif } @@ -544,7 +543,7 @@ static void rdpsnd_recv_pdu(rdpsndPlugin* rdpsnd, wStream* s) Stream_Seek_UINT8(s); /* bPad */ Stream_Read_UINT16(s, BodySize); - //CLOG_ERR( "msgType %d BodySize %d\n", msgType, BodySize); + //WLog_ERR(TAG, "msgType %d BodySize %d\n", msgType, BodySize); switch (msgType) { @@ -569,7 +568,7 @@ static void rdpsnd_recv_pdu(rdpsndPlugin* rdpsnd, wStream* s) break; default: - CLOG_ERR("unknown msgType %d", msgType); + WLog_ERR(TAG, "unknown msgType %d", msgType); break; } @@ -580,7 +579,7 @@ static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlug { if (rdpsnd->device) { - CLOG_ERR("existing device, abort."); + WLog_ERR(TAG, "existing device, abort."); return; } @@ -606,7 +605,7 @@ static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, AD if (entry(&entryPoints) != 0) { - CLOG_ERR("%s entry returns error.", name); + WLog_ERR(TAG, "%s entry returns error.", name); return FALSE; } @@ -795,7 +794,7 @@ static void rdpsnd_process_connect(rdpsndPlugin* rdpsnd) if (!rdpsnd->device) { - CLOG_ERR("no sound device."); + WLog_ERR(TAG, "no sound device."); return; } @@ -875,7 +874,7 @@ int rdpsnd_virtual_channel_write(rdpsndPlugin* rdpsnd, wStream* s) if (status != CHANNEL_RC_OK) { Stream_Free(s, TRUE); - CLOG_ERR( "rdpdr_virtual_channel_write: VirtualChannelWrite failed %d\n", status); + WLog_ERR(TAG, "rdpdr_virtual_channel_write: VirtualChannelWrite failed %d\n", status); } return status; @@ -907,7 +906,7 @@ static void rdpsnd_virtual_channel_event_data_received(rdpsndPlugin* plugin, { if (Stream_Capacity(s) != Stream_GetPosition(s)) { - CLOG_ERR( "rdpsnd_virtual_channel_event_data_received: read error\n"); + WLog_ERR(TAG, "rdpsnd_virtual_channel_event_data_received: read error\n"); } plugin->data_in = NULL; @@ -927,7 +926,7 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_open_event(DWORD openHandle, UINT e if (!plugin) { - CLOG_ERR( "rdpsnd_virtual_channel_open_event: error no match\n"); + WLog_ERR(TAG, "rdpsnd_virtual_channel_open_event: error no match\n"); return; } @@ -987,7 +986,7 @@ static void rdpsnd_virtual_channel_event_connected(rdpsndPlugin* plugin, LPVOID if (status != CHANNEL_RC_OK) { - CLOG_ERR( "rdpsnd_virtual_channel_event_connected: open failed: status: %d\n", status); + WLog_ERR(TAG, "rdpsnd_virtual_channel_event_connected: open failed: status: %d\n", status); return; } @@ -1040,7 +1039,7 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_init_event(LPVOID pInitHandle, UINT if (!plugin) { - CLOG_ERR( "rdpsnd_virtual_channel_init_event: error no match\n"); + WLog_ERR(TAG, "rdpsnd_virtual_channel_init_event: error no match\n"); return; } diff --git a/channels/rdpsnd/client/rdpsnd_main.h b/channels/rdpsnd/client/rdpsnd_main.h index 4b7cb472c..5b9c41358 100644 --- a/channels/rdpsnd/client/rdpsnd_main.h +++ b/channels/rdpsnd/client/rdpsnd_main.h @@ -25,9 +25,12 @@ #include #include #include +#include + +#define TAG CHANNELS_TAG("rdpsnd.client") #if defined(WITH_DEBUG_SND) -#define DEBUG_SND(fmt, ...) CLOG_CLASS("rdpsnd", fmt, ## __VA_ARGS__) +#define DEBUG_SND(fmt, ...) WLog_DBG(TAG, fmt, ## __VA_ARGS__) #else #define DEBUG_SND(fmt, ...) do { } while (0) #endif diff --git a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c index cb69098c8..cbae34e72 100644 --- a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c +++ b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c @@ -102,11 +102,11 @@ static void CALLBACK rdpsnd_winmm_callback_function(HWAVEOUT hwo, UINT uMsg, DWO switch (uMsg) { case MM_WOM_OPEN: - CLOG_ERR( "MM_WOM_OPEN\n"); + WLog_ERR(TAG, "MM_WOM_OPEN\n"); break; case MM_WOM_CLOSE: - CLOG_ERR( "MM_WOM_CLOSE\n"); + WLog_ERR(TAG, "MM_WOM_CLOSE\n"); break; case MM_WOM_DONE: @@ -122,9 +122,8 @@ static void CALLBACK rdpsnd_winmm_callback_function(HWAVEOUT hwo, UINT uMsg, DWO if (!wave) return; - CLOG_ERR( "MM_WOM_DONE: dwBufferLength: %d cBlockNo: %d\n", - lpWaveHdr->dwBufferLength, wave->cBlockNo); - + WLog_ERR(TAG, "MM_WOM_DONE: dwBufferLength: %d cBlockNo: %d\n", + lpWaveHdr->dwBufferLength, wave->cBlockNo); wave->wLocalTimeB = GetTickCount(); wTimeDelta = wave->wLocalTimeB - wave->wLocalTimeA; wave->wTimeStampB = wave->wTimeStampA + wTimeDelta; @@ -156,7 +155,7 @@ static void rdpsnd_winmm_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format, if (mmResult != MMSYSERR_NOERROR) { - CLOG_ERR( "waveOutOpen failed: %d\n", mmResult); + WLog_ERR(TAG, "waveOutOpen failed: %d\n", mmResult); } } @@ -173,7 +172,7 @@ static void rdpsnd_winmm_close(rdpsndDevicePlugin* device) if (mmResult != MMSYSERR_NOERROR) { - CLOG_ERR( "waveOutClose failure: %d\n", mmResult); + WLog_ERR(TAG, "waveOutClose failure: %d\n", mmResult); } winmm->hWaveOut = NULL; @@ -300,7 +299,7 @@ void rdpsnd_winmm_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave) if (mmResult != MMSYSERR_NOERROR) { - CLOG_ERR( "waveOutPrepareHeader failure: %d\n", mmResult); + WLog_ERR(TAG, "waveOutPrepareHeader failure: %d\n", mmResult); return; } @@ -308,7 +307,7 @@ void rdpsnd_winmm_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave) if (mmResult != MMSYSERR_NOERROR) { - CLOG_ERR( "waveOutWrite failure: %d\n", mmResult); + WLog_ERR(TAG, "waveOutWrite failure: %d\n", mmResult); waveOutUnprepareHeader(winmm->hWaveOut, lpWaveHdr, sizeof(WAVEHDR)); return; } diff --git a/channels/rdpsnd/server/rdpsnd_main.c b/channels/rdpsnd/server/rdpsnd_main.c index 820d8654d..e27ffd31f 100644 --- a/channels/rdpsnd/server/rdpsnd_main.c +++ b/channels/rdpsnd/server/rdpsnd_main.c @@ -109,8 +109,7 @@ static BOOL rdpsnd_server_recv_quality_mode(RdpsndServerContext* context, wStrea Stream_Read_UINT16(s, quality); Stream_Seek_UINT16(s); // reserved - - CLOG_ERR( "Client requested sound quality: %#0X\n", quality); + WLog_ERR(TAG, "Client requested sound quality: %#0X\n", quality); return TRUE; } @@ -139,7 +138,7 @@ static BOOL rdpsnd_server_recv_formats(RdpsndServerContext* context, wStream* s) if (!context->num_client_formats) { - CLOG_ERR( "%s: client doesn't support any format!\n", __FUNCTION__); + WLog_ERR(TAG, "%s: client doesn't support any format!\n", __FUNCTION__); return FALSE; } @@ -176,7 +175,7 @@ static BOOL rdpsnd_server_recv_formats(RdpsndServerContext* context, wStream* s) if (!context->num_client_formats) { - CLOG_ERR( "%s: client doesn't support any known format!\n", __FUNCTION__); + WLog_ERR(TAG, "%s: client doesn't support any known format!\n", __FUNCTION__); goto out_free; } @@ -232,7 +231,7 @@ static BOOL rdpsnd_server_select_format(RdpsndServerContext* context, int client if (client_format_index < 0 || client_format_index >= context->num_client_formats) { - CLOG_ERR( "%s: index %d is not correct.\n", __FUNCTION__, client_format_index); + WLog_ERR(TAG, "%s: index %d is not correct.\n", __FUNCTION__, client_format_index); return FALSE; } @@ -244,7 +243,7 @@ static BOOL rdpsnd_server_select_format(RdpsndServerContext* context, int client if (format->nSamplesPerSec == 0) { - CLOG_ERR( "%s: invalid Client Sound Format!!\n", __FUNCTION__); + WLog_ERR(TAG, "%s: invalid Client Sound Format!!\n", __FUNCTION__); return FALSE; } @@ -477,8 +476,9 @@ static int rdpsnd_server_start(RdpsndServerContext* context) if (!WTSVirtualChannelQuery(priv->ChannelHandle, WTSVirtualEventHandle, &buffer, &bytesReturned) || (bytesReturned != sizeof(HANDLE))) { - CLOG_ERR( "%s: error during WTSVirtualChannelQuery(WTSVirtualEventHandle) or invalid returned size(%d)\n", - __FUNCTION__, bytesReturned); + WLog_ERR(TAG, "%s: error during WTSVirtualChannelQuery(WTSVirtualEventHandle) or invalid returned size(%d)\n", + __FUNCTION__, bytesReturned); + if (buffer) WTSFreeMemory(buffer); goto out_close; @@ -642,7 +642,7 @@ int rdpsnd_server_handle_messages(RdpsndServerContext *context) if (GetLastError() == ERROR_NO_DATA) return -1; - CLOG_ERR( "%s: channel connection closed\n", __FUNCTION__); + WLog_ERR(TAG, "%s: channel connection closed\n", __FUNCTION__); return 0; } priv->expectedBytes -= bytesReturned; @@ -671,7 +671,7 @@ int rdpsnd_server_handle_messages(RdpsndServerContext *context) /* when here we have the header + the body */ #ifdef WITH_DEBUG_SND - CLOG_ERR( "%s: message type %d\n", __FUNCTION__, priv->msgType); + WLog_ERR(TAG, "%s: message type %d\n", __FUNCTION__, priv->msgType); #endif priv->expectedBytes = 4; priv->waitingHeader = TRUE; @@ -699,7 +699,7 @@ int rdpsnd_server_handle_messages(RdpsndServerContext *context) break; default: - CLOG_ERR( "%s: UNKOWN MESSAGE TYPE!! (%#0X)\n\n", __FUNCTION__, priv->msgType); + WLog_ERR(TAG, "%s: UNKOWN MESSAGE TYPE!! (%#0X)\n\n", __FUNCTION__, priv->msgType); ret = FALSE; break; } diff --git a/channels/rdpsnd/server/rdpsnd_main.h b/channels/rdpsnd/server/rdpsnd_main.h index 667c211ee..20ed42d80 100644 --- a/channels/rdpsnd/server/rdpsnd_main.h +++ b/channels/rdpsnd/server/rdpsnd_main.h @@ -27,8 +27,11 @@ #include #include +#include #include +#define TAG CHANNELS_TAG("rdpsnd.server") + struct _rdpsnd_server_private { BOOL ownThread; diff --git a/channels/remdesk/client/remdesk_main.c b/channels/remdesk/client/remdesk_main.c index c81e6eaaf..2ad69243d 100644 --- a/channels/remdesk/client/remdesk_main.c +++ b/channels/remdesk/client/remdesk_main.c @@ -50,7 +50,7 @@ int remdesk_virtual_channel_write(remdeskPlugin* remdesk, wStream* s) if (status != CHANNEL_RC_OK) { - CLOG_ERR( "remdesk_virtual_channel_write: VirtualChannelWrite failed %d\n", status); + WLog_ERR(TAG, "VirtualChannelWrite failed %d", status); return -1; } @@ -225,9 +225,7 @@ static int remdesk_recv_ctl_result_pdu(remdeskPlugin* remdesk, wStream* s, REMDE Stream_Read_UINT32(s, result); /* result (4 bytes) */ *pResult = result; - - //CLOG_DBG("RemdeskRecvResult: 0x%04X\n", result); - + //WLog_DBG(TAG, "RemdeskRecvResult: 0x%04X", result); return 1; } @@ -397,7 +395,7 @@ static int remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHAN Stream_Read_UINT32(s, msgType); /* msgType (4 bytes) */ - //CLOG_DBG("msgType: %d\n", msgType); + //WLog_DBG(TAG, "msgType: %d", msgType); switch (msgType) { @@ -462,7 +460,7 @@ static int remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHAN break; default: - CLOG_ERR( "remdesk_recv_control_pdu: unknown msgType: %d\n", msgType); + WLog_ERR(TAG, "unknown msgType: %d", msgType); status = -1; break; } @@ -476,7 +474,7 @@ static int remdesk_process_receive(remdeskPlugin* remdesk, wStream* s) REMDESK_CHANNEL_HEADER header; #if 0 - CLOG_DBG("RemdeskReceive: %d\n", Stream_GetRemainingLength(s)); + WLog_DBG(TAG, "RemdeskReceive: %d", Stream_GetRemainingLength(s)); winpr_HexDump(Stream_Pointer(s), Stream_GetRemainingLength(s)); #endif @@ -586,7 +584,7 @@ int remdesk_send(remdeskPlugin* remdesk, wStream* s) if (status != CHANNEL_RC_OK) { Stream_Free(s, TRUE); - CLOG_ERR( "remdesk_send: VirtualChannelWrite failed %d\n", status); + WLog_ERR(TAG, "VirtualChannelWrite failed %d", status); } return status; @@ -618,7 +616,7 @@ static void remdesk_virtual_channel_event_data_received(remdeskPlugin* remdesk, { if (Stream_Capacity(data_in) != Stream_GetPosition(data_in)) { - CLOG_ERR( "remdesk_plugin_process_received: read error\n"); + WLog_ERR(TAG, "read error"); } remdesk->data_in = NULL; @@ -638,7 +636,7 @@ static VOID VCAPITYPE remdesk_virtual_channel_open_event(DWORD openHandle, UINT if (!remdesk) { - CLOG_ERR( "remdesk_virtual_channel_open_event: error no match\n"); + WLog_ERR(TAG, "error no match"); return; } @@ -698,7 +696,7 @@ static void remdesk_virtual_channel_event_connected(remdeskPlugin* remdesk, LPVO if (status != CHANNEL_RC_OK) { - CLOG_ERR( "remdesk_virtual_channel_event_connected: open failed: status: %d\n", status); + WLog_ERR(TAG, "open failed: status: %d", status); return; } @@ -736,7 +734,7 @@ static VOID VCAPITYPE remdesk_virtual_channel_init_event(LPVOID pInitHandle, UIN if (!remdesk) { - CLOG_ERR( "remdesk_virtual_channel_init_event: error no match\n"); + WLog_ERR(TAG, "error no match"); return; } diff --git a/channels/remdesk/client/remdesk_main.h b/channels/remdesk/client/remdesk_main.h index 031353be5..e47773f57 100644 --- a/channels/remdesk/client/remdesk_main.h +++ b/channels/remdesk/client/remdesk_main.h @@ -33,6 +33,9 @@ #include +#include +#define TAG CHANNELS_TAG("remdesk.client") + struct remdesk_plugin { CHANNEL_DEF channelDef; diff --git a/channels/remdesk/server/remdesk_main.c b/channels/remdesk/server/remdesk_main.c index 8c193e0fc..4a7670ebd 100644 --- a/channels/remdesk/server/remdesk_main.c +++ b/channels/remdesk/server/remdesk_main.c @@ -209,9 +209,8 @@ static int remdesk_recv_ctl_remote_control_desktop_pdu(RemdeskServerContext* con if (status <= 0) return -1; - printf("RaConnectionString: %s\n", - pdu.raConnectionString); - + WLog_INFO(TAG, "RaConnectionString: %s", + pdu.raConnectionString); free(pdu.raConnectionString); remdesk_send_ctl_result_pdu(context, 0); @@ -281,9 +280,8 @@ static int remdesk_recv_ctl_authenticate_pdu(RemdeskServerContext* context, wStr if (status <= 0) return -1; - printf("RaConnectionString: %s ExpertBlob: %s\n", - pdu.raConnectionString, pdu.expertBlob); - + WLog_INFO(TAG, "RaConnectionString: %s ExpertBlob: %s", + pdu.raConnectionString, pdu.expertBlob); free(pdu.raConnectionString); free(pdu.expertBlob); @@ -305,9 +303,7 @@ static int remdesk_recv_ctl_verify_password_pdu(RemdeskServerContext* context, w cbExpertBlobW = header->DataLength - 4; status = ConvertFromUnicode(CP_UTF8, 0, expertBlobW, cbExpertBlobW / 2, &pdu.expertBlob, 0, NULL, NULL); - - printf("ExpertBlob: %s\n", pdu.expertBlob); - + WLog_INFO(TAG, "ExpertBlob: %s", pdu.expertBlob); remdesk_send_ctl_result_pdu(context, 0); return 1; @@ -322,8 +318,7 @@ static int remdesk_recv_ctl_pdu(RemdeskServerContext* context, wStream* s, REMDE return -1; Stream_Read_UINT32(s, msgType); /* msgType (4 bytes) */ - - printf("msgType: %d\n", msgType); + WLog_INFO(TAG, "msgType: %d", msgType); switch (msgType) { @@ -362,7 +357,7 @@ static int remdesk_recv_ctl_pdu(RemdeskServerContext* context, wStream* s, REMDE break; default: - fprintf(stderr, "remdesk_recv_control_pdu: unknown msgType: %d\n", msgType); + WLog_ERR(TAG, "remdesk_recv_control_pdu: unknown msgType: %d", msgType); status = -1; break; } @@ -376,7 +371,7 @@ static int remdesk_server_receive_pdu(RemdeskServerContext* context, wStream* s) REMDESK_CHANNEL_HEADER header; #if 0 - printf("RemdeskReceive: %d\n", Stream_GetRemainingLength(s)); + WLog_INFO(TAG, "RemdeskReceive: %d", Stream_GetRemainingLength(s)); winpr_HexDump(Stream_Pointer(s), Stream_GetRemainingLength(s)); #endif diff --git a/channels/remdesk/server/remdesk_main.h b/channels/remdesk/server/remdesk_main.h index 94184aeb9..3c35b45a6 100644 --- a/channels/remdesk/server/remdesk_main.h +++ b/channels/remdesk/server/remdesk_main.h @@ -25,6 +25,9 @@ #include #include +#include + +#define TAG CHANNELS_TAG("remdesk.server") struct _remdesk_server_private { diff --git a/channels/smartcard/client/smartcard_main.c b/channels/smartcard/client/smartcard_main.c index 9baf16355..f501d7717 100644 --- a/channels/smartcard/client/smartcard_main.c +++ b/channels/smartcard/client/smartcard_main.c @@ -372,9 +372,8 @@ void smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp) } else { - CLOG_ERR( "Unexpected SmartCard IRP: MajorFunction 0x%08X MinorFunction: 0x%08X", - irp->MajorFunction, irp->MinorFunction); - + WLog_ERR(TAG, "Unexpected SmartCard IRP: MajorFunction 0x%08X MinorFunction: 0x%08X", + irp->MajorFunction, irp->MinorFunction); irp->IoStatus = STATUS_NOT_SUPPORTED; Queue_Enqueue(smartcard->CompletedIrpQueue, (void*) irp); diff --git a/channels/smartcard/client/smartcard_main.h b/channels/smartcard/client/smartcard_main.h index c2ef362f8..d9123cda5 100644 --- a/channels/smartcard/client/smartcard_main.h +++ b/channels/smartcard/client/smartcard_main.h @@ -30,6 +30,8 @@ #include #include +#define TAG CHANNELS_TAG("smartcard.client") + #define RDP_SCARD_CTL_CODE(code) CTL_CODE(FILE_DEVICE_FILE_SYSTEM, (code), METHOD_BUFFERED, FILE_ANY_ACCESS) #define SCARD_IOCTL_ESTABLISHCONTEXT RDP_SCARD_CTL_CODE(5) /* SCardEstablishContext */ diff --git a/channels/smartcard/client/smartcard_operations.c b/channels/smartcard/client/smartcard_operations.c index 979b9a59d..643ba97fb 100644 --- a/channels/smartcard/client/smartcard_operations.c +++ b/channels/smartcard/client/smartcard_operations.c @@ -38,8 +38,6 @@ #include "smartcard_main.h" -#define TAG "smartcard.client" - const char* smartcard_get_ioctl_string(UINT32 ioControlCode, BOOL funcName) { switch (ioControlCode) @@ -1070,7 +1068,7 @@ UINT32 smartcard_irp_device_control_decode(SMARTCARD_DEVICE* smartcard, SMARTCAR WLog_Print(smartcard->log, WLOG_DEBUG, "%s (0x%08X) FileId: %d CompletionId: %d", smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId); #if 0 - CLOG_DBG("%s (0x%08X) FileId: %d CompletionId: %d\n", + WLog_DBG(TAG, "%s (0x%08X) FileId: %d CompletionId: %d\n", smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId); #endif diff --git a/channels/tsmf/client/alsa/tsmf_alsa.c b/channels/tsmf/client/alsa/tsmf_alsa.c index 8c95b337c..dec1e3443 100644 --- a/channels/tsmf/client/alsa/tsmf_alsa.c +++ b/channels/tsmf/client/alsa/tsmf_alsa.c @@ -56,7 +56,7 @@ static BOOL tsmf_alsa_open_device(TSMFAlsaAudioDevice *alsa) error = snd_pcm_open(&alsa->out_handle, alsa->device, SND_PCM_STREAM_PLAYBACK, 0); if(error < 0) { - CLOG_ERR("failed to open device %s", alsa->device); + WLog_ERR(TAG, "failed to open device %s", alsa->device); return FALSE; } DEBUG_TSMF("open device %s", alsa->device); @@ -95,7 +95,7 @@ static BOOL tsmf_alsa_set_format(ITSMFAudioDevice *audio, error = snd_pcm_hw_params_malloc(&hw_params); if(error < 0) { - CLOG_ERR("snd_pcm_hw_params_malloc failed"); + WLog_ERR(TAG, "snd_pcm_hw_params_malloc failed"); return FALSE; } snd_pcm_hw_params_any(alsa->out_handle, hw_params); @@ -115,7 +115,7 @@ static BOOL tsmf_alsa_set_format(ITSMFAudioDevice *audio, error = snd_pcm_sw_params_malloc(&sw_params); if(error < 0) { - CLOG_ERR("snd_pcm_sw_params_malloc"); + WLog_ERR(TAG, "snd_pcm_sw_params_malloc"); return FALSE; } snd_pcm_sw_params_current(alsa->out_handle, sw_params); diff --git a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c index 428ceaa97..947b289b7 100644 --- a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c +++ b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c @@ -89,7 +89,7 @@ static BOOL tsmf_ffmpeg_init_context(ITSMFDecoder *decoder) mdecoder->codec_context = avcodec_alloc_context3(NULL); if(!mdecoder->codec_context) { - CLOG_ERR("avcodec_alloc_context failed."); + WLog_ERR(TAG, "avcodec_alloc_context failed."); return FALSE; } return TRUE; @@ -143,7 +143,7 @@ static BOOL tsmf_ffmpeg_init_stream(ITSMFDecoder *decoder, const TS_AM_MEDIA_TYP mdecoder->codec = avcodec_find_decoder(mdecoder->codec_id); if(!mdecoder->codec) { - CLOG_ERR("avcodec_find_decoder failed."); + WLog_ERR(TAG, "avcodec_find_decoder failed."); return FALSE; } mdecoder->codec_context->codec_id = mdecoder->codec_id; @@ -205,7 +205,7 @@ static BOOL tsmf_ffmpeg_prepare(ITSMFDecoder *decoder) TSMFFFmpegDecoder *mdecoder = (TSMFFFmpegDecoder *) decoder; if(avcodec_open2(mdecoder->codec_context, mdecoder->codec, NULL) < 0) { - CLOG_ERR("avcodec_open2 failed."); + WLog_ERR(TAG, "avcodec_open2 failed."); return FALSE; } mdecoder->prepared = 1; @@ -301,36 +301,36 @@ static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder *decoder, const BYTE *data, UI #endif if(len < 0) { - CLOG_ERR("data_size %d, avcodec_decode_video failed (%d)", data_size, len); + WLog_ERR(TAG, "data_size %d, avcodec_decode_video failed (%d)", data_size, len); + ret = FALSE; + } + else if (!decoded) + { + WLog_ERR(TAG, "data_size %d, no frame is decoded.", data_size); ret = FALSE; } else - if(!decoded) - { - CLOG_ERR("data_size %d, no frame is decoded.", data_size); - ret = FALSE; - } - else - { - DEBUG_TSMF("linesize[0] %d linesize[1] %d linesize[2] %d linesize[3] %d " - "pix_fmt %d width %d height %d", - mdecoder->frame->linesize[0], mdecoder->frame->linesize[1], - mdecoder->frame->linesize[2], mdecoder->frame->linesize[3], + { + DEBUG_TSMF("linesize[0] %d linesize[1] %d linesize[2] %d linesize[3] %d " + "pix_fmt %d width %d height %d", + mdecoder->frame->linesize[0], mdecoder->frame->linesize[1], + mdecoder->frame->linesize[2], mdecoder->frame->linesize[3], + mdecoder->codec_context->pix_fmt, + mdecoder->codec_context->width, mdecoder->codec_context->height); + mdecoder->decoded_size = avpicture_get_size(mdecoder->codec_context->pix_fmt, + mdecoder->codec_context->width, mdecoder->codec_context->height); + mdecoder->decoded_data = malloc(mdecoder->decoded_size); + ZeroMemory(mdecoder->decoded_data, mdecoder->decoded_size); + frame = avcodec_alloc_frame(); + avpicture_fill((AVPicture*) frame, mdecoder->decoded_data, mdecoder->codec_context->pix_fmt, mdecoder->codec_context->width, mdecoder->codec_context->height); - mdecoder->decoded_size = avpicture_get_size(mdecoder->codec_context->pix_fmt, - mdecoder->codec_context->width, mdecoder->codec_context->height); - mdecoder->decoded_data = malloc(mdecoder->decoded_size); - ZeroMemory(mdecoder->decoded_data, mdecoder->decoded_size); - frame = avcodec_alloc_frame(); - avpicture_fill((AVPicture *) frame, mdecoder->decoded_data, - mdecoder->codec_context->pix_fmt, - mdecoder->codec_context->width, mdecoder->codec_context->height); - av_picture_copy((AVPicture *) frame, (AVPicture *) mdecoder->frame, - mdecoder->codec_context->pix_fmt, - mdecoder->codec_context->width, mdecoder->codec_context->height); - av_free(frame); - } + av_picture_copy((AVPicture*) frame, (AVPicture*) mdecoder->frame, + mdecoder->codec_context->pix_fmt, + mdecoder->codec_context->width, mdecoder->codec_context->height); + av_free(frame); + } + return ret; } @@ -344,15 +344,14 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder *decoder, const BYTE *data, UI BYTE *dst; int dst_offset; #if 0 - LLOGLN(0, ("tsmf_ffmpeg_decode_audio: data_size %d", data_size)); + WLog_DBG(TAG, ("tsmf_ffmpeg_decode_audio: data_size %d", data_size)); int i; for(i = 0; i < data_size; i++) { - LLOG(0, ("%02X ", data[i])); + WLog_DBG(TAG, ("%02X ", data[i])); if(i % 16 == 15) - LLOG(0, ("\n")); + WLog_DBG(TAG, ("\n")); } - LLOG(0, ("\n")); #endif if(mdecoder->decoded_size_max == 0) mdecoder->decoded_size_max = MAX_AUDIO_FRAME_SIZE + 16; @@ -403,7 +402,7 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder *decoder, const BYTE *data, UI #endif if(len <= 0 || frame_size <= 0) { - CLOG_ERR("error decoding"); + WLog_ERR(TAG, "error decoding"); break; } src += len; @@ -443,7 +442,7 @@ static BOOL tsmf_ffmpeg_decode(ITSMFDecoder *decoder, const BYTE *data, UINT32 d case AVMEDIA_TYPE_AUDIO: return tsmf_ffmpeg_decode_audio(decoder, data, data_size, extensions); default: - CLOG_ERR("unknown media type."); + WLog_ERR(TAG, "unknown media type."); return FALSE; } } @@ -467,8 +466,8 @@ static UINT32 tsmf_ffmpeg_get_decoded_format(ITSMFDecoder *decoder) case PIX_FMT_YUV420P: return RDP_PIXFMT_I420; default: - CLOG_ERR("unsupported pixel format %u", - mdecoder->codec_context->pix_fmt); + WLog_ERR(TAG, "unsupported pixel format %u", + mdecoder->codec_context->pix_fmt); return (UINT32) -1; } } @@ -520,8 +519,9 @@ ITSMFDecoder *freerdp_tsmf_client_decoder_subsystem_entry(void) avcodec_register_all(); initialized = TRUE; } - CLOG_ERR( "TSMFDecoderEntry FFMPEG\n"); - decoder = (TSMFFFmpegDecoder *) malloc(sizeof(TSMFFFmpegDecoder)); + + WLog_ERR(TAG, "TSMFDecoderEntry FFMPEG\n"); + decoder = (TSMFFFmpegDecoder*) malloc(sizeof(TSMFFFmpegDecoder)); ZeroMemory(decoder, sizeof(TSMFFFmpegDecoder)); decoder->iface.SetFormat = tsmf_ffmpeg_set_format; decoder->iface.Decode = tsmf_ffmpeg_decode; diff --git a/channels/tsmf/client/gstreamer/tsmf_X11.c b/channels/tsmf/client/gstreamer/tsmf_X11.c index 8db874b12..1bfc11e51 100644 --- a/channels/tsmf/client/gstreamer/tsmf_X11.c +++ b/channels/tsmf/client/gstreamer/tsmf_X11.c @@ -87,7 +87,7 @@ int tsmf_platform_create(TSMFGstreamerDecoder *decoder) if (!hdl) { - CLOG_ERR("%s: Could not allocate handle.", __func__); + WLog_ERR(TAG, "Could not allocate handle."); return -1; } @@ -97,8 +97,7 @@ int tsmf_platform_create(TSMFGstreamerDecoder *decoder) if (hdl->shmid < 0) { - CLOG_ERR("%s: failed to get access to shared memory - shmget()", - __func__); + WLog_ERR(TAG, "failed to get access to shared memory - shmget()"); return -2; } else @@ -106,7 +105,7 @@ int tsmf_platform_create(TSMFGstreamerDecoder *decoder) if (hdl->xfwin == (int *)-1) { - CLOG_ERR("%s: shmat failed!", __func__); + WLog_ERR(TAG, "shmat failed!"); return -3; } @@ -114,7 +113,7 @@ int tsmf_platform_create(TSMFGstreamerDecoder *decoder) if (!hdl->disp) { - CLOG_ERR("Failed to open display"); + WLog_ERR(TAG, "Failed to open display"); return -4; } @@ -140,7 +139,7 @@ int tsmf_platform_register_handler(TSMFGstreamerDecoder *decoder) if (!bus) { - CLOG_ERR("gst_pipeline_get_bus failed!"); + WLog_ERR(TAG, "gst_pipeline_get_bus failed!"); return 1; } @@ -193,7 +192,7 @@ int tsmf_window_create(TSMFGstreamerDecoder *decoder) if (!hdl->subwin) { - CLOG_ERR("Could not create subwindow!"); + WLog_ERR(TAG, "Could not create subwindow!"); } XMapWindow(hdl->disp, hdl->subwin); @@ -238,14 +237,14 @@ int tsmf_window_resize(TSMFGstreamerDecoder *decoder, int x, int y, int width, if (!gst_video_overlay_set_render_rectangle(overlay, 0, 0, width, height)) { - CLOG_ERR("Could not resize overlay!"); + WLog_ERR(TAG, "Could not resize overlay!"); } gst_video_overlay_expose(overlay); #else if (!gst_x_overlay_set_render_rectangle(overlay, 0, 0, width, height)) { - CLOG_ERR("Could not resize overlay!"); + WLog_ERR(TAG, "Could not resize overlay!"); } gst_x_overlay_expose(overlay); diff --git a/channels/tsmf/client/gstreamer/tsmf_gstreamer.c b/channels/tsmf/client/gstreamer/tsmf_gstreamer.c index b4c8635d2..407dc8037 100644 --- a/channels/tsmf/client/gstreamer/tsmf_gstreamer.c +++ b/channels/tsmf/client/gstreamer/tsmf_gstreamer.c @@ -120,10 +120,10 @@ int tsmf_gstreamer_pipeline_set_state(TSMFGstreamerDecoder *mdecoder, GstState d state_change = gst_element_set_state(mdecoder->pipe, desired_state); if (state_change == GST_STATE_CHANGE_FAILURE) - CLOG_ERR("%s: (%s) GST_STATE_CHANGE_FAILURE.", sname, name); + WLog_ERR(TAG, "%s: (%s) GST_STATE_CHANGE_FAILURE.", sname, name); else if (state_change == GST_STATE_CHANGE_ASYNC) { - CLOG_ERR("%s: (%s) GST_STATE_CHANGE_ASYNC.", sname, name); + WLog_ERR(TAG, "%s: (%s) GST_STATE_CHANGE_ASYNC.", sname, name); mdecoder->state = desired_state; } else @@ -142,7 +142,7 @@ static GstBuffer *tsmf_get_buffer_from_data(const void *raw_data, gsize size) if (!data) { - CLOG_ERR("Could not allocate %"G_GSIZE_FORMAT" bytes of data.", size); + WLog_ERR(TAG, "Could not allocate %"G_GSIZE_FORMAT" bytes of data.", size); return NULL; } @@ -154,7 +154,7 @@ static GstBuffer *tsmf_get_buffer_from_data(const void *raw_data, gsize size) if (!buffer) { - CLOG_ERR("Could not create GstBuffer"); + WLog_ERR(TAG, "Could not create GstBuffer"); free(data); return NULL; } @@ -346,7 +346,7 @@ static BOOL tsmf_gstreamer_set_format(ITSMFDecoder *decoder, TS_AM_MEDIA_TYPE *m NULL); break; default: - CLOG_ERR("unknown format:(%d).", media_type->SubType); + WLog_ERR(TAG, "unknown format:(%d).", media_type->SubType); return FALSE; } @@ -358,7 +358,7 @@ static BOOL tsmf_gstreamer_set_format(ITSMFDecoder *decoder, TS_AM_MEDIA_TYPE *m if (!buffer) { - CLOG_ERR("could not allocate GstBuffer!"); + WLog_ERR(TAG, "could not allocate GstBuffer!"); return FALSE; } @@ -375,7 +375,7 @@ static BOOL tsmf_gstreamer_set_format(ITSMFDecoder *decoder, TS_AM_MEDIA_TYPE *m return TRUE; } -void tsmf_gstreamer_clean_up(TSMFGstreamerDecoder *mdecoder) +void tsmf_gstreamer_clean_up(TSMFGstreamerDecoder* mdecoder) { //Cleaning up elements if (!mdecoder || !mdecoder->pipe) @@ -416,7 +416,7 @@ BOOL tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder *mdecoder) if (!mdecoder->pipe) { - CLOG_ERR("Failed to create new pipe"); + WLog_ERR(TAG, "Failed to create new pipe"); return FALSE; } @@ -424,7 +424,7 @@ BOOL tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder *mdecoder) if (!mdecoder->src) { - CLOG_ERR("Failed to get appsrc"); + WLog_ERR(TAG, "Failed to get appsrc"); return FALSE; } @@ -432,7 +432,7 @@ BOOL tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder *mdecoder) if (!mdecoder->outsink) { - CLOG_ERR("Failed to get sink"); + WLog_ERR(TAG, "Failed to get sink"); return FALSE; } @@ -442,7 +442,7 @@ BOOL tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder *mdecoder) if (!mdecoder->volume) { - CLOG_ERR("Failed to get volume"); + WLog_ERR(TAG, "Failed to get volume"); return FALSE; } } @@ -482,7 +482,7 @@ static BOOL tsmf_gstreamer_decodeEx(ITSMFDecoder *decoder, const BYTE *data, UIN if (!mdecoder) { - CLOG_ERR("Decoder not initialized!"); + WLog_ERR(TAG, "Decoder not initialized!"); return FALSE; } @@ -498,13 +498,13 @@ static BOOL tsmf_gstreamer_decodeEx(ITSMFDecoder *decoder, const BYTE *data, UIN if (mdecoder->gst_caps == NULL) { - CLOG_ERR("tsmf_gstreamer_set_format not called or invalid format."); + WLog_ERR(TAG, "tsmf_gstreamer_set_format not called or invalid format."); return FALSE; } if (!mdecoder->src) { - CLOG_ERR("failed to construct pipeline correctly. Unable to push buffer to source element."); + WLog_ERR(TAG, "failed to construct pipeline correctly. Unable to push buffer to source element."); return FALSE; } @@ -512,7 +512,7 @@ static BOOL tsmf_gstreamer_decodeEx(ITSMFDecoder *decoder, const BYTE *data, UIN if (gst_buf == NULL) { - CLOG_ERR("tsmf_get_buffer_from_data(%p, %d) failed.", data, data_size); + WLog_ERR(TAG, "tsmf_get_buffer_from_data(%p, %d) failed.", data, data_size); return FALSE; } @@ -534,7 +534,7 @@ static BOOL tsmf_gstreamer_decodeEx(ITSMFDecoder *decoder, const BYTE *data, UIN GST_SEEK_TYPE_SET, sample_time, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) { - CLOG_ERR("seek failed"); + WLog_ERR(TAG, "seek failed"); } mdecoder->pipeline_start_time_valid = 0; @@ -608,7 +608,7 @@ static void tsmf_gstreamer_control(ITSMFDecoder *decoder, ITSMFControlMsg contro if (mdecoder->paused) { - CLOG_ERR("%s: Ignoring control PAUSE, already received!", get_type(mdecoder)); + WLog_ERR(TAG, "%s: Ignoring control PAUSE, already received!", get_type(mdecoder)); return; } @@ -624,7 +624,7 @@ static void tsmf_gstreamer_control(ITSMFDecoder *decoder, ITSMFControlMsg contro if (!mdecoder->paused && !mdecoder->shutdown) { - CLOG_ERR("%s: Ignoring control RESUME, already received!", get_type(mdecoder)); + WLog_ERR(TAG, "%s: Ignoring control RESUME, already received!", get_type(mdecoder)); return; } @@ -642,7 +642,7 @@ static void tsmf_gstreamer_control(ITSMFDecoder *decoder, ITSMFControlMsg contro if (mdecoder->shutdown) { - CLOG_ERR("%s: Ignoring control STOP, already received!", get_type(mdecoder)); + WLog_ERR(TAG, "%s: Ignoring control STOP, already received!", get_type(mdecoder)); return; } @@ -656,7 +656,7 @@ static void tsmf_gstreamer_control(ITSMFDecoder *decoder, ITSMFControlMsg contro gst_app_src_end_of_stream((GstAppSrc *)mdecoder->src); } else - CLOG_ERR("Unknown control message %08x", control_msg); + WLog_ERR(TAG, "Unknown control message %08x", control_msg); } static BOOL tsmf_gstreamer_buffer_filled(ITSMFDecoder *decoder) diff --git a/channels/tsmf/client/pulse/tsmf_pulse.c b/channels/tsmf/client/pulse/tsmf_pulse.c index c04c5b3ea..f35f24902 100644 --- a/channels/tsmf/client/pulse/tsmf_pulse.c +++ b/channels/tsmf/client/pulse/tsmf_pulse.c @@ -72,7 +72,7 @@ static BOOL tsmf_pulse_connect(TSMFPulseAudioDevice *pulse) return FALSE; if(pa_context_connect(pulse->context, NULL, 0, NULL)) { - CLOG_ERR("pa_context_connect failed (%d)", + WLog_ERR(TAG, "pa_context_connect failed (%d)", pa_context_errno(pulse->context)); return FALSE; } @@ -80,7 +80,7 @@ static BOOL tsmf_pulse_connect(TSMFPulseAudioDevice *pulse) if(pa_threaded_mainloop_start(pulse->mainloop) < 0) { pa_threaded_mainloop_unlock(pulse->mainloop); - CLOG_ERR("pa_threaded_mainloop_start failed (%d)", + WLog_ERR(TAG, "pa_threaded_mainloop_start failed (%d)", pa_context_errno(pulse->context)); return FALSE; } @@ -120,19 +120,19 @@ static BOOL tsmf_pulse_open(ITSMFAudioDevice *audio, const char *device) pulse->mainloop = pa_threaded_mainloop_new(); if(!pulse->mainloop) { - CLOG_ERR("pa_threaded_mainloop_new failed"); + WLog_ERR(TAG, "pa_threaded_mainloop_new failed"); return FALSE; } pulse->context = pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), "freerdp"); if(!pulse->context) { - CLOG_ERR("pa_context_new failed"); + WLog_ERR(TAG, "pa_context_new failed"); return FALSE; } pa_context_set_state_callback(pulse->context, tsmf_pulse_context_state_callback, pulse); if(tsmf_pulse_connect(pulse)) { - CLOG_ERR("tsmf_pulse_connect failed"); + WLog_ERR(TAG, "tsmf_pulse_connect failed"); return FALSE; } DEBUG_TSMF("open device %s", pulse->device); @@ -214,7 +214,7 @@ static BOOL tsmf_pulse_open_stream(TSMFPulseAudioDevice *pulse) if(!pulse->stream) { pa_threaded_mainloop_unlock(pulse->mainloop); - CLOG_ERR("pa_stream_new failed (%d)", + WLog_ERR(TAG, "pa_stream_new failed (%d)", pa_context_errno(pulse->context)); return FALSE; } @@ -233,7 +233,7 @@ static BOOL tsmf_pulse_open_stream(TSMFPulseAudioDevice *pulse) NULL, NULL) < 0) { pa_threaded_mainloop_unlock(pulse->mainloop); - CLOG_ERR("pa_stream_connect_playback failed (%d)", + WLog_ERR(TAG, "pa_stream_connect_playback failed (%d)", pa_context_errno(pulse->context)); return FALSE; } @@ -244,7 +244,7 @@ static BOOL tsmf_pulse_open_stream(TSMFPulseAudioDevice *pulse) break; if(!PA_STREAM_IS_GOOD(state)) { - CLOG_ERR("bad stream state (%d)", + WLog_ERR(TAG, "bad stream state (%d)", pa_context_errno(pulse->context)); break; } diff --git a/channels/tsmf/client/tsmf_audio.c b/channels/tsmf/client/tsmf_audio.c index 4e43ba80f..d03ebbcef 100644 --- a/channels/tsmf/client/tsmf_audio.c +++ b/channels/tsmf/client/tsmf_audio.c @@ -41,7 +41,7 @@ static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const if (audio == NULL) { - CLOG_ERR("failed to call export function in %s", name); + WLog_ERR(TAG, "failed to call export function in %s", name); return NULL; } diff --git a/channels/tsmf/client/tsmf_codec.c b/channels/tsmf/client/tsmf_codec.c index cb6bd25b3..5657a8dd0 100644 --- a/channels/tsmf/client/tsmf_codec.c +++ b/channels/tsmf/client/tsmf_codec.c @@ -269,29 +269,27 @@ static void tsmf_print_guid(const BYTE* guid) int i; for (i = 3; i >= 0; i--) - CLOG_ERR("%02X", guid[i]); + WLog_INFO(TAG, "%02X", guid[i]); - CLOG_ERR("-"); + WLog_INFO(TAG, "-"); for (i = 5; i >= 4; i--) - CLOG_ERR("%02X", guid[i]); + WLog_INFO(TAG, "%02X", guid[i]); - CLOG_ERR("-"); + WLog_INFO(TAG, "-"); for (i = 7; i >= 6; i--) - CLOG_ERR("%02X", guid[i]); + WLog_INFO(TAG, "%02X", guid[i]); - CLOG_ERR("-"); + WLog_INFO(TAG, "-"); for (i = 8; i < 16; i++) { - CLOG_ERR("%02X", guid[i]); + WLog_INFO(TAG, "%02X", guid[i]); if (i == 9) - CLOG_ERR("-"); + WLog_INFO(TAG, "-"); } - - CLOG_ERR("\n"); #endif } diff --git a/channels/tsmf/client/tsmf_decoder.c b/channels/tsmf/client/tsmf_decoder.c index 59262508c..0067cd548 100644 --- a/channels/tsmf/client/tsmf_decoder.c +++ b/channels/tsmf/client/tsmf_decoder.c @@ -42,7 +42,7 @@ static ITSMFDecoder *tsmf_load_decoder_by_name(const char *name, TS_AM_MEDIA_TYP decoder = entry(); if(decoder == NULL) { - CLOG_ERR("failed to call export function in %s", name); + WLog_ERR(TAG, "failed to call export function in %s", name); return NULL; } if(!decoder->SetFormat(decoder, media_type)) diff --git a/channels/tsmf/client/tsmf_ifman.c b/channels/tsmf/client/tsmf_ifman.c index 6c2d99b9b..18c654b27 100644 --- a/channels/tsmf/client/tsmf_ifman.c +++ b/channels/tsmf/client/tsmf_ifman.c @@ -80,7 +80,7 @@ int tsmf_ifman_exchange_capability_request(TSMF_IFMAN *ifman) MMREDIR_CAPABILITY_PLATFORM_MF | MMREDIR_CAPABILITY_PLATFORM_DSHOW); break; default: - CLOG_ERR("unknown capability type %d", CapabilityType); + WLog_ERR(TAG, "unknown capability type %d", CapabilityType); break; } Stream_SetPosition(ifman->output, pos + cbCapabilityLength); @@ -236,7 +236,7 @@ int tsmf_ifman_shutdown_presentation(TSMF_IFMAN *ifman) if(presentation) tsmf_presentation_free(presentation); else - CLOG_ERR("unknown presentation id"); + WLog_ERR(TAG, "unknown presentation id"); Stream_EnsureRemainingCapacity(ifman->output, 4); Stream_Write_UINT32(ifman->output, 0); /* Result */ ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB; @@ -261,7 +261,7 @@ int tsmf_ifman_on_stream_volume(TSMF_IFMAN *ifman) } else { - CLOG_ERR("unknown presentation id"); + WLog_ERR(TAG, "unknown presentation id"); } ifman->output_pending = TRUE; return 0; @@ -393,13 +393,13 @@ int tsmf_ifman_on_sample(TSMF_IFMAN *ifman) presentation = tsmf_presentation_find_by_id(ifman->presentation_id); if(presentation == NULL) { - CLOG_ERR("unknown presentation id"); + WLog_ERR(TAG, "unknown presentation id"); return 1; } stream = tsmf_stream_find_by_id(presentation, StreamId); if(stream == NULL) { - CLOG_ERR("unknown stream id"); + WLog_ERR(TAG, "unknown stream id"); return 1; } tsmf_stream_push_sample(stream, ifman->channel_callback, @@ -420,7 +420,7 @@ int tsmf_ifman_on_flush(TSMF_IFMAN *ifman) presentation = tsmf_presentation_find_by_id(ifman->presentation_id); if(presentation == NULL) { - CLOG_ERR("unknown presentation id"); + WLog_ERR(TAG, "unknown presentation id"); return 1; } tsmf_presentation_flush(presentation); @@ -460,7 +460,7 @@ int tsmf_ifman_on_playback_started(TSMF_IFMAN *ifman) if(presentation) tsmf_presentation_start(presentation); else - CLOG_ERR("unknown presentation id"); + WLog_ERR(TAG, "unknown presentation id"); Stream_EnsureRemainingCapacity(ifman->output, 16); Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ Stream_Write_UINT32(ifman->output, 0); /* StreamId */ @@ -480,7 +480,7 @@ int tsmf_ifman_on_playback_paused(TSMF_IFMAN *ifman) if(presentation) tsmf_presentation_paused(presentation); else - CLOG_ERR("unknown presentation id"); + WLog_ERR(TAG, "unknown presentation id"); return 0; } @@ -494,7 +494,7 @@ int tsmf_ifman_on_playback_restarted(TSMF_IFMAN *ifman) if(presentation) tsmf_presentation_restarted(presentation); else - CLOG_ERR("unknown presentation id"); + WLog_ERR(TAG, "unknown presentation id"); return 0; } @@ -506,7 +506,7 @@ int tsmf_ifman_on_playback_stopped(TSMF_IFMAN *ifman) if(presentation) tsmf_presentation_stop(presentation); else - CLOG_ERR("unknown presentation id"); + WLog_ERR(TAG, "unknown presentation id"); Stream_EnsureRemainingCapacity(ifman->output, 16); Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ Stream_Write_UINT32(ifman->output, 0); /* StreamId */ diff --git a/channels/tsmf/client/tsmf_main.c b/channels/tsmf/client/tsmf_main.c index 76b0a7c32..65ce35b4c 100644 --- a/channels/tsmf/client/tsmf_main.c +++ b/channels/tsmf/client/tsmf_main.c @@ -89,14 +89,14 @@ void tsmf_playback_ack(IWTSVirtualChannelCallback *pChannelCallback, Stream_Write_UINT64(s, data_size); /* cbData */ DEBUG_TSMF("response size %d", (int) Stream_GetPosition(s)); if(!callback || !callback->channel || !callback->channel->Write) - CLOG_ERR("callback=%p, channel=%p, write=%p", callback, + WLog_ERR(TAG, "callback=%p, channel=%p, write=%p", callback, callback->channel, callback->channel->Write); else status = callback->channel->Write(callback->channel, Stream_GetPosition(s), Stream_Buffer(s), NULL); if(status) { - CLOG_ERR("response error %d", status); + WLog_ERR(TAG, "response error %d", status); } Stream_Free(s, TRUE); } @@ -108,7 +108,7 @@ BOOL tsmf_push_event(IWTSVirtualChannelCallback *pChannelCallback, wMessage *eve status = callback->channel_mgr->PushEvent(callback->channel_mgr, event); if(status) { - CLOG_ERR("response error %d", status); + WLog_ERR(TAG, "response error %d", status); return FALSE; } return TRUE; @@ -130,7 +130,7 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, w /* 2.2.1 Shared Message Header (SHARED_MSG_HEADER) */ if(cbSize < 12) { - CLOG_ERR("invalid size. cbSize=%d", cbSize); + WLog_ERR(TAG, "invalid size. cbSize=%d", cbSize); return 1; } @@ -272,7 +272,7 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, w } if(status == -1) { - CLOG_ERR("InterfaceId 0x%X FunctionId 0x%X not processed.", + WLog_ERR(TAG, "InterfaceId 0x%X FunctionId 0x%X not processed.", InterfaceId, FunctionId); /* When a request is not implemented we return empty response indicating error */ } @@ -289,7 +289,7 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, w status = callback->channel->Write(callback->channel, length, Stream_Buffer(output), NULL); if(status) { - CLOG_ERR("response error %d", status); + WLog_ERR(TAG, "response error %d", status); } } Stream_Free(output, TRUE); diff --git a/channels/tsmf/client/tsmf_media.c b/channels/tsmf/client/tsmf_media.c index 611f80365..28e0d2142 100644 --- a/channels/tsmf/client/tsmf_media.c +++ b/channels/tsmf/client/tsmf_media.c @@ -271,7 +271,7 @@ TSMF_PRESENTATION *tsmf_presentation_new(const BYTE *guid, IWTSVirtualChannelCal if (!presentation) { - CLOG_ERR("calloc failed"); + WLog_ERR(TAG, "calloc failed"); return NULL; } @@ -320,7 +320,7 @@ TSMF_PRESENTATION *tsmf_presentation_find_by_id(const BYTE *guid) ArrayList_Unlock(presentation_list); if (!found) - CLOG_ERR("presentation id %s not found", guid_to_string(guid, guid_str, sizeof(guid_str))); + WLog_ERR(TAG, "presentation id %s not found", guid_to_string(guid, guid_str, sizeof(guid_str))); return (found) ? presentation : NULL; } @@ -902,7 +902,7 @@ TSMF_STREAM *tsmf_stream_new(TSMF_PRESENTATION *presentation, UINT32 stream_id) if (stream) { - CLOG_ERR("duplicated stream id %d!", stream_id); + WLog_ERR(TAG, "duplicated stream id %d!", stream_id); return NULL; } @@ -910,7 +910,7 @@ TSMF_STREAM *tsmf_stream_new(TSMF_PRESENTATION *presentation, UINT32 stream_id) if (!stream) { - CLOG_ERR("Calloc failed"); + WLog_ERR(TAG, "Calloc failed"); return NULL; } @@ -966,7 +966,7 @@ void tsmf_stream_set_format(TSMF_STREAM *stream, const char *name, wStream *s) if (stream->decoder) { - CLOG_ERR("duplicated call"); + WLog_ERR(TAG, "duplicated call"); return; } @@ -1071,7 +1071,7 @@ void tsmf_stream_push_sample(TSMF_STREAM *stream, IWTSVirtualChannelCallback *pC if (!sample) { - CLOG_ERR("calloc failed!"); + WLog_ERR(TAG, "calloc failed!"); return; } @@ -1087,7 +1087,7 @@ void tsmf_stream_push_sample(TSMF_STREAM *stream, IWTSVirtualChannelCallback *pC if (!sample->data) { - CLOG_ERR("calloc failed!"); + WLog_ERR(TAG, "calloc failed!"); free(sample); return; } diff --git a/channels/tsmf/client/tsmf_types.h b/channels/tsmf/client/tsmf_types.h index 4afbd1434..07cd999fc 100644 --- a/channels/tsmf/client/tsmf_types.h +++ b/channels/tsmf/client/tsmf_types.h @@ -28,10 +28,12 @@ #include #include +#define TAG CHANNELS_TAG("tsmf.client") + #ifdef WITH_DEBUG_TSMF -#define DEBUG_TSMF(fmt, ...) CLOG_CLASS(TSMF, fmt, ## __VA_ARGS__) +#define DEBUG_TSMF(fmt, ...) WLog_DBG(TAG, fmt, ## __VA_ARGS__) #else -#define DEBUG_TSMF(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__) +#define DEBUG_TSMF(fmt, ...) do { } while (0) #endif typedef struct _TS_AM_MEDIA_TYPE diff --git a/channels/urbdrc/client/data_transfer.c b/channels/urbdrc/client/data_transfer.c index dec8e547e..cb3ca7e54 100644 --- a/channels/urbdrc/client/data_transfer.c +++ b/channels/urbdrc/client/data_transfer.c @@ -100,7 +100,7 @@ static int func_check_isochronous_fds(IUDEVICE* pdev) ret = isoch_queue->unregister_data(isoch_queue, isoch); if (!ret) - LLOGLN(0, ("isoch_queue_unregister_data: Not found isoch data!!\n")); + WLog_DBG(TAG, "isoch_queue_unregister_data: Not found isoch data!!"); pthread_mutex_unlock(&isoch_queue->isoch_loading); @@ -124,7 +124,7 @@ static int urbdrc_process_register_request_callback(URBDRC_CHANNEL_CALLBACK* cal UINT32 NumRequestCompletion = 0; UINT32 RequestCompletion = 0; - LLOGLN(urbdrc_debug, ("urbdrc_process_register_request_callback")); + WLog_DBG(TAG, "urbdrc_process_register_request_callback"); pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -165,7 +165,7 @@ static int urbdrc_process_cancel_request(BYTE* data, UINT32 data_sizem, IUDEVMAN data_read_UINT32(data + 0, CancelId); /** RequestId */ - LLOGLN(urbdrc_debug, ("urbdrc_process_cancel_request: id 0x%x", CancelId)); + WLog_DBG(TAG, "urbdrc_process_cancel_request: id 0x%x", CancelId); pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -180,19 +180,19 @@ static int urbdrc_process_cancel_request(BYTE* data, UINT32 data_sizem, IUDEVMAN static int urbdrc_process_retract_device_request(BYTE* data, UINT32 data_sizem, IUDEVMAN* udevman, UINT32 UsbDevice) { UINT32 Reason; - LLOGLN(urbdrc_debug, ("urbdrc_process_retract_device_request")); + WLog_DBG(TAG, "urbdrc_process_retract_device_request"); data_read_UINT32(data + 0, Reason); /** Reason */ switch (Reason) { case UsbRetractReason_BlockedByPolicy: - LLOGLN(urbdrc_debug, ("UsbRetractReason_BlockedByPolicy: now it is not support")); + WLog_DBG(TAG, "UsbRetractReason_BlockedByPolicy: now it is not support"); return -1; break; default: - LLOGLN(urbdrc_debug, ("urbdrc_process_retract_device_request: Unknown Reason %d", Reason)); + WLog_DBG(TAG, "urbdrc_process_retract_device_request: Unknown Reason %d", Reason); return -1; break; } @@ -215,7 +215,7 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, BYTE* da BYTE* out_data; int i, offset, success = 0; - LLOGLN(urbdrc_debug, ("urbdrc_process__io_control")); + WLog_DBG(TAG, "urbdrc_process__io_control"); data_read_UINT32(data + 0, IoControlCode); data_read_UINT32(data + 4, InputBufferSize); @@ -236,16 +236,16 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, BYTE* da switch (IoControlCode) { case IOCTL_INTERNAL_USB_SUBMIT_URB: /** 0x00220003 */ - LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_SUBMIT_URB")); - CLOG_ERR( " Function IOCTL_INTERNAL_USB_SUBMIT_URB: Unchecked\n"); + WLog_DBG(TAG, "ioctl: IOCTL_INTERNAL_USB_SUBMIT_URB"); + WLog_ERR(TAG, " Function IOCTL_INTERNAL_USB_SUBMIT_URB: Unchecked"); break; case IOCTL_INTERNAL_USB_RESET_PORT: /** 0x00220007 */ - LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_RESET_PORT")); + WLog_DBG(TAG, "ioctl: IOCTL_INTERNAL_USB_RESET_PORT"); break; case IOCTL_INTERNAL_USB_GET_PORT_STATUS: /** 0x00220013 */ - LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_GET_PORT_STATUS")); + WLog_DBG(TAG, "ioctl: IOCTL_INTERNAL_USB_GET_PORT_STATUS"); success = pdev->query_device_port_status(pdev, &usbd_status, &OutputBufferSize, OutputBuffer); @@ -261,24 +261,24 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, BYTE* da OutputBufferSize = 4; } - LLOGLN(urbdrc_debug, ("PORT STATUS(fake!):0x%02x%02x%02x%02x", - OutputBuffer[3], OutputBuffer[2], OutputBuffer[1], OutputBuffer[0])); + WLog_DBG(TAG, "PORT STATUS(fake!):0x%02x%02x%02x%02x", + OutputBuffer[3], OutputBuffer[2], OutputBuffer[1], OutputBuffer[0]); } break; case IOCTL_INTERNAL_USB_CYCLE_PORT: /** 0x0022001F */ - LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_CYCLE_PORT")); - CLOG_ERR( " Function IOCTL_INTERNAL_USB_CYCLE_PORT: Unchecked\n"); + WLog_DBG(TAG, "ioctl: IOCTL_INTERNAL_USB_CYCLE_PORT"); + WLog_ERR(TAG, " Function IOCTL_INTERNAL_USB_CYCLE_PORT: Unchecked"); break; case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: /** 0x00220027 */ - LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION")); - CLOG_ERR( " Function IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: Unchecked\n"); + WLog_DBG(TAG, "ioctl: IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION"); + WLog_ERR(TAG, " Function IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: Unchecked"); break; default: - LLOGLN(urbdrc_debug, ("urbdrc_process_io_control: unknown IoControlCode 0x%X", IoControlCode)); + WLog_DBG(TAG, "urbdrc_process_io_control: unknown IoControlCode 0x%X", IoControlCode); zfree(OutputBuffer); return -1; break; @@ -321,7 +321,7 @@ static int urbdrc_process_internal_io_control(URBDRC_CHANNEL_CALLBACK* callback, data_read_UINT32(data + 0, IoControlCode); - LLOGLN(urbdrc_debug, ("urbdrc_process_internal_io_control:0x%x", IoControlCode)); + WLog_DBG(TAG, "urbdrc_process_internal_io_control:0x%x", IoControlCode); data_read_UINT32(data + 4, InputBufferSize); data_read_UINT32(data + 8, OutputBufferSize); @@ -370,7 +370,7 @@ static int urbdrc_process_query_device_text(URBDRC_CHANNEL_CALLBACK* callback, B BYTE DeviceDescription[bufferSize]; int out_offset; - LLOGLN(urbdrc_debug, ("urbdrc_process_query_device_text")); + WLog_DBG(TAG, "urbdrc_process_query_device_text"); data_read_UINT32(data + 0, TextType); data_read_UINT32(data + 4, LocaleId); @@ -448,7 +448,7 @@ static int urb_select_configuration(URBDRC_CHANNEL_CALLBACK* callback, BYTE* dat if (transferDir == 0) { - CLOG_ERR( "urb_select_configuration: not support transfer out\n"); + WLog_ERR(TAG, "urb_select_configuration: not support transfer out"); return -1; } @@ -540,7 +540,7 @@ static int urb_select_interface(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, U if (transferDir == 0) { - CLOG_ERR( "urb_select_interface: not support transfer out\n"); + WLog_ERR(TAG, "urb_select_interface: not support transfer out"); return -1; } @@ -648,7 +648,7 @@ static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, if (length != OutputBufferSize) { - LLOGLN(urbdrc_debug, ("urb_control_transfer ERROR: buf != length")); + WLog_DBG(TAG, "urb_control_transfer ERROR: buf != length"); return -1; } @@ -675,7 +675,7 @@ static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, Timeout); if (ret < 0){ - LLOGLN(urbdrc_debug, ("control_transfer: error num %d!!\n", ret)); + WLog_DBG(TAG, "control_transfer: error num %d!!", ret); OutputBufferSize = 0; } @@ -866,12 +866,12 @@ static int urb_isoch_transfer(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, break; } - LLOGLN(urbdrc_debug, ("urb_isoch_transfer: EndpointAddress: 0x%x, " + WLog_DBG(TAG, "urb_isoch_transfer: EndpointAddress: 0x%x, " "TransferFlags: 0x%x, " "StartFrame: 0x%x, " "NumberOfPackets: 0x%x, " "OutputBufferSize: 0x%x " "RequestId: 0x%x", EndpointAddress, TransferFlags, StartFrame, - NumberOfPackets, OutputBufferSize, RequestId)); + NumberOfPackets, OutputBufferSize, RequestId); #if ISOCH_FIFO ISOCH_CALLBACK_QUEUE * isoch_queue = NULL; @@ -1010,7 +1010,7 @@ static int urb_control_descriptor_request(URBDRC_CHANNEL_CALLBACK* callback, memcpy(buffer, data + offset, OutputBufferSize); break; default: - LLOGLN(urbdrc_debug, ("%s: get error transferDir", __func__)); + WLog_DBG(TAG, "get error transferDir"); OutputBufferSize = 0; usbd_status = USBD_STATUS_STALL_PID; break; @@ -1030,7 +1030,7 @@ static int urb_control_descriptor_request(URBDRC_CHANNEL_CALLBACK* callback, if (ret < 0) { - LLOGLN(urbdrc_debug, ("%s:get_descriptor: error num %d", __func__, ret)); + WLog_DBG(TAG, "get_descriptor: error num %d", ret); OutputBufferSize = 0; } @@ -1073,7 +1073,7 @@ static int urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, BY int offset, ret; if (transferDir == 0){ - LLOGLN(urbdrc_debug, ("urb_control_get_status_request: not support transfer out\n")); + WLog_DBG(TAG, "urb_control_get_status_request: not support transfer out"); return -1; } @@ -1105,7 +1105,7 @@ static int urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, BY 1000); if (ret < 0){ - LLOGLN(urbdrc_debug, ("%s:control_transfer: error num %d!!\n", __func__, ret)); + WLog_DBG(TAG, "control_transfer: error num %d!!", ret); OutputBufferSize = 0; usbd_status = USBD_STATUS_STALL_PID; } @@ -1198,11 +1198,11 @@ static int urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callbac if (TransferFlags & USBD_TRANSFER_DIRECTION) bmRequestType |= 0x80; - LLOGLN(urbdrc_debug, ("urb_control_vendor_or_class_request: " + WLog_DBG(TAG, "urb_control_vendor_or_class_request: " "RequestId 0x%x TransferFlags: 0x%x ReqTypeReservedBits: 0x%x " "Request:0x%x Value: 0x%x Index: 0x%x OutputBufferSize: 0x%x bmRequestType: 0x%x!!", RequestId, TransferFlags, ReqTypeReservedBits, Request, Value, - Index, OutputBufferSize, bmRequestType)); + Index, OutputBufferSize, bmRequestType); ret = pdev->control_transfer( pdev, RequestId, 0, 0, bmRequestType, @@ -1215,7 +1215,7 @@ static int urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callbac 2000); if (ret < 0){ - LLOGLN(urbdrc_debug, ("%s:control_transfer: error num %d!!", __func__, ret)); + WLog_DBG(TAG, "control_transfer: error num %d!!", ret); OutputBufferSize = 0; usbd_status = USBD_STATUS_STALL_PID; } @@ -1297,18 +1297,18 @@ static int urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback, switch (transferDir) { case USBD_TRANSFER_DIRECTION_OUT: - CLOG_ERR( "Function urb_os_feature_descriptor_request: OUT Unchecked\n"); + WLog_ERR(TAG, "Function urb_os_feature_descriptor_request: OUT Unchecked"); memcpy(buffer, data + offset, OutputBufferSize); break; case USBD_TRANSFER_DIRECTION_IN: break; } - LLOGLN(urbdrc_debug, ("Ms descriptor arg: Recipient:0x%x, " + WLog_DBG(TAG, "Ms descriptor arg: Recipient:0x%x, " "InterfaceNumber:0x%x, Ms_PageIndex:0x%x, " "Ms_featureDescIndex:0x%x, OutputBufferSize:0x%x", Recipient, InterfaceNumber, Ms_PageIndex, - Ms_featureDescIndex, OutputBufferSize)); + Ms_featureDescIndex, OutputBufferSize); /** get ms string */ ret = pdev->os_feature_descriptor_request( pdev, RequestId, Recipient, @@ -1321,7 +1321,7 @@ static int urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback, 1000); if (ret < 0) - LLOGLN(urbdrc_debug, ("os_feature_descriptor_request: error num %d", ret)); + WLog_DBG(TAG, "os_feature_descriptor_request: error num %d", ret); offset = 36; out_size = offset + OutputBufferSize; @@ -1367,7 +1367,7 @@ static int urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, int out_offset, ret; if (transferDir == 0){ - LLOGLN(urbdrc_debug, ("urb_pipe_request: not support transfer out\n")); + WLog_DBG(TAG, "urb_pipe_request: not support transfer out"); return -1; } @@ -1386,7 +1386,7 @@ static int urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, switch (action){ case PIPE_CANCEL: - LLOGLN(urbdrc_debug, ("urb_pipe_request: PIPE_CANCEL 0x%x ", EndpointAddress)); + WLog_DBG(TAG, "urb_pipe_request: PIPE_CANCEL 0x%x ", EndpointAddress); ret = pdev->control_pipe_request( pdev, RequestId, EndpointAddress, @@ -1394,13 +1394,13 @@ static int urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, PIPE_CANCEL); if (ret < 0) { - LLOGLN(urbdrc_debug, ("PIPE SET HALT: error num %d", ret)); + WLog_DBG(TAG, "PIPE SET HALT: error num %d", ret); } break; case PIPE_RESET: - LLOGLN(urbdrc_debug, ("urb_pipe_request: PIPE_RESET ep 0x%x ", EndpointAddress)); + WLog_DBG(TAG, "urb_pipe_request: PIPE_RESET ep 0x%x ", EndpointAddress); ret = pdev->control_pipe_request( pdev, RequestId, EndpointAddress, @@ -1408,11 +1408,11 @@ static int urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, PIPE_RESET); if (ret < 0) - LLOGLN(urbdrc_debug, ("PIPE RESET: error num %d!!\n", ret)); + WLog_DBG(TAG, "PIPE RESET: error num %d!!", ret); break; default: - LLOGLN(urbdrc_debug, ("urb_pipe_request action: %d is not support!\n", action)); + WLog_DBG(TAG, "urb_pipe_request action: %d is not support!", action); break; } @@ -1459,7 +1459,7 @@ static int urb_get_current_frame_number(URBDRC_CHANNEL_CALLBACK* callback, BYTE* out_data; if (transferDir == 0){ - LLOGLN(urbdrc_debug, ("urb_get_current_frame_number: not support transfer out\n")); + WLog_DBG(TAG, "urb_get_current_frame_number: not support transfer out"); //exit(1); return -1; } @@ -1519,8 +1519,8 @@ static int urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK* callba if (transferDir == 0) { - LLOGLN(urbdrc_debug, ("urb_control_get_configuration_request:" - " not support transfer out\n")); + WLog_DBG(TAG, "urb_control_get_configuration_request:" + " not support transfer out"); return -1; } @@ -1551,7 +1551,7 @@ static int urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK* callba 1000); if (ret < 0){ - LLOGLN(urbdrc_debug, ("%s:control_transfer: error num %d\n", __func__, ret)); + WLog_DBG(TAG, "control_transfer: error num %d", ret); OutputBufferSize = 0; } @@ -1600,7 +1600,7 @@ static int urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK* callback, int ret, offset; if (transferDir == 0){ - LLOGLN(urbdrc_debug, ("urb_control_get_interface_request: not support transfer out\n")); + WLog_DBG(TAG, "urb_control_get_interface_request: not support transfer out"); return -1; } @@ -1629,7 +1629,7 @@ static int urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK* callback, 1000); if (ret < 0){ - LLOGLN(urbdrc_debug, ("%s:control_transfer: error num %d\n", __func__, ret)); + WLog_DBG(TAG, "control_transfer: error num %d", ret); OutputBufferSize = 0; } @@ -1700,7 +1700,7 @@ static int urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE switch (transferDir) { case USBD_TRANSFER_DIRECTION_OUT: - CLOG_ERR( "Function urb_control_feature_request: OUT Unchecked\n"); + WLog_ERR(TAG, "Function urb_control_feature_request: OUT Unchecked"); memcpy(buffer, data + offset, OutputBufferSize); bmRequestType |= 0x00; break; @@ -1718,7 +1718,7 @@ static int urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE bmRequest = 0x01; /* REQUEST_CLEAR_FEATURE */ break; default: - CLOG_ERR( "urb_control_feature_request: Error Command %x\n", command); + WLog_ERR(TAG, "urb_control_feature_request: Error Command %x", command); zfree(out_data); return -1; } @@ -1733,7 +1733,7 @@ static int urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE 1000); if (ret < 0){ - LLOGLN(urbdrc_debug, ("feature control transfer: error num %d", ret)); + WLog_DBG(TAG, "feature control transfer: error num %d", ret); OutputBufferSize = 0; } @@ -1790,7 +1790,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B switch (URB_Function) { case URB_FUNCTION_SELECT_CONFIGURATION: /** 0x0000 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SELECT_CONFIGURATION")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SELECT_CONFIGURATION"); error = urb_select_configuration( callback, data + 8, data_sizem - 8, @@ -1800,7 +1800,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_SELECT_INTERFACE: /** 0x0001 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SELECT_INTERFACE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SELECT_INTERFACE"); error = urb_select_interface( callback, data + 8, data_sizem - 8, @@ -1810,7 +1810,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_ABORT_PIPE: /** 0x0002 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_ABORT_PIPE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_ABORT_PIPE"); error = urb_pipe_request( callback, data + 8, data_sizem - 8, MessageId, @@ -1820,31 +1820,31 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B PIPE_CANCEL); break; case URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL: /** 0x0003 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL"); error = -1; /** This URB function is obsolete in Windows 2000 * and later operating systems * and is not supported by Microsoft. */ break; case URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL: /** 0x0004 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL"); error = -1; /** This URB function is obsolete in Windows 2000 * and later operating systems * and is not supported by Microsoft. */ break; case URB_FUNCTION_GET_FRAME_LENGTH: /** 0x0005 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_FRAME_LENGTH")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_FRAME_LENGTH"); error = -1; /** This URB function is obsolete in Windows 2000 * and later operating systems * and is not supported by Microsoft. */ break; case URB_FUNCTION_SET_FRAME_LENGTH: /** 0x0006 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SET_FRAME_LENGTH")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SET_FRAME_LENGTH"); error = -1; /** This URB function is obsolete in Windows 2000 * and later operating systems * and is not supported by Microsoft. */ break; case URB_FUNCTION_GET_CURRENT_FRAME_NUMBER: /** 0x0007 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_CURRENT_FRAME_NUMBER")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_CURRENT_FRAME_NUMBER"); error = urb_get_current_frame_number( callback, data + 8, data_sizem - 8, @@ -1854,7 +1854,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_CONTROL_TRANSFER: /** 0x0008 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CONTROL_TRANSFER")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CONTROL_TRANSFER"); error = urb_control_transfer( callback, data + 8, data_sizem - 8, @@ -1865,7 +1865,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B URB_CONTROL_TRANSFER_NONEXTERNAL); break; case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: /** 0x0009 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER"); error = urb_bulk_or_interrupt_transfer( callback, data + 8, data_sizem - 8, @@ -1875,7 +1875,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_ISOCH_TRANSFER: /** 0x000A */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_ISOCH_TRANSFER")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_ISOCH_TRANSFER"); error = urb_isoch_transfer( callback, data + 8, data_sizem - 8, MessageId, @@ -1884,7 +1884,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE: /** 0x000B */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE"); error = urb_control_descriptor_request( callback, data + 8, data_sizem - 8, @@ -1895,7 +1895,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE: /** 0x000C */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE"); error = urb_control_descriptor_request( callback, data + 8, data_sizem - 8, @@ -1906,7 +1906,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_SET_FEATURE_TO_DEVICE: /** 0x000D */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SET_FEATURE_TO_DEVICE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SET_FEATURE_TO_DEVICE"); error = urb_control_feature_request(callback, data + 8, data_sizem - 8, @@ -1918,7 +1918,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_SET_FEATURE_TO_INTERFACE: /** 0x000E */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SET_FEATURE_TO_INTERFACE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SET_FEATURE_TO_INTERFACE"); error = urb_control_feature_request( callback, data + 8, data_sizem - 8, @@ -1930,7 +1930,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_SET_FEATURE_TO_ENDPOINT: /** 0x000F */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SET_FEATURE_TO_ENDPOINT")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SET_FEATURE_TO_ENDPOINT"); error = urb_control_feature_request( callback, data + 8, data_sizem - 8, @@ -1942,7 +1942,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE: /** 0x0010 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE"); error = urb_control_feature_request( callback, data + 8, data_sizem - 8, @@ -1954,7 +1954,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE: /** 0x0011 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE"); error = urb_control_feature_request( callback, data + 8, data_sizem - 8, @@ -1966,7 +1966,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT: /** 0x0012 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT"); error = urb_control_feature_request( callback, data + 8, data_sizem - 8, @@ -1978,7 +1978,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_STATUS_FROM_DEVICE: /** 0x0013 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_STATUS_FROM_DEVICE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_STATUS_FROM_DEVICE"); error = urb_control_get_status_request( callback, data + 8, data_sizem - 8, @@ -1989,7 +1989,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_STATUS_FROM_INTERFACE: /** 0x0014 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_STATUS_FROM_INTERFACE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_STATUS_FROM_INTERFACE"); error = urb_control_get_status_request( callback, data + 8, data_sizem - 8, @@ -2000,7 +2000,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_STATUS_FROM_ENDPOINT: /** 0x0015 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_STATUS_FROM_ENDPOINT")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_STATUS_FROM_ENDPOINT"); error = urb_control_get_status_request( callback, data + 8, data_sizem - 8, @@ -2011,11 +2011,11 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_RESERVED_0X0016: /** 0x0016 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_RESERVED_0X0016")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_RESERVED_0X0016"); error = -1; break; case URB_FUNCTION_VENDOR_DEVICE: /** 0x0017 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_VENDOR_DEVICE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_VENDOR_DEVICE"); error = urb_control_vendor_or_class_request( callback, data + 8, data_sizem - 8, @@ -2027,7 +2027,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_VENDOR_INTERFACE: /** 0x0018 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_VENDOR_INTERFACE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_VENDOR_INTERFACE"); error = urb_control_vendor_or_class_request( callback, data + 8, data_sizem - 8, @@ -2039,7 +2039,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_VENDOR_ENDPOINT: /** 0x0019 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_VENDOR_ENDPOINT")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_VENDOR_ENDPOINT"); error = urb_control_vendor_or_class_request( callback, data + 8, data_sizem - 8, @@ -2051,7 +2051,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_CLASS_DEVICE: /** 0x001A */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CLASS_DEVICE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CLASS_DEVICE"); error = urb_control_vendor_or_class_request( callback, data + 8, data_sizem - 8, @@ -2063,7 +2063,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_CLASS_INTERFACE: /** 0x001B */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CLASS_INTERFACE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CLASS_INTERFACE"); error = urb_control_vendor_or_class_request( callback, data + 8, data_sizem - 8, @@ -2075,7 +2075,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_CLASS_ENDPOINT: /** 0x001C */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CLASS_ENDPOINT")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CLASS_ENDPOINT"); error = urb_control_vendor_or_class_request( callback, data + 8, data_sizem - 8, @@ -2087,11 +2087,11 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_RESERVE_0X001D: /** 0x001D */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_RESERVE_0X001D")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_RESERVE_0X001D"); error = -1; break; case URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL: /** 0x001E */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL"); error = urb_pipe_request( callback, data + 8, data_sizem - 8, MessageId, @@ -2101,7 +2101,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B PIPE_RESET); break; case URB_FUNCTION_CLASS_OTHER: /** 0x001F */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CLASS_OTHER")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CLASS_OTHER"); error = urb_control_vendor_or_class_request( callback, data + 8, data_sizem - 8, @@ -2113,7 +2113,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_VENDOR_OTHER: /** 0x0020 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_VENDOR_OTHER")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_VENDOR_OTHER"); error = urb_control_vendor_or_class_request( callback, data + 8, data_sizem - 8, @@ -2125,7 +2125,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_STATUS_FROM_OTHER: /** 0x0021 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_STATUS_FROM_OTHER")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_STATUS_FROM_OTHER"); error = urb_control_get_status_request( callback, data + 8, data_sizem - 8, @@ -2136,7 +2136,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_CLEAR_FEATURE_TO_OTHER: /** 0x0022 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CLEAR_FEATURE_TO_OTHER")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CLEAR_FEATURE_TO_OTHER"); error = urb_control_feature_request( callback, data + 8, data_sizem - 8, @@ -2148,7 +2148,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_SET_FEATURE_TO_OTHER: /** 0x0023 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SET_FEATURE_TO_OTHER")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SET_FEATURE_TO_OTHER"); error = urb_control_feature_request( callback, data + 8, data_sizem - 8, @@ -2160,7 +2160,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT: /** 0x0024 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT"); error = urb_control_descriptor_request( callback, data + 8, data_sizem - 8, @@ -2171,7 +2171,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT: /** 0x0025 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT"); error = urb_control_descriptor_request( callback, data + 8, data_sizem - 8, @@ -2182,7 +2182,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_CONFIGURATION: /** 0x0026 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_CONFIGURATION")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_CONFIGURATION"); error = urb_control_get_configuration_request( callback, data + 8, data_sizem - 8, @@ -2192,7 +2192,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_INTERFACE: /** 0x0027 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_INTERFACE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_INTERFACE"); error = urb_control_get_interface_request( callback, data + 8, data_sizem - 8, @@ -2202,7 +2202,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE: /** 0x0028 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE"); error = urb_control_descriptor_request( callback, data + 8, data_sizem - 8, @@ -2213,7 +2213,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE: /** 0x0029 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE"); error = urb_control_descriptor_request( callback, data + 8, data_sizem - 8, @@ -2224,7 +2224,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR: /** 0x002A */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR"); error = urb_os_feature_descriptor_request( callback, data + 8, data_sizem - 8, @@ -2234,28 +2234,28 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B transferDir); break; case URB_FUNCTION_RESERVE_0X002B: /** 0x002B */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_RESERVE_0X002B")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_RESERVE_0X002B"); error = -1; break; case URB_FUNCTION_RESERVE_0X002C: /** 0x002C */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_RESERVE_0X002C")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_RESERVE_0X002C"); error = -1; break; case URB_FUNCTION_RESERVE_0X002D: /** 0x002D */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_RESERVE_0X002D")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_RESERVE_0X002D"); error = -1; break; case URB_FUNCTION_RESERVE_0X002E: /** 0x002E */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_RESERVE_0X002E")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_RESERVE_0X002E"); error = -1; break; case URB_FUNCTION_RESERVE_0X002F: /** 0x002F */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_RESERVE_0X002F")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_RESERVE_0X002F"); error = -1; break; /** USB 2.0 calls start at 0x0030 */ case URB_FUNCTION_SYNC_RESET_PIPE: /** 0x0030 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SYNC_RESET_PIPE")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SYNC_RESET_PIPE"); error = urb_pipe_request( callback, data + 8, data_sizem - 8, @@ -2267,7 +2267,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B error = -9; /** function not support */ break; case URB_FUNCTION_SYNC_CLEAR_STALL: /** 0x0031 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_SYNC_CLEAR_STALL")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_SYNC_CLEAR_STALL"); error = urb_pipe_request( callback, data + 8, data_sizem - 8, @@ -2279,7 +2279,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B error = -9; break; case URB_FUNCTION_CONTROL_TRANSFER_EX: /** 0x0032 */ - LLOGLN(urbdrc_debug, ("URB_Func: URB_FUNCTION_CONTROL_TRANSFER_EX")); + WLog_DBG(TAG, "URB_Func: URB_FUNCTION_CONTROL_TRANSFER_EX"); error = urb_control_transfer( callback, data + 8, data_sizem - 8, @@ -2290,7 +2290,7 @@ static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, B URB_CONTROL_TRANSFER_EXTERNAL); break; default: - LLOGLN(urbdrc_debug, ("URB_Func: %x is not found!", URB_Function)); + WLog_DBG(TAG, "URB_Func: %x is not found!", URB_Function); break; } @@ -2331,8 +2331,8 @@ void* urbdrc_process_udev_data_transfer(void* arg) switch (FunctionId) { case CANCEL_REQUEST: - LLOGLN(urbdrc_debug, ("urbdrc_process_udev_data_transfer:" - " >>CANCEL_REQUEST<<0x%X", FunctionId)); + WLog_DBG(TAG, "urbdrc_process_udev_data_transfer:" + " >>CANCEL_REQUEST<<0x%X", FunctionId); error = urbdrc_process_cancel_request( pBuffer + 8, cbSize - 8, @@ -2340,8 +2340,8 @@ void* urbdrc_process_udev_data_transfer(void* arg) UsbDevice); break; case REGISTER_REQUEST_CALLBACK: - LLOGLN(urbdrc_debug, ("urbdrc_process_udev_data_transfer:" - " >>REGISTER_REQUEST_CALLBACK<<0x%X", FunctionId)); + WLog_DBG(TAG, "urbdrc_process_udev_data_transfer:" + " >>REGISTER_REQUEST_CALLBACK<<0x%X", FunctionId); error = urbdrc_process_register_request_callback( callback, pBuffer + 8, @@ -2350,8 +2350,8 @@ void* urbdrc_process_udev_data_transfer(void* arg) UsbDevice); break; case IO_CONTROL: - LLOGLN(urbdrc_debug, ("urbdrc_process_udev_data_transfer:" - " >>IO_CONTROL<<0x%X", FunctionId)); + WLog_DBG(TAG, "urbdrc_process_udev_data_transfer:" + " >>IO_CONTROL<<0x%X", FunctionId); error = urbdrc_process_io_control( callback, pBuffer + 8, @@ -2360,8 +2360,8 @@ void* urbdrc_process_udev_data_transfer(void* arg) udevman, UsbDevice); break; case INTERNAL_IO_CONTROL: - LLOGLN(urbdrc_debug, ("urbdrc_process_udev_data_transfer:" - " >>INTERNAL_IO_CONTROL<<0x%X", FunctionId)); + WLog_DBG(TAG, "urbdrc_process_udev_data_transfer:" + " >>INTERNAL_IO_CONTROL<<0x%X", FunctionId); error = urbdrc_process_internal_io_control( callback, pBuffer + 8, @@ -2370,8 +2370,8 @@ void* urbdrc_process_udev_data_transfer(void* arg) udevman, UsbDevice); break; case QUERY_DEVICE_TEXT: - LLOGLN(urbdrc_debug, ("urbdrc_process_udev_data_transfer:" - " >>QUERY_DEVICE_TEXT<<0x%X", FunctionId)); + WLog_DBG(TAG, "urbdrc_process_udev_data_transfer:" + " >>QUERY_DEVICE_TEXT<<0x%X", FunctionId); error = urbdrc_process_query_device_text( callback, pBuffer + 8, @@ -2381,8 +2381,8 @@ void* urbdrc_process_udev_data_transfer(void* arg) UsbDevice); break; case TRANSFER_IN_REQUEST: - LLOGLN(urbdrc_debug, ("urbdrc_process_udev_data_transfer:" - " >>TRANSFER_IN_REQUEST<<0x%X", FunctionId)); + WLog_DBG(TAG, "urbdrc_process_udev_data_transfer:" + " >>TRANSFER_IN_REQUEST<<0x%X", FunctionId); error = urbdrc_process_transfer_request( callback, pBuffer + 8, @@ -2393,8 +2393,8 @@ void* urbdrc_process_udev_data_transfer(void* arg) USBD_TRANSFER_DIRECTION_IN); break; case TRANSFER_OUT_REQUEST: - LLOGLN(urbdrc_debug, ("urbdrc_process_udev_data_transfer:" - " >>TRANSFER_OUT_REQUEST<<0x%X", FunctionId)); + WLog_DBG(TAG, "urbdrc_process_udev_data_transfer:" + " >>TRANSFER_OUT_REQUEST<<0x%X", FunctionId); error = urbdrc_process_transfer_request( callback, pBuffer + 8, @@ -2405,8 +2405,8 @@ void* urbdrc_process_udev_data_transfer(void* arg) USBD_TRANSFER_DIRECTION_OUT); break; case RETRACT_DEVICE: - LLOGLN(urbdrc_debug, ("urbdrc_process_udev_data_transfer:" - " >>RETRACT_DEVICE<<0x%X", FunctionId)); + WLog_DBG(TAG, "urbdrc_process_udev_data_transfer:" + " >>RETRACT_DEVICE<<0x%X", FunctionId); error = urbdrc_process_retract_device_request( pBuffer + 8, cbSize - 8, @@ -2414,8 +2414,8 @@ void* urbdrc_process_udev_data_transfer(void* arg) UsbDevice); break; default: - LLOGLN(urbdrc_debug, ("urbdrc_process_udev_data_transfer:" - " unknown FunctionId 0x%X", FunctionId)); + WLog_DBG(TAG, "urbdrc_process_udev_data_transfer:" + " unknown FunctionId 0x%X", FunctionId); error = -1; break; } diff --git a/channels/urbdrc/client/libusb/libusb_udevice.c b/channels/urbdrc/client/libusb/libusb_udevice.c index bb1ead0ca..53fbe5949 100644 --- a/channels/urbdrc/client/libusb/libusb_udevice.c +++ b/channels/urbdrc/client/libusb/libusb_udevice.c @@ -118,7 +118,7 @@ retry: if (completed == NULL || !*completed) { /* we obtained the event lock: do our own event handling */ - LLOGLN(10, ("doing our own event handling")); + WLog_DBG(TAG,"doing our own event handling"); r = libusb_handle_events_locked(ctx, &tv); } @@ -139,11 +139,11 @@ retry: /* we hit a race: whoever was event handling earlier finished in the * time it took us to reach this point. try the cycle again. */ libusb_unlock_event_waiters(ctx); - LLOGLN(10, ("event handler was active but went away, retrying")); + WLog_DBG(TAG,"event handler was active but went away, retrying"); goto retry; } - LLOGLN(10, ("another thread is doing event handling")); + WLog_DBG(TAG,"another thread is doing event handling"); r = libusb_wait_for_event(ctx, &poll_timeout); already_done: @@ -201,7 +201,7 @@ static void func_iso_callback(struct libusb_transfer *transfer) } else { - //CLOG_ERR( "actual length %d \n", act_len); + //WLog_ERR(TAG, "actual length %d ", act_len); //exit(EXIT_FAILURE); } } @@ -273,7 +273,7 @@ static int func_set_usbd_status(UDEVICE* pdev, UINT32* status, int err_result) case LIBUSB_ERROR_IO: *status = USBD_STATUS_STALL_PID; - LLOGLN(10, ("urb_status: LIBUSB_ERROR_IO!!\n")); + WLog_DBG(TAG,"urb_status: LIBUSB_ERROR_IO!!"); break; case LIBUSB_ERROR_INVALID_PARAM: @@ -291,7 +291,7 @@ static int func_set_usbd_status(UDEVICE* pdev, UINT32* status, int err_result) if (!(pdev->status & URBDRC_DEVICE_NOT_FOUND)) { pdev->status |= URBDRC_DEVICE_NOT_FOUND; - LLOGLN(libusb_debug, ("urb_status: LIBUSB_ERROR_NO_DEVICE!!\n")); + WLog_DBG(TAG,"urb_status: LIBUSB_ERROR_NO_DEVICE!!"); } } break; @@ -362,7 +362,7 @@ static int func_config_release_all_interface(LIBUSB_DEVICE_HANDLE* libusb_handle if (ret < 0) { - CLOG_ERR( "config_release_all_interface: error num %d\n", ret); + WLog_ERR(TAG, "config_release_all_interface: error num %d", ret); return -1; } } @@ -380,7 +380,7 @@ static int func_claim_all_interface(LIBUSB_DEVICE_HANDLE* libusb_handle, int Num if (ret < 0) { - CLOG_ERR( "claim_all_interface: error num %d\n", ret); + WLog_ERR(TAG, "claim_all_interface: error num %d", ret); return -1; } } @@ -394,28 +394,28 @@ static void* print_transfer_status(enum libusb_transfer_status status) switch (status) { case LIBUSB_TRANSFER_COMPLETED: - //CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_COMPLETED\n"); + //WLog_ERR(TAG, "Transfer Status: LIBUSB_TRANSFER_COMPLETED"); break; case LIBUSB_TRANSFER_ERROR: - CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_ERROR\n"); + WLog_ERR(TAG, "Transfer Status: LIBUSB_TRANSFER_ERROR"); break; case LIBUSB_TRANSFER_TIMED_OUT: - CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_TIMED_OUT\n"); + WLog_ERR(TAG, "Transfer Status: LIBUSB_TRANSFER_TIMED_OUT"); break; case LIBUSB_TRANSFER_CANCELLED: - CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_CANCELLED\n"); + WLog_ERR(TAG, "Transfer Status: LIBUSB_TRANSFER_CANCELLED"); break; case LIBUSB_TRANSFER_STALL: - CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_STALL\n"); + WLog_ERR(TAG, "Transfer Status: LIBUSB_TRANSFER_STALL"); break; case LIBUSB_TRANSFER_NO_DEVICE: - CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_NO_DEVICE\n"); + WLog_ERR(TAG, "Transfer Status: LIBUSB_TRANSFER_NO_DEVICE"); break; case LIBUSB_TRANSFER_OVERFLOW: - CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_OVERFLOW\n"); + WLog_ERR(TAG, "Transfer Status: LIBUSB_TRANSFER_OVERFLOW"); break; default: - CLOG_ERR( "Transfer Status: Get unknow error num %d (0x%x)\n", + WLog_ERR(TAG, "Transfer Status: Get unknow error num %d (0x%x)", status, status); } return 0; @@ -426,28 +426,28 @@ static void print_status(enum libusb_transfer_status status) switch (status) { case LIBUSB_TRANSFER_COMPLETED: - CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_COMPLETED\n"); + WLog_ERR(TAG, "Transfer status: LIBUSB_TRANSFER_COMPLETED"); break; case LIBUSB_TRANSFER_ERROR: - CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_ERROR\n"); + WLog_ERR(TAG, "Transfer status: LIBUSB_TRANSFER_ERROR"); break; case LIBUSB_TRANSFER_TIMED_OUT: - CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_TIMED_OUT\n"); + WLog_ERR(TAG, "Transfer status: LIBUSB_TRANSFER_TIMED_OUT"); break; case LIBUSB_TRANSFER_CANCELLED: - CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_CANCELLED\n"); + WLog_ERR(TAG, "Transfer status: LIBUSB_TRANSFER_CANCELLED"); break; case LIBUSB_TRANSFER_STALL: - CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_STALL\n"); + WLog_ERR(TAG, "Transfer status: LIBUSB_TRANSFER_STALL"); break; case LIBUSB_TRANSFER_NO_DEVICE: - CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_NO_DEVICE\n"); + WLog_ERR(TAG, "Transfer status: LIBUSB_TRANSFER_NO_DEVICE"); break; case LIBUSB_TRANSFER_OVERFLOW: - CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_OVERFLOW\n"); + WLog_ERR(TAG, "Transfer status: LIBUSB_TRANSFER_OVERFLOW"); break; default: - CLOG_ERR( "Transfer status: unknow status %d(0x%x)\n", status, status); + WLog_ERR(TAG, "Transfer status: unknow status %d(0x%x)", status, status); break; } } @@ -484,7 +484,7 @@ static LIBUSB_DEVICE_DESCRIPTOR* udev_new_descript(LIBUSB_DEVICE* libusb_dev) if (ret < 0) { - CLOG_ERR( "libusb_get_device_descriptor: ERROR!!\n"); + WLog_ERR(TAG, "libusb_get_device_descriptor: ERROR!!"); free(descriptor); return NULL; } @@ -510,7 +510,7 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb if (!udev) { - LLOGLN(0, ("%s: Can't create udev", __func__)); + WLog_DBG(TAG, "Can't create udev"); return -1; } @@ -563,7 +563,7 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb } pdev->port_number = atoi(p2); - LLOGLN(libusb_debug, (" Port: %d", pdev->port_number)); + WLog_DBG(TAG, " Port: %d", pdev->port_number); /* get device path */ p1 = (char*) sysfs_path; @@ -577,7 +577,7 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb memset(pdev->path, 0, 17); strcpy(pdev->path, p2); - LLOGLN(libusb_debug, (" DevPath: %s", pdev->path)); + WLog_DBG(TAG," DevPath: %s", pdev->path); /* query parent hub info */ dev = udev_device_get_parent(dev); @@ -587,7 +587,7 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb hub_found = 1; hub_bus = atoi(udev_device_get_property_value(dev,"BUSNUM")); hub_dev = atoi(udev_device_get_property_value(dev,"DEVNUM")); - LLOGLN(libusb_debug, (" Hub BUS/DEV: %d %d", hub_bus, hub_dev)); + WLog_DBG(TAG, " Hub BUS/DEV: %d %d", hub_bus, hub_dev); } udev_device_unref(dev); @@ -601,7 +601,7 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb if (!hub_found) { - LLOGLN(0, ("%s: hub was not found!", __func__)); + WLog_DBG(TAG,"hub was not found!"); return -1; } @@ -610,7 +610,7 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb if (libusb_dev == NULL) { - LLOGLN(0, ("%s: get hub libusb_dev fail!", __func__)); + WLog_DBG(TAG,"get hub libusb_dev fail!"); return -1; } @@ -618,11 +618,11 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb if (error < 0) { - LLOGLN(0, ("%s: libusb_open error!", __func__)); + WLog_DBG(TAG,"libusb_open error!"); return -1; } - LLOGLN(libusb_debug, ("%s: libusb_open success!", __func__)); + WLog_DBG(TAG,"libusb_open success!"); /* Success! */ return 0; @@ -654,8 +654,8 @@ static int libusb_udev_select_interface(IUDEVICE* idev, BYTE InterfaceNumber, BY if (error < 0) { - CLOG_ERR( "%s: Set interface altsetting get error num %d\n", - __func__, error); + WLog_ERR(TAG, "Set interface altsetting get error num %d", + error); } } @@ -681,8 +681,8 @@ static MSUSB_CONFIG_DESCRIPTOR* libusb_udev_complete_msconfig_setup(IUDEVICE* id LibusbConfig = pdev->LibusbConfig; if (LibusbConfig->bNumInterfaces != MsConfig->NumInterfaces) { - CLOG_ERR( "Select Configuration: Libusb NumberInterfaces(%d) is different " - "with MsConfig NumberInterfaces(%d)\n", + WLog_ERR(TAG, "Select Configuration: Libusb NumberInterfaces(%d) is different " + "with MsConfig NumberInterfaces(%d)", LibusbConfig->bNumInterfaces, MsConfig->NumInterfaces); } @@ -827,7 +827,7 @@ static int libusb_udev_select_configuration(IUDEVICE* idev, UINT32 bConfiguratio ret = libusb_set_configuration(libusb_handle, bConfigurationValue); if (ret < 0){ - CLOG_ERR( "libusb_set_configuration: ERROR number %d!!\n", ret); + WLog_ERR(TAG, "libusb_set_configuration: ERROR number %d!!", ret); func_claim_all_interface(libusb_handle, (*LibusbConfig)->bNumInterfaces); return -1; } @@ -835,7 +835,7 @@ static int libusb_udev_select_configuration(IUDEVICE* idev, UINT32 bConfiguratio { ret = libusb_get_active_config_descriptor (libusb_dev, LibusbConfig); if (ret < 0){ - CLOG_ERR( "libusb_get_config_descriptor_by_value: ERROR number %d!!\n", ret); + WLog_ERR(TAG, "libusb_get_config_descriptor_by_value: ERROR number %d!!", ret); func_claim_all_interface(libusb_handle, (*LibusbConfig)->bNumInterfaces); return -1; } @@ -885,7 +885,7 @@ static int libusb_udev_control_pipe_request(IUDEVICE* idev, UINT32 RequestId, *UsbdStatus = 0; /* if(pdev->request_queue->unregister_request(pdev->request_queue, RequestId)) - CLOG_ERR( "request_queue_unregister_request: not fount request 0x%x\n", RequestId); + WLog_ERR(TAG, "request_queue_unregister_request: not fount request 0x%x", RequestId); */ return error; } @@ -918,8 +918,8 @@ static int libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextType ret -= 2; if (ret <= 0 || ret < 4){ - LLOGLN(libusb_debug, ("libusb_get_string_descriptor: " - "ERROR num %d, iProduct: %d!", ret, devDescriptor->iProduct)); + WLog_DBG(TAG,"libusb_get_string_descriptor: " + "ERROR num %d, iProduct: %d!", ret, devDescriptor->iProduct); memcpy(Buffer, strDesc, strlen(strDesc)); Buffer[strlen(strDesc)] = '\0'; *BufferSize = (strlen((char *)Buffer)) * 2; @@ -947,7 +947,7 @@ static int libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextType *BufferSize = (i*2); break; default: - LLOGLN(0, ("Query Text: unknown TextType %d", TextType)); + WLog_DBG(TAG,"Query Text: unknown TextType %d", TextType); break; } @@ -980,12 +980,12 @@ static int libusb_udev_os_feature_descriptor_request(IUDEVICE* idev, UINT32 Requ ms_string_desc, 0x12, Timeout); - //CLOG_ERR( "Get ms string: result number %d", error); + //WLog_ERR(TAG, "Get ms string: result number %d", error); if (error > 0) { BYTE bMS_Vendorcode; data_read_BYTE(ms_string_desc + 16, bMS_Vendorcode); - //CLOG_ERR( "bMS_Vendorcode:0x%x", bMS_Vendorcode); + //WLog_ERR(TAG, "bMS_Vendorcode:0x%x", bMS_Vendorcode); /** get os descriptor */ error = libusb_control_transfer(pdev->libusb_handle, LIBUSB_ENDPOINT_IN |LIBUSB_REQUEST_TYPE_VENDOR | Recipient, @@ -1004,7 +1004,7 @@ static int libusb_udev_os_feature_descriptor_request(IUDEVICE* idev, UINT32 Requ *UsbdStatus = USBD_STATUS_SUCCESS; /* if(pdev->request_queue->unregister_request(pdev->request_queue, RequestId)) - CLOG_ERR( "request_queue_unregister_request: not fount request 0x%x\n", RequestId); + WLog_ERR(TAG, "request_queue_unregister_request: not fount request 0x%x", RequestId); */ return error; } @@ -1059,10 +1059,10 @@ static void libusb_udev_detach_kernel_driver(IUDEVICE* idev) for (i = 0; i < pdev->LibusbConfig->bNumInterfaces; i++) { err = libusb_kernel_driver_active(pdev->libusb_handle , i); - LLOGLN(libusb_debug, ("libusb_kernel_driver_active = %d\n", err)); + WLog_DBG(TAG,"libusb_kernel_driver_active = %d", err); if (err){ err = libusb_detach_kernel_driver(pdev->libusb_handle , i); - LLOGLN(libusb_debug, ("libusb_detach_kernel_driver = %d\n", err)); + WLog_DBG(TAG,"libusb_detach_kernel_driver = %d", err); } } @@ -1079,12 +1079,12 @@ static void libusb_udev_attach_kernel_driver(IUDEVICE* idev) { err = libusb_release_interface (pdev->libusb_handle, i); if (err < 0){ - LLOGLN(libusb_debug, ("libusb_release_interface: error num %d = %d", i, err)); + WLog_DBG(TAG,"libusb_release_interface: error num %d = %d", i, err); } if (err != LIBUSB_ERROR_NO_DEVICE) { err = libusb_attach_kernel_driver (pdev->libusb_handle , i); - LLOGLN(libusb_debug, ("libusb_attach_kernel_driver if%d = %d", i, err)); + WLog_DBG(TAG,"libusb_attach_kernel_driver if%d = %d", i, err); } } } @@ -1222,13 +1222,13 @@ static int libusb_udev_query_device_port_status(IUDEVICE* idev, UINT32* UsbdStat if (ret < 0) { - LLOGLN(libusb_debug, ("libusb_control_transfer: error num %d", ret)); + WLog_DBG(TAG,"libusb_control_transfer: error num %d", ret); *BufferSize = 0; } else { - LLOGLN(libusb_debug, ("PORT STATUS:0x%02x%02x%02x%02x", - Buffer[3], Buffer[2], Buffer[1], Buffer[0])); + WLog_DBG(TAG,"PORT STATUS:0x%02x%02x%02x%02x", + Buffer[3], Buffer[2], Buffer[1], Buffer[0]); success = 1; } } @@ -1263,7 +1263,7 @@ static int libusb_udev_isoch_transfer(IUDEVICE* idev, UINT32 RequestId, UINT32 E if (iso_transfer == NULL) { - CLOG_ERR( "Error: libusb_alloc_transfer.\n"); + WLog_ERR(TAG, "Error: libusb_alloc_transfer."); status = -1; } @@ -1288,7 +1288,7 @@ static int libusb_udev_isoch_transfer(IUDEVICE* idev, UINT32 RequestId, UINT32 E if (submit < 0) { - LLOGLN(libusb_debug, ("Error: Failed to submit transfer (ret = %d).", submit)); + WLog_DBG(TAG,"Error: Failed to submit transfer (ret = %d).", submit); status = -1; func_set_usbd_status(pdev, UrbdStatus, ret); } @@ -1309,7 +1309,7 @@ static int libusb_udev_isoch_transfer(IUDEVICE* idev, UINT32 RequestId, UINT32 E } ret = handle_events_completed(NULL, &iso_user_data.completed); if (ret < 0) { - LLOGLN(libusb_debug, ("Error: libusb_handle_events (ret = %d).", ret)); + WLog_DBG(TAG,"Error: libusb_handle_events (ret = %d).", ret); status = -1; break; } @@ -1368,14 +1368,14 @@ static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, UINT32 Request if (!ep_desc) { - CLOG_ERR( "func_get_ep_desc: endpoint 0x%x is not found!!\n", EndpointAddress); + WLog_ERR(TAG, "func_get_ep_desc: endpoint 0x%x is not found!!", EndpointAddress); return -1; } transfer_type = (ep_desc->bmAttributes) & 0x3; - LLOGLN(libusb_debug, ("urb_bulk_or_interrupt_transfer: ep:0x%x " + WLog_DBG(TAG,"urb_bulk_or_interrupt_transfer: ep:0x%x " "transfer_type %d flag:%d OutputBufferSize:0x%x", - EndpointAddress, transfer_type, TransferFlags, *BufferSize)); + EndpointAddress, transfer_type, TransferFlags, *BufferSize); switch (transfer_type) { @@ -1391,9 +1391,9 @@ static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, UINT32 Request * request to wMaxPacketSize */ if (*BufferSize != (ep_desc->wMaxPacketSize)) { - LLOGLN(libusb_debug, ("Interrupt Transfer(%s): " + WLog_DBG(TAG,"Interrupt Transfer(%s): " "BufferSize is different than maxPacketsize(0x%x)", - ((transferDir)?"IN":"OUT"), ep_desc->wMaxPacketSize)); + ((transferDir)?"IN":"OUT"), ep_desc->wMaxPacketSize); if((*BufferSize) > (ep_desc->wMaxPacketSize) && transferDir == USBD_TRANSFER_DIRECTION_IN) (*BufferSize) = ep_desc->wMaxPacketSize; @@ -1402,8 +1402,8 @@ static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, UINT32 Request break; default: - LLOGLN(0, ("urb_bulk_or_interrupt_transfer:" - " other transfer type 0x%X", transfer_type)); + WLog_DBG(TAG,"urb_bulk_or_interrupt_transfer:" + " other transfer type 0x%X", transfer_type); return -1; break; } @@ -1418,7 +1418,7 @@ static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, UINT32 Request if (submit < 0) { - LLOGLN(libusb_debug, ("libusb_bulk_transfer: error num %d", status)); + WLog_DBG(TAG,"libusb_bulk_transfer: error num %d", status); func_set_usbd_status(pdev, UsbdStatus, status); *BufferSize = 0; } @@ -1489,12 +1489,12 @@ static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, UINT32 Request *BufferSize = transfer->actual_length; } - LLOGLN(libusb_debug, ("bulk or interrupt Transfer data size : 0x%x", *BufferSize)); + WLog_DBG(TAG,"bulk or interrupt Transfer data size : 0x%x", *BufferSize); if (request) { if(pdev->request_queue->unregister_request(pdev->request_queue, RequestId)) - CLOG_ERR( "request_queue_unregister_request: not fount request 0x%x\n", RequestId); + WLog_ERR(TAG, "request_queue_unregister_request: not fount request 0x%x", RequestId); } libusb_free_transfer(transfer); @@ -1528,7 +1528,7 @@ static void libusb_udev_cancel_all_transfer_request(IUDEVICE* idev) if (status < 0) { - LLOGLN(libusb_debug, ("libusb_cancel_transfer: error num %d!!\n", status)); + WLog_DBG(TAG,"libusb_cancel_transfer: error num %d!!", status); } else { @@ -1557,14 +1557,14 @@ static int func_cancel_xact_request(TRANSFER_REQUEST *request) if (status < 0) { - LLOGLN(0, ("libusb_cancel_transfer: error num %d!!", status)); + WLog_DBG(TAG,"libusb_cancel_transfer: error num %d!!", status); if (status == LIBUSB_ERROR_NOT_FOUND) return -1; } else { - LLOGLN(libusb_debug, ("libusb_cancel_transfer: Success num:0x%x!!", request->RequestId)); + WLog_DBG(TAG,"libusb_cancel_transfer: Success num:0x%x!!", request->RequestId); request->submit = -1; return 1; } @@ -1590,8 +1590,8 @@ cancel_retry: if (!request) continue; - LLOGLN(libusb_debug, ("%s: CancelId:0x%x RequestId:0x%x endpoint 0x%x!!", - __func__, RequestId, request->RequestId, request->endpoint)); + WLog_DBG(TAG,"CancelId:0x%x RequestId:0x%x endpoint 0x%x!!", + RequestId, request->RequestId, request->endpoint); if ((request && request->RequestId) == (RequestId && retry_times <= 10)) { @@ -1611,16 +1611,16 @@ cancel_retry: { retry_times++; usleep(100000); - LLOGLN(10, ("urbdrc_process_cancel_request: go retry!!")); + WLog_DBG(TAG,"urbdrc_process_cancel_request: go retry!!"); goto cancel_retry; } else if ((status < 0) || (retry_times >= 10)) { /** END */ - LLOGLN(libusb_debug, ("urbdrc_process_cancel_request: error go exit!!")); + WLog_DBG(TAG,"urbdrc_process_cancel_request: error go exit!!"); return -1; } - LLOGLN(libusb_debug, ("urbdrc_process_cancel_request: success!!")); + WLog_DBG(TAG,"urbdrc_process_cancel_request: success!!"); return 0; } @@ -1704,7 +1704,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number) if (status < 0) { - CLOG_ERR( "USB init: Error to get HUB handle!!\n"); + WLog_ERR(TAG, "USB init: Error to get HUB handle!!"); pdev->hub_handle = NULL; } @@ -1712,7 +1712,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number) if (!pdev->devDescriptor) { - CLOG_ERR( "USB init: Error to get device descriptor!!\n"); + WLog_ERR(TAG, "USB init: Error to get device descriptor!!"); zfree(pdev); return NULL; } @@ -1723,7 +1723,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number) if (status < 0) { - CLOG_ERR( "libusb_get_descriptor: ERROR!!ret:%d\n", status); + WLog_ERR(TAG, "libusb_get_descriptor: ERROR!!ret:%d", status); zfree(pdev); return NULL; } @@ -1732,11 +1732,11 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number) /* get the first interface and first altsetting */ interface_temp = config_temp->interface[0].altsetting[0]; - LLOGLN(0, ("Regist Device: Vid: 0x%04X Pid: 0x%04X" + WLog_DBG(TAG,"Regist Device: Vid: 0x%04X Pid: 0x%04X" " InterfaceClass = 0x%X", pdev->devDescriptor->idVendor, pdev->devDescriptor->idProduct, - interface_temp.bInterfaceClass)); + interface_temp.bInterfaceClass); /* Denied list */ switch(interface_temp.bInterfaceClass) @@ -1752,7 +1752,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number) case CLASS_CONTENT_SECURITY: //case CLASS_WIRELESS_CONTROLLER: //case CLASS_ELSE_DEVICE: - CLOG_ERR( " Device is not supported!!\n"); + WLog_ERR(TAG, " Device is not supported!!"); zfree(pdev); return NULL; default: @@ -1818,7 +1818,7 @@ int udev_new_by_id(UINT16 idVendor, UINT16 idProduct, IUDEVICE*** devArray) ssize_t total_device; int i, status, num = 0; - CLOG_ERR( "VID: 0x%04X PID: 0x%04X\n", idVendor, idProduct); + WLog_ERR(TAG, "VID: 0x%04X PID: 0x%04X", idVendor, idProduct); array = (UDEVICE**) malloc(16 * sizeof(UDEVICE*)); @@ -1839,7 +1839,7 @@ int udev_new_by_id(UINT16 idVendor, UINT16 idProduct, IUDEVICE*** devArray) if (status < 0) { - CLOG_ERR( "libusb_open: (by id) error: 0x%08X (%d)\n", status, status); + WLog_ERR(TAG, "libusb_open: (by id) error: 0x%08X (%d)", status, status); zfree(descriptor); zfree(array[num]); continue; @@ -1868,7 +1868,7 @@ IUDEVICE* udev_new_by_addr(int bus_number, int dev_number) int status; UDEVICE* pDev; - LLOGLN(10, ("bus:%d dev:%d\n", bus_number, dev_number)); + WLog_DBG(TAG,"bus:%d dev:%d", bus_number, dev_number); pDev = (PUDEVICE) malloc(sizeof(UDEVICE)); @@ -1876,7 +1876,7 @@ IUDEVICE* udev_new_by_addr(int bus_number, int dev_number) if (pDev->libusb_dev == NULL) { - CLOG_ERR( "libusb_device_new: ERROR!!\n"); + WLog_ERR(TAG, "libusb_device_new: ERROR!!"); zfree(pDev); return NULL; } @@ -1885,7 +1885,7 @@ IUDEVICE* udev_new_by_addr(int bus_number, int dev_number) if (status < 0) { - CLOG_ERR( "libusb_open: (by addr) ERROR!!\n"); + WLog_ERR(TAG, "libusb_open: (by addr) ERROR!!"); zfree(pDev); return NULL; } diff --git a/channels/urbdrc/client/libusb/libusb_udevman.c b/channels/urbdrc/client/libusb/libusb_udevman.c index c395b3c37..f8ce71503 100644 --- a/channels/urbdrc/client/libusb/libusb_udevman.c +++ b/channels/urbdrc/client/libusb/libusb_udevman.c @@ -116,9 +116,8 @@ static IUDEVICE* udevman_get_udevice_by_addr(IUDEVMAN* idevman, int bus_number, } idevman->loading_unlock(idevman); - LLOGLN(libusb_debug, ("%s: bus:%d dev:%d not exist in udevman", - __func__, bus_number, dev_number)); - + WLog_WARN(TAG, "bus:%d dev:%d not exist in udevman", + bus_number, dev_number); return NULL; } @@ -206,7 +205,7 @@ static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_n } else { - CLOG_ERR( "udevman_register_udevice: function error!!"); + WLog_ERR(TAG, "udevman_register_udevice: function error!!"); return 0; } @@ -270,9 +269,10 @@ static int udevman_unregister_udevice(IUDEVMAN* idevman, int bus_number, int dev if (err != LIBUSB_ERROR_NO_DEVICE) { ret = libusb_reset_device(dev->libusb_handle); - if (ret<0){ - LLOGLN(10, ("libusb_reset_device: ERROR!!ret:%d\n", ret)); - } + if (ret<0) + { + WLog_ERR(TAG, "libusb_reset_device: ERROR!!ret:%d", ret); + } } /* release all interface and attach kernel driver */ @@ -390,8 +390,7 @@ static IUDEVICE* udevman_get_udevice_by_UsbDevice(IUDEVMAN* idevman, UINT32 UsbD return (IUDEVICE*) pdev; } - LLOGLN(libusb_debug, ("udevman_get_udevice_by_UsbDevice: 0x%x ERROR!!\n", UsbDevice)); - + WLog_ERR(TAG, "0x%x ERROR!!", UsbDevice); return NULL; } @@ -550,7 +549,7 @@ static void urbdrc_udevman_parse_addin_args(UDEVMAN* udevman, ADDIN_ARGV* args) CommandLineSwitchCase(arg, "dbg") { - urbdrc_debug = 0; + WLog_SetLogLevel(WLog_Get(TAG), WLOG_TRACE); } CommandLineSwitchCase(arg, "dev") { diff --git a/channels/urbdrc/client/libusb/request_queue.c b/channels/urbdrc/client/libusb/request_queue.c index 5709faef2..86035f1e4 100644 --- a/channels/urbdrc/client/libusb/request_queue.c +++ b/channels/urbdrc/client/libusb/request_queue.c @@ -100,7 +100,7 @@ TRANSFER_REQUEST* request_queue_get_request_by_endpoint(REQUEST_QUEUE* queue, BY } } pthread_mutex_unlock(&queue->request_loading); - CLOG_ERR( "request_queue_get_request_by_id: ERROR!!\n"); + WLog_ERR(TAG, "request_queue_get_request_by_id: ERROR!!"); return NULL; } diff --git a/channels/urbdrc/client/searchman.c b/channels/urbdrc/client/searchman.c index bdf103890..7396fda27 100644 --- a/channels/urbdrc/client/searchman.c +++ b/channels/urbdrc/client/searchman.c @@ -155,17 +155,17 @@ static void searchman_list_show(USB_SEARCHMAN* self) { int num = 0; USB_SEARCHDEV* usb; - - CLOG_ERR( "=========== Usb Search List ========= \n"); + WLog_ERR(TAG, "=========== Usb Search List ========="); self->rewind(self); while (self->has_next(self)) { usb = self->get_next(self); - CLOG_ERR( " USB %d: \n", num++); - CLOG_ERR( " idVendor: 0x%04X \n", usb->idVendor); - CLOG_ERR( " idProduct: 0x%04X \n", usb->idProduct); + WLog_ERR(TAG, " USB %d: \n", num++); + WLog_ERR(TAG, " idVendor: 0x%04X", usb->idVendor); + WLog_ERR(TAG, " idProduct: 0x%04X", usb->idProduct); } - CLOG_ERR( "================= END =============== \n"); + + WLog_ERR(TAG, "================= END ==============="); } void searchman_free(USB_SEARCHMAN* self) @@ -202,7 +202,7 @@ USB_SEARCHMAN* searchman_new(void * urbdrc, UINT32 UsbDevice) if (ret != 0) { - CLOG_ERR( "searchman mutex initialization: searchman->mutex failed"); + WLog_ERR(TAG, "searchman mutex initialization: searchman->mutex failed"); exit(EXIT_FAILURE); } diff --git a/channels/urbdrc/client/urbdrc_main.c b/channels/urbdrc/client/urbdrc_main.c index 568d0d5c6..e87966932 100644 --- a/channels/urbdrc/client/urbdrc_main.c +++ b/channels/urbdrc/client/urbdrc_main.c @@ -39,9 +39,7 @@ #include "data_transfer.h" #include "searchman.h" -int urbdrc_debug = 0; - -static int func_hardware_id_format(IUDEVICE* pdev, char (*HardwareIds)[DEVICE_HARDWARE_ID_SIZE]) +static int func_hardware_id_format(IUDEVICE* pdev, char(*HardwareIds)[DEVICE_HARDWARE_ID_SIZE]) { char str[DEVICE_HARDWARE_ID_SIZE]; int idVendor, idProduct, bcdDevice; @@ -230,8 +228,7 @@ static int urbdrc_process_capability_request(URBDRC_CHANNEL_CALLBACK* callback, UINT32 Version; UINT32 out_size; char * out_data; - - LLOGLN(10, ("urbdrc_process_capability_request")); + WLog_VRB(TAG, ""); data_read_UINT32(data + 0, Version); InterfaceId = ((STREAM_ID_NONE<<30) | CAPABILITIES_NEGOTIATOR); @@ -257,8 +254,7 @@ static int urbdrc_process_channel_create(URBDRC_CHANNEL_CALLBACK* callback, char UINT32 MinorVersion; UINT32 Capabilities; char* out_data; - - LLOGLN(10, ("urbdrc_process_channel_create")); + WLog_VRB(TAG, ""); data_read_UINT32(data + 0, MajorVersion); data_read_UINT32(data + 4, MinorVersion); data_read_UINT32(data + 8, Capabilities); @@ -286,9 +282,7 @@ static int urdbrc_send_virtual_channel_add(IWTSVirtualChannel* channel, UINT32 M UINT32 out_size; UINT32 InterfaceId; char* out_data; - - LLOGLN(10, ("urdbrc_send_virtual_channel_add")); - + WLog_VRB(TAG, ""); assert(NULL != channel); assert(NULL != channel->Write); @@ -318,8 +312,7 @@ static int urdbrc_send_usb_device_add(URBDRC_CHANNEL_CALLBACK* callback, IUDEVIC char strInstanceId[DEVICE_INSTANCE_STR_SIZE]; char* composite_str = "USB\\COMPOSITE"; int size, out_offset, cchCompatIds, bcdUSB; - - LLOGLN(10, ("urdbrc_send_usb_device_add")); + WLog_VRB(TAG, ""); InterfaceId = ((STREAM_ID_PROXY<<30) | CLIENT_DEVICE_SINK); /* USB kernel driver detach!! */ @@ -433,7 +426,7 @@ static int urbdrc_exchange_capabilities(URBDRC_CHANNEL_CALLBACK* callback, char* break; default: - LLOGLN(10, ("urbdrc_exchange_capabilities: unknown FunctionId 0x%X", FunctionId)); + WLog_ERR(TAG, "unknown FunctionId 0x%X", FunctionId); error = 1; break; } @@ -455,9 +448,7 @@ static void* urbdrc_search_usb_device(void* arg) int numobj, timeout; int busnum, devnum; int success = 0, error, on_close = 0, found = 0; - - LLOGLN(10, ("urbdrc_search_usb_device: ")); - + WLog_VRB(TAG, ""); channel_mgr = urbdrc->listener_callback->channel_mgr; /* init usb monitor */ @@ -469,7 +460,7 @@ static void* urbdrc_search_usb_device(void* arg) if (!udev) { - CLOG_ERR( "Can't create udev\n"); + WLog_ERR(TAG, "Can't create udev"); return 0; } @@ -484,7 +475,7 @@ static void* urbdrc_search_usb_device(void* arg) while (1) { - LLOGLN(10, ("======= SEARCH ======= ")); + WLog_VRB(TAG, "======= SEARCH ======= "); busnum = 0; devnum = 0; sdev = NULL; @@ -541,8 +532,8 @@ static void* urbdrc_search_usb_device(void* arg) if (sdev->idVendor == idVendor && sdev->idProduct == idProduct) { - LLOGLN(10, ("Searchman Find Device: %04x:%04x ", - sdev->idVendor, sdev->idProduct)); + WLog_VRB(TAG, "Searchman Find Device: %04x:%04x ", + sdev->idVendor, sdev->idProduct); found = 1; break; } @@ -550,8 +541,8 @@ static void* urbdrc_search_usb_device(void* arg) if (!found && udevman->isAutoAdd(udevman)) { - LLOGLN(10, ("Auto Find Device: %04x:%04x ", - idVendor, idProduct)); + WLog_VRB(TAG, "Auto Find Device: %04x:%04x ", + idVendor, idProduct); found = 2; } @@ -611,7 +602,7 @@ static void* urbdrc_search_usb_device(void* arg) if (dvc_channel == NULL) { - LLOGLN(0, ("SEARCH: dvc_channel %d is NULL!!", pdev->get_channel_id(pdev))); + WLog_ERR(TAG, "SEARCH: dvc_channel %d is NULL!!", pdev->get_channel_id(pdev)); func_close_udevice(searchman, pdev); break; } @@ -653,7 +644,7 @@ static void* urbdrc_search_usb_device(void* arg) } else { - CLOG_ERR( "No Device from receive_device(). An error occured.\n"); + WLog_ERR(TAG, "No Device from receive_device(). An error occured."); } } } @@ -733,8 +724,8 @@ void* urbdrc_new_device_create(void* arg) break; default: - LLOGLN(0, ("urbdrc_new_device_create: vchannel_status unknown value %d", - urbdrc->vchannel_status)); + WLog_ERR(TAG, "vchannel_status unknown value %d", + urbdrc->vchannel_status); break; } @@ -758,7 +749,7 @@ static int urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callback break; case RIMCALL_RELEASE: - LLOGLN(10, ("urbdrc_process_channel_notification: recv RIMCALL_RELEASE")); + WLog_VRB(TAG, "recv RIMCALL_RELEASE"); pthread_t thread; TRANSFER_DATA* transfer_data; @@ -781,14 +772,14 @@ static int urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callback break; default: - LLOGLN(10, ("urbdrc_process_channel_notification: unknown FunctionId 0x%X", FunctionId)); + WLog_VRB(TAG, "unknown FunctionId 0x%X", FunctionId); error = 1; break; } return error; } -static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, UINT32 cbSize, BYTE* Buffer) +static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* data) { URBDRC_CHANNEL_CALLBACK* callback = (URBDRC_CHANNEL_CALLBACK*) pChannelCallback; URBDRC_PLUGIN* urbdrc; @@ -797,7 +788,8 @@ static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, UINT32 InterfaceId; UINT32 Mask; int error = 0; - char* pBuffer = (char*) Buffer; + char* pBuffer = (char*)Stream_Pointer(data); + UINT32 cbSize = Stream_GetRemainingLength(data); if (callback == NULL) return 0; @@ -815,7 +807,7 @@ static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, data_read_UINT32(pBuffer + 0, InterfaceTemp); InterfaceId = (InterfaceTemp & 0x0fffffff); Mask = ((InterfaceTemp & 0xf0000000)>>30); - LLOGLN(10, ("urbdrc_on_data_received: Size=%d InterfaceId=0x%X Mask=0x%X", cbSize, InterfaceId, Mask)); + WLog_VRB(TAG, "Size=%d InterfaceId=0x%X Mask=0x%X", cbSize, InterfaceId, Mask); switch (InterfaceId) { @@ -828,7 +820,7 @@ static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, break; default: - LLOGLN(10, ("urbdrc_on_data_received: InterfaceId 0x%X Start matching devices list", InterfaceId)); + WLog_VRB(TAG, "InterfaceId 0x%X Start matching devices list", InterfaceId); pthread_t thread; TRANSFER_DATA* transfer_data; @@ -836,7 +828,7 @@ static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, if (transfer_data == NULL) { - CLOG_ERR( "transfer_data is NULL!!"); + WLog_ERR(TAG, "transfer_data is NULL!!"); return 0; } @@ -860,7 +852,7 @@ static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, error = pthread_create(&thread, 0, urbdrc_process_udev_data_transfer, transfer_data); if (error < 0) - LLOGLN(0, ("Create Data Transfer Thread got error = %d", error)); + WLog_ERR(TAG, "Create Data Transfer Thread got error = %d", error); else pthread_detach(thread); @@ -881,9 +873,7 @@ static int urbdrc_on_close(IWTSVirtualChannelCallback * pChannelCallback) int found = 0; ChannelId = callback->channel_mgr->GetChannelId(callback->channel); - - LLOGLN(0, ("urbdrc_on_close: channel id %d", ChannelId)); - + WLog_INFO(TAG, "urbdrc_on_close: channel id %d", ChannelId); udevman->loading_lock(udevman); udevman->rewind(udevman); @@ -907,9 +897,7 @@ static int urbdrc_on_close(IWTSVirtualChannelCallback * pChannelCallback) } zfree(callback); - - LLOGLN(urbdrc_debug, ("urbdrc_on_close: success")); - + WLog_DBG(TAG, "success"); return 0; } @@ -918,8 +906,7 @@ static int urbdrc_on_new_channel_connection(IWTSListenerCallback* pListenerCallb { URBDRC_LISTENER_CALLBACK* listener_callback = (URBDRC_LISTENER_CALLBACK*) pListenerCallback; URBDRC_CHANNEL_CALLBACK* callback; - - LLOGLN(10, ("urbdrc_on_new_channel_connection:")); + WLog_VRB(TAG, ""); callback = (URBDRC_CHANNEL_CALLBACK*) malloc(sizeof(URBDRC_CHANNEL_CALLBACK)); callback->iface.OnDataReceived = urbdrc_on_data_received; callback->iface.OnClose = urbdrc_on_close; @@ -936,8 +923,7 @@ static int urbdrc_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManag URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*) pPlugin; IUDEVMAN* udevman = NULL; USB_SEARCHMAN* searchman = NULL; - - LLOGLN(10, ("urbdrc_plugin_initialize:")); + WLog_VRB(TAG, ""); urbdrc->listener_callback = (URBDRC_LISTENER_CALLBACK*) malloc(sizeof(URBDRC_LISTENER_CALLBACK)); memset(urbdrc->listener_callback, 0, sizeof(URBDRC_LISTENER_CALLBACK)); @@ -959,8 +945,7 @@ static int urbdrc_plugin_terminated(IWTSPlugin* pPlugin) URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*) pPlugin; IUDEVMAN* udevman = urbdrc->udevman; USB_SEARCHMAN* searchman = urbdrc->searchman; - - LLOGLN(10, ("urbdrc_plugin_terminated:")); + WLog_VRB(TAG, ""); if (searchman) { @@ -1001,7 +986,7 @@ static void urbdrc_register_udevman_addin(IWTSPlugin* pPlugin, IUDEVMAN* udevman if (urbdrc->udevman) { - CLOG_ERR("existing device, abort."); + WLog_ERR(TAG, "existing device, abort."); return; } @@ -1026,7 +1011,7 @@ static int urbdrc_load_udevman_addin(IWTSPlugin* pPlugin, const char* name, ADDI if (entry(&entryPoints) != 0) { - CLOG_ERR("%s entry returns error.", name); + WLog_ERR(TAG, "%s entry returns error.", name); return FALSE; } @@ -1070,7 +1055,7 @@ static void urbdrc_process_addin_args(URBDRC_PLUGIN* urbdrc, ADDIN_ARGV* args) CommandLineSwitchCase(arg, "dbg") { - urbdrc_debug = 0; + WLog_SetLogLevel(WLog_Get(TAG), WLOG_TRACE); } CommandLineSwitchCase(arg, "sys") { @@ -1111,8 +1096,6 @@ int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) urbdrc->searchman = NULL; urbdrc->vchannel_status = INIT_CHANNEL_IN; - urbdrc_debug = 10; - status = pEntryPoints->RegisterPlugin(pEntryPoints, "urbdrc", (IWTSPlugin*) urbdrc); } diff --git a/channels/urbdrc/client/urbdrc_types.h b/channels/urbdrc/client/urbdrc_types.h index fc5a8b4c6..641478eea 100644 --- a/channels/urbdrc/client/urbdrc_types.h +++ b/channels/urbdrc/client/urbdrc_types.h @@ -36,10 +36,11 @@ #include +#define TAG CHANNELS_TAG("urbdrc.client") #ifdef WITH_DEBUG_DVC -#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) WLog_DBG(TAG, fmt, ## __VA_ARGS__) #else -#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__) +#define DEBUG_DVC(fmt, ...) do { } while (0) #endif #define CAPABILITIES_NEGOTIATOR 0x00000000 @@ -316,10 +317,6 @@ enum device_descriptor_table #define MAX_URB_REQUSET_NUM 0x80 #define LOG_LEVEL 1 -#define LLOG(_level, args) \ - do { if (_level < LOG_LEVEL) { CLOG_DBG args ; } } while (0) -#define LLOGLN(_level, args) \ - do { if (_level < LOG_LEVEL) { CLOG_DBG args ; } } while (0) #define dummy_wait_obj(void) do{ sleep(5); } while(0) #define dummy_wait_s_obj(_s) do{ sleep(_s); } while(0) @@ -333,6 +330,4 @@ enum device_descriptor_table _t = (_tp.tv_sec * 1000) + (_tp.tv_usec / 1000); \ } while (0) -extern int urbdrc_debug; - #endif /* __URBDRC_TYPES_H */