main.c - description
-------------------
begin : Mon Apr 7 12:05:22 CEST 2003
- copyright : (C) 2003-2011 by Intra2net AG and the libftdi developers
+ copyright : (C) 2003-2014 by Intra2net AG and the libftdi developers
email : opensource@intra2net.com
***************************************************************************/
#include <string.h>
#include <confuse.h>
+#include <libusb.h>
#include <ftdi.h>
#include <ftdi_eeprom_version.h>
static int str_to_cbus(char *str, int max_allowed)
{
- #define MAX_OPTION 14
- const char* options[MAX_OPTION] = {
- "TXDEN", "PWREN", "RXLED", "TXLED", "TXRXLED", "SLEEP",
- "CLK48", "CLK24", "CLK12", "CLK6",
- "IO_MODE", "BITBANG_WR", "BITBANG_RD", "SPECIAL"};
+#define MAX_OPTION 14
+ const char* options[MAX_OPTION] =
+ {
+ "TXDEN", "PWREN", "RXLED", "TXLED", "TXRXLED", "SLEEP",
+ "CLK48", "CLK24", "CLK12", "CLK6",
+ "IO_MODE", "BITBANG_WR", "BITBANG_RD", "SPECIAL"
+ };
int i;
max_allowed += 1;
if (max_allowed > MAX_OPTION) max_allowed = MAX_OPTION;
- for (i=0; i<max_allowed; i++) {
- if (!(strcmp(options[i], str))) {
+ for (i=0; i<max_allowed; i++)
+ {
+ if (!(strcmp(options[i], str)))
+ {
return i;
}
}
}
}
}
- ftdi_eeprom_initdefaults (ftdi, cfg_getstr(cfg, "manufacturer"),
- cfg_getstr(cfg, "product"),
+ ftdi_eeprom_initdefaults (ftdi, cfg_getstr(cfg, "manufacturer"),
+ cfg_getstr(cfg, "product"),
cfg_getstr(cfg, "serial"));
printf("FTDI read eeprom: %d\n", ftdi_read_eeprom(ftdi));
printf ("Sorry, the eeprom can only contain 128 bytes (100 bytes for your strings).\n");
printf ("You need to short your string by: %d bytes\n", size_check);
goto cleanup;
- } else if (size_check < 0) {
+ }
+ else if (size_check < 0)
+ {
printf ("ftdi_eeprom_build(): error: %d\n", size_check);
}
else
}
}
printf ("FTDI write eeprom: %d\n", ftdi_write_eeprom(ftdi));
+ libusb_reset_device(ftdi->usb_dev);
}
// Write to file?