blob: 2c6bdafd86dd1b1fe590de0e4aa978f7228a83b2 [file] [log] [blame]
Brad Bishop11641952017-08-29 11:21:15 -04001/**
2 * Copyright © 2017 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#include <iostream>
17#include <string>
18#include "../sysfs.hpp"
19
20int main(int argc, char* argv[])
21{
22 using namespace std::string_literals;
23
24 if (argc < 6)
25 {
26 std::cerr << "Usage: " << argv[0]
27 << " [read|write] PATH TYPE N ATTR [VALUE]" << std::endl;
28 return 1;
29 }
30
31 sysfs::hwmonio::HwmonIO io(argv[2]);
32
33 if ("read"s == argv[1])
34 {
35 std::cout << io.read(argv[3], argv[4], argv[5]) << std::endl;
36 }
37 else
38 {
39 io.write(strtol(argv[6], nullptr, 0), argv[3], argv[4], argv[5]);
40 }
41
42 return 0;
43}
44
45// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4