summaryrefslogtreecommitdiffstats
path: root/readd.cpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2018-03-05 12:07:46 -0600
committerMatt Spinler <spinler@us.ibm.com>2018-03-07 13:16:15 -0600
commit147b0337b36e58604fbdd517f71f97a4dae725c1 (patch)
tree2a7c65ad82c18413816b4f9861bc110798070598 /readd.cpp
parent626df17a5e2b7fecbdfa36045cdd19efda667f81 (diff)
downloadphosphor-hwmon-147b0337b36e58604fbdd517f71f97a4dae725c1.tar.gz
phosphor-hwmon-147b0337b36e58604fbdd517f71f97a4dae725c1.zip
Find hwmon path based on input path type
If the input path starts with /devices, find the hwmon path using the findHwmonFromDevPath function, otherwise use findHwmonFromOFPath. Also change the argument name to something more generic. Did not change the argument's short name so the service file isn't coupled to this change. Tested: Tested with both paths. Change-Id: I5feb8a897fc86117b102ce44584ed977282cb955 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'readd.cpp')
-rw-r--r--readd.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/readd.cpp b/readd.cpp
index 454ac62..3c2c2d2 100644
--- a/readd.cpp
+++ b/readd.cpp
@@ -34,10 +34,19 @@ int main(int argc, char** argv)
auto options = std::make_unique<ArgumentParser>(argc, argv);
// Parse out path argument.
- auto path = (*options)["of-name"];
+ auto path = (*options)["dev-path"];
if (path != ArgumentParser::empty_string)
{
- path = sysfs::findHwmonFromOFPath(path);
+ // This path may either be a device path (starts with
+ // /devices), or an open firmware device tree path.
+ if (path.substr(0, 8) == "/devices")
+ {
+ path = sysfs::findHwmonFromDevPath(path);
+ }
+ else
+ {
+ path = sysfs::findHwmonFromOFPath(path);
+ }
}
if (path == ArgumentParser::empty_string)
OpenPOWER on IntegriCloud