Fix getService fail on single host platform

Add exception handling in the getService() function to so that the
isMultiHost() function returns correct value for single and multi-host
platform.

Tested: check on single host platform
1. Press power button and check if it works properly
2. Press reset button and check if it work properly

Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: I5c7019fb27b6ccb795ada9c63e591ce8561ff70c
1 file changed
tree: 59f9aefb91e0f74c6f35e0b8431a1afc54cbad67
  1. inc/
  2. service_files/
  3. src/
  4. subprojects/
  5. .clang-format
  6. .gitignore
  7. LICENSE
  8. meson.build
  9. meson_options.txt
  10. OWNERS
  11. README.md
README.md

phosphor-buttons

Phosphor-buttons has a collection of IO event handler interfaces for physical inputs which are part of OCP front panel.

It defines an individual dbus interface object for each physical button/switch inputs such as power button, reset button etc. Each of this button interfaces monitors it's associated io for event changes and calls the respective event handlers.

Gpio defs config

In order to monitor a button/input interface the

respective gpio config details should be mentioned in the gpio defs json file - "/etc/default/obmc/gpio/gpio_defs.json"

  1. The button interface type name.
  2. An array consists of single or multiple gpio configs associated with the specific button interface.

example gpio def Json config

{ "gpio_definitions": [ { "name": "POWER_BUTTON", "gpio_config" :[ { "pin": "D0", "direction": "both" } ] }, { "name": "RESET_BUTTON", "gpio_config" :[ { "pin": "AB0", "direction": "both" } ] }, { "name" : "HOST_SELECTOR",

        "gpio_config" : [
        {
            "pin": "AA4",
            "direction": "both"
        },
        {
            "pin": "AA5",
            "direction": "both"
        },
        {
            "pin": "AA6",
            "direction": "both"
        },
        {
            "pin": "AA7",
            "direction": "both"
        }
        ]
    },

}