Commit Graph

4 Commits

Author SHA1 Message Date
Florian Eckert 96d947d4ab Documentation: leds: Update led-trigger-tty ABI description
The 'led-trigger-tty' uses the same naming in the ABI documentation as
the 'led-trigger-netdev'. Which leads to the following warning when
building the documentation.

Warning: /sys/class/leds/<led>/rx is defined 2 times:
Documentation/ABI/testing/sysfs-class-led-trigger-tty:7
Documentation/ABI/testing/sysfs-class-led-trigger-netdev:49
Warning: /sys/class/leds/<led>/tx is defined 2 times:
Documentation/ABI/testing/sysfs-class-led-trigger-tty:15
Documentation/ABI/testing/sysfs-class-led-trigger-netdev:34

Renaming the 'What' path by prefixing it with 'tty_' solves this problem.

Fixes: 6dec659896 ("leds: ledtrig-tty: Add additional line state evaluation")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Link: https://lore.kernel.org/r/20240110133410.81645-1-fe@dev.tdt.de
Signed-off-by: Lee Jones <lee@kernel.org>
(cherry picked from commit ea411a8422c1d7f8193d726fb76ba09534b6a5fe)
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:59 +00:00
Florian Eckert 6dec659896 leds: ledtrig-tty: Add additional line state evaluation
The serial tty interface also supports additional input signals, that
can also be evaluated within this trigger. This change is adding the
following additional input sources, which could be controlled
via the '/sys/class/<leds>/' sysfs interface.

Explanation:
DCE = Data Communication Equipment (Modem)
DTE = Data Terminal Equipment (Computer)

- cts:
  DCE is ready to accept data from the DTE (CTS = Clear To Send). If
  the line state is detected, the LED is switched on.
  If set to 0 (default), the LED will not evaluate CTS.
  If set to 1, the LED will evaluate CTS.

- dsr:
  DCE is ready to receive and send data (DSR = Data Set Ready). If the
  line state is detected, the LED is switched on.
  If set to 0 (default), the LED will not evaluate DSR.
  If set to 1, the LED will evaluate DSR.

- dcd:
  DTE is receiving a carrier from the DCE (DCD = Data Carrier Detect).
  If the line state is detected, the LED is switched on.
  If set to 0 (default), the LED will not evaluate DCD.
  If set to 1, the LED will evaluate DCD.

- rng:
  DCE has detected an incoming ring signal on the telephone line
  (RNG = Ring Indicator). If the line state is detected, the LED is
  switched on.
  If set to 0 (default), the LED will not evaluate RNG.
  If set to 1, the LED will evaluate RNG.

Also add an invert flag on LED blink, so that the LED blinks in the
correct order.

* If one off the new enabled input signals are evaluatet as 'enabled',
  and data are transmitted, then the LED should first blink 'off' and
  then 'on' (invert).
* If all the new enabled input signals are evaluatet as 'disabled',
  and data are transmitted, then the LED should first blink 'on' and
  then 'off'.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Reviewed-by: Maarten Brock <m.brock@vanmierlo.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20231127110311.3583957-5-fe@dev.tdt.de
Signed-off-by: Lee Jones <lee@kernel.org>
2023-12-13 11:28:51 +00:00
Florian Eckert 5b755ca677 leds: ledtrig-tty: Make rx tx activitate configurable
Until now, the LED blinks when data is sent via the tty (rx/tx).
This is not configurable.

This change adds the possibility to make the indication for the direction
of the transmitted data independently controllable via the new rx and
tx sysfs entries.

- rx:
  Signal reception (rx) of data on the named tty device.
  If set to 0, the LED will not blink on reception.
  If set to 1 (default), the LED will blink on reception.

- tx:
  Signal transmission (tx) of data on the named tty device.
  If set to 0, the LED will not blink on transmission.
  If set to 1 (default), the LED will blink on transmission.

This new sysfs entry are on by default. Thus the trigger behaves as
before this change.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20231127110311.3583957-4-fe@dev.tdt.de
Signed-off-by: Lee Jones <lee@kernel.org>
2023-12-13 11:28:49 +00:00
Uwe Kleine-König fd4a641ac8 leds: trigger: implement a tty trigger
Usage is as follows:

	myled=ledname
	tty=ttyS0

	echo tty > /sys/class/leds/$myled/trigger
	echo $tty > /sys/class/leds/$myled/ttyname

. When this new trigger is active it periodically checks the tty's
statistics and when it changed since the last check the led is flashed
once.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20210113173018.bq2fkea2o3yp6rf6@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-15 10:22:26 +01:00