Support indirections other than just "label"

The current code only allowed the MODE_<type><Num> env var
to be "label" when doing DBus naming indirection.

Add support to allow it to be anything, and then use that value
to do the lookup.

For example, if MODE_temp1 = "foo", then the code will read the
temp1_foo file to find the value to append to LABEL to find the
DBus object name.  So if temp1_foo contained a 42, then the code
will use the LABEL_temp42 var to find the object name.

Tested: Test on the OpenPower OCC device which use 'label' and now
        'function_id' for the indirections.

Change-Id: I1f3115a2d37d008efca74748ac7eff8434d8320a
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
3 files changed
tree: 9e8a3c0342e6a75db0584295732423965d2ad62c
  1. msl/
  2. test/
  3. tools/
  4. .gitignore
  5. argument.cpp
  6. argument.hpp
  7. bootstrap.sh
  8. configure.ac
  9. env.cpp
  10. env.hpp
  11. fan_pwm.cpp
  12. fan_pwm.hpp
  13. fan_speed.cpp
  14. fan_speed.hpp
  15. hwmon.cpp
  16. hwmon.hpp
  17. hwmonio.cpp
  18. hwmonio.hpp
  19. interface.hpp
  20. LICENSE
  21. mainloop.cpp
  22. mainloop.hpp
  23. Makefile.am
  24. readd.cpp
  25. README.iio.md
  26. README.md
  27. sensor.cpp
  28. sensor.hpp
  29. sensorset.cpp
  30. sensorset.hpp
  31. sysfs.cpp
  32. sysfs.hpp
  33. targets.hpp
  34. thresholds.hpp
  35. timer.cpp
  36. timer.hpp
  37. 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.