I'm currently working on device support for the TP-Link EAP225-Wall, which has a GPIO push button that can be used to toggle the status LED with the stock firmware.
The gpio led trigger can be used to link an input GPIO to an led, but that's a one-to-one translation of the input state. Having to hold the button down all the time to keep the LED off doesn't sound like a good user experience to me.
Does anybody know of a way to use button/GPIO events to toggle an LED?
Last time I worked with buttons and leds, I wrote my own daemon to monitor button holding times (long press means a factory reset, short press changes a config, for instance). I followed the suggestions at https://elinux.org/GPIO#GPIO_interrupts_from_user_space
If the the LED is currently uncontrolled, you can simply write something to /sys/class/ledx/.../brightness that has 0 for dark and 1-255 for lit LED (if it is just on/off LED). echo "255" > /sys/class/leds/r7800:amber:power/brightness
The hardware.button wiki page lists KEY_LIGHTS_TOGGLE as one of the supported keys, for which I can add a script in /etc/rc.button/lights_toggle.
To disable the LED(s), I could probably just loop over all buttons and set trigger to 'none' and default to '0'. That would mean I lost all user config though, so I'll have a look at how to avoid that.
Edit: Found a similar use case for KEY_LIGHTS_TOGGLE