Claim a stable well known busname

Prior to this patch readd instances claim a busname with a format of:

xyz.openbmc_project.Hwmon.Hwmon<N> where N is the hwmon sysfs class
instance.

This is problematic for client applications that cache sensor object
busname mappings for objects provided by readd.  When readd instances
restart (due to udev events) the hwmon sysfs class index may have changed,
resulting in clients connecting to the wrong service instance.

Address this by ensuring readd instances claim the same name every
time they are started:

xyz.openbmc_project.Hwmon-<ID>.Hwmon1

Where ID is a std::hash of the /sys/devices path backing the hwmon
instance.

Additionally, add a trailing API version as recommended best practice
by the D-Bus specification.

Change-Id: Idd0057ce883a49c1e828fb54fede27ea14022d6a
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
2 files changed
tree: 060434ea4946d470b2f16fb5728dfa3dea78a0db
  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_speed.cpp
  11. fan_speed.hpp
  12. hwmon.hpp
  13. interface.hpp
  14. LICENSE
  15. mainloop.cpp
  16. mainloop.hpp
  17. Makefile.am
  18. readd.cpp
  19. README.iio.md
  20. README.md
  21. sensorset.cpp
  22. sensorset.hpp
  23. sysfs.cpp
  24. sysfs.hpp
  25. targets.hpp
  26. thresholds.hpp
  27. 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.