i2cdump: use I2C block mode for the 'i' mode parameter
authorBartosz Golaszewski <bartekgola@gmail.com>
Tue, 27 Oct 2015 16:15:03 +0000 (17:15 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 1 Nov 2015 19:55:09 +0000 (20:55 +0100)
Currently we're calling i2c_smbus_read_block_data() for both 'i' and 's'
mode parameters. If the bus doesn't support SMBus block mode, then the
i2c access ioctl() fails. Make i2cdump behave compatibly with upstream
version by calling i2c_smbus_read_i2c_block_data() for I2C block.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/i2c_tools.c

index 094bf9e38736144de2d2beaec35b36e231fc717e..6d221e9fc30f5a3fbb168c071bd0103014cf2592 100644 (file)
@@ -723,7 +723,7 @@ static int read_block_data(int buf_fd, int mode, int *block)
        uint8_t cblock[I2C_SMBUS_BLOCK_MAX + I2CDUMP_NUM_REGS];
        int res, blen = 0, tmp, i;
 
-       if (mode == I2C_SMBUS_BLOCK_DATA || mode == I2C_SMBUS_I2C_BLOCK_DATA) {
+       if (mode == I2C_SMBUS_BLOCK_DATA) {
                res = i2c_smbus_read_block_data(buf_fd, 0, cblock);
                blen = res;
        } else {