#include <sys/stat.h>
#include <sys/time.h>
#include <stdio.h>
+#include <usb.h>
#include "xilinx.h"
static int (*ioctl_func) (int, int, void *) = NULL;
static int windrvrfd = 0;
+static struct usb_bus *busses = NULL;
void hexdump(unsigned char *buf, int len);
void diff(unsigned char *buf1, unsigned char *buf2, int len);
{
struct interrupt *it = (struct interrupt*)(wdheader->data);
- fprintf(stderr," Handle: %lu, Options: %lx, ncmds: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds);
+ fprintf(stderr,"Handle: %lu, Options: %lx, ncmds: %lu, enableok: %lu, count: %lu, lost: %lu, stopped: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds, it->fEnableOk, it->dwCounter, it->dwLost, it->fStopped);
it->fEnableOk = 1;
//ret = (*ioctl_func) (fd, request, wdioctl);
{
struct interrupt *it = (struct interrupt*)(wdheader->data);
- fprintf(stderr," Handle: %lu, Options: %lx, ncmds: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds);
-
- hexdump(wdheader->data, wdheader->size);
+ fprintf(stderr,"Handle: %lu, Options: %lx, ncmds: %lu, enableok: %lu, count: %lu, lost: %lu, stopped: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds, it->fEnableOk, it->dwCounter, it->dwLost, it->fStopped);
//it->dwCounter = 0;
//it->fStopped = 1;
ret = (*ioctl_func) (fd, request, wdioctl);
- fprintf(stderr,"\n\n");
- hexdump(wdheader->data, wdheader->size);
- fprintf(stderr,"\n");
+ fprintf(stderr,"Handle: %lu, Options: %lx, ncmds: %lu, enableok: %lu, count: %lu, lost: %lu, stopped: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds, it->fEnableOk, it->dwCounter, it->dwLost, it->fStopped);
}
break;
{
struct interrupt *it = (struct interrupt*)(wdheader->data);
- fprintf(stderr," Handle: %lu, Options: %lx, ncmds: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds);
+ fprintf(stderr,"Handle: %lu, Options: %lx, ncmds: %lu, enableok: %lu, count: %lu, lost: %lu, stopped: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds, it->fEnableOk, it->dwCounter, it->dwLost, it->fStopped);
- hexdump(wdheader->data, wdheader->size);
ret = (*ioctl_func) (fd, request, wdioctl);
- //ret = 0;
- //it->dwCounter++;
- fprintf(stderr,"\n\n");
- hexdump(wdheader->data, wdheader->size);
- fprintf(stderr,"\n");
+ fprintf(stderr,"Handle: %lu, Options: %lx, ncmds: %lu, enableok: %lu, count: %lu, lost: %lu, stopped: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds, it->fEnableOk, it->dwCounter, it->dwLost, it->fStopped);
}
break;
case EVENT_PULL:
fprintf(stderr,"EVENT_PULL\n");
- ret = (*ioctl_func) (fd, request, wdioctl);
+ {
+ struct event *e = (struct event*)(wdheader->data);
+ int i;
+
+ fprintf(stderr,"handle: %lu, action: %lu, status: %lu, eventid: %lu, cardtype: %lu, kplug: %lu, options: %lu, dev: %lx:%lx, unique: %lu, ver: %lu, nummatch: %lu\n", e->handle, e->dwAction, e->dwStatus, e->dwEventId, e->dwCardType, e->hKernelPlugIn, e->dwOptions, e->u.Usb.deviceId.dwVendorId, e->u.Usb.deviceId.dwProductId, e->u.Usb.dwUniqueID, e->dwEventVer, e->dwNumMatchTables);
+ for (i = 0; i < e->dwNumMatchTables; i++)
+ fprintf(stderr,"match: dev: %x:%x, class: %x, subclass: %x, intclass: %x, intsubclass: %x, intproto: %x\n", e->matchTables[i].VendorId, e->matchTables[i].ProductId, e->matchTables[i].bDeviceClass, e->matchTables[i].bDeviceSubClass, e->matchTables[i].bInterfaceClass, e->matchTables[i].bInterfaceSubClass, e->matchTables[i].bInterfaceProtocol);
+
+ ret = (*ioctl_func) (fd, request, wdioctl);
+
+ fprintf(stderr,"handle: %lu, action: %lu, status: %lu, eventid: %lu, cardtype: %lu, kplug: %lu, options: %lu, dev: %lx:%lx, unique: %lu, ver: %lu, nummatch: %lu\n", e->handle, e->dwAction, e->dwStatus, e->dwEventId, e->dwCardType, e->hKernelPlugIn, e->dwOptions, e->u.Usb.deviceId.dwVendorId, e->u.Usb.deviceId.dwProductId, e->u.Usb.dwUniqueID, e->dwEventVer, e->dwNumMatchTables);
+ for (i = 0; i < e->dwNumMatchTables; i++)
+ fprintf(stderr,"match: dev: %x:%x, class: %x, subclass: %x, intclass: %x, intsubclass: %x, intproto: %x\n", e->matchTables[i].VendorId, e->matchTables[i].ProductId, e->matchTables[i].bDeviceClass, e->matchTables[i].bDeviceSubClass, e->matchTables[i].bInterfaceClass, e->matchTables[i].bInterfaceSubClass, e->matchTables[i].bInterfaceProtocol);
+ }
break;
default:
if (!strcmp (pathname, "/dev/windrvr6")) {
fprintf(stderr,"opening windrvr6\n");
windrvrfd = fd;
+ if (!busses) {
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+
+ busses = usb_get_busses();
+ }
}
return fd;