How to get LED triggers for ethernet activity?
luz last edited by
I am using the ethernet expansion and would like to have a LED blink on ethernet activity, like with most switches' or router's ethernet ports.
Apparently, the official Linux way for this is assigning a kernel known LED the right trigger mode.
On the omega, the amber LED is known by the kernel as onion:amber:system
The list of available triggers can be found by
[none] timer default-on netdev transient gpio heartbeat morse oneshot usbdev phy0rx phy0tx phy0assoc phy0radio phy0tpt
So I can easily make the LED blink in a heartbeat fashion with
echo heartbeat >"/sys/class/leds/onion:amber:system/trigger"
Now for showing ethernet activity, phy0tpt looks promising, however it turns out that phy0 is the wireless interface. It works fine to show wireless network receiving activity with
echo phy0rx >"/sys/class/leds/onion:amber:system/trigger"
Unfortunately there are no phy1tpt/rx/tx or similar for the ethernet interface.
Also, netdev does not work for either interface (supposed to show network activity in general).
I am working with the OpenWrt buildroot, so I tried to figure out what could be missing, but with no success so far. It seems that the ethernet driver needs to register appropriate led triggers with the kernel. I tried to find menuconfig options for this, but everything that sounds related (ledtrig...) is already enabled.
Maybe it is because the AR9331 has a built-in switch with hardware-level LED support? That could be a reason for the ethernet driver not providing LED triggers at all. But then, how to use the switch LEDs? From the schematics, GPIO 0/1/13..17 correspond to LED0..6, and there are LED-related bits in the AR9331's GPIO_FUNCTION_1 register.
Any hints are welcome!