eeprom->vendor_id = 0x0403;
eeprom->use_serial = USE_SERIAL_NUM;
- if((ftdi->type= TYPE_AM) || (ftdi->type= TYPE_BM) ||(ftdi->type= TYPE_R))
+ if((ftdi->type == TYPE_AM) || (ftdi->type == TYPE_BM) ||
+ (ftdi->type == TYPE_R))
eeprom->product_id = 0x6001;
else
eeprom->product_id = 0x6010;
switch (ftdi->type)
{
+ case TYPE_2232C:
+ eeprom->release = 0x500;
+ break;
case TYPE_2232H:
eeprom->release = 0x200;
break;
if (eeprom->high_current_a) return -5;
}
- size_check = eeprom->size;
- size_check -= 28; // 28 are always in use (fixed)
+ size_check = 0x80;
+ switch(ftdi->type)
+ {
+ case TYPE_2232H:
+ case TYPE_4232H:
+ size_check -= 4;
+ case TYPE_R:
+ size_check -= 4;
+ case TYPE_2232C:
+ size_check -= 4;
+ case TYPE_AM:
+ case TYPE_BM:
+ size_check -= 0x14*2;
+ }
- // Top half of a 256byte eeprom is used just for strings and checksum
- // it seems that the FTDI chip will not read these strings from the lower half
- // Each string starts with two bytes; offset and type (0x03 for string)
- // the checksum needs two bytes, so without the string data that 8 bytes from the top half
- if (eeprom->size>=256) size_check = 120;
size_check -= manufacturer_size*2;
size_check -= product_size*2;
size_check -= serial_size*2;
+ /* Space for the string type and pointer bytes */
+ size_check -= -6;
+
// eeprom size exceeded?
if (size_check < 0)
return (-1);
if (ftdi == NULL)
ftdi_error_return(-1,"No context");
if (ftdi->eeprom == NULL)
- ftdi_error_return(-1,"No eeprom");
+ ftdi_error_return(-1,"No eeprom structure");
eeprom_size = ftdi->eeprom->size;
if(ftdi->type == TYPE_R)
else if ((ftdi->type == TYPE_AM) || (ftdi->type == TYPE_BM))
{
- eeprom->chip = buf[14];
+ eeprom->chip = -1;
}
else if(ftdi->type == TYPE_2232C)
{
- eeprom->chip = buf[14];
+ eeprom->chip = buf[0x14];
}
else if(ftdi->type == TYPE_R)
{
+ eeprom->chip = buf[0x16];
// Addr 0B: Invert data lines
// Works only on FT232R, not FT245R, but no way to distinguish
eeprom->invert = buf[0x0B];
}
else if ((ftdi->type == TYPE_2232H) ||(ftdi->type == TYPE_4232H))
{
+ eeprom->chip = buf[0x18];
eeprom->group0_drive = buf[0x0c] & DRIVE_16MA;
eeprom->group0_schmitt = buf[0x0c] & IS_SCHMITT;
eeprom->group0_slew = buf[0x0c] & SLOW_SLEW;
if(eeprom->self_powered)
fprintf(stdout, "Self-Powered%s", (eeprom->remote_wakeup)?", USB Remote Wake Up\n":"\n");
else
- fprintf(stdout, "Bus Powered: %3d mA%s", eeprom->max_power*2,
+ fprintf(stdout, "Bus Powered: %3d mA%s", eeprom->max_power * 2,
(eeprom->remote_wakeup)?" USB Remote Wake Up\n":"\n");
if(eeprom->manufacturer)
fprintf(stdout, "Manufacturer: %s\n",eeprom->manufacturer);
if(eeprom->serial)
fprintf(stdout, "Serial: %s\n",eeprom->serial);
fprintf(stdout, "Checksum : %04x\n", checksum);
+ if (ftdi->type == TYPE_R)
+ fprintf(stdout, "Internal EEPROM\n");
+ else if (eeprom->chip >= 0x46)
+ fprintf(stdout, "Attached EEPROM: 93x%02x\n", eeprom->chip);
if(eeprom->suspend_dbus7)
fprintf(stdout, "Suspend on DBUS7\n");
if(eeprom->suspend_pull_downs)
channel_mode[eeprom->channel_a_type],
(eeprom->channel_a_driver)?" VCP":"",
(eeprom->high_current_a)?" High Currenr IO":"");
- if (ftdi->type == TYPE_2232C)
+ if (ftdi->type >= TYPE_2232C)
fprintf(stdout,"Channel B has Mode %s%s%s\n",
channel_mode[eeprom->channel_b_type],
(eeprom->channel_b_driver)?" VCP":"",