commit | 24d124f979f1ca5f53e8b35dd42c750d684658e6 | [log] [tgz] |
---|---|---|
author | Alexander Hansen <alexander.hansen@9elements.com> | Tue Jul 16 13:49:55 2024 +0200 |
committer | Alexander Hansen <alexander.hansen@9elements.com> | Wed Jul 31 09:25:00 2024 +0200 |
tree | 4703f14121db5a1f227e35afc26244147fe0e625 | |
parent | e6239da82ece032fa864c57e4fb0e781f863885f [diff] |
sysfs: Refactor LED property parsing Added new test for parsing led description from sysfs. Since there are some edge cases that can happen, to make sure the parsing happens as expected in all cases. The edge cases primarily come from the different led properties that can be present or absent in devicetree. I have tested some combinations thereof and would prefer the label to be generated by led sysfs instead of manually providing the 3-component label. However for that to work phosphor-led-sysfs must be able to extract the labels components in all cases. This modifies the behavior slightly but it will stay the same for led names that have 1 or 3 components. Change-Id: I8def089e4c8dc5d3a341cf6f6b1d6356f5aefe48 Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
This project exposes physical LEDs on dbus.
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 add an LED via the helper program. The main service is then started via dbus-activation.
./add-led-action --path /sys/class/leds/identify
which will expose following dbus objects:
busctl tree xyz.openbmc_project.LED.Controller `- /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 /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.
Query the LED State
busctl get-property xyz.openbmc_project.LED.Controller \ /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 \ /xyz/openbmc_project/led/physical/identify \ xyz.openbmc_project.Led.Physical State s \ "xyz.openbmc_project.Led.Physical.Action.Off"
meson setup build cd build ninja