Name Date Size #Lines LOC

..Today-

multi-presence/H12-Nov-2024-572377

presence/H17-Aug-2024-581386

subprojects/H25-Jun-2024-7353

test/H25-Jun-2024-166119

.clang-formatH A D17-Aug-20243.7 KiB137135

.gitignoreH A D25-Jun-202474 65

99-gpio-keys.rulesH A D07-Mar-2021217 22

LICENSEH A D07-Mar-202111.1 KiB202169

OWNERSH A D12-Oct-20221.6 KiB4944

README.mdH A D06-Aug-20244.5 KiB129105

evdev.cppH A D07-Aug-20231.6 KiB7254

evdev.hppH A D17-Aug-20243.4 KiB13177

file.hppH A D07-Aug-20231 KiB5941

gpioMon.cppH A D17-Aug-20244.1 KiB151106

gpioMon.hppH A D17-Aug-20242.7 KiB9043

gpioMonMain.cppH A D12-Nov-20245.2 KiB185109

mainapp.cppH A D10-Aug-20232.7 KiB9557

meson.buildH A D25-Jun-20243 KiB153132

meson.optionsH A D17-Aug-202394 65

monitor.cppH A D07-Aug-20233 KiB10360

monitor.hppH A D17-Aug-20242.8 KiB9142

phosphor-gpio-monitor@.serviceH A D07-Mar-2021253 97

phosphor-gpio-presence@.serviceH A D07-Mar-2021517 1310

phosphor-multi-gpio-monitor.jsonH A D06-Dec-2022249 1514

phosphor-multi-gpio-monitor.serviceH A D07-Mar-2021191 75

phosphor-multi-gpio-presence.jsonH A D19-Oct-2023427 1716

phosphor-multi-gpio-presence.serviceH A D19-Oct-2023347 119

README.md

1# GPIO Monitoring
2
3## Implemented Daemons
4
5### `phosphor-gpio-monitor`
6
7This daemon accepts a command line parameter for monitoring single gpio line and
8take action if requested. This implementation uses GPIO keys and only supports
9monitoring single GPIO line, for multiple lines, user has to run this daemon
10seperately for each gpio line.
11
12### `phosphor-multi-gpio-monitor`
13
14This daemon accepts command line parameter as a well-defined GPIO configuration
15file in json format to monitor list of gpios from config file and take action
16defined in config based on gpio state change. It uses libgpiod library.
17
18#### Difference
19
20New implementation (phosphor-multi-gpio-monitor) provides multiple gpio line
21monitoring in single instance of phosphor-multi-gpio-monitor running. It is very
22easy to add list of gpios into JSON config file and it also supports of GPIO
23line by name defined in kernel.
24
25#### Configuration
26
27There is a phosphor-multi-gpio-monitor.json file that defines details of GPIOs
28which is required to be monitored. This file can be replaced with a platform
29specific configuration file via bbappend.
30
31Following are fields in json file
32
331. Name: Name of gpio for reference.
342. LineName: this is the line name defined in device tree for specific gpio
353. GpioNum: GPIO offset, this field is optional if LineName is defined.
364. ChipId: This is device name either offset ("0") or complete gpio device
37   ("gpiochip0"). This field is not required if LineName is defined.
385. EventMon: Event of gpio to be monitored. This can be "FALLING", "RISING" OR
39   "BOTH". Default value for this is "BOTH".
406. Target: This is an optional systemd service which will get started after
41   triggering event. A journal entry will be added for every event occurs
42   irrespective of this definition.
437. Targets: This is an optional systemd service which will get started after
44   triggering corresponding event(RASING or FALLING). A journal entry will be
45   added for every event occurs irrespective of this definition.
468. Continue: This is a optional flag and if it is defined as true then this gpio
47   will be monitored continously. If not defined then monitoring of this gpio
48   will stop after first event.
49
50#### Sample config file
51
52```json
53[
54  {
55    "Name": "PowerButton",
56    "LineName": "POWER_BUTTON",
57    "GpioNum": 34,
58    "ChipId": "gpiochip0",
59    "EventMon": "FALLING",
60    "Target": "PowerButtonDown.service",
61    "Continue": true
62  },
63  {
64    "Name": "PowerGood",
65    "LineName": "PS_PWROK",
66    "EventMon": "BOTH",
67    "Targets": {
68      "FALLING": ["PowerGoodFalling.service", "PowerOff.service"],
69      "RISING": ["PowerGoodRising.service", "PowerOn.service"]
70    },
71    "Continue": false
72  },
73  { "Name": "SystemReset", "GpioNum": 46, "ChipId": "0" }
74]
75```
76
77### `phosphor-multi-gpio-presence`
78
79This daemon accepts command line parameter as a well-defined GPIO configuration
80file in json format to monitor list of gpios from config file and sets inventory
81presence as defined in config based on gpio state change. It uses libgpiod
82library.
83
84#### Difference
85
86New implementation (phosphor-multi-gpio-presence) provides multiple gpio line
87monitoring in single instance of phosphor-multi-gpio-presence running. It is
88very easy to add list of gpios into JSON config file and it also supports of
89GPIO line by name defined in kernel.
90
91#### Configuration
92
93There is a phosphor-multi-gpio-presence.json file that defines details of GPIOs
94which is required to be monitored. This file can be replaced with a platform
95specific configuration file via bbappend.
96
97Following are fields in json file
98
991. Name: PrettyName of inventory item
1002. LineName: this is the line name defined in device tree for specific gpio
1013. GpioNum: GPIO offset, this field is optional if LineName is defined.
1024. ChipId: This is device name either offset ("0") or complete gpio device
103   ("gpiochip0"). This field is not required if LineName is defined.
1045. Inventory: Object path under inventory that will be created
1056. ExtraInterfaces: [Optional] List of interfaces to associate to inventory item
1067. ActiveLow: [Optional] Object is present on LOW level
1078. Bias: [Optional] Configure a BIAS on the GPIO line, for example PULL_UP
108
109#### Sample config file
110
111```json
112[
113  {
114    "Name": "DIMM A0",
115    "LineName": "POWER_BUTTON",
116    "Inventory": "/system/chassis/motherboard/dimm_a0"
117  },
118  {
119    "Name": "Powersupply 0",
120    "ChipId": "0",
121    "GpioNum": 14,
122    "Inventory": "/system/chassis/motherboard/powersupply0",
123    "ActiveLow": true,
124    "Bias": "PULL_UP",
125    "ExtraInterfaces": ["xyz.openbmc_project.Inventory.Item.PowerSupply"]
126  }
127]
128```
129