blob: f6cb665185de68d87543b9f3b230ea64cd7c9420 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include <iostream>
#include <phosphor-logging/log.hpp>
#include "argument.hpp"
#include "gpio_presence.hpp"
using namespace phosphor::logging;
using namespace phosphor::gpio;
using namespace phosphor::gpio::presence;
int main(int argc, char* argv[])
{
auto options = ArgumentParser(argc, argv);
auto inventory = options["inventory"];
auto key = options["key"];
auto path = options["path"];
if (argc < 4)
{
std::cerr << "Too few arguments\n";
options.usage(argv);
}
if (inventory == ArgumentParser::emptyString)
{
std::cerr << "Inventory argument required\n";
options.usage(argv);
}
if (key == ArgumentParser::emptyString)
{
std::cerr << "GPIO key argument required\n";
options.usage(argv);
}
if (path == ArgumentParser::emptyString)
{
std::cerr << "Device path argument required\n";
options.usage(argv);
}
auto bus = sdbusplus::bus::new_default();
auto name = options["name"];
Presence presence(bus, inventory, path, std::stoul(key), name);
return 0;
}
|