External LEDs Penta SATA Hat

Hi,

I’m setting up my Rock Pi with a Penta SATA hat inside a larger, custom case. It would be great if I could bring several “status” LEDs to the front panel of the case. Specifically, I’m looking for:

  1. Power “On”
  2. “any” drive activity
  3. “any” LAN (Ethernet) activity
    https://kodi.software/
    https://dltutuapp.com/tutuapp-download/
    Looked through all of the online docs & PDFs that I could find, as well as the topics posted here, but was unable to find an answer. Is this even possible? Easily possible? I couldn’t find any documentation on the ten pin cable that normally goes to the optional display. Any help / links would be very much appreciated!

The easiest way would be to to pass the 2 LEDs of the Rock board to the front of your case. At least one can be programmed, the events supported by the kernel can be looked up by

$ cat /sys/class/leds/user-led2/trigger

one usb-gadget usb-host bluetooth-power rfkill-any
rfkill-none kbd-scrolllock kbd-numlock kbd-capslock
kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock
kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock
kbd-ctrlrlock tcpm-source-psy-4-0022-online mmc2 
timer oneshot disk-activity disk-read disk-write ide-disk
mtd nand-disk [heartbeat] backlight gpio cpu
 cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 cpu6 cpu7 activity
 default-on transient flash torch panic netdev
 mmc1 mmc0 hci0-power rfkill0 rfkill1

The one in brackets [] is the current trigger. Just write the one you like to have:

echo "netdev" > /sys/class/leds/user-led/trigger

might be one of the value you want. Test if these events are want you want. If yes, you could add more LEDs driven by GPIO. This should be possible by just add an overlay, see

Documentation/devicetree/bindings/leds/leds-gpio.yaml

in your kernel source.

drivers/leds/leds-gpio.c is the GPIO LED driver in the Linux kernel.

If you need other events, well … use the source Luke …