Skip to content

Commit 06f502f

Browse files
BWhittenjacek-anaszewski
authored andcommitted
leds: trigger: Introduce a NETDEV trigger
This commit introduces a NETDEV trigger for named device activity. Available triggers are link, rx, and tx. Signed-off-by: Ben Whitten <ben.whitten@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
1 parent e0d4229 commit 06f502f

File tree

4 files changed

+549
-0
lines changed

4 files changed

+549
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
What: /sys/class/leds/<led>/device_name
2+
Date: Dec 2017
3+
KernelVersion: 4.16
4+
Contact: linux-leds@vger.kernel.org
5+
Description:
6+
Specifies the network device name to monitor.
7+
8+
What: /sys/class/leds/<led>/interval
9+
Date: Dec 2017
10+
KernelVersion: 4.16
11+
Contact: linux-leds@vger.kernel.org
12+
Description:
13+
Specifies the duration of the LED blink in milliseconds.
14+
Defaults to 50 ms.
15+
16+
What: /sys/class/leds/<led>/link
17+
Date: Dec 2017
18+
KernelVersion: 4.16
19+
Contact: linux-leds@vger.kernel.org
20+
Description:
21+
Signal the link state of the named network device.
22+
If set to 0 (default), the LED's normal state is off.
23+
If set to 1, the LED's normal state reflects the link state
24+
of the named network device.
25+
Setting this value also immediately changes the LED state.
26+
27+
What: /sys/class/leds/<led>/tx
28+
Date: Dec 2017
29+
KernelVersion: 4.16
30+
Contact: linux-leds@vger.kernel.org
31+
Description:
32+
Signal transmission of data on the named network device.
33+
If set to 0 (default), the LED will not blink on transmission.
34+
If set to 1, the LED will blink for the milliseconds specified
35+
in interval to signal transmission.
36+
37+
What: /sys/class/leds/<led>/rx
38+
Date: Dec 2017
39+
KernelVersion: 4.16
40+
Contact: linux-leds@vger.kernel.org
41+
Description:
42+
Signal reception of data on the named network device.
43+
If set to 0 (default), the LED will not blink on reception.
44+
If set to 1, the LED will blink for the milliseconds specified
45+
in interval to signal reception.

drivers/leds/trigger/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,11 @@ config LEDS_TRIGGER_PANIC
135135
a different trigger.
136136
If unsure, say Y.
137137

138+
config LEDS_TRIGGER_NETDEV
139+
tristate "LED Netdev Trigger"
140+
depends on NET && LEDS_TRIGGERS
141+
help
142+
This allows LEDs to be controlled by network device activity.
143+
If unsure, say Y.
144+
138145
endif # LEDS_TRIGGERS

drivers/leds/trigger/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
1212
obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o
1313
obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o
1414
obj-$(CONFIG_LEDS_TRIGGER_PANIC) += ledtrig-panic.o
15+
obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o

0 commit comments

Comments
 (0)