Handle file errors when device path gets unbound
occ-control was asserting when the hwmon path would get removed due to
device being unbound. This change will gracefully handle the path
getting removed / added back.
Tested on Raininer by unbind/bind of devices:
echo occ-hwmon.2 > /sys/bus/platform/drivers/occ-hwmon/unbind
echo occ-hwmon.2 > /sys/bus/platform/drivers/occ-hwmon/bind
Change-Id: I46fd2c2c54868ffb8183d3dc49cd0c2751165d3b
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_status.hpp b/occ_status.hpp
index 6a00676..6376b6c 100644
--- a/occ_status.hpp
+++ b/occ_status.hpp
@@ -204,7 +204,7 @@
*
* @return path or empty path if not found
*/
- fs::path getHwmonPath() const;
+ fs::path getHwmonPath();
private:
/** @brief OCC dbus object path */
@@ -251,6 +251,9 @@
sdeventplus::Event sdpEvent;
#endif
+ /** @brief hwmon path for this OCC */
+ fs::path hwmonPath;
+
/** @brief Callback function on host control signals
*
* @param[in] msg - Data associated with subscribed signal