commit | 543ac9f16ff63c9d18d9d2aab5c9a142e66c19c9 | [log] [tgz] |
---|---|---|
author | Patrick Williams <patrick@stwcx.xyz> | Fri Aug 16 15:19:59 2024 -0400 |
committer | Patrick Williams <patrick@stwcx.xyz> | Fri Aug 16 15:19:59 2024 -0400 |
tree | 73c0148319b170d50ae6b10e69ffc4b3755f8a8f | |
parent | 4a435516a856324839e047607be8ef53855ddc8a [diff] |
clang-format: re-format for clang-18 clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda formatting also changed, so we have made changes to the organization default style format to better handle lambda formatting. See I5e08687e696dd240402a2780158664b7113def0e for updated style. See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement. Change-Id: I47f3c815913ae34be19ce0d823fa233ed698d1a0 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
This project manages LED groups on dbus. Sometimes many LEDs must be driven together to indicate some system state.
For example, there can be multiple identify LEDs. When the user wants to identify the system, they should all light up together.
The configuration can happen via json or yaml.
Each LED can have "Priority" as "Blink" or "On". If this property is defined, it should be defined on each instance of the LED in the config.
When multiple LED groups are asserted and contain the same LED, "Priority" determines the state of the LED.
For example, Group 1 says LED1 should be "Blink", and Group 2 says it should be "On". LED1 will then have the state declared in "Priority".
This is our configuration file. It describes 2 LEDs for the 'enclosure_identify' group, with their respective states and duty cycles.
{ "leds": [ { "group": "enclosure_identify", "members": [ { "Name": "pca955x_front_sys_id0", "Action": "On", "DutyOn": 50, "Period": 0, "Priority": "Blink" }, { "Name": "led_rear_enc_id0", "Action": "On", "DutyOn": 50, "Period": 0, "Priority": "Blink" } ] } ] }
Then start the program with
~# ./phosphor-led-manager --config example.json
When starting the program, our LED group shows up on dbus. Usually there will be many more groups.
$ busctl tree xyz.openbmc_project.LED.GroupManager `- /xyz `- /xyz/openbmc_project `- /xyz/openbmc_project/led `- /xyz/openbmc_project/led/groups `- /xyz/openbmc_project/led/groups/enclosure_identify $ busctl introspect xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/enclosure_identify NAME TYPE SIGNATURE RESULT/VALUE FLAGS ... xyz.openbmc_project.Led.Group interface - - - .Asserted property b false emits-change writable
In the above output, the usual org.freedesktop.* interfaces have been removed to keep it readable.
We can now drive the entire group by setting it's 'Asserted' property on dbus.
$ busctl set-property \ xyz.openbmc_project.LED.GroupManager \ /xyz/openbmc_project/led/groups/enclosure_identify \ xyz.openbmc_project.Led.Group Asserted b true
The program can then use the xyz.openbmc_project.Led.Physical dbus interface exposed by phosphor-led-sysfs to set each LED state.
meson setup build
cd build
ninja