1# phosphor-gpio-monitor
2
3This daemon accepts a command line parameter for monitoring single gpio
4line and take action if requested. This implementation uses GPIO keys
5and only supports monitoring single GPIO line, for multiple lines,
6user has to run this daemon seperately for each gpio line.
7
8# phosphor-multi-gpio-monitor
9
10This daemon accepts command line parameter as a well-defined GPIO
11configuration file in json format to monitor list of gpios from
12config file and take action defined in config based on gpio state
13change. It uses libgpiod library.
14
15# Difference
16New implementation (phosphor-multi-gpio-monitor) provides multiple gpio
17line monitoring in single instance of phosphor-multi-gpio-monitor running.
18It is very easy to add list of gpios into JSON config file and it also
19supports of GPIO line by name defined in kernel.
20
21## Configuration
22
23There is a phosphor-multi-gpio-monitor.json file that defines details of
24GPIOs which is required to be monitored. This file can be replaced with
25a platform specific configuration file via bbappend.
26
27Following are fields in json file
281. Name: Name of gpio for reference.
292. LineName: this is the line name defined in device tree for specific gpio
303. GpioNum: GPIO offset, this field is optional if LineName is defined.
314. ChipId: This is device name either offset ("0") or complete gpio device
32           ("gpiochip0"). This field is not required if LineName is defined.
335. EventMon: Event of gpio to be monitored. This can be "FALLING", "RISING"
34             OR "BOTH". Default value for this is "BOTH".
356. Target: This is an optional systemd service which will get started after
36           triggering event. A journal entry will be added for every event
37           occurs irrespective of this definition.
387. Continue: This is a optional flag and if it is defined as true then this
39             gpio will be monitored continously. If not defined then
40             monitoring of this gpio will stop after first event.
41
42## Sample config file
43
44[
45	{
46		"Name": "PowerButton",
47		"LineName": "POWER_BUTTON",
48		"GpioNum": 34,
49		"ChipId": "gpiochip0",
50		"EventMon": "BOTH",
51		"Continue": true
52	},
53	{
54		"Name": "PowerGood",
55		"LineName": "PS_PWROK",
56		"EventMon": "FALLING",
57		"Continue": false
58	},
59	{
60		"Name": "SystemReset",
61		"GpioNum": 46,
62		"ChipId": "0"
63	}
64]
65