ftdi_usb_find_all: Only search for default devices if both VID AND PID are 0
authorUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Tue, 5 Jul 2011 16:03:26 +0000 (18:03 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Fri, 8 Jul 2011 11:49:21 +0000 (13:49 +0200)
src/ftdi.c

index 4dc47bd..852b3ff 100644 (file)
@@ -293,8 +293,10 @@ int ftdi_usb_find_all(struct ftdi_context *ftdi, struct ftdi_device_list **devli
         if (libusb_get_device_descriptor(dev, &desc) < 0)
             ftdi_error_return_free_device_list(-6, "libusb_get_device_descriptor() failed", devs);
 
-        if ((vendor != 0 && product != 0 && desc.idVendor == vendor && desc.idProduct == product) ||
-            ((desc.idVendor == 0x403) && (desc.idProduct == 0x6001 || desc.idProduct == 0x6010
+        if (((vendor != 0 && product != 0) && 
+             desc.idVendor == vendor && desc.idProduct == product) ||
+            ((vendor == 0 && product == 0) && 
+             (desc.idVendor == 0x403) && (desc.idProduct == 0x6001 || desc.idProduct == 0x6010
                                           || desc.idProduct == 0x6011 || desc.idProduct == 0x6014)))
         {
             *curdev = (struct ftdi_device_list*)malloc(sizeof(struct ftdi_device_list));