From: michael Date: Thu, 22 Feb 2007 14:22:31 +0000 (+0000) Subject: init libusb X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver/commitdiff_plain/f10480d179d5e5b0fc19c04ab9e4ec3e50e46329 init libusb --- diff --git a/Makefile b/Makefile index 5413efd..d77f96a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CFLAGS=-Wall xilinx.so: xilinx.c xilinx.h - gcc $(CFLAGS) $< -o $@ -ldl -shared + gcc $(CFLAGS) $< -o $@ -ldl -lusb -shared clean: rm -f xilinx.so diff --git a/usb-driver.c b/usb-driver.c index 1687290..ea8a7a7 100644 --- a/usb-driver.c +++ b/usb-driver.c @@ -18,10 +18,12 @@ #include #include #include +#include #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); @@ -229,6 +231,13 @@ int open (const char *pathname, int flags, ...) 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;