Add sensor instance id command line argument.
Introduce `-i|--sensor-id` flag to explicitly set sensor
suffix for dbus name.
Sample usage:
phosphor-hwmon-readd -i test_sensor_id -o /apb/...
Will register the service with the following busname:
xyz.openbmc_project.Hwmon-test_sensor_id.Hwmon1
This change required as a part of privilege separation work:
https://github.com/openbmc/openbmc/issues/3383
Signed-off-by: Anton D. Kachalov <gmouse@google.com>
Change-Id: I48ff9c3efe0edb84718ff8f695e7e932af5445de
diff --git a/readd.cpp b/readd.cpp
index cba043e..06e7d8c 100644
--- a/readd.cpp
+++ b/readd.cpp
@@ -34,10 +34,12 @@
// Read arguments.
std::string syspath = "";
std::string devpath = "";
+ std::string sensor_id = "";
CLI::App app{"OpenBMC Hwmon Daemon"};
app.add_option("-p,--path", syspath, "sysfs location to monitor");
app.add_option("-o,--dev-path", devpath, "device path to monitor");
+ app.add_option("-i,--sensor-id", sensor_id, "dbus sensor instance id");
CLI11_PARSE(app, argc, argv);
@@ -80,7 +82,7 @@
hwmonio::HwmonIO io(path);
MainLoop loop(sdbusplus::bus::new_default(), param, path, calloutPath,
- BUSNAME_PREFIX, SENSOR_ROOT, &io);
+ BUSNAME_PREFIX, SENSOR_ROOT, sensor_id, &io);
loop.run();
return 0;