/**
Init eeprom with default values.
\param ftdi pointer to ftdi_context
-
+ \param manufacturer String to use as Manufacturer
+ \param product String to use as Product description
+ \param serial String to use as Serial number description
+
+ \retval 0: all fine
+ \retval -1: No struct ftdi_context
+ \retval -2: No struct ftdi_eeprom
*/
-void ftdi_eeprom_initdefaults(struct ftdi_context *ftdi, char * manufacturer,
+int ftdi_eeprom_initdefaults(struct ftdi_context *ftdi, char * manufacturer,
char * product, char * serial)
{
struct ftdi_eeprom *eeprom;
if (ftdi == NULL)
- return;
+ ftdi_error_return(-1, "No struct ftdi_context");
+
if (ftdi->eeprom == NULL)
- return;
+ ftdi_error_return(-2,"No struct ftdi_eeprom");
eeprom = ftdi->eeprom;
memset(eeprom, 0, sizeof(struct ftdi_eeprom));
}
else
eeprom->size = -1;
+ return 0;
}
/**
size_check -= serial_size*2;
/* Space for the string type and pointer bytes */
- size_check -= -6;
+ size_check -= -9;
// eeprom size exceeded?
if (size_check < 0)
output[i & k] = eeprom->serial[j], i++;
output[i & k] = 0x00, i++;
}
+ output[i & k] = 0x02; /* as seen when written with FTD2XX */
+ i++;
+ output[i & k] = 0x03; /* as seen when written with FTD2XX */
+ i++;
+ output[i & k] = eeprom->is_not_pnp; /* as seen when written with FTD2XX */
+ i++;
+
output[0x13] = serial_size*2 + 2;
/* Fixme: ftd2xx seems to append 0x02, 0x03 and 0x01 for PnP = 0 or 0x00 else */
fprintf(stdout, "Pull IO pins low during suspend\n");
if(eeprom->remote_wakeup)
fprintf(stdout, "Enable Remote Wake Up\n");
+ fprintf(stdout, "PNP: %d\n",(eeprom->is_not_pnp)?0:1);
if (ftdi->type >= TYPE_2232C)
fprintf(stdout,"Channel A has Mode %s%s%s\n",
channel_mode[eeprom->channel_a_type],