Get sensor identifiers function

To minimize handling the return cases when getting a sensor object,
retrieve the sensor identifiers from a function. The identifiers
returned are then checked to be valid before proceeding in creating the
sensor object.

Tested:
    Sensor objects created the same
    Empty id or label cause sensor object to not be created

Change-Id: I7c2f0df3fee99448af5365e0a40c4282f9a235fa
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
2 files changed
tree: 18cb08dd64fd98bb07e9cd569837d8ada5e785a9
  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.cpp
  15. hwmon.hpp
  16. interface.hpp
  17. LICENSE
  18. mainloop.cpp
  19. mainloop.hpp
  20. Makefile.am
  21. readd.cpp
  22. README.iio.md
  23. README.md
  24. sensorset.cpp
  25. sensorset.hpp
  26. sysfs.cpp
  27. sysfs.hpp
  28. targets.hpp
  29. thresholds.hpp
  30. timer.cpp
  31. timer.hpp
  32. 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 clean the repository 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.