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