xref: /openbmc/phosphor-hwmon/tools/find_callout_path.cpp (revision c635e8609f5246224dfba7db57991de0b1c5327f)
1*c635e860SPatrick Venture /**
2*c635e860SPatrick Venture  * Copyright © 2017 IBM Corporation
3*c635e860SPatrick Venture  *
4*c635e860SPatrick Venture  * Licensed under the Apache License, Version 2.0 (the "License");
5*c635e860SPatrick Venture  * you may not use this file except in compliance with the License.
6*c635e860SPatrick Venture  * You may obtain a copy of the License at
7*c635e860SPatrick Venture  *
8*c635e860SPatrick Venture  *     http://www.apache.org/licenses/LICENSE-2.0
9*c635e860SPatrick Venture  *
10*c635e860SPatrick Venture  * Unless required by applicable law or agreed to in writing, software
11*c635e860SPatrick Venture  * distributed under the License is distributed on an "AS IS" BASIS,
12*c635e860SPatrick Venture  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*c635e860SPatrick Venture  * See the License for the specific language governing permissions and
14*c635e860SPatrick Venture  * limitations under the License.
15*c635e860SPatrick Venture  */
16*c635e860SPatrick Venture #include <iostream>
17*c635e860SPatrick Venture #include "../sysfs.hpp"
18*c635e860SPatrick Venture 
19*c635e860SPatrick Venture int main(int argc, char* argv[])
20*c635e860SPatrick Venture {
21*c635e860SPatrick Venture     if (argc < 2)
22*c635e860SPatrick Venture     {
23*c635e860SPatrick Venture         std::cerr << "Usage: " << argv[0]
24*c635e860SPatrick Venture             << " HWMON_INST_PATH" << std::endl;
25*c635e860SPatrick Venture         return 1;
26*c635e860SPatrick Venture     }
27*c635e860SPatrick Venture 
28*c635e860SPatrick Venture     try
29*c635e860SPatrick Venture     {
30*c635e860SPatrick Venture         std::cout << sysfs::findCalloutPath(argv[1]) << '\n';
31*c635e860SPatrick Venture     }
32*c635e860SPatrick Venture     catch (const std::exception& e)
33*c635e860SPatrick Venture     {
34*c635e860SPatrick Venture         std::cerr << e.what() << '\n';
35*c635e860SPatrick Venture         return 1;
36*c635e860SPatrick Venture     }
37*c635e860SPatrick Venture     return 0;
38*c635e860SPatrick Venture }
39*c635e860SPatrick Venture 
40*c635e860SPatrick Venture // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
41