xref: /openbmc/phosphor-led-manager/README.md (revision 191949c8)
1# phosphor-led-manager
2
3This project manages LED groups on dbus. Sometimes many LEDs must be driven
4together to indicate some system state.
5
6For example, there can be multiple identify LEDs. When the user wants to
7identify the system, they should all light up together.
8
9## Configuration
10
11The configuration can happen via json or yaml.
12
13## Configuration Example (JSON)
14
15This is our configuration file. It describes 2 LEDs for the
16'_enclosure_identify_' group, with their respective states and duty cycles.
17
18```json
19{
20  "leds": [
21    {
22      "group": "enclosure_identify",
23      "members": [
24        {
25          "Name": "pca955x_front_sys_id0",
26          "Action": "On",
27          "DutyOn": 50,
28          "Period": 0,
29          "Priority": "Blink"
30        },
31        {
32          "Name": "led_rear_enc_id0",
33          "Action": "On",
34          "DutyOn": 50,
35          "Period": 0,
36          "Priority": "Blink"
37        }
38      ]
39    }
40  ]
41}
42```
43
44Then start the program with
45
46```text
47~# ./phosphor-led-manager --config example.json
48```
49
50## Dbus interface
51
52When starting the program, our LED group shows up on dbus. Usually there will be
53many more groups.
54
55```text
56$ busctl tree xyz.openbmc_project.LED.GroupManager
57`- /xyz
58  `- /xyz/openbmc_project
59    `- /xyz/openbmc_project/led
60      `- /xyz/openbmc_project/led/groups
61        `- /xyz/openbmc_project/led/groups/enclosure_identify
62
63
64$ busctl introspect xyz.openbmc_project.LED.GroupManager /xyz/openbmc_project/led/groups/enclosure_identify
65NAME                                TYPE      SIGNATURE RESULT/VALUE FLAGS
66...
67xyz.openbmc_project.Led.Group       interface -         -            -
68.Asserted                           property  b         false        emits-change writable
69```
70
71In the above output, the usual org.freedesktop.\* interfaces have been removed
72to keep it readable.
73
74We can now drive the entire group by setting it's 'Asserted' property on dbus.
75
76```text
77$ busctl set-property \
78xyz.openbmc_project.LED.GroupManager \
79/xyz/openbmc_project/led/groups/enclosure_identify \
80xyz.openbmc_project.Led.Group Asserted b true
81```
82
83The program can then use the _xyz.openbmc_project.Led.Physical_ dbus interface
84exposed by _phosphor-led-sysfs_ to set each LED state.
85
86## How to Build
87
88```text
89meson setup build
90cd build
91ninja
92```
93