sysfs: refactor findCallout
- Export findCalloutPath so other modules can use it.
- Change parameter to hwmon instance path to avoid
fs::canonical outside sysfs.cpp.
- Check for the iio-hwmon driver instead of relying on
DT nodes having 'iio-hwmon' in them.
- For iio devices, provide a /sys/devices path rather
than a DT path.
- Use existing application indenting and doxygen style.
Change-Id: I16c2dc7417eb68f7cbef44243f481df8040ec1fd
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/sysfs.hpp b/sysfs.hpp
index 9a8211d..f0e92db 100644
--- a/sysfs.hpp
+++ b/sysfs.hpp
@@ -64,6 +64,17 @@
*/
std::string findHwmon(const std::string& ofNode);
+/** @brief Return the path to use for a call out.
+ *
+ * Return an empty string if a callout path cannot be
+ * found.
+ *
+ * @param[in] instancePath - /sys/class/hwmon/hwmon<N> path.
+ *
+ * @return Path to use for call out
+ */
+std::string findCalloutPath(const std::string& instancePath);
+
/** @brief Read an hwmon sysfs value.
*
* Calls exit(3) with bad status on failure.