Skip to contentSkip to conversation

leds: add "network" LED trigger (lan/wan/wlan)

PATCH Superseded Mieczyslaw Nalewaj 1 participant 1 message Nov 25, 2025 1 message not in the archive LED

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 2/2 leds: add "network" LED trigger (lan/wan/wlan)

LED trigger for network interfaces.

- Aggregated per-family (lan/wan/wlan).
- Family and flags are taken from device tree properties:
   - "dev"  : simple family string "lan" | "wan" | "wlan"
   - "mode" : any combination of "link", "tx", "rx" flags Priority/combination:
   * If "mode" present: flags come from "mode" and take precedence. Family is taken from "dev" if present, otherwise from the LED name.
   * If only "dev" present: use its family and default flags = link+tx+rx.
   * If neither present: fall back to LED device name parsing.

- Suffix "-online" is valid ONLY in the LED name (label),
   e.g. "green:wlan-online". It indicates the online variant but is applied only when DT "mode" is absent.

Behaviour:
- wlan (normal): blink/solid driven by throughput table
- lan/wan (normal): one-shot blink on TX/RX packet change
- *-online variants: steady ON while any interface of the family has carrier

Interfaces are auto-tracked by name match (lan0, wan1, wlan2, phy0, wl1, ath0, ra0…). Up to MAX_IFACES (16) interfaces per family

This trigger is intended for board/device authors and drivers to provide simple network-activity LED behaviour without per-interface wiring in userspace.

---
package/kernel/linux/modules/leds.mk          |   16 + target/linux/generic/config-6.12              |    1 + target/linux/generic/config-6.6               |    1 + .../820-ledtrig-network-module.patch          | 1047 +++++++++++++++++ .../hack-6.6/820-ledtrig-network-module.patch | 1047 +++++++++++++++++

5 files changed, 2112 insertions(+)

create mode 100644 target/linux/generic/hack-6.12/820-ledtrig-network-module.patch create mode 100644 target/linux/generic/hack-6.6/820-ledtrig-network-module.patch

package/kernel/linux/modules/leds.mk +0 -0
index 1de74c98c821cc..bd1c238f88bf3a 100644
@@ -86,6 +86,22 @@ endef

$(eval $(call KernelPackage,ledtrig-gpio))

+define KernelPackage/ledtrig-network
+  SUBMENU:=$(LEDS_MENU)
+  TITLE:=LED Network Trigger
+  KCONFIG:=CONFIG_LEDS_TRIGGER_NETWORK
+  FILES:=$(LED_TRIGGER_DIR)/ledtrig-network.ko
+  AUTOLOAD:=$(call AutoLoad,50,ledtrig-network)
+endef
+
+define KernelPackage/ledtrig-network/description
+ Kernel module that allows LEDs to be controlled by network interfaces
+ aggregated by family (lan/wan/wlan), with an optional per-LED '-online' mode. +endef
+
+$(eval $(call KernelPackage,ledtrig-network))
+
+
define KernelPackage/ledtrig-transient
   SUBMENU:=$(LEDS_MENU)
   TITLE:=LED Transient Trigger

target/linux/generic/config-6.12 +0 -0
index dbf4fe49ddb400..696fb381fc1899 100644
@@ -3206,6 +3206,7 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y

# CONFIG_LEDS_TRIGGER_INPUT_EVENTS is not set
# CONFIG_LEDS_TRIGGER_MTD is not set
CONFIG_LEDS_TRIGGER_NETDEV=y
+# CONFIG_LEDS_TRIGGER_NETWORK is not set
# CONFIG_LEDS_TRIGGER_ONESHOT is not set
# CONFIG_LEDS_TRIGGER_PANIC is not set
# CONFIG_LEDS_TRIGGER_PATTERN is not set

target/linux/generic/config-6.6 +0 -0
index 980545120b4e46..3c6b19e1ae041e 100644
@@ -3109,6 +3109,7 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y

CONFIG_LEDS_TRIGGER_HEARTBEAT=y
# CONFIG_LEDS_TRIGGER_MTD is not set
CONFIG_LEDS_TRIGGER_NETDEV=y
+# CONFIG_LEDS_TRIGGER_NETWORK is not set
# CONFIG_LEDS_TRIGGER_ONESHOT is not set
# CONFIG_LEDS_TRIGGER_PANIC is not set
# CONFIG_LEDS_TRIGGER_PATTERN is not set

target/linux/generic/hack-6.12/820-ledtrig-network-module.patch new file +1047 -0

1,047 lines not on this page · raw message

target/linux/generic/hack-6.6/820-ledtrig-network-module.patch new file +1047 -0

1,047 lines not on this page · raw message