Hi,
>> I missed the ability to create a config file from an eeprom file. So I
>> created a small program. Besides I added a procedure to to free the
>> allocated memory for strings (ftdi_eeprom_free), this could be added to
>> libftdi to clean up.
>>
>> If this feature is usefull, please tell me if it could be integrated
>> into "ftdi_eeprom" or it should stay as a stand alone application.
>
> I like the idea! I'll take a close look at the code the next days.
>
> Care to send a patch for the string cleanup?
Yes, here it is.
regards
Wilfried
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [email protected]
--- ./ftdi.c.orig 2010-06-10 20:15:54.000000000 +0200
+++ ./ftdi.c 2010-06-10 20:22:17.000000000 +0200
@@ -2132,6 +2132,27 @@
}
/**
+ Frees allocated memory in eeprom.
+
+ \param eeprom Pointer to ftdi_eeprom
+*/
+void ftdi_eeprom_free(struct ftdi_eeprom *eeprom)
+{
+ if (eeprom->manufacturer != 0) {
+ free(eeprom->manufacturer);
+ eeprom->manufacturer = 0;
+ }
+ if (eeprom->product != 0) {
+ free(eeprom->product);
+ eeprom->product = 0;
+ }
+ if (eeprom->serial != 0) {
+ free(eeprom->serial);
+ eeprom->serial = 0;
+ }
+}
+
+/**
Build binary output from ftdi_eeprom structure.
Output is suitable for ftdi_write_eeprom().
--- ./ftdi.h.orig 2010-06-10 20:15:49.000000000 +0200
+++ ./ftdi.h 2010-06-10 20:18:13.000000000 +0200
@@ -352,6 +352,7 @@
/* init and build eeprom from ftdi_eeprom structure */
void ftdi_eeprom_initdefaults(struct ftdi_eeprom *eeprom);
+ void ftdi_eeprom_free(struct ftdi_eeprom *eeprom);
int ftdi_eeprom_build(struct ftdi_eeprom *eeprom, unsigned char *output);
int ftdi_eeprom_decode(struct ftdi_eeprom *eeprom, unsigned char *output,
int size);