libftdi Archives

Subject: Re: [EEPROM branch] Amount of data in ftdi_read_eeprom

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 24 Sep 2010 16:42:21 +0200
>>>>> "Thomas" == Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx> writes:

    Thomas> Hello Uwe, one more code piece to examine:

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

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

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

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

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

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

Because I think is is easier that way. We have a fixed buffer, read all 0x200
bytes in a single libusb calls and if 0x80.. 0xff is a mirror of 0x00..0x7f,
we have a 93x46 ...

-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread