]> git.zerfleddert.de Git - usb-driver/commitdiff
fix usb_reset. sharing the cable between applications is still possible.
authorMichael Gernoth <michael@gernoth.net>
Thu, 10 Apr 2008 20:21:21 +0000 (22:21 +0200)
committerMichael Gernoth <michael@gernoth.net>
Thu, 10 Apr 2008 20:21:21 +0000 (22:21 +0200)
Makefile
usb-driver.c

index 1575da5b3ea4724dcabbcb066cae68e2debb2e3c..de3216dfdcc727bea5695f9c0ca279a0f1c18580 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 #Add -DFORCE_PC3_IDENT to CFLAGS to force the identification of
 #a Parallel Cable III
 #Add -DFORCE_PC3_IDENT to CFLAGS to force the identification of
 #a Parallel Cable III
-#Add -DNO_USB_RESET to disable the hard reset of the cable on
-#close of the device
+#Add -DNO_USB_RESET to disable the hard reset of the cable when
+#opening the device
 CFLAGS=-Wall -fPIC -DUSB_DRIVER_VERSION="\"$(shell stat -c '%y' usb-driver.c |cut -d\. -f1)\"" #-DFORCE_PC3_IDENT -DNO_USB_RESET
 
 LIBS=-ldl -lusb -lpthread
 CFLAGS=-Wall -fPIC -DUSB_DRIVER_VERSION="\"$(shell stat -c '%y' usb-driver.c |cut -d\. -f1)\"" #-DFORCE_PC3_IDENT -DNO_USB_RESET
 
 LIBS=-ldl -lusb -lpthread
index a0524bf67d521ed5cc84a0aa5cf0f10267768936..942cdc15a01c8ed59a3d86eb12b26813b1d1799e 100644 (file)
@@ -450,8 +450,15 @@ static int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) {
                                ret = (*ioctl_func) (fd, request, wdioctl);
 #else
                                if (usbdevice) {
                                ret = (*ioctl_func) (fd, request, wdioctl);
 #else
                                if (usbdevice) {
-                                       if (!usb_devhandle)
+                                       if (!usb_devhandle) {
                                                usb_devhandle = usb_open(usbdevice);
                                                usb_devhandle = usb_open(usbdevice);
+#ifndef NO_USB_RESET
+                                               if (usb_devhandle) {
+                                                       usb_reset(usb_devhandle);
+                                                       usb_devhandle = usb_open(usbdevice);
+                                               }
+#endif
+                                       }
 
                                        usbinterface = usbdevice->config[0].interface[usi->dwInterfaceNum].altsetting[usi->dwAlternateSetting].bInterfaceNumber;
                                        usbalternate = usi->dwAlternateSetting;
 
                                        usbinterface = usbdevice->config[0].interface[usi->dwInterfaceNum].altsetting[usi->dwAlternateSetting].bInterfaceNumber;
                                        usbalternate = usi->dwAlternateSetting;
Impressum, Datenschutz