30#define _FTDI_DISABLE_DEPRECATED
58 struct libusb_device*
dev;
94int Context::open(
int vendor,
int product,
const std::string& description,
const std::string& serial,
unsigned int index)
98 const char* c_description=NULL;
99 const char* c_serial=NULL;
206 d->dev = libusb_get_device(dev);
226 return d->ftdi->usb_read_timeout;
231 d->ftdi->usb_read_timeout = usb_read_timeout;
236 return d->ftdi->usb_write_timeout;
241 d->ftdi->usb_write_timeout = usb_write_timeout;
289 int dtr = 0, rts = 0;
323 unsigned short status = 0;
366 char ivendor[512], idesc[512], iserial[512];
374 d->description = idesc;
388 d->dev = libusb_get_device(d->ftdi->usb_dev);
401 d->open = (ret >= 0);
411 if(d->vendor.empty())
420 if(d->description.empty())
422 return d->description;
429 if(d->serial.empty())
464 d->context = parent->
context();
534 for (; devlist != 0; devlist = devlist->
next)
539 d->list.push_back(c);
554 return d->list.begin();
563 return d->list.end();
572 return d->list.begin();
581 return d->list.end();
590 return d->list.rbegin();
599 return d->list.rend();
608 return d->list.rbegin();
617 return d->list.rend();
627 return d->list.size();
636 return d->list.empty();
662 d->list.push_back(element);
671 d->list.push_front(element);
681 return d->list.erase(pos);
692 return d->list.erase(beg,
end);
699 return new List(dlist);
struct ftdi_context * ftdi
struct libusb_device * dev
FTDI device context. Represents single FTDI device context.
const char * error_string()
int set_flow_control(int flowctrl)
int set_baud_rate(int baudrate)
const std::string & description()
Device strings properties.
int read(unsigned char *buf, int size)
int DEPRECATED() flush(int mask=Input|Output)
const std::string & serial()
Device strings properties.
void set_usb_device(struct libusb_device_handle *dev)
void set_usb_write_timeout(int usb_write_timeout)
int get_usb_read_timeout() const
int set_write_chunk_size(unsigned int chunksize)
int set_error_char(unsigned char errorch, unsigned char enable)
int set_latency(unsigned char latency)
int set_read_chunk_size(unsigned int chunksize)
int tcflush(int mask=Input|Output)
int open(struct libusb_device *dev=0)
int set_event_char(unsigned char eventch, unsigned char enable)
unsigned short poll_modem_status()
int set_interface(enum ftdi_interface interface)
int get_strings(bool vendor=true, bool description=true, bool serial=true)
int read_pins(unsigned char *pins)
void set_context(struct ftdi_context *context)
const std::string & vendor()
Device strings properties.
void set_usb_read_timeout(int usb_read_timeout)
int write(const unsigned char *buf, int size)
int set_line_property(enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity)
int set_modem_control(int mask=Dtr|Rts)
int set_bitmode(unsigned char bitmask, unsigned char mode)
struct ftdi_context * context()
int get_strings_and_reopen(bool vendor=true, bool description=true, bool serial=true)
int get_usb_write_timeout() const
struct ftdi_context * context
struct ftdi_eeprom eeprom
int read(unsigned char *eeprom)
int init_defaults(char *manufacturer, char *product, char *serial)
int write_location(int eeprom_addr, unsigned short eeprom_val)
int read_location(int eeprom_addr, unsigned short *eeprom_val)
int build(unsigned char *output)
int write(unsigned char *eeprom)
int chip_id(unsigned int *chipid)
Private(struct ftdi_device_list *_devlist)
struct ftdi_device_list * devlist
std::list< Context > list
std::list< Context > ListType
List type storing "Context" objects.
void push_back(const Context &element)
ListType::const_reverse_iterator const_reverse_iterator
Const reverse iterator type for the container.
ListType::iterator iterator
Iterator type for the container.
ListType::reverse_iterator reverse_iterator
Reverse iterator type for the container.
iterator erase(iterator pos)
reverse_iterator rbegin()
ListType::const_iterator const_iterator
Const iterator type for the container.
List(struct ftdi_device_list *devlist=0)
static List * find_all(Context &context, int vendor, int product)
void push_front(const Context &element)
ListType::size_type size() const
int ftdi_write_data(struct ftdi_context *ftdi, const unsigned char *buf, int size)
int ftdi_set_line_property(struct ftdi_context *ftdi, enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity)
int ftdi_usb_open_dev(struct ftdi_context *ftdi, libusb_device *dev)
int ftdi_eeprom_initdefaults(struct ftdi_context *ftdi, char *manufacturer, char *product, char *serial)
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)
int ftdi_usb_purge_tx_buffer(struct ftdi_context *ftdi)
void ftdi_set_usbdev(struct ftdi_context *ftdi, libusb_device_handle *usb)
int ftdi_usb_purge_rx_buffer(struct ftdi_context *ftdi)
int ftdi_erase_eeprom(struct ftdi_context *ftdi)
int ftdi_usb_reset(struct ftdi_context *ftdi)
int ftdi_usb_find_all(struct ftdi_context *ftdi, struct ftdi_device_list **devlist, int vendor, int product)
int ftdi_usb_purge_buffers(struct ftdi_context *ftdi)
void ftdi_list_free(struct ftdi_device_list **devlist)
int ftdi_tciflush(struct ftdi_context *ftdi)
int ftdi_poll_modem_status(struct ftdi_context *ftdi, unsigned short *status)
int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial, unsigned int index)
void ftdi_free(struct ftdi_context *ftdi)
int ftdi_set_latency_timer(struct ftdi_context *ftdi, unsigned char latency)
int ftdi_disable_bitbang(struct ftdi_context *ftdi)
int ftdi_setdtr(struct ftdi_context *ftdi, int state)
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)
int ftdi_setrts(struct ftdi_context *ftdi, int state)
int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize)
int ftdi_setdtr_rts(struct ftdi_context *ftdi, int dtr, int rts)
int ftdi_write_eeprom_location(struct ftdi_context *ftdi, int eeprom_addr, unsigned short eeprom_val)
int ftdi_read_eeprom_location(struct ftdi_context *ftdi, int eeprom_addr, unsigned short *eeprom_val)
int ftdi_read_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize)
int ftdi_set_interface(struct ftdi_context *ftdi, enum ftdi_interface interface)
int ftdi_set_event_char(struct ftdi_context *ftdi, unsigned char eventch, unsigned char enable)
int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size)
int ftdi_set_bitmode(struct ftdi_context *ftdi, unsigned char bitmask, unsigned char mode)
const char * ftdi_get_error_string(struct ftdi_context *ftdi)
int ftdi_write_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize)
int ftdi_write_eeprom(struct ftdi_context *ftdi)
int ftdi_usb_close(struct ftdi_context *ftdi)
int ftdi_usb_open(struct ftdi_context *ftdi, int vendor, int product)
int ftdi_usb_open_string(struct ftdi_context *ftdi, const char *description)
int ftdi_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize)
struct ftdi_context * ftdi_new(void)
int ftdi_tcoflush(struct ftdi_context *ftdi)
int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins)
int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid)
int ftdi_read_eeprom(struct ftdi_context *ftdi)
int ftdi_setflowctrl(struct ftdi_context *ftdi, int flowctrl)
int ftdi_eeprom_build(struct ftdi_context *ftdi)
int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency)
int ftdi_set_baudrate(struct ftdi_context *ftdi, int baudrate)
int ftdi_set_error_char(struct ftdi_context *ftdi, unsigned char errorch, unsigned char enable)
int ftdi_tcioflush(struct ftdi_context *ftdi)
Main context structure for all libftdi functions.
struct ftdi_eeprom * eeprom
list of usb devices created by ftdi_usb_find_all()
struct ftdi_device_list * next
struct libusb_device * dev