APU4 and GPIO control

I am running an apu4, just a newer version of the apu2 boards folks have been using with VyOS, and was wondering if VyOS has a way to control GPIO in order to do LED assignments. Would like to set the 3 front LED’s to show up/down for 2 of the NIC’s and, if possible, the status of a wireguard tunnel.

Any thoughts?

Wireguard has no status, like in terms of an established network connection, you probably could send icmp echos and if you get a reply, take that as a ‘tunnel up’.

What about mapping of physical interfaces and/or led control in general for other things?

I have a pair of apu2c4 and wasn’t even able to get pc-engines own documentation working on Fedora/CentOS and I’ve tried the FreeBSD apuled without success. You might have better luck.

So the first issue I have found after finding an apu led package for debian is that the led package requires dkms which is not used on VyOS.

More research needed to see if there are any other options.

So I was able to get this working…

The LED driver is loading under VyOS and indicated here:

ls -l /sys/class/leds/
total 0
lrwxrwxrwx 1 root root 0 Jan 15 14:30 apu4:green:led1 -> …/…/devices/pci0000:00/PRP0001:02/leds/apu4:green:led1
lrwxrwxrwx 1 root root 0 Jan 15 14:30 apu4:green:led2 -> …/…/devices/pci0000:00/PRP0001:02/leds/apu4:green:led2
lrwxrwxrwx 1 root root 0 Jan 15 14:30 apu4:green:led3 -> …/…/devices/pci0000:00/PRP0001:02/leds/apu4:green:led3

Once I found the above, I tried setting up triggering for eth0 and eth1 but the trigger file did not contain the netdev option.

cat /sys/class/leds/apu4:green:led1/trigger
[none] disk-activity disk-read disk-write ide-disk cpu cpu0 cpu1 cpu2 cpu3 panic mmc0

Doing some more searching I came across the LED info on the Arch Linux Wiki:

https://wiki.archlinux.org/index.php/PC_Engines#LED_Control

It led me to the section which talked about there being additional LED kernel modules which are not loaded by default and the netdev was one of them. After doing a “modprobe ledtrig-netdev”, the netdev showed up in the trigger file and I was able to follow sample setup in the wiki by updating the LED directory names and get the LED’s to show eth0 and eth1 traffic.

I added the ledtrig-netdev module to /etc/modules/modules.conf file, but have yet to test to see if it persists after updates or if there is somewhere else I need to add it.

For the Wierguard tracking, I will probably end up running a ping script or something to trigger the LED where if ping is successful, turn the LED on and if it fails, then turn it off.

Hopefully this will help some others on getting the LED’s working under VyOS.

1 Like

That’s awesome you got it working; thanks for sharing your findings.