Add README.md

Explaining the high level workings of this project.

Change-Id: I434e6790c1ec47a2b049cbd0579d23359369dc4a
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
1 file changed
tree: ef90e03848edfb6ad05e4ea7b6ee6c48c63a475c
  1. subprojects/
  2. systemd/
  3. test/
  4. udev/
  5. .clang-format
  6. .clang-tidy
  7. .gitignore
  8. controller.cpp
  9. LICENSE
  10. meson.build
  11. meson.options
  12. OWNERS
  13. physical.cpp
  14. physical.hpp
  15. README.md
  16. sysfs.cpp
  17. sysfs.hpp
README.md

phosphor-led-sysfs

This project exposes physical LEDs on dbus.

Example

Say we have 'identify' LED in our system, which may be declared in devicetree.

leds {
    compatible = "gpio-leds";

    identify {
        gpios = <&gpio ASPEED_GPIO(S, 6) GPIO_ACTIVE_HIGH>;
    };
};

We can start the program

./phosphor-ledcontroller --path /sys/class/leds/identify

which will expose following dbus objects:

busctl tree xyz.openbmc_project.LED.Controller.identify
`- /xyz
  `- /xyz/openbmc_project
    `- /xyz/openbmc_project/led
      `- /xyz/openbmc_project/led/physical
        `- /xyz/openbmc_project/led/physical/identify

busctl introspect  xyz.openbmc_project.LED.Controller.identify /xyz/openbmc_project/led/physical/identify
NAME                                TYPE      SIGNATURE  RESULT/VALUE                             FLAGS
...
xyz.openbmc_project.Led.Physical    interface -          -                                        -
.Color                              property  s          "xyz.openbmc_project.Led.Physical.Pal... emits-change writable
.DutyOn                             property  y          50                                       emits-change writable
.Period                             property  q          1000                                     emits-change writable
.State                              property  s          "xyz.openbmc_project.Led.Physical.Act... emits-change writable

In the above output, the usual org.freedesktop.* interfaces have been removed to keep it readable.

Example: using the dbus interface

Query the LED State

busctl get-property  xyz.openbmc_project.LED.Controller.identify \
/xyz/openbmc_project/led/physical/identify \
xyz.openbmc_project.Led.Physical State \
s "xyz.openbmc_project.Led.Physical.Action.Off"

Set the LED State

busctl set-property  xyz.openbmc_project.LED.Controller.identify \
/xyz/openbmc_project/led/physical/identify \
xyz.openbmc_project.Led.Physical State s \
"xyz.openbmc_project.Led.Physical.Action.Off"

How to Build

meson setup build
cd build
ninja