libftdi1  1.3
ftdi.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  ftdi.cpp - C++ wraper for libftdi
3  -------------------
4  begin : Mon Oct 13 2008
5  copyright : (C) 2008-2014 by Marek Vavruša / libftdi developers
6  email : opensource@intra2net.com and marek@vavrusa.com
7  ***************************************************************************/
8 /*
9 Copyright (C) 2008-2014 by Marek Vavruša / libftdi developers
10 
11 The software in this package is distributed under the GNU General
12 Public License version 2 (with a special exception described below).
13 
14 A copy of GNU General Public License (GPL) is included in this distribution,
15 in the file COPYING.GPL.
16 
17 As a special exception, if other files instantiate templates or use macros
18 or inline functions from this file, or you compile this file and link it
19 with other works to produce a work based on this file, this file
20 does not by itself cause the resulting work to be covered
21 by the GNU General Public License.
22 
23 However the source code for this file must still be made available
24 in accordance with section (3) of the GNU General Public License.
25 
26 This exception does not invalidate any other reasons why a work based
27 on this file might be covered by the GNU General Public License.
28 */
29 #include <libusb.h>
30 #include "ftdi.hpp"
31 #include "ftdi_i.h"
32 #include "ftdi.h"
33 
34 namespace Ftdi
35 {
36 
38 {
39 public:
41  : open(false), ftdi(0), dev(0)
42  {
43  ftdi = ftdi_new();
44  }
45 
47  {
48  if (open)
50 
51  ftdi_free(ftdi);
52  }
53 
54  bool open;
55 
56  struct ftdi_context* ftdi;
57  struct libusb_device* dev;
58 
59  std::string vendor;
60  std::string description;
61  std::string serial;
62 };
63 
67  : d( new Private() )
68 {
69 }
70 
74 {
75 }
76 
78 {
79  return d->open;
80 }
81 
82 int Context::open(int vendor, int product)
83 {
84  // Open device
85  int ret = ftdi_usb_open(d->ftdi, vendor, product);
86 
87  if (ret < 0)
88  return ret;
89 
90  return get_strings_and_reopen();
91 }
92 
93 int Context::open(int vendor, int product, const std::string& description, const std::string& serial, unsigned int index)
94 {
95  // translate empty strings to NULL
96  // -> do not use them to find the device (vs. require an empty string to be set in the EEPROM)
97  const char* c_description=NULL;
98  const char* c_serial=NULL;
99  if (!description.empty())
100  c_description=description.c_str();
101  if (!serial.empty())
102  c_serial=serial.c_str();
103 
104  int ret = ftdi_usb_open_desc_index(d->ftdi, vendor, product, c_description, c_serial, index);
105 
106  if (ret < 0)
107  return ret;
108 
109  return get_strings_and_reopen();
110 }
111 
112 int Context::open(const std::string& description)
113 {
114  int ret = ftdi_usb_open_string(d->ftdi, description.c_str());
115 
116  if (ret < 0)
117  return ret;
118 
119  return get_strings_and_reopen();
120 }
121 
122 int Context::open(struct libusb_device *dev)
123 {
124  if (dev != 0)
125  d->dev = dev;
126 
127  if (d->dev == 0)
128  return -1;
129 
130  return get_strings_and_reopen();
131 }
132 
134 {
135  d->open = false;
136  d->dev = 0;
137  return ftdi_usb_close(d->ftdi);
138 }
139 
141 {
142  return ftdi_usb_reset(d->ftdi);
143 }
144 
145 int Context::flush(int mask)
146 {
147  int ret = 1;
148 
149  if (mask & Input)
150  ret &= ftdi_usb_purge_rx_buffer(d->ftdi);
151  if (mask & Output)
152  ret &= ftdi_usb_purge_tx_buffer(d->ftdi);
153 
154  return ret;
155 }
156 
158 {
159  return ftdi_set_interface(d->ftdi, interface);
160 }
161 
162 void Context::set_usb_device(struct libusb_device_handle *dev)
163 {
164  ftdi_set_usbdev(d->ftdi, dev);
165  d->dev = libusb_get_device(dev);
166 }
167 
168 int Context::set_baud_rate(int baudrate)
169 {
170  return ftdi_set_baudrate(d->ftdi, baudrate);
171 }
172 
174 {
175  return ftdi_set_line_property(d->ftdi, bits, sbit, parity);
176 }
177 
178 int Context::set_line_property(enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity, enum ftdi_break_type break_type)
179 {
180  return ftdi_set_line_property2(d->ftdi, bits, sbit, parity, break_type);
181 }
182 
184 {
185  return d->ftdi->usb_read_timeout;
186 }
187 
188 void Context::set_usb_read_timeout(int usb_read_timeout)
189 {
190  d->ftdi->usb_read_timeout = usb_read_timeout;
191 }
192 
194 {
195  return d->ftdi->usb_write_timeout;
196 }
197 
198 void Context::set_usb_write_timeout(int usb_write_timeout)
199 {
200  d->ftdi->usb_write_timeout = usb_write_timeout;
201 }
202 
203 int Context::read(unsigned char *buf, int size)
204 {
205  return ftdi_read_data(d->ftdi, buf, size);
206 }
207 
208 int Context::set_read_chunk_size(unsigned int chunksize)
209 {
210  return ftdi_read_data_set_chunksize(d->ftdi, chunksize);
211 }
212 
214 {
215  unsigned chunk = -1;
216  if (ftdi_read_data_get_chunksize(d->ftdi, &chunk) < 0)
217  return -1;
218 
219  return chunk;
220 }
221 
222 int Context::write(unsigned char *buf, int size)
223 {
224  return ftdi_write_data(d->ftdi, buf, size);
225 }
226 
227 int Context::set_write_chunk_size(unsigned int chunksize)
228 {
229  return ftdi_write_data_set_chunksize(d->ftdi, chunksize);
230 }
231 
233 {
234  unsigned chunk = -1;
235  if (ftdi_write_data_get_chunksize(d->ftdi, &chunk) < 0)
236  return -1;
237 
238  return chunk;
239 }
240 
241 int Context::set_flow_control(int flowctrl)
242 {
243  return ftdi_setflowctrl(d->ftdi, flowctrl);
244 }
245 
247 {
248  int dtr = 0, rts = 0;
249 
250  if (mask & Dtr)
251  dtr = 1;
252  if (mask & Rts)
253  rts = 1;
254 
255  return ftdi_setdtr_rts(d->ftdi, dtr, rts);
256 }
257 
258 int Context::set_dtr(bool state)
259 {
260  return ftdi_setdtr(d->ftdi, state);
261 }
262 
263 int Context::set_rts(bool state)
264 {
265  return ftdi_setrts(d->ftdi, state);
266 }
267 
268 int Context::set_latency(unsigned char latency)
269 {
270  return ftdi_set_latency_timer(d->ftdi, latency);
271 }
272 
274 {
275  unsigned char latency = 0;
276  ftdi_get_latency_timer(d->ftdi, &latency);
277  return latency;
278 }
279 
281 {
282  unsigned short status = 0;
283  ftdi_poll_modem_status(d->ftdi, &status);
284  return status;
285 }
286 
287 int Context::set_event_char(unsigned char eventch, unsigned char enable)
288 {
289  return ftdi_set_event_char(d->ftdi, eventch, enable);
290 }
291 
292 int Context::set_error_char(unsigned char errorch, unsigned char enable)
293 {
294  return ftdi_set_error_char(d->ftdi, errorch, enable);
295 }
296 
297 int Context::set_bitmode(unsigned char bitmask, unsigned char mode)
298 {
299  return ftdi_set_bitmode(d->ftdi, bitmask, mode);
300 }
301 
302 int Context::set_bitmode(unsigned char bitmask, enum ftdi_mpsse_mode mode)
303 {
304  return ftdi_set_bitmode(d->ftdi, bitmask, mode);
305 }
306 
308 {
309  return ftdi_disable_bitbang(d->ftdi);
310 }
311 
312 int Context::read_pins(unsigned char *pins)
313 {
314  return ftdi_read_pins(d->ftdi, pins);
315 }
316 
318 {
319  return ftdi_get_error_string(d->ftdi);
320 }
321 
323 {
324  // Prepare buffers
325  char vendor[512], desc[512], serial[512];
326 
327  int ret = ftdi_usb_get_strings(d->ftdi, d->dev, vendor, 512, desc, 512, serial, 512);
328 
329  if (ret < 0)
330  return -1;
331 
332  d->vendor = vendor;
333  d->description = desc;
334  d->serial = serial;
335 
336  return 1;
337 }
338 
340 {
341  if ( d->dev == 0 )
342  {
343  d->dev = libusb_get_device(d->ftdi->usb_dev);
344  }
345 
346  // Get device strings (closes device)
347  int ret=get_strings();
348  if (ret < 0)
349  {
350  d->open = 0;
351  return ret;
352  }
353 
354  // Reattach device
355  ret = ftdi_usb_open_dev(d->ftdi, d->dev);
356  d->open = (ret >= 0);
357 
358  return ret;
359 }
360 
363 const std::string& Context::vendor()
364 {
365  return d->vendor;
366 }
367 
370 const std::string& Context::description()
371 {
372  return d->description;
373 }
374 
377 const std::string& Context::serial()
378 {
379  return d->serial;
380 }
381 
382 void Context::set_context(struct ftdi_context* context)
383 {
384  ftdi_free(d->ftdi);
385  d->ftdi = context;
386 }
387 
388 void Context::set_usb_device(struct libusb_device *dev)
389 {
390  d->dev = dev;
391 }
392 
394 {
395  return d->ftdi;
396 }
397 
399 {
400 public:
402  : context(0)
403  {}
404 
407 };
408 
410  : d ( new Private() )
411 {
412  d->context = parent->context();
413 }
414 
416 {
417 }
418 
419 int Eeprom::init_defaults(char* manufacturer, char *product, char * serial)
420 {
421  return ftdi_eeprom_initdefaults(d->context, manufacturer, product, serial);
422 }
423 
424 int Eeprom::chip_id(unsigned int *chipid)
425 {
426  return ftdi_read_chipid(d->context, chipid);
427 }
428 
429 int Eeprom::build(unsigned char *output)
430 {
431  return ftdi_eeprom_build(d->context);
432 }
433 
434 int Eeprom::read(unsigned char *eeprom)
435 {
436  return ftdi_read_eeprom(d->context);
437 }
438 
439 int Eeprom::write(unsigned char *eeprom)
440 {
441  return ftdi_write_eeprom(d->context);
442 }
443 
444 int Eeprom::read_location(int eeprom_addr, unsigned short *eeprom_val)
445 {
446  return ftdi_read_eeprom_location(d->context, eeprom_addr, eeprom_val);
447 }
448 
449 int Eeprom::write_location(int eeprom_addr, unsigned short eeprom_val)
450 {
451  return ftdi_write_eeprom_location(d->context, eeprom_addr, eeprom_val);
452 }
453 
455 {
456  return ftdi_erase_eeprom(d->context);
457 }
458 
460 {
461 public:
462  Private(struct ftdi_device_list* _devlist)
463  : devlist(_devlist)
464  {}
465 
467  {
468  if(devlist)
470  }
471 
472  std::list<Context> list;
474 };
475 
476 List::List(struct ftdi_device_list* devlist)
477  : d( new Private(devlist) )
478 {
479  if (devlist != 0)
480  {
481  // Iterate list
482  for (; devlist != 0; devlist = devlist->next)
483  {
484  Context c;
485  c.set_usb_device(devlist->dev);
486  c.get_strings();
487  d->list.push_back(c);
488  }
489  }
490 }
491 
493 {
494 }
495 
501 {
502  return d->list.begin();
503 }
504 
510 {
511  return d->list.end();
512 }
513 
519 {
520  return d->list.begin();
521 }
522 
528 {
529  return d->list.end();
530 }
531 
537 {
538  return d->list.rbegin();
539 }
540 
546 {
547  return d->list.rend();
548 }
549 
555 {
556  return d->list.rbegin();
557 }
558 
564 {
565  return d->list.rend();
566 
567 }
568 
573 List::ListType::size_type List::size() const
574 {
575  return d->list.size();
576 }
577 
582 bool List::empty() const
583 {
584  return d->list.empty();
585 }
586 
593 {
594  ListType().swap(d->list);
595 
596  // Free device list
597  if (d->devlist)
598  {
599  ftdi_list_free(&d->devlist);
600  d->devlist = 0;
601  }
602 }
603 
608 void List::push_back(const Context& element)
609 {
610  d->list.push_back(element);
611 }
612 
617 void List::push_front(const Context& element)
618 {
619  d->list.push_front(element);
620 }
621 
628 {
629  return d->list.erase(pos);
630 }
631 
639 {
640  return d->list.erase(beg, end);
641 }
642 
643 List* List::find_all(Context &context, int vendor, int product)
644 {
645  struct ftdi_device_list* dlist = 0;
646  ftdi_usb_find_all(context.context(), &dlist, vendor, product);
647  return new List(dlist);
648 }
649 
650 }
bool empty() const
Definition: ftdi.cpp:582
int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins)
Definition: ftdi.c:2090
int ftdi_usb_open(struct ftdi_context *ftdi, int vendor, int product)
Definition: ftdi.c:697
int set_modem_control(int mask=Dtr|Rts)
Definition: ftdi.cpp:246
list of usb devices created by ftdi_usb_find_all()
Definition: ftdi.h:342
struct ftdi_device_list * next
Definition: ftdi.h:345
iterator end()
Definition: ftdi.cpp:509
int ftdi_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize)
Definition: ftdi.c:2020
char * error_string()
Definition: ftdi.cpp:317
int ftdi_usb_purge_tx_buffer(struct ftdi_context *ftdi)
Definition: ftdi.c:996
int ftdi_read_eeprom_location(struct ftdi_context *ftdi, int eeprom_addr, unsigned short *eeprom_val)
Definition: ftdi.c:4186
void ftdi_set_usbdev(struct ftdi_context *ftdi, libusb_device_handle *usb)
Definition: ftdi.c:268
int write(unsigned char *buf, int size)
Definition: ftdi.cpp:222
FTDI device context. Represents single FTDI device context.
Definition: ftdi.hpp:47
int read_chunk_size()
Definition: ftdi.cpp:213
const std::string & description()
Device strings properties.
Definition: ftdi.cpp:370
reverse_iterator rbegin()
Definition: ftdi.cpp:536
ftdi_interface
Definition: ftdi.h:72
void push_front(const Context &element)
Definition: ftdi.cpp:617
int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial, unsigned int index)
Definition: ftdi.c:753
int read(unsigned char *buf, int size)
Definition: ftdi.cpp:203
struct ftdi_context * context
Definition: ftdi.cpp:406
int ftdi_set_baudrate(struct ftdi_context *ftdi, int baudrate)
Definition: ftdi.c:1299
ListType::iterator iterator
Iterator type for the container.
Definition: ftdi.hpp:186
int reset()
Definition: ftdi.cpp:140
int ftdi_write_data(struct ftdi_context *ftdi, const unsigned char *buf, int size)
Definition: ftdi.c:1434
const std::string & vendor()
Device strings properties.
Definition: ftdi.cpp:363
Main context structure for all libftdi functions.
Definition: ftdi.h:219
int read_location(int eeprom_addr, unsigned short *eeprom_val)
Definition: ftdi.cpp:444
std::list< Context > ListType
List type storing "Context" objects.
Definition: ftdi.hpp:184
int ftdi_set_event_char(struct ftdi_context *ftdi, unsigned char eventch, unsigned char enable)
Definition: ftdi.c:2343
std::list< Context > list
Definition: ftdi.cpp:472
int get_usb_write_timeout() const
Definition: ftdi.cpp:193
~Context()
Destructor.
Definition: ftdi.cpp:73
int ftdi_set_bitmode(struct ftdi_context *ftdi, unsigned char bitmask, unsigned char mode)
Definition: ftdi.c:2041
int bitbang_disable()
Definition: ftdi.cpp:307
void ftdi_list_free(struct ftdi_device_list **devlist)
Definition: ftdi.c:358
int flush(int mask=Input|Output)
Definition: ftdi.cpp:145
int ftdi_set_line_property(struct ftdi_context *ftdi, enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity)
Definition: ftdi.c:1345
iterator begin()
Definition: ftdi.cpp:500
int write_chunk_size()
Definition: ftdi.cpp:232
int ftdi_usb_purge_rx_buffer(struct ftdi_context *ftdi)
Definition: ftdi.c:970
int open(struct libusb_device *dev=0)
Definition: ftdi.cpp:122
int set_latency(unsigned char latency)
Definition: ftdi.cpp:268
const std::string & serial()
Device strings properties.
Definition: ftdi.cpp:377
struct ftdi_context * ftdi_new(void)
Definition: ftdi.c:128
int ftdi_erase_eeprom(struct ftdi_context *ftdi)
Definition: ftdi.c:4414
int ftdi_set_interface(struct ftdi_context *ftdi, enum ftdi_interface interface)
Definition: ftdi.c:157
int ftdi_eeprom_initdefaults(struct ftdi_context *ftdi, char *manufacturer, char *product, char *serial)
Definition: ftdi.c:2402
struct libusb_device * dev
Definition: ftdi.cpp:57
int ftdi_set_error_char(struct ftdi_context *ftdi, unsigned char errorch, unsigned char enable)
Definition: ftdi.c:2372
std::string serial
Definition: ftdi.cpp:61
struct libusb_device * dev
Definition: ftdi.h:347
int erase()
Definition: ftdi.cpp:454
ftdi_bits_type
Definition: ftdi.h:52
int set_interface(enum ftdi_interface interface)
Definition: ftdi.cpp:157
int set_read_chunk_size(unsigned int chunksize)
Definition: ftdi.cpp:208
int get_usb_read_timeout() const
Definition: ftdi.cpp:183
std::string vendor
Definition: ftdi.cpp:59
Private(struct ftdi_device_list *_devlist)
Definition: ftdi.cpp:462
int set_rts(bool state)
Definition: ftdi.cpp:263
unsigned latency()
Definition: ftdi.cpp:273
int close()
Definition: ftdi.cpp:133
unsigned short poll_modem_status()
Definition: ftdi.cpp:280
void set_usb_write_timeout(int usb_write_timeout)
Definition: ftdi.cpp:198
int set_write_chunk_size(unsigned int chunksize)
Definition: ftdi.cpp:227
int ftdi_poll_modem_status(struct ftdi_context *ftdi, unsigned short *status)
Definition: ftdi.c:2197
int ftdi_setdtr_rts(struct ftdi_context *ftdi, int dtr, int rts)
Definition: ftdi.c:2307
Definition: ftdi.cpp:34
int ftdi_write_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize)
Definition: ftdi.c:1816
ListType::reverse_iterator reverse_iterator
Reverse iterator type for the container.
Definition: ftdi.hpp:190
int ftdi_usb_open_dev(struct ftdi_context *ftdi, libusb_device *dev)
Definition: ftdi.c:584
void set_usb_read_timeout(int usb_read_timeout)
Definition: ftdi.cpp:188
reverse_iterator rend()
Definition: ftdi.cpp:545
void push_back(const Context &element)
Definition: ftdi.cpp:608
void set_usb_device(struct libusb_device_handle *dev)
Definition: ftdi.cpp:162
struct ftdi_eeprom eeprom
Definition: ftdi.cpp:405
int ftdi_setflowctrl(struct ftdi_context *ftdi, int flowctrl)
Definition: ftdi.c:2223
List(struct ftdi_device_list *devlist=0)
Definition: ftdi.cpp:476
int set_flow_control(int flowctrl)
Definition: ftdi.cpp:241
iterator erase(iterator pos)
Definition: ftdi.cpp:627
int build(unsigned char *output)
Definition: ftdi.cpp:429
ftdi_break_type
Definition: ftdi.h:54
int chip_id(unsigned int *chipid)
Definition: ftdi.cpp:424
int ftdi_usb_close(struct ftdi_context *ftdi)
Definition: ftdi.c:1048
int ftdi_setrts(struct ftdi_context *ftdi, int state)
Definition: ftdi.c:2276
int set_bitmode(unsigned char bitmask, unsigned char mode)
Definition: ftdi.cpp:297
int ftdi_usb_reset(struct ftdi_context *ftdi)
Definition: ftdi.c:944
int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency)
Definition: ftdi.c:2143
int ftdi_usb_get_strings(struct ftdi_context *ftdi, struct libusb_device *dev, char *manufacturer, int mnf_len, char *description, int desc_len, char *serial, int serial_len)
Definition: ftdi.c:409
int set_error_char(unsigned char errorch, unsigned char enable)
Definition: ftdi.cpp:292
ftdi_parity_type
Definition: ftdi.h:48
int get_strings()
Definition: ftdi.cpp:322
int ftdi_read_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize)
Definition: ftdi.c:1983
Context()
Constructor.
Definition: ftdi.cpp:66
int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize)
Definition: ftdi.c:1834
int ftdi_write_eeprom(struct ftdi_context *ftdi)
Definition: ftdi.c:4359
int ftdi_usb_open_string(struct ftdi_context *ftdi, const char *description)
Definition: ftdi.c:851
int ftdi_disable_bitbang(struct ftdi_context *ftdi)
Definition: ftdi.c:2067
int ftdi_setdtr(struct ftdi_context *ftdi, int state)
Definition: ftdi.c:2246
void clear()
Definition: ftdi.cpp:592
int init_defaults(char *manufacturer, char *product, char *serial)
Definition: ftdi.cpp:419
struct ftdi_context * ftdi
Definition: ftdi.cpp:56
int ftdi_set_latency_timer(struct ftdi_context *ftdi, unsigned char latency)
Definition: ftdi.c:2116
FTDI eeprom structure.
Definition: ftdi_i.h:30
ftdi_stopbits_type
Definition: ftdi.h:50
int set_dtr(bool state)
Definition: ftdi.cpp:258
int ftdi_read_eeprom(struct ftdi_context *ftdi)
Definition: ftdi.c:4206
char * ftdi_get_error_string(struct ftdi_context *ftdi)
Definition: ftdi.c:4476
Device list.
Definition: ftdi.hpp:175
int set_line_property(enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity)
Definition: ftdi.cpp:173
int ftdi_eeprom_build(struct ftdi_context *ftdi)
Definition: ftdi.c:2669
int get_strings_and_reopen()
Definition: ftdi.cpp:339
ListType::const_iterator const_iterator
Const iterator type for the container.
Definition: ftdi.hpp:188
struct ftdi_context * context()
Definition: ftdi.cpp:393
int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size)
Definition: ftdi.c:1858
struct ftdi_device_list * devlist
Definition: ftdi.cpp:473
int ftdi_write_eeprom_location(struct ftdi_context *ftdi, int eeprom_addr, unsigned short eeprom_val)
Definition: ftdi.c:4303
Eeprom(Context *parent)
Definition: ftdi.cpp:409
int read(unsigned char *eeprom)
Definition: ftdi.cpp:434
int set_baud_rate(int baudrate)
Definition: ftdi.cpp:168
ListType::size_type size() const
Definition: ftdi.cpp:573
std::string description
Definition: ftdi.cpp:60
int write(unsigned char *eeprom)
Definition: ftdi.cpp:439
void ftdi_free(struct ftdi_context *ftdi)
Definition: ftdi.c:256
int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid)
Definition: ftdi.c:4265
ftdi_mpsse_mode
Definition: ftdi.h:57
ListType::const_reverse_iterator const_reverse_iterator
Const reverse iterator type for the container.
Definition: ftdi.hpp:192
static List * find_all(Context &context, int vendor, int product)
Definition: ftdi.cpp:643
int set_event_char(unsigned char eventch, unsigned char enable)
Definition: ftdi.cpp:287
bool is_open()
Definition: ftdi.cpp:77
int ftdi_usb_find_all(struct ftdi_context *ftdi, struct ftdi_device_list **devlist, int vendor, int product)
Definition: ftdi.c:310
int read_pins(unsigned char *pins)
Definition: ftdi.cpp:312
int ftdi_set_line_property2(struct ftdi_context *ftdi, enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity, enum ftdi_break_type break_type)
Definition: ftdi.c:1364
void set_context(struct ftdi_context *context)
Definition: ftdi.cpp:382
struct ftdi_eeprom * eeprom
Definition: ftdi.h:265
int write_location(int eeprom_addr, unsigned short eeprom_val)
Definition: ftdi.cpp:449