diff options
author | Bartosz Golaszewski <bartekgola@gmail.com> | 2015-10-27 19:15:02 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-11-01 22:55:09 +0300 |
commit | 1cde5f79d4c077cd6a2a8998a9180dfcc2800852 (patch) | |
tree | 89f1ae0737123a707637d6e0e364f77c55ced326 | |
parent | fc8eb056ea8b81798467f8306629a7ea1feffe50 (diff) |
i2cdump: don't read block data in non-block modes
We currently read data twice in byte mode. Add a check to avoid calling
i2c_smbus_read_i2c_block_data() if we're not in I2C or SMBus block mode.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/i2c_tools.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index 907d738fd..094bf9e38 100644 --- a/miscutils/i2c_tools.c +++ b/miscutils/i2c_tools.c @@ -971,7 +971,8 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv) /* All but word data. */ if (mode != I2C_SMBUS_WORD_DATA || even) { - blen = read_block_data(fd, mode, block); + if (mode == I2C_SMBUS_BLOCK_DATA || mode == I2C_SMBUS_I2C_BLOCK_DATA) + blen = read_block_data(fd, mode, block); if (mode == I2C_SMBUS_BYTE) { res = i2c_smbus_write_byte(fd, first); |