Enable searching for FTDI devices with either a VID or PID of zero
authorForest Crossman <cyrozap@gmail.com>
Fri, 31 Oct 2014 17:17:16 +0000 (13:17 -0400)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Thu, 6 Nov 2014 20:44:39 +0000 (21:44 +0100)
This change makes it possible to detect FTDI clone chips that have been
"bricked" by the FTDI Windows driver (PID set to zero)

Signed-off-by: Forest Crossman <cyrozap@gmail.com>

src/ftdi.c

index bad338d..32b3817 100644 (file)
@@ -328,9 +328,9 @@ 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) &&
+        if (((vendor || product) &&
                 desc.idVendor == vendor && desc.idProduct == product) ||
-                ((vendor == 0 && product == 0) &&
+                (!(vendor || product) &&
                  (desc.idVendor == 0x403) && (desc.idProduct == 0x6001 || desc.idProduct == 0x6010
                                               || desc.idProduct == 0x6011 || desc.idProduct == 0x6014)))
         {