web-legacy/milkymist-wiki/wiki/index.php?title=Build_the_l...

564 lines
27 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="MediaWiki 1.14.0" />
<meta name="keywords" content="Build the libftdi-1.0 and new ftdi eeprom" />
<link rel="alternate" type="application/x-wiki" title="Edit" href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;action=edit" />
<link rel="edit" title="Edit" href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;action=edit" />
<link rel="shortcut icon" href="../favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" href="opensearch_desc.php" title="Milkymist Wiki (en)" />
<link title="Creative Commons" type="application/rdf+xml" href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;action=creativecommons" rel="meta" />
<link rel="copyright" href="http://www.milkymist.org/wiki/index.php?title=Copyright" />
<link rel="alternate" type="application/rss+xml" title="Milkymist Wiki RSS Feed" href="http://milkymist.org/wiki/index.php?title=Special:RecentChanges&amp;feed=rss" />
<link rel="alternate" type="application/atom+xml" title="Milkymist Wiki Atom Feed" href="http://milkymist.org/wiki/index.php?title=Special:RecentChanges&amp;feed=atom" />
<title>Build the libftdi-1.0 and new ftdi eeprom - Milkymist Wiki</title>
<link rel="stylesheet" href="skins/common/shared.css%3F195.css" type="text/css" media="screen" />
<link rel="stylesheet" href="skins/common/commonPrint.css%3F195.css" type="text/css" media="print" />
<link rel="stylesheet" href="skins/monobook/main.css%3F195.css" type="text/css" media="screen" />
<!--[if lt IE 5.5000]><link rel="stylesheet" href="/wiki/skins/monobook/IE50Fixes.css?195" type="text/css" media="screen" /><![endif]-->
<!--[if IE 5.5000]><link rel="stylesheet" href="/wiki/skins/monobook/IE55Fixes.css?195" type="text/css" media="screen" /><![endif]-->
<!--[if IE 6]><link rel="stylesheet" href="/wiki/skins/monobook/IE60Fixes.css?195" type="text/css" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="/wiki/skins/monobook/IE70Fixes.css?195" type="text/css" media="screen" /><![endif]-->
<link rel="stylesheet" href="http://milkymist.org/wiki/index.php?title=MediaWiki:Common.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" type="text/css" />
<link rel="stylesheet" href="http://milkymist.org/wiki/index.php?title=MediaWiki:Print.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" type="text/css" media="print" />
<link rel="stylesheet" href="http://milkymist.org/wiki/index.php?title=MediaWiki:Monobook.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" type="text/css" />
<link rel="stylesheet" href="http://milkymist.org/wiki/index.php?title=-&amp;action=raw&amp;maxage=18000&amp;gen=css" type="text/css" />
<!--[if lt IE 7]><script type="text/javascript" src="/wiki/skins/common/IEFixes.js?195"></script>
<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
<script type= "text/javascript">/*<![CDATA[*/
var skin = "monobook";
var stylepath = "/wiki/skins";
var wgArticlePath = "/wiki/index.php?title=$1";
var wgScriptPath = "/wiki";
var wgScript = "/wiki/index.php";
var wgVariantArticlePath = false;
var wgActionPaths = {};
var wgServer = "http://milkymist.org";
var wgCanonicalNamespace = "";
var wgCanonicalSpecialPageName = false;
var wgNamespaceNumber = 0;
var wgPageName = "Build_the_libftdi-1.0_and_new_ftdi_eeprom";
var wgTitle = "Build the libftdi-1.0 and new ftdi eeprom";
var wgAction = "view";
var wgArticleId = "118";
var wgIsArticle = true;
var wgUserName = null;
var wgUserGroups = null;
var wgUserLanguage = "en";
var wgContentLanguage = "en";
var wgBreakFrames = false;
var wgCurRevisionId = "1317";
var wgVersion = "1.14.0";
var wgEnableAPI = true;
var wgEnableWriteAPI = true;
var wgSeparatorTransformTable = ["", ""];
var wgDigitTransformTable = ["", ""];
var wgRestrictionEdit = [];
var wgRestrictionMove = [];
/*]]>*/</script>
<script type="text/javascript" src="skins/common/wikibits.js%3F195"><!-- wikibits js --></script>
<!-- Head Scripts -->
<script type="text/javascript" src="skins/common/ajax.js%3F195"></script>
<script type="text/javascript" src="http://milkymist.org/wiki/index.php?title=-&amp;action=raw&amp;gen=js&amp;useskin=monobook"><!-- site js --></script>
</head>
<body class="mediawiki ltr ns-0 ns-subject page-Build_the_libftdi-1_0_and_new_ftdi_eeprom skin-monobook">
<div id="globalWrapper">
<div id="column-content">
<div id="content">
<a name="top" id="top"></a>
<h1 id="firstHeading" class="firstHeading">Build the libftdi-1.0 and new ftdi eeprom</h1>
<div id="bodyContent">
<h3 id="siteSub">From Milkymist Wiki</h3>
<div id="contentSub"></div>
<div id="jump-to-nav">Jump to: <a href="index.php%3Ftitle=Build_the_libftdi-1.0_and_new_ftdi_eeprom.html#column-one">navigation</a>, <a href="index.php%3Ftitle=Build_the_libftdi-1.0_and_new_ftdi_eeprom.html#searchInput">search</a></div> <!-- start content -->
<a name="ftdi_library_variants" id="ftdi_library_variants"></a><h2><span class="editsection">[<a href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;action=edit&amp;section=1" title="Edit section: ftdi library variants">edit</a>]</span> <span class="mw-headline"> ftdi library variants </span></h2>
<p>This is the chip support library, you will need it for your tools.
</p><p>There are currently 3 independent variants. <b>You need to select one!</b>
</p>
<table border="1">
<tr>
<td><b>method</b>
</td><td><b>comment</b>
</td></tr>
<tr>
<td>D2XX
</td><td>Binary drivers from [<a href="http://www.ftdichip.com/Drivers/D2XX.htm" class="external text" title="http://www.ftdichip.com/Drivers/D2XX.htm" rel="nofollow">ftdichip.com</a>]
</td></tr>
<tr>
<td>libftdi
</td><td>Git repository at [<a href="http://developer.intra2net.com/git/?p=libftdi;a=summary" class="external text" title="http://developer.intra2net.com/git/?p=libftdi;a=summary" rel="nofollow">libftdi</a>] however this requires <b>libboost</b> to compile which pulls in a ton of additional code and is less portable than the method below.
</td></tr>
<tr>
<td>libftdi-1.0
</td><td>Git repository at [<a href="http://developer.intra2net.com/git/?p=libftdi-1.0;a=summary" class="external text" title="http://developer.intra2net.com/git/?p=libftdi-1.0;a=summary" rel="nofollow">libftdi-1.0</a>] this is the preferred method, discussed in the next steps
</td></tr></table>
<p><br />
</p>
<a name="1._Build_the_libftdi-1.0" id="1._Build_the_libftdi-1.0"></a><h2><span class="editsection">[<a href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;action=edit&amp;section=2" title="Edit section: 1. Build the libftdi-1.0">edit</a>]</span> <span class="mw-headline"> 1. Build the <i>libftdi-1.0</i> </span></h2>
<p>1.1. First, get a clone of the repository&nbsp;:
</p><p>1.1.1. Create and go to a directory where you want to store the git projects
</p>
<pre> # mkdir ~/git
# cd ~/git
</pre>
<p>1.1.2. Clone the repository
</p>
<pre> # git clone git://developer.intra2net.com/libftdi-1.0
Cloning into libftdi-1.0...
remote: Counting objects: 2008, done.
remote: Compressing objects: 100% (942/942), done.
remote: Total 2008 (delta 1285), reused 1643 (delta 1056)
Receiving objects: 100% (2008/2008), 902.65 KiB | 449 KiB/s, done.
Resolving deltas: 100% (1285/1285), done.
</pre>
<p>It'l create a directory called <i>libftdi-1.0</i> with some file in it.
</p><p>1.2. Prepare to build with the autotools
</p><p>1.2.1. Go to the directory of <i>libftdi-1.0</i>, you need some file
</p>
<pre> # ln -s /usr/share/libtool/config/config.guess
# ln -s /usr/share/libtool/config/config.sub
# ln -s /usr/share/libtool/config/install-sh
# ln -s /usr/share/libtool/config/ltmain.sh
# ln -s /usr/share/libtool/config/missing
# ln -s /usr/share/libtool/config/depcomp
</pre>
<p>1.2.2 Build the auto-conguration
</p>
<pre> # autoscan
# aclocal
# autoheader
# autoconf
# automake
</pre>
<p>1.3.1. Now, you can normally build and install the libftdi
</p>
<pre> # ./configure
...
</pre>
<pre> # make
...
</pre>
<p>1.3.2. You need to be root for installing the lib
</p>
<pre> (root)# make install
...
</pre>
<p>1.3.3. Quit root, and if there's no error, you can continue to build <i>ftdi_eeprom</i>, you maybe needs run
</p>
<pre> # <b>ldconfig</b>.
</pre>
<a name="2._Build_the_ftdi_eeprom_tool" id="2._Build_the_ftdi_eeprom_tool"></a><h2><span class="editsection">[<a href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;action=edit&amp;section=3" title="Edit section: 2. Build the ftdi_eeprom tool">edit</a>]</span> <span class="mw-headline"> 2. Build the <i>ftdi_eeprom</i> tool </span></h2>
<p>2.1. Go to the directory <i>ftdi_eeprom</i>
</p>
<pre> # cd ftdi_eeprom
</pre>
<p>2.2. Replace it in <i>libftdi-1.0/ftdi_eeprom/main.c</i>&nbsp;:
</p>
<pre> /***************************************************************************
main.c - description
-------------------
begin &nbsp;: Mon Apr 7 12:05:22 CEST 2003
copyright &nbsp;: (C) 2003,2008 by Intra2net AG
email &nbsp;: opensource@intra2net.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 as *
* published by the Free Software Foundation. *
* *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include &lt;config.h&gt;
#endif
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;confuse.h&gt;
#include "../src/ftdi.h"
#include "ftdi_eeprom_version.h.in"
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"};
int i;
max_allowed += 1;
if (max_allowed &gt; MAX_OPTION) max_allowed = MAX_OPTION;
for (i=0; i&lt;max_allowed; i++) {
if (!(strcmp(options[i], str))) {
return i;
}
}
printf("WARNING: Invalid cbus option '%s'\n", str);
return 0;
}
int main(int argc, char *argv[])
{
/*
configuration options
*/
cfg_opt_t opts[] =
{
CFG_INT("vendor_id", 0, 0),
CFG_INT("product_id", 0, 0),
CFG_BOOL("self_powered", cfg_true, 0),
CFG_BOOL("remote_wakeup", cfg_true, 0),
CFG_STR_LIST("chip_type", "{AM,BM,2232C,R,2232H,4232H,other}", 0),
CFG_BOOL("in_is_isochronous", cfg_false, 0),
CFG_BOOL("out_is_isochronous", cfg_false, 0),
CFG_BOOL("suspend_pull_downs", cfg_false, 0),
CFG_BOOL("use_serial", cfg_false, 0),
CFG_BOOL("change_usb_version", cfg_false, 0),
CFG_INT("usb_version", 0, 0),
CFG_INT("max_power", 0, 0),
CFG_STR("manufacturer", "Acme Inc.", 0),
CFG_STR("product", "USB Serial Converter", 0),
CFG_STR("serial", "08-15", 0),
CFG_BOOL("high_current", cfg_false, 0),
CFG_STR_LIST("cbus0", "{TXDEN,PWREN,RXLED,TXLED,TXRXLED,SLEEP,CLK48,CLK24,CLK12,CLK6,IO_MODE,BITBANG_WR,BITBANG_D,SPECIAL}", 0),
CFG_STR_LIST("cbus1", "{TXDEN,PWREN,RXLED,TXLED,TXRXLED,SLEEP,CLK48,CLK24,CLK12,CLK6,IO_MODE,BITBANG_WR,BITBANG_D,SPECIAL}", 0),
CFG_STR_LIST("cbus2", "{TXDEN,PWREN,RXLED,TXLED,TXRXLED,SLEEP,CLK48,CLK24,CLK12,CLK6,IO_MODE,BITBANG_WR,BITBANG_D,SPECIAL}", 0),
CFG_STR_LIST("cbus3", "{TXDEN,PWREN,RXLED,TXLED,TXRXLED,SLEEP,CLK48,CLK24,CLK12,CLK6,IO_MODE,BITBANG_WR,BITBANG_D,SPECIAL}", 0),
CFG_STR_LIST("cbus4", "{TXDEN,PWRON,RXLED,TXLED,TX_RX_LED,SLEEP,CLK48,CLK24,CLK12,CLK6}", 0),
CFG_BOOL("invert_txd", cfg_false, 0),
CFG_BOOL("invert_rxd", cfg_false, 0),
CFG_BOOL("invert_rts", cfg_false, 0),
CFG_BOOL("invert_cts", cfg_false, 0),
CFG_BOOL("invert_dtr", cfg_false, 0),
CFG_BOOL("invert_dsr", cfg_false, 0),
CFG_BOOL("invert_dcd", cfg_false, 0),
CFG_BOOL("invert_ri", cfg_false, 0),
CFG_END()
};
cfg_t *cfg;
/*
normal variables
*/
unsigned char _read = 0, _erase = 0, _flash = 0;
int size_check;
int i;
char * type;
unsigned int invert;
FILE * fp;
unsigned short device_vid = 0;
unsigned short device_pid = 0;
FILE * device;
struct ftdi_context ftdi;
struct ftdi_eeprom *eeprom;
printf("\nFTDI eeprom generator v%s\n", EEPROM_VERSION_STRING);
printf ("(c) Intra2net AG &lt;opensource@intra2net.com&gt;\n");
if (argc &lt; 3)
{
printf("Syntax sample&nbsp;:\n");
printf(" &nbsp;%s --read-eeprom /dev/bus/usb/002/003 ftdi-backup.conf\n", argv[0]);
printf(" &nbsp;%s --erase-eeprom /dev/bus/usb/002/003\n", argv[0]);
printf(" &nbsp;%s --flash-eeprom /dev/bus/usb/002/003 ftdi-source.conf\n", argv[0]);
exit (-1);
}
else
{
if (strcmp(argv[1], "--read-eeprom") == 0)
_read = 1;
else if (strcmp(argv[1], "--erase-eeprom") == 0)
_erase = 1;
else if (strcmp(argv[1], "--flash-eeprom") == 0)
_flash = 1;
}
ftdi_init(&amp;ftdi);
ftdi_eeprom_initdefaults (&amp;ftdi, "Acme Inc.", "FTDI Chip", NULL);
eeprom = ftdi.eeprom;
if ((device = fopen(argv[2], "r")) == NULL)
{
printf ("Can't open device file\n");
exit (-1);
}
fseek(device, 8, SEEK_SET);
fread(&amp;device_vid, 1, 2, device);
fread(&amp;device_pid, 1, 2, device);
fclose(device);
printf("\nFound device with VID:PID&nbsp;: 0x%X:0x%X\n", device_vid, device_pid);
i = ftdi_usb_open(&amp;ftdi, device_vid, device_pid);
if (i == 0)
{
printf("EEPROM size:&nbsp;%d\n", eeprom-&gt;size);
}
else
{
printf("Unable to find FTDI devices under given vendor/product id: 0x%X/0x%X\n", device_vid, device_pid);
printf("Error code:&nbsp;%d (%s)\n", i, ftdi_get_error_string(&amp;ftdi));
exit (-1);
}
if (_read)
{
printf("FTDI read eeprom:&nbsp;%d\n", ftdi_read_eeprom(&amp;ftdi));
ftdi_eeprom_decode(&amp;ftdi, 0);
const char* chip_types[] = {"other", "", "AM", "", "BM", "2232C", "R", "2232H", "4232H"};
FILE *fp = fopen (argv[3], "wb");
/*
To implement
CFG_BOOL("high_current", cfg_false, 0),
CFG_STR_LIST("cbus0", "{TXDEN,PWREN,RXLED,TXLED,TXRXLED,SLEEP,CLK48,CLK24,CLK12,CLK6,IO_MODE,BITBANG_WR,BITBANG_D,SPECIAL}", 0),
CFG_STR_LIST("cbus1", "{TXDEN,PWREN,RXLED,TXLED,TXRXLED,SLEEP,CLK48,CLK24,CLK12,CLK6,IO_MODE,BITBANG_WR,BITBANG_D,SPECIAL}", 0),
CFG_STR_LIST("cbus2", "{TXDEN,PWREN,RXLED,TXLED,TXRXLED,SLEEP,CLK48,CLK24,CLK12,CLK6,IO_MODE,BITBANG_WR,BITBANG_D,SPECIAL}", 0),
CFG_STR_LIST("cbus3", "{TXDEN,PWREN,RXLED,TXLED,TXRXLED,SLEEP,CLK48,CLK24,CLK12,CLK6,IO_MODE,BITBANG_WR,BITBANG_D,SPECIAL}", 0),
CFG_STR_LIST("cbus4", "{TXDEN,PWRON,RXLED,TXLED,TX_RX_LED,SLEEP,CLK48,CLK24,CLK12,CLK6}", 0),
CFG_BOOL("invert_txd", cfg_false, 0),
CFG_BOOL("invert_rxd", cfg_false, 0),
CFG_BOOL("invert_rts", cfg_false, 0),
CFG_BOOL("invert_cts", cfg_false, 0),
CFG_BOOL("invert_dtr", cfg_false, 0),
CFG_BOOL("invert_dsr", cfg_false, 0),
CFG_BOOL("invert_dcd", cfg_false, 0),
CFG_BOOL("invert_ri", cfg_false, 0),
*/
fprintf(fp, "vendor_id=0x%04x\n", eeprom-&gt;vendor_id);
fprintf(fp, "product_id=0x%04x\n", eeprom-&gt;product_id);
fprintf(fp, "self_powered=%s\n", eeprom-&gt;self_powered?"true":"false");
fprintf(fp, "remote_wakeup=%s\n", eeprom-&gt;remote_wakeup?"true":"false");
fprintf(fp, "chip_type=%s\n", chip_types[ftdi.type]);
fprintf(fp, "max_power=%d\n", eeprom-&gt;max_power);
fprintf(fp, "in_is_isochronous=%s\n", eeprom-&gt;in_is_isochronous?"true":"false");
fprintf(fp, "out_is_isochronous=%s\n", eeprom-&gt;out_is_isochronous?"true":"false");
fprintf(fp, "suspend_pull_downs=%s\n", eeprom-&gt;suspend_pull_downs?"true":"false");
fprintf(fp, "use_serial=%s\n", eeprom-&gt;use_serial?"true":"false");
fprintf(fp, "change_usb_version=%s\n", eeprom-&gt;use_usb_version?"true":"false");
fprintf(fp, "usb_version=%d\n", eeprom-&gt;usb_version);
fprintf(fp, "manufacturer=\"%s\"\n", eeprom-&gt;manufacturer);
fprintf(fp, "product=\"%s\"\n", eeprom-&gt;product);
fprintf(fp, "serial=\"%s\"\n", eeprom-&gt;serial);
fclose (fp);
goto cleanup;
}
else if (_erase)
{
printf("FTDI erase eeprom:&nbsp;%d\n", ftdi_erase_eeprom(&amp;ftdi));
}
else if (_flash)
{
if ((fp = fopen(argv[3], "r")) == NULL)
{
printf ("Can't open configuration file\n");
exit (-1);
}
fclose (fp);
cfg = cfg_init(opts, 0);
cfg_parse(cfg, argv[3]);
if (cfg_getbool(cfg, "self_powered") &amp;&amp; cfg_getint(cfg, "max_power") &gt; 0)
printf("Hint: Self powered devices should have a max_power setting of 0.\n");
eeprom-&gt;vendor_id = cfg_getint(cfg, "vendor_id");
eeprom-&gt;product_id = cfg_getint(cfg, "product_id");
type = cfg_getstr(cfg, "chip_type");
if (!strcmp(type, "AM")) {
ftdi.type = TYPE_AM;
} else if (!strcmp(type, "BM")) {
ftdi.type = TYPE_BM;
} else if (!strcmp(type, "2232C")) {
ftdi.type = TYPE_2232C;
} else if (!strcmp(type, "R")) {
ftdi.type = TYPE_R;
} else if (!strcmp(type, "2232H")) {
ftdi.type = TYPE_2232H;
} else if (!strcmp(type, "4232H")) {
ftdi.type = TYPE_4232H;
}
eeprom-&gt;self_powered = cfg_getbool(cfg, "self_powered");
eeprom-&gt;remote_wakeup = cfg_getbool(cfg, "remote_wakeup");
eeprom-&gt;max_power = cfg_getint(cfg, "max_power");
eeprom-&gt;in_is_isochronous = cfg_getbool(cfg, "in_is_isochronous");
eeprom-&gt;out_is_isochronous = cfg_getbool(cfg, "out_is_isochronous");
eeprom-&gt;suspend_pull_downs = cfg_getbool(cfg, "suspend_pull_downs");
eeprom-&gt;use_serial = cfg_getbool(cfg, "use_serial") == 0&nbsp;? 0&nbsp;: USE_SERIAL_NUM;
eeprom-&gt;use_usb_version = cfg_getbool(cfg, "change_usb_version");
eeprom-&gt;usb_version = cfg_getint(cfg, "usb_version");
eeprom-&gt;manufacturer = cfg_getstr(cfg, "manufacturer");
eeprom-&gt;product = cfg_getstr(cfg, "product");
eeprom-&gt;serial = cfg_getstr(cfg, "serial");
eeprom-&gt;high_current = cfg_getbool(cfg, "high_current");
eeprom-&gt;cbus_function[0] = str_to_cbus(cfg_getstr(cfg, "cbus0"), 13);
eeprom-&gt;cbus_function[1] = str_to_cbus(cfg_getstr(cfg, "cbus1"), 13);
eeprom-&gt;cbus_function[2] = str_to_cbus(cfg_getstr(cfg, "cbus2"), 13);
eeprom-&gt;cbus_function[3] = str_to_cbus(cfg_getstr(cfg, "cbus3"), 13);
eeprom-&gt;cbus_function[4] = str_to_cbus(cfg_getstr(cfg, "cbus4"), 9);
invert = 0;
if (cfg_getbool(cfg, "invert_rxd")) invert |= INVERT_RXD;
if (cfg_getbool(cfg, "invert_txd")) invert |= INVERT_TXD;
if (cfg_getbool(cfg, "invert_rts")) invert |= INVERT_RTS;
if (cfg_getbool(cfg, "invert_cts")) invert |= INVERT_CTS;
if (cfg_getbool(cfg, "invert_dtr")) invert |= INVERT_DTR;
if (cfg_getbool(cfg, "invert_dsr")) invert |= INVERT_DSR;
if (cfg_getbool(cfg, "invert_dcd")) invert |= INVERT_DCD;
if (cfg_getbool(cfg, "invert_ri")) invert |= INVERT_RI;
eeprom-&gt;invert = invert;
size_check = ftdi_eeprom_build(&amp;ftdi);
if (size_check == -1)
{
printf ("Sorry, the eeprom can only contain 128 bytes (100 bytes for your strings).\n");
printf ("You need to short your string by:&nbsp;%d bytes\n", size_check);
goto cleanup;
} else if (size_check &lt; 0) {
printf ("ftdi_eeprom_build(): error:&nbsp;%d\n", size_check);
}
else
{
printf ("Used eeprom space:&nbsp;%d bytes\n", 128-size_check);
}
printf ("FTDI write eeprom:&nbsp;%d\n", ftdi_write_eeprom(&amp;ftdi));
cfg_free(cfg);
}
cleanup:
/*
fp = fopen("eeprom.img", "w");
fwrite(eeprom-&gt;buf, 1, 128, fp);
fclose (fp);
*/
printf("FTDI close:&nbsp;%d\n", ftdi_usb_close(&amp;ftdi));
ftdi_deinit (&amp;ftdi);
printf("\n");
return 0;
}
</pre>
<p>2.3. Compile the source
</p>
<pre> # gcc main.c -I/usr/include/libusb-1.0/ -lconfuse -L/usr/local/lib/ -lftdi -o ftdi_eeprom
</pre>
<p><br />
That's all.
</p>
<!--
NewPP limit report
Preprocessor node count: 4/1000000
Post-expand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
Expensive parser function count: 0/100
-->
<!-- Saved in parser cache with key sbsql1-mw_:pcache:idhash:118-0!1!0!!en!2 and timestamp 20140823135722 -->
<div class="printfooter">
Retrieved from "<a href="index.php%3Ftitle=Build_the_libftdi-1.0_and_new_ftdi_eeprom.html">http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom</a>"</div>
<!-- end content -->
<div class="visualClear"></div>
</div>
</div>
</div>
<div id="column-one">
<div id="p-cactions" class="portlet">
<h5>Views</h5>
<div class="pBody">
<ul>
<li id="ca-nstab-main" class="selected"><a href="index.php%3Ftitle=Build_the_libftdi-1.0_and_new_ftdi_eeprom.html" title="View the content page [c]" accesskey="c">Page</a></li>
<li id="ca-talk" class="new"><a href="http://milkymist.org/wiki/index.php?title=Talk:Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;action=edit&amp;redlink=1" title="Discussion about the content page [t]" accesskey="t">Discussion</a></li>
<li id="ca-edit"><a href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;action=edit" title="You can edit this page.&#10;Please use the preview button before saving [e]" accesskey="e">Edit</a></li>
<li id="ca-history"><a href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;action=history" title="Past versions of this page [h]" accesskey="h">History</a></li> </ul>
</div>
</div>
<div class="portlet" id="p-personal">
<h5>Personal tools</h5>
<div class="pBody">
<ul>
<li id="pt-anonuserpage"><a href="http://milkymist.org/wiki/index.php?title=User:124.244.181.48" title="The user page for the ip you&#039;re editing as [.]" accesskey="." class="new">124.244.181.48</a></li>
<li id="pt-anontalk"><a href="http://milkymist.org/wiki/index.php?title=User_talk:124.244.181.48" title="Discussion about edits from this IP address [n]" accesskey="n" class="new">Talk for this IP</a></li>
<li id="pt-anonlogin"><a href="http://milkymist.org/wiki/index.php?title=Special:UserLogin&amp;returnto=Build_the_libftdi-1.0_and_new_ftdi_eeprom" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o">Log in / create account</a></li>
</ul>
</div>
</div>
<div class="portlet" id="p-logo">
<a style="background-image: url(http://www.milkymist.org/wikilogo.png);" href="../wiki.html" title="Visit the main page [z]" accesskey="z"></a>
</div>
<script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
<div class='generated-sidebar portlet' id='p-navigation'>
<h5>Navigation</h5>
<div class='pBody'>
<ul>
<li id="n-mainpage-description"><a href="../wiki.html">Main Page</a></li>
<li id="n-portal"><a href="http://milkymist.org/wiki/index.php?title=Milkymist_Wiki:Community_Portal" title="About the project, what you can do, where to find things">Community portal</a></li>
<li id="n-currentevents"><a href="http://milkymist.org/wiki/index.php?title=Milkymist_Wiki:Current_events" title="Find background information on current events">Current events</a></li>
<li id="n-recentchanges"><a href="http://milkymist.org/wiki/index.php?title=Special:RecentChanges" title="The list of recent changes in the wiki [r]" accesskey="r">Recent changes</a></li>
<li id="n-randompage"><a href="http://milkymist.org/wiki/index.php?title=Special:Random" title="Load a random page [x]" accesskey="x">Random page</a></li>
<li id="n-help"><a href="http://milkymist.org/wiki/index.php?title=Help:Contents" title="The place to find out">Help</a></li>
</ul>
</div>
</div>
<div id="p-search" class="portlet">
<h5><label for="searchInput">Search</label></h5>
<div id="searchBody" class="pBody">
<form action="http://milkymist.org/wiki/index.php?title=Special:Search" id="searchform"><div>
<input id="searchInput" name="search" type="text" title="Search Milkymist Wiki [f]" accesskey="f" value="" />
<input type='submit' name="go" class="searchButton" id="searchGoButton" value="Go" title="Go to a page with this exact name if exists" />&nbsp;
<input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="Search" title="Search the pages for this text" />
</div></form>
</div>
</div>
<div class="portlet" id="p-tb">
<h5>Toolbox</h5>
<div class="pBody">
<ul>
<li id="t-whatlinkshere"><a href="http://milkymist.org/wiki/index.php?title=Special:WhatLinksHere/Build_the_libftdi-1.0_and_new_ftdi_eeprom" title="List of all wiki pages that link here [j]" accesskey="j">What links here</a></li>
<li id="t-recentchangeslinked"><a href="http://milkymist.org/wiki/index.php?title=Special:RecentChangesLinked/Build_the_libftdi-1.0_and_new_ftdi_eeprom" title="Recent changes in pages linked from this page [k]" accesskey="k">Related changes</a></li>
<li id="t-specialpages"><a href="http://milkymist.org/wiki/index.php?title=Special:SpecialPages" title="List of all special pages [q]" accesskey="q">Special pages</a></li>
<li id="t-print"><a href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;printable=yes" title="Printable version of this page [p]" accesskey="p">Printable version</a></li> <li id="t-permalink"><a href="http://milkymist.org/wiki/index.php?title=Build_the_libftdi-1.0_and_new_ftdi_eeprom&amp;oldid=1317" title="Permanent link to this version of the page">Permanent link</a></li> </ul>
</div>
</div>
</div><!-- end of the left (by default at least) column -->
<div class="visualClear"></div>
<div id="footer">
<div id="f-poweredbyico"><a href="http://www.mediawiki.org/"><img src="skins/common/images/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" /></a></div>
<div id="f-copyrightico"><a href="http://www.milkymist.org/wiki/index.php?title=Copyright"><img src="skins/common/images/gnu-fdl.png" alt='GNU Free Documentation License 1.3 and CC-BY-SA 3.0 Unported' /></a></div>
<ul id="f-list">
<li id="lastmod"> This page was last modified on 4 July 2011, at 08:30.</li>
<li id="viewcount">This page has been accessed 8,531 times.</li>
<li id="copyright">Content is available under <a href="http://www.milkymist.org/wiki/index.php?title=Copyright" class="external " title="http://www.milkymist.org/wiki/index.php?title=Copyright">GNU Free Documentation License 1.3 and CC-BY-SA 3.0 Unported</a>.</li>
<li id="privacy"><a href="http://milkymist.org/wiki/index.php?title=Milkymist_Wiki:Privacy_policy" title="Milkymist Wiki:Privacy policy">Privacy policy</a></li>
<li id="about"><a href="http://milkymist.org/wiki/index.php?title=Milkymist_Wiki:About" title="Milkymist Wiki:About">About Milkymist Wiki</a></li>
<li id="disclaimer"><a href="http://milkymist.org/wiki/index.php?title=Milkymist_Wiki:General_disclaimer" title="Milkymist Wiki:General disclaimer">Disclaimers</a></li>
</ul>
</div>
</div>
<script type="text/javascript">if (window.runOnloadHook) runOnloadHook();</script>
<!-- Served in 0.192 secs. --></body></html>