Add read() function to PMBus
Adding a read() function to PMBus to read one or more bytes of data. A
number of errors will require data from the 2 byte STATUS_WORD command,
1 byte from STATUS_INPUT and various other commands, along with later
functions that will require even more bytes of data.
Change-Id: I0433b36254565a124229a5bb884fbebd6ec536fc
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/pmbus.hpp b/pmbus.hpp
index 4946829..82e2ffc 100644
--- a/pmbus.hpp
+++ b/pmbus.hpp
@@ -61,7 +61,7 @@
*
* @param[in] name - path concatenated to
* basePath to read
- * @param[in] type - one of Base, Hwmon, or Debug
+ * @param[in] type - one of Base, Hwmon, or Debug (path type)
*
* @return bool - false if result was 0, else true
*/
@@ -75,13 +75,22 @@
* @param[in] name - path concatenated to
* basePath to read
* @param[in] page - page number
- * @param[in] type - one of Base, Hwmon, or Debug
+ * @param[in] type - one of Base, Hwmon, or Debug (path type)
*
* @return bool - false if result was 0, else true
*/
bool readBitInPage(const std::string& name,
size_t page,
Type type);
+ /**
+ * Read byte(s) from file in sysfs.
+ *
+ * @param[in] name - path concatenated to basePath to read
+ * @param[in] type - one of Base, Hwmon, or Debug (path type)
+ *
+ * @return uint64_t - Up to 8 bytes of data read from file.
+ */
+ uint64_t read(const std::string& name, Type type);
/**
* Writes an integer value to the file, therefore doing
@@ -90,7 +99,7 @@
* @param[in] name - path concatenated to
* basePath to write
* @param[in] value - the value to write
- * @param[in] type - one of Base, Hwmon, or Debug
+ * @param[in] type - one of Base, Hwmon, or Debug (path type)
*/
void write(const std::string& name, int value, Type type);
@@ -127,7 +136,7 @@
/**
* Returns the path to use for the passed in type.
*
- * @param[in] type - one of Base, Hwmon, or Debug
+ * @param[in] type - one of Base, Hwmon, or Debug (path type)
*
* @return fs::path - the full path to Base, Hwmon, or Debug path
*/