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>
3 files changed
tree: 47fc56c9683ab8ff17dca84c470f0c2c16ec6c48
  1. msl/
  2. test/
  3. .gitignore
  4. argument.cpp
  5. argument.hpp
  6. bootstrap.sh
  7. configure.ac
  8. env.cpp
  9. env.hpp
  10. fan_pwm.cpp
  11. fan_pwm.hpp
  12. fan_speed.cpp
  13. fan_speed.hpp
  14. hwmon.hpp
  15. interface.hpp
  16. LICENSE
  17. mainloop.cpp
  18. mainloop.hpp
  19. Makefile.am
  20. readd.cpp
  21. README.iio.md
  22. README.md
  23. sensorset.cpp
  24. sensorset.hpp
  25. sysfs.cpp
  26. sysfs.hpp
  27. targets.hpp
  28. thresholds.hpp
  29. util.hpp
README.md

Exposes generic hwmon entries as DBus objects.

To Build

To build this package, do the following steps:

    1. ./bootstrap.sh
    2. ./configure ${CONFIGURE_FLAGS}
    3. make

To full clean the repository again run `./bootstrap.sh clean`.

D-Bus bus names

To enable the use of Linux features like cgroups prioritization and
udev/systemd control, one instance of phosphor-hwmon is intended to
be run per hwmon sysfs class instance.

This requires an algorithm for selecting a stable, well-known D-Bus busname.

The algorithm is <PREFIX>-<ID>.Hwmon<N> where PREFIX is an autoconf
configurable prefix (BUSNAME_PREFIX, xyz.openbmc_project by default),
ID is a std::hash of the /sys/devices path backing the hwmon class
instance, and N is the implemented phosphor-hwmon D-Bus API version.