improve debug output
This commit is contained in:
parent
8949e420b6
commit
325556c933
@ -293,10 +293,8 @@ int jtagkey_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
|
|||||||
pthread_join(reader_thread, NULL);
|
pthread_join(reader_thread, NULL);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
DPRINTF("write: ");
|
hexdump(writebuf, writepos-writebuf, "->");
|
||||||
hexdump(writebuf, writepos-writebuf);
|
hexdump(readbuf, i, "<-");
|
||||||
DPRINTF("read: ");
|
|
||||||
hexdump(readbuf, i);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
writepos = writebuf;
|
writepos = writebuf;
|
||||||
|
12
usb-driver.c
12
usb-driver.c
@ -56,13 +56,14 @@ static int modules_read = 0;
|
|||||||
|
|
||||||
#define NO_WINDRVR 1
|
#define NO_WINDRVR 1
|
||||||
|
|
||||||
void hexdump(unsigned char *buf, int len) {
|
void hexdump(unsigned char *buf, int len, char *prefix) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
fprintf(stderr, "%s ", prefix);
|
||||||
for(i=0; i<len; i++) {
|
for(i=0; i<len; i++) {
|
||||||
fprintf(stderr,"%02x ", buf[i]);
|
fprintf(stderr,"%02x ", buf[i]);
|
||||||
if ((i % 16) == 15)
|
if ((i % 16) == 15)
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n%s ", prefix);
|
||||||
}
|
}
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
}
|
}
|
||||||
@ -143,12 +144,12 @@ static int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) {
|
|||||||
ut->dwOptions, ut->dwBufferSize, ut->dwTimeout);
|
ut->dwOptions, ut->dwBufferSize, ut->dwTimeout);
|
||||||
if (ut->dwPipeNum == 0) {
|
if (ut->dwPipeNum == 0) {
|
||||||
DPRINTF("-> setup packet:");
|
DPRINTF("-> setup packet:");
|
||||||
hexdump(ut->SetupPacket, 8);
|
hexdump(ut->SetupPacket, 8, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ut->fRead && ut->dwBufferSize)
|
if (!ut->fRead && ut->dwBufferSize)
|
||||||
{
|
{
|
||||||
hexdump(ut->pBuffer, ut->dwBufferSize);
|
hexdump(ut->pBuffer, ut->dwBufferSize, "->");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -162,8 +163,7 @@ static int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) {
|
|||||||
DPRINTF("Transferred: %lu (%s)\n",ut->dwBytesTransferred, (ut->fRead?"read":"write"));
|
DPRINTF("Transferred: %lu (%s)\n",ut->dwBytesTransferred, (ut->fRead?"read":"write"));
|
||||||
if (ut->fRead && ut->dwBytesTransferred)
|
if (ut->fRead && ut->dwBytesTransferred)
|
||||||
{
|
{
|
||||||
DPRINTF("<- Read: ");
|
hexdump(ut->pBuffer, ut->dwBytesTransferred, "<-");
|
||||||
hexdump(ut->pBuffer, ut->dwBytesTransferred);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#define DPRINTF(format, args...)
|
#define DPRINTF(format, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void __attribute__ ((visibility ("hidden"))) hexdump(unsigned char *buf, int len);
|
void __attribute__ ((visibility ("hidden"))) hexdump(unsigned char *buf, int len, char *prefix);
|
||||||
|
|
||||||
#define WDU_GET_MAX_PACKET_SIZE(x) ((unsigned short) (((x) & 0x7ff) * (1 + (((x) & 0x1800) >> 11))))
|
#define WDU_GET_MAX_PACKET_SIZE(x) ((unsigned short) (((x) & 0x7ff) * (1 + (((x) & 0x1800) >> 11))))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user