57 struct libusb_device*
dev;
93 int Context::open(
int vendor,
int product,
const std::string& description,
const std::string& serial,
unsigned int index)
97 const char* c_description=NULL;
98 const char* c_serial=NULL;
99 if (!description.empty())
100 c_description=description.c_str();
102 c_serial=serial.c_str();
165 d->dev = libusb_get_device(dev);
185 return d->ftdi->usb_read_timeout;
190 d->ftdi->usb_read_timeout = usb_read_timeout;
195 return d->ftdi->usb_write_timeout;
200 d->ftdi->usb_write_timeout = usb_write_timeout;
248 int dtr = 0, rts = 0;
282 unsigned short status = 0;
333 d->description = desc;
343 d->dev = libusb_get_device(d->ftdi->usb_dev);
356 d->open = (ret >= 0);
372 return d->description;
412 d->context = parent->
context();
482 for (; devlist != 0; devlist = devlist->
next)
487 d->list.push_back(c);
502 return d->list.begin();
511 return d->list.end();
520 return d->list.begin();
529 return d->list.end();
538 return d->list.rbegin();
547 return d->list.rend();
556 return d->list.rbegin();
565 return d->list.rend();
575 return d->list.size();
584 return d->list.empty();
610 d->list.push_back(element);
619 d->list.push_front(element);
629 return d->list.erase(pos);
640 return d->list.erase(beg, end);
647 return new List(dlist);
int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins)
int ftdi_usb_open(struct ftdi_context *ftdi, int vendor, int product)
int set_modem_control(int mask=Dtr|Rts)
list of usb devices created by ftdi_usb_find_all()
struct ftdi_device_list * next
int ftdi_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize)
int ftdi_usb_purge_tx_buffer(struct ftdi_context *ftdi)
int ftdi_read_eeprom_location(struct ftdi_context *ftdi, int eeprom_addr, unsigned short *eeprom_val)
void ftdi_set_usbdev(struct ftdi_context *ftdi, libusb_device_handle *usb)
int write(unsigned char *buf, int size)
FTDI device context. Represents single FTDI device context.
const std::string & description()
Device strings properties.
reverse_iterator rbegin()
void push_front(const Context &element)
int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial, unsigned int index)
int read(unsigned char *buf, int size)
struct ftdi_context * context
int ftdi_set_baudrate(struct ftdi_context *ftdi, int baudrate)
ListType::iterator iterator
Iterator type for the container.
int ftdi_write_data(struct ftdi_context *ftdi, const unsigned char *buf, int size)
const std::string & vendor()
Device strings properties.
Main context structure for all libftdi functions.
int read_location(int eeprom_addr, unsigned short *eeprom_val)
std::list< Context > ListType
List type storing "Context" objects.
int ftdi_set_event_char(struct ftdi_context *ftdi, unsigned char eventch, unsigned char enable)
std::list< Context > list
int get_usb_write_timeout() const
int ftdi_set_bitmode(struct ftdi_context *ftdi, unsigned char bitmask, unsigned char mode)
void ftdi_list_free(struct ftdi_device_list **devlist)
int flush(int mask=Input|Output)
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_purge_rx_buffer(struct ftdi_context *ftdi)
int open(struct libusb_device *dev=0)
int set_latency(unsigned char latency)
const std::string & serial()
Device strings properties.
struct ftdi_context * ftdi_new(void)
int ftdi_erase_eeprom(struct ftdi_context *ftdi)
int ftdi_set_interface(struct ftdi_context *ftdi, enum ftdi_interface interface)
int ftdi_eeprom_initdefaults(struct ftdi_context *ftdi, char *manufacturer, char *product, char *serial)
struct libusb_device * dev
int ftdi_set_error_char(struct ftdi_context *ftdi, unsigned char errorch, unsigned char enable)
struct libusb_device * dev
int set_interface(enum ftdi_interface interface)
int set_read_chunk_size(unsigned int chunksize)
int get_usb_read_timeout() const
Private(struct ftdi_device_list *_devlist)
unsigned short poll_modem_status()
void set_usb_write_timeout(int usb_write_timeout)
int set_write_chunk_size(unsigned int chunksize)
int ftdi_poll_modem_status(struct ftdi_context *ftdi, unsigned short *status)
int ftdi_setdtr_rts(struct ftdi_context *ftdi, int dtr, int rts)
int ftdi_write_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize)
ListType::reverse_iterator reverse_iterator
Reverse iterator type for the container.
int ftdi_usb_open_dev(struct ftdi_context *ftdi, libusb_device *dev)
void set_usb_read_timeout(int usb_read_timeout)
void push_back(const Context &element)
void set_usb_device(struct libusb_device_handle *dev)
struct ftdi_eeprom eeprom
int ftdi_setflowctrl(struct ftdi_context *ftdi, int flowctrl)
List(struct ftdi_device_list *devlist=0)
int set_flow_control(int flowctrl)
iterator erase(iterator pos)
int build(unsigned char *output)
int chip_id(unsigned int *chipid)
int ftdi_usb_close(struct ftdi_context *ftdi)
int ftdi_setrts(struct ftdi_context *ftdi, int state)
int set_bitmode(unsigned char bitmask, unsigned char mode)
int ftdi_usb_reset(struct ftdi_context *ftdi)
int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency)
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 set_error_char(unsigned char errorch, unsigned char enable)
int ftdi_read_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize)
int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize)
int ftdi_write_eeprom(struct ftdi_context *ftdi)
int ftdi_usb_open_string(struct ftdi_context *ftdi, const char *description)
int ftdi_disable_bitbang(struct ftdi_context *ftdi)
int ftdi_setdtr(struct ftdi_context *ftdi, int state)
int init_defaults(char *manufacturer, char *product, char *serial)
struct ftdi_context * ftdi
int ftdi_set_latency_timer(struct ftdi_context *ftdi, unsigned char latency)
int ftdi_read_eeprom(struct ftdi_context *ftdi)
char * ftdi_get_error_string(struct ftdi_context *ftdi)
int set_line_property(enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity)
int ftdi_eeprom_build(struct ftdi_context *ftdi)
int get_strings_and_reopen()
ListType::const_iterator const_iterator
Const iterator type for the container.
struct ftdi_context * context()
int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size)
struct ftdi_device_list * devlist
int ftdi_write_eeprom_location(struct ftdi_context *ftdi, int eeprom_addr, unsigned short eeprom_val)
int read(unsigned char *eeprom)
int set_baud_rate(int baudrate)
ListType::size_type size() const
int write(unsigned char *eeprom)
void ftdi_free(struct ftdi_context *ftdi)
int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid)
ListType::const_reverse_iterator const_reverse_iterator
Const reverse iterator type for the container.
static List * find_all(Context &context, int vendor, int product)
int set_event_char(unsigned char eventch, unsigned char enable)
int ftdi_usb_find_all(struct ftdi_context *ftdi, struct ftdi_device_list **devlist, int vendor, int product)
int read_pins(unsigned char *pins)
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)
void set_context(struct ftdi_context *context)
struct ftdi_eeprom * eeprom
int write_location(int eeprom_addr, unsigned short eeprom_val)