Name Date Size #Lines LOC

..--

dbus-1/system-services/H--65

interfaces/H--309175

subprojects/H--4231

systemd/system/H--2317

test/H--546393

udev/rules.d/H--21

.clang-formatH A D18-Dec-20243.7 KiB137135

.clang-tidyH A D02-Feb-202311.1 KiB319317

.gitignoreH A D17-May-202142 43

LICENSEH A D29-Nov-201611.1 KiB202169

OWNERSH A D22-Dec-20231.8 KiB5348

README.mdH A D05-Aug-20242.1 KiB7657

add_led_action.cppH A D07-Oct-20222.2 KiB9056

argument.cppH A D07-Oct-20221.9 KiB7448

argument.hppH A D07-Oct-20221.6 KiB5931

controller.cppH A D07-Oct-20221.2 KiB4114

meson.buildH A D01-Aug-20241.9 KiB7766

meson.optionsH A D15-Aug-202380 11

physical.cppH A D17-Aug-20224.1 KiB155103

physical.hppH A D17-Aug-20223.4 KiB12548

sysfs.cppH A D01-Aug-20245.1 KiB206137

sysfs.hppH A D16-Jul-20242.3 KiB7744

README.md

1# phosphor-led-sysfs
2
3This project exposes physical LEDs on dbus.
4
5## Example
6
7Say we have 'identify' LED in our system, which may be declared in devicetree.
8
9```text
10leds {
11    compatible = "gpio-leds";
12
13    identify {
14        gpios = <&gpio ASPEED_GPIO(S, 6) GPIO_ACTIVE_HIGH>;
15    };
16};
17```
18
19We can add an LED via the helper program. The main service is then started via
20dbus-activation.
21
22```sh
23./add-led-action --path /sys/class/leds/identify
24```
25
26which will expose following dbus objects:
27
28```text
29busctl tree xyz.openbmc_project.LED.Controller
30`- /xyz
31  `- /xyz/openbmc_project
32    `- /xyz/openbmc_project/led
33      `- /xyz/openbmc_project/led/physical
34        `- /xyz/openbmc_project/led/physical/identify
35
36busctl introspect  xyz.openbmc_project.LED.Controller /xyz/openbmc_project/led/physical/identify
37NAME                                TYPE      SIGNATURE  RESULT/VALUE                             FLAGS
38...
39xyz.openbmc_project.Led.Physical    interface -          -                                        -
40.Color                              property  s          "xyz.openbmc_project.Led.Physical.Pal... emits-change writable
41.DutyOn                             property  y          50                                       emits-change writable
42.Period                             property  q          1000                                     emits-change writable
43.State                              property  s          "xyz.openbmc_project.Led.Physical.Act... emits-change writable
44```
45
46In the above output, the usual org.freedesktop.\* interfaces have been removed
47to keep it readable.
48
49## Example: using the dbus interface
50
51Query the LED State
52
53```text
54busctl get-property  xyz.openbmc_project.LED.Controller \
55/xyz/openbmc_project/led/physical/identify \
56xyz.openbmc_project.Led.Physical State \
57s "xyz.openbmc_project.Led.Physical.Action.Off"
58```
59
60Set the LED State
61
62```text
63busctl set-property  xyz.openbmc_project.LED.Controller \
64/xyz/openbmc_project/led/physical/identify \
65xyz.openbmc_project.Led.Physical State s \
66"xyz.openbmc_project.Led.Physical.Action.Off"
67```
68
69## How to Build
70
71```sh
72meson setup build
73cd build
74ninja
75```
76