Table of Contents
Intro
Radxa Rock 5C has quite a few LEDs onboard. One for power, one for heartbeat, and one for EMMC activity. They are bright enough to illuminate my room at night. And annoy me the heck of me in case of blinking blue one. I need to find out how to drop its brightness. Preferably to zero.
Radxa's own Wiki
I was unable to find any wiki articles depicting LEDs on Rock 5C exactly. The only article that I found was this article on Radxa Wiki called "The Radxa Rock has 3 LEDs on board", so I presume it may fit all Rock series boards. Ok. Let's check.
Indeed, at the end of article section about turning LEDs off can be found. It suggests next commands:
echo none > /sys/class/leds/blue/trigger
echo none > /sys/class/leds/green/trigger
echo 0 > /sys/class/leds/red/brightness
One problem though. red
, green
and blue
is absent from my system. Wiki may be outdated or tailored to Radxas own flavor of Linux. Or both. Anyway... I have Armbian installed and looks like have to figure this out by myself.
Finding correct names
Listing of contents of /sys/class/leds reveals correct LEDs names:
ls /sys/class/leds
blue:heartbeat green:power mmc0::
Seems like in Armbian they got another names. All other things should be identical. I'd start from blue
one.
ls /sys/class/leds/blue:heartbeat
brightness device max_brightness power subsystem trigger uevent
brightness
current LED brightness;max_brightness
will return maximum brightness available;trigger
is tricky. On read, it will return all available tigers, that can be set to this particular LED. On write - set desired trigger if possible.
Let's check what we can set here:
cat /sys/class/leds/blue:heartbeat/trigger
none usb-gadget usb-host kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock disk-activity disk-read disk-write mtd nand-disk [heartbeat] cpu cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 cpu6 cpu7 activity default-on panic usbport mmc0 mmc1 rfkill-any rfkill-none stmmac-0:01:link stmmac-0:01:10Mbps stmmac-0:01:100Mbps stmmac-0:01:1Gbps bluetooth-power
There are a lot of different triggers to consider, but frankly I interested in setting trigger to none
and call it a day.
echo "none" > /sys/class/leds/blue:heartbeat/trigger
echo "none" > /sys/class/leds/green:power/trigger
echo "none" > /sys/class/leds/mmc0::/trigger
Persisting changes
If system restarts SBC will retain its settings in hardware registries. However, if power cycle will happen settings will be lost. To restore then on boot I'll use Systemd unit and small shell script.
Systemd unit:
[Unit]
Description=Set onboard LEDs to OFF
After=network.target
[Service]
Type=oneshot
ExecStart=/opt/ledsoff/off.sh
RemainAfterExit=no
[Install]
WantedBy=multi-user.target
Shell script:
echo "none" > /sys/class/leds/blue:heartbeat/trigger
echo "none" > /sys/class/leds/green:power/trigger
echo "none" > /sys/class/leds/mmc0::/trigger
Makefile:
NAME=ledsoff
install:
chmod +x ./${NAME}.sh
cp ./${NAME}.service /etc/systemd/system/${NAME}.service
systemctl daemon-reload
systemctl enable --now ${NAME}.service
remove:
chmod -x ./${NAME}.sh
systemctl disable ${NAME}.service
systemctl daemon-reload
rm /etc/systemd/system/${NAME}.service
Now, even after power cycle changes will persist.
Bonus
I put code to my GitLab repository in case someone will need it.