On Fri, 07 Mar 2025 10:32:32 +1100 Lee Jones wrote > On Fri, 07 Mar 2025, Craig McQueen wrote: > > > If the text "default" is written to the LED's sysfs 'trigger' attr, then > > call led_trigger_set_default() to set the LED to its default trigger. > > More info please. > > Please explain why this is useful. > > Under what circumstances would the default trigger not be set? Example Scenario: Device has a row of LEDs on the front, with several LEDs linked to a trigger (in the device tree, eg linux,default-trigger = "battery";). In normal operation, the LEDs are driven by the default trigger. But, in some unusual scenarios (eg an error condition, or main application starting up or shutting down) the application wants to temporarily take manual control of the LEDs. Eg turn on a FAULT LED and indicate a fault code on several other LEDs. When the exceptional manual control is finished, the application wants to return all LEDs to their default trigger. With this code change, the application can simply iterate over all LEDs and write "default" to /sys/class/leds/<each-led>/trigger. In general, we want to make the functionality of led_trigger_set_default() to be accessible to userspace. -- Craig McQueen