diff --git a/src/os_mac/os_mac.m b/src/os_mac/os_mac.m index c1d235a..8a91829 100644 --- a/src/os_mac/os_mac.m +++ b/src/os_mac/os_mac.m @@ -247,17 +247,6 @@ return; } - // log the received data -#ifdef WITH_WIIUSE_DEBUG - { - printf("[DEBUG] (id %i) RECV: (%x) ", wm->unid, data[0]); - int x; - for (x = 1; x < length; ++x) - printf("%.2x ", data[x]); - printf("\n"); - } -#endif - /* * This is called if we are receiving data before completing * the handshaking, hence before calling wiiuse_poll @@ -308,6 +297,19 @@ WIIUSE_WARNING("Received data was longer than event buffer. Dropping excess bytes."); length = sizeof(wm->event_buf); } + + // log the received data +#ifdef WITH_WIIUSE_DEBUG + { + printf("[DEBUG] (id %i) RECV: (%x) ", wm->unid, bytes[1]); + int x; + for (x = 2; x < length; ++x) + printf("%.2x ", bytes[x]); + printf("\n"); + } +#endif + + // copy to struct memcpy(wm->event_buf, bytes, length); return length; diff --git a/src/wiiuse.c b/src/wiiuse.c index f947a59..6d1ff5e 100644 --- a/src/wiiuse.c +++ b/src/wiiuse.c @@ -693,12 +693,13 @@ int wiiuse_send(struct wiimote_t* wm, byte report_type, byte* msg, int len) { #ifdef WITH_WIIUSE_DEBUG { - int x = 2; - printf("[DEBUG] (id %i) SEND: (%x) %.2x ", wm->unid, buf[0], buf[1]); + int x; #ifndef WIIUSE_WIN32 - for (; x < len+2; ++x) + printf("[DEBUG] (id %i) SEND: (%x) %.2x ", wm->unid, buf[1], buf[2]); + for (x = 3; x < len+2; ++x) #else - for (; x < len+1; ++x) + printf("[DEBUG] (id %i) SEND: (%x) %.2x ", wm->unid, buf[0], buf[1]); + for (x = 2; x < len+1; ++x) #endif printf("%.2x ", buf[x]); printf("\n");