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/i2c/i2c.hpp b/tools/i2c/i2c.hpp
index 45bb024..7fe064f 100644
--- a/tools/i2c/i2c.hpp
+++ b/tools/i2c/i2c.hpp
@@ -42,6 +42,17 @@
/** @brief The i2c bus path in /dev */
std::string busStr;
+ /** @brief Check i2c adapter read functionality
+ *
+ * Check if the i2c adapter has the functionality specified by the SMBus
+ * transaction type
+ *
+ * @param[in] type - The SMBus transaction type defined in linux/i2c.h
+ *
+ * @throw I2CException if the function is not supported
+ */
+ void checkReadFuncs(int type);
+
public:
~I2CDevice()
{