Add findHwmonFromDevPath()

This function can find the hwmon path from a /devices
path.  This path is similar to what udev lists as the
device path, but with the /hwmon/hwmonN directories
removed from the end.  In addition, any ':' characters
in the path have been converted to '--', so the code
needs to convert them back.

This is done because some devices are not in the device
tree, and hence wouldn't have the open firmware device
path that the code previously only supported.

Tested: Tested with the new /devices path.

Change-Id: Ic26646c6f609323cff86d4cd10bbe0a44d7d61ac
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/sysfs.hpp b/sysfs.hpp
index e673205..70568cd 100644
--- a/sysfs.hpp
+++ b/sysfs.hpp
@@ -51,6 +51,19 @@
  */
 std::string findHwmonFromOFPath(const std::string& ofNode);
 
+/** @brief Find hwmon instances from a device path
+ *
+ *  Look for a matching hwmon instance given a device path that
+ *  starts with /devices.  This path is the DEVPATH udev attribute
+ *  for the device except it has the '/hwmon/hwmonN' stripped off.
+ *
+ *  @param[in] devPath - The device path.
+ *
+ *  @return - The hwmon instance path or an empty
+ *            string if no match is found.
+ */
+std::string findHwmonFromDevPath(const std::string& devPath);
+
 /** @brief Return the path to use for a call out.
  *
  *  Return an empty string if a callout path cannot be