Add a helper function to capture command metadata
Due to openbmc/openbmc#2364, certain command response files may be
missing. Add a helper function to call the PMBus::exists() function to
skip trying to read in metadata for missing files.
Change-Id: I101c5ccebe76dd29fb07369fd082072ce94f021b
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index 379a937..474ad8d 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -3,6 +3,7 @@
#include "device.hpp"
#include "pmbus.hpp"
#include "timer.hpp"
+#include "names_values.hpp"
namespace witherspoon
{
@@ -201,6 +202,16 @@
void powerStateChanged(sdbusplus::message::message& msg);
/**
+ * @brief Wrapper for PMBus::read() and adding metadata
+ *
+ * @param[out] nv - NamesValues instance to store cmd string and value
+ * @param[in] cmd - String for the command to read data from.
+ * @param[in] type - The type of file to read the command from.
+ */
+ void captureCmd(util::NamesValues& nv, const std::string& cmd,
+ witherspoon::pmbus::Type type);
+
+ /**
* @brief Checks for input voltage faults and logs error if needed.
*
* Check for voltage input under voltage fault (VIN_UV_FAULT) and/or