libftdi Archives

Subject: [EEPROM branch] Amount of data in ftdi_read_eeprom

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 24 Sep 2010 14:34:53 +0200
Hello Uwe,

one more code piece to examine:

int ftdi_read_eeprom(struct ftdi_context *ftdi)
    int i;
    unsigned char *buf;

    if (ftdi == NULL || ftdi->usb_dev == NULL)
        ftdi_error_return(-2, "USB device unavailable");
    buf = ftdi->eeprom->buf;

    for (i = 0; i < FTDI_MAX_EEPROM_SIZE/2; i++)
        if (libusb_control_transfer(
                buf+(i*2), 2, ftdi->usb_read_timeout) != 2)
            ftdi_error_return(-1, "reading eeprom failed");

This looks wrong for 93x46 eeproms / older chips
as FTDI_MAX_EEPROM_SIZE is 256 (0x100).

This used to be "eeprom->size/2". Any reason you changed that?

There's also (old) code to guess the eeprom size.
Maybe we shouldn't do that anyway.


libftdi - see for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread