leds: add "network" LED trigger (lan/wan/wlan)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/2 leds: add "network" LED trigger (lan/wan/wlan)
LED trigger for network interfaces.
- Aggregated per-family (lan/wan/wlan).
- Family and flags (link/tx/rx) are taken from led_cdev->params if present (format "network:<family>[ link][ tx][ rx]" or "<family>-online"). If params is NULL/empty they fall back to the LED device name:
<colour>:<family>[-online] e.g. "green:wlan", "red:wan-online" or, if no colon exists, to the whole name.
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.
drivers/leds/trigger/Kconfig +0 -0
@@ -129,6 +129,15 @@ config LEDS_TRIGGER_NETDEV
This allows LEDs to be controlled by network device activity. If unsure, say Y.
+config LEDS_TRIGGER_NETWORK
+ tristate "LED trigger for network interfaces"
+ depends on NET
+ help
+ Family (lan/wan/wlan) and flags are read from led_cdev->params + ("network:wlan tx rx" or "network:lan-online") and, if missing, + parsed from the LED name itself.
+ If unsure, say Y.
+
config LEDS_TRIGGER_PATTERN
tristate "LED Pattern Trigger"
help
drivers/leds/trigger/ledtrig-network.c new file +718 -0
718 lines not on this page · raw message
drivers/leds/trigger/Makefile +0 -0
@@ -16,3 +16,4 @@ obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += led
obj-$(CONFIG_LEDS_TRIGGER_PATTERN) += ledtrig-pattern.o obj-$(CONFIG_LEDS_TRIGGER_TTY) += ledtrig-tty.o obj-$(CONFIG_LEDS_TRIGGER_INPUT_EVENTS) += ledtrig-input-events.o +obj-$(CONFIG_LEDS_TRIGGER_NETWORK) += ledtrig-network.o