fix mac send/receive debug output

This commit is contained in:
Lysann Schlegel
2012-11-11 23:12:44 +01:00
parent 83fc61d7b1
commit 6aef04f375
2 changed files with 18 additions and 15 deletions

View File

@@ -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;

View File

@@ -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");