Added detection for FT2232H and FT4232H type chips
[libftdi] / src / ftdi.c
index b67f950..a00e951 100644 (file)
@@ -438,6 +438,10 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct usb_device *dev)
     }
     else if (dev->descriptor.bcdDevice == 0x600)
         ftdi->type = TYPE_R;
+    else if (dev->descriptor.bcdDevice == 0x700)
+        ftdi->type = TYPE_2232H;
+    else if (dev->descriptor.bcdDevice == 0x800)
+        ftdi->type = TYPE_4232H;
 
     ftdi_error_return(0, "all fine");
 }
@@ -1954,7 +1958,8 @@ int ftdi_eeprom_decode(struct ftdi_eeprom *eeprom, unsigned char *buf, int size)
     // Addr 04: Product ID
     eeprom->product_id = buf[0x04] + (buf[0x05] << 8);
 
-    switch (buf[0x06] + (buf[0x07]<<8))
+    value = buf[0x06] + (buf[0x07]<<8);
+    switch (value)
     {
         case 0x0400:
             eeprom->BM_type_chip = 1;