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