Home > General > Ftdi_error_return

Ftdi_error_return

The chip generates the two stripped status bytes in the absence of data every 40 ms. Thomas -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. Referenced by ftdi_readstream(). int ftdi_write_data_get_chunksize ( struct ftdi_context * ftdi, unsigned int * chunksize ) Get write buffer chunk size.

References ftdi_deinit(). Referenced by ftdi_init(), and Ftdi::Context::set_read_chunk_size(). struct ftdi_version_info ftdi_get_library_version ( void ) Get libftdi library version. Returnsftdi_version_info Library version information Definition at line 281 of file ftdi.c. http://developer.intra2net.com/git/?p=libftdi;a=patch;h=a5e1bd8cb666ea95a8e0854ab197fe1387912601

Search:[]List[]Subjects[]Authors[]Bodies (mustpickalistfirst) Set Page Width: [ 80 ] [ 90 ] [ 100 ] [ 120 ] Viewing messages in thread '[PATCH] fixed NULL-pointer dereference in the ftdi_error_return(code, str) macro that Parameters tcpointer to ftdi_transfer_control Return values <0: Some error happens >=0: Data size transferred tc->transfer could be NULL if "(size <= ftdi->readbuffer_remaining)" at ftdi_read_data_submit(). References ftdi_usb_close_internal(), ftdi_usb_open_dev(), and ftdi_context::usb_dev.

int ftdi_read_data_get_chunksize ( struct ftdi_context * ftdi, unsigned int * chunksize ) Get read buffer chunk size. int ftdi_set_error_char ( struct ftdi_context * ftdi, unsigned char errorch, unsigned char enable ) Set error character Parameters ftdipointer to ftdi_context errorchError character enable0 to disable the error character, non-zero otherwise References ftdi_usb_open_desc_index(). References ftdi_error_return, ftdi_context::in_ep, ftdi_context::usb_dev, ftdi_context::usb_write_timeout, and ftdi_context::writebuffer_chunksize.

Parameters ftdipointer to ftdi_context Return values 0all fine -1couldn't allocate read buffer -2couldn't allocate struct buffer -3libusb_init() failed RemarksThis should be called before all functions Definition at line 88 of file int ftdi_usb_purge_tx_buffer ( struct ftdi_context * ftdi) Clears the write buffer on the chip. int ftdi_read_chipid ( struct ftdi_context * ftdi, unsigned int * chipid ) Read the FTDIChip-ID from R-type devices Parameters ftdipointer to ftdi_context chipidPointer to store FTDIChip-ID Return values 0all fine -1read try this Note: bitbang baudrates are automatically multiplied by 4"); - if (usb_control_msg(ftdi->usb_dev, SIO_SET_BAUDRATE_REQUEST_TYPE, + if (usb_control_msg(ftdi->usb_dev, FTDI_DEVICE_OUT_REQTYPE, SIO_SET_BAUDRATE_REQUEST, value, index, NULL, 0, ftdi->usb_write_timeout) != 0) ftdi_error_return (-2, "Setting new baudrate failed"); @@

struct ftdi_transfer_control* ftdi_write_data_submit ( struct ftdi_context * ftdi, unsigned char * buf, int size ) Writes data to the chip. I placed this callin ftdi_free(). References ftdi_error_return, ftdi_context::in_ep, ftdi_context::index, ftdi_context::interface, INTERFACE_A, INTERFACE_ANY, INTERFACE_B, INTERFACE_C, INTERFACE_D, ftdi_context::out_ep, and ftdi_context::usb_dev. int ftdi_read_data_set_chunksize ( struct ftdi_context * ftdi, unsigned int chunksize ) Configure read buffer chunk size.

Referenced by Ftdi::Context::set_context(), and Ftdi::Context::Private::~Private(). Parameters ftdipointer to ftdi_context bufBuffer with the data sizeSize of the buffer Return values NULLSome error happens when submit transfer !NULLPointer to a ftdi_transfer_control Definition at line 1656 of file ftdi.c. int ftdi_set_line_property ( struct ftdi_context * ftdi, enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity ) Set (RS232) line characteristics. References ftdi_error_return, ftdi_error_return_free_device_list, ftdi_usb_open_desc_index(), ftdi_usb_open_dev(), and ftdi_context::usb_ctx.

This free must happen after an libusb_open() andin all the error pathes, so I added a define for the error case and the return ofthe libusb_open() call must be remembered.ftdi_deinit(ftdi);+ libusb_exit(NULL);free(ftdi);I Parameters ftdipointer to ftdi_context Return values 0all fine -1usb_release failed -3ftdi context invalid Definition at line 1048 of file ftdi.c. Use libusb 1.0 asynchronous API. The parameters manufacturer, description and serial may be NULL or pointer to buffers to store the fetched strings.

Return values 0all fine -1usb_find_busses() failed -2usb_find_devices() failed -3usb device not found -4unable to open device -5unable to claim device -6reset failed -7set baudrate failed -8get product description failed -9get serial The parameters manufacturer, description and serial may be NULL or pointer to buffers to store the fetched strings. Referenced by Ftdi::Context::get_strings(). Useful for bitbang mode.

Return values 0all fine -1unknown interface -2USB device unavailable -3Device already open, interface can't be set in that state Definition at line 157 of file ftdi.c. I placed this callin ftdi_free(). This free must happen after an libusb_open() andin all the error pathes, so I added a define for the error case and the return ofthe libusb_open() call must be remembered.Bye--Uwe Bonnes

References FTDI_DEVICE_IN_REQTYPE, ftdi_error_return, SIO_READ_EEPROM_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_read_timeout.

Only valid for 1-255"); usb_val = latency; - if (usb_control_msg(ftdi->usb_dev, 0x40, 0x09, usb_val, ftdi->index, NULL, 0, ftdi->usb_write_timeout) != 0) + if (usb_control_msg(ftdi->usb_dev, FTDI_DEVICE_OUT_REQTYPE, SIO_SET_LATENCY_TIMER_REQUEST, usb_val, ftdi->index, NULL, 0, ftdi->usb_write_timeout) != 0) Use NULL if not needed. Referenced by ftdi_eeprom_build(), ftdi_erase_eeprom(), ftdi_write_eeprom_location(), and Ftdi::Eeprom::read_location(). This version only closes the device if it was opened by it.

Parameters ftdipointer to ftdi_context bitsNumber of bits sbitNumber of stop bits parityParity mode Return values 0all fine -1Setting line property failed Definition at line 1345 of file ftdi.c. Referenced by Ftdi::Context::flush(), and ftdi_usb_purge_buffers(). int ftdi_setflowctrl ( struct ftdi_context * ftdi, int flowctrl ) Set flowcontrol for ftdi chip Parameters ftdipointer to ftdi_context flowctrlflow control to use. FIXME: Strings are malloc'ed here and should be freed somewhere Definition at line 3297 of file ftdi.c.

Referenced by ftdi_disable_bitbang(), ftdi_eeprom_build(), ftdi_eeprom_decode(), ftdi_eeprom_initdefaults(), ftdi_eeprom_set_strings(), ftdi_erase_eeprom(), ftdi_get_eeprom_buf(), ftdi_get_eeprom_value(), ftdi_get_latency_timer(), ftdi_init(), ftdi_poll_modem_status(), ftdi_read_chipid(), ftdi_read_data(), ftdi_read_data_get_chunksize(), ftdi_read_data_set_chunksize(), ftdi_read_eeprom(), ftdi_read_eeprom_location(), ftdi_read_pins(), ftdi_set_baudrate(), ftdi_set_bitmode(), ftdi_set_eeprom_buf(), ftdi_set_eeprom_user_data(), ftdi_set_eeprom_value(), ftdi_set_error_char(), ftdi_set_event_char(), ftdi_set_interface(), ftdi_set_latency_timer(), ftdi_set_line_property2(), ftdi_setdtr(), Referenced by Ftdi::Context::set_error_char().