]> git.zerfleddert.de Git - usb-driver/commitdiff
init libusb
authormichael <michael>
Thu, 22 Feb 2007 14:22:31 +0000 (14:22 +0000)
committermichael <michael>
Thu, 22 Feb 2007 14:22:31 +0000 (14:22 +0000)
Makefile
usb-driver.c

index 5413efd85dfaf00e4277a04fb639ac1fd39c940b..d77f96afe3d65af77816d26bef879f5454a5784b 100644 (file)
--- 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
index 16872908ed237eb812ad19200ca856b967afdd0d..ea8a7a70085996e0a898e619e790bef3190f1c29 100644 (file)
 #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);
@@ -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;
Impressum, Datenschutz