Controlling onboard LEDs on Rpi 4

I would like to control the on-board PWR/ACT LEDs on the Raspberry Pi 4 from inside my app container.

Running the container as privileged and writing to /sys/class/leds/led[0,1]/trigger works, but the Balena supervisor also sometimes sets the state of the ACT LED as per troubleshooting, for example when internet connectivity is lost.

As per this thread and this related documentation it is possible to manually edit /etc/resin-supervisor/supervisor.conf and set LED_FILE=/dev/null which stops the supervisor interfering with my own control of the ACT LED. However I have only edited that file manually via balena ssh for testing and it feels like I am changing an internal file in an unsupported way.

What is the ‘correct’ or more maintainable way to make this change across my fleet?

Hi. The blink patterns you linked to are being controlled by the raspberry pi firmware rather than the supervisor. Are you positive that after you commented out the led file from /etc/resin-supervisor/supervisor.conf then you did not see the interference anymore?

The blink patterns you linked to are being controlled by the raspberry pi firmware rather than the supervisor

Are you sure? I guessed the blinks were coming from the Balena supervisor since it matches the pattern described here and also occurs in the right circumstances, i.e. if I interrupt the internet connection. Also, the blinking ACT LED isn’t documented in the Pi docs here.

Are you positive that after you commented out the led file from /etc/resin-supervisor/supervisor.conf then you did not see the interference anymore?

If I comment out that line in supervisor.conf to say

#LED_FILE=<whatever>

I still get the interference. To stop the interference, I have to explicitly set it to

LED_FILE=/dev/null

Furthermore if I set it to

LED_FILE=/sys/class/leds/led1/brightness

Then the red PWR LED starts flashing in the Balena pattern when internet connection is lost, rather than the green ACT LED. This seems consistent with the Balena supervisor controlling the LED.

Hi, just wanted to let you know we started an internal discussion on how to move this forward and will come back to you when we have more details.
The current approach you used with modifying the filesystem will not work on the long term since your changes will be overwritten when you do a host OS update. So we are thinking if it makes sense to have a programmatic way of informing the supervisor to ignore the leds.

1 Like

Hi Hugh, just to follow up here. I think this is a pretty legit feature request and I have created an issue here: https://github.com/balena-io/balena-supervisor/issues/1375 to track that. We will discuss it in our product brainstorm next week and figure out a nice way to do it. We will update on that github issue as and when we have more details .

1 Like