Add helper function to see if PMBus file exists
Due to some odd power supply behavior on some systems, certain PMBus
files in sysfs end up missing. Adding in a helper function to avoid
spurious tracing if an application so chooses to check for existence
before trying to read one of those files. See openbmc/openbmc#2364 issue
opened for this problem with the missing files.
Change-Id: Ib295beb7ff1733da6ecbcd6966b76b918ade7f54
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/pmbus.hpp b/pmbus.hpp
index fc9a1cb..7089445 100644
--- a/pmbus.hpp
+++ b/pmbus.hpp
@@ -175,6 +175,16 @@
size_t page,
Type type);
/**
+ * Checks if the file for the given name and type exists.
+ *
+ * @param[in] name - path concatenated to basePath to read
+ * @param[in] type - Path type
+ *
+ * @return bool - True if file exists, false if it does not.
+ */
+ bool exists(const std::string& name, Type type);
+
+ /**
* Read byte(s) from file in sysfs.
*
* @param[in] name - path concatenated to basePath to read