char full_buff[(EEPROM_ID_MAX_PAGE_SIZE + MAX_CMD_SIZE)];
int eeprom_type = get_eeprom_type();
- switch (eeprom_type) {
+ switch (eeprom_type) {
case EEPROM_TYPE_SMALL:
cmd_size = CMD_SIZE_SMALL;
page_size = EEPROM_ID_SMALL_PAGE_SIZE;
break;
case 0x10: /* A repeated START has been transmitted. */
/* Setting read_index to 0 is usefull only if next data byte is
- * Slave Address + Read (SLA + R), but it's OK if we will write too. */
+ * Slave Address + Read (SLA + R), but it's OK if we perform a write too, and
+ * is necessary for read with a null data length used to probe for devices.
+ */
i2c->read_index = 0;
/* Send Slave Address and Read/Write bit (SLA + R/W)
* Depending on R/W bit, Master Receive or master Transmit mode will be enterred. */
-
/***************************************************************************** */
/* I2C access */
/***************************************************************************** */
/* read buffer */
mod_i2c.in_buff = inbuff;
mod_i2c.read_length = count;
+ mod_i2c.read_index = 0;
/* Start the process */
mod_i2c.state = I2C_BUSY;