i2c: Implement read function
Implement I2CDevice::read() by invoking i2c_smbus_read_xxx() APIs.
The code is referenced from i2c-tools' i2cget.c:
https://github.com/ev3dev/i2c-tools/blob/ev3dev-stretch/tools/i2cget.c
Tested: Verify on Witherspoon that it reads the PSU ppgrade mode status
register (1 byte) and CRC16 register (2 bytes) correctly.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I8759b6a35229f81120acf77f08429f7f79458b8b
diff --git a/tools/power-utils/test/test_updater.cpp b/tools/power-utils/test/test_updater.cpp
index 4d051f7..d2dfd11 100644
--- a/tools/power-utils/test/test_updater.cpp
+++ b/tools/power-utils/test/test_updater.cpp
@@ -95,7 +95,10 @@
updater = std::make_unique<Updater>(psuInventoryPath, devPath, imageDir);
updater->createI2CDevice();
auto& i2c = getMockedI2c();
+ EXPECT_CALL(i2c, read(An<uint8_t&>()));
EXPECT_CALL(i2c, read(_, An<uint8_t&>()));
+ EXPECT_CALL(i2c, read(_, An<uint16_t&>()));
+ EXPECT_CALL(i2c, read(_, An<uint8_t&>(), _));
updater->doUpdate();
}