Linux LED subsystem development
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Florian Eckert <fe@dev.tdt.de>
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, pavel@ucw.cz,
	lee@kernel.org, linux-kernel@vger.kernel.org,
	linux-leds@vger.kernel.org, Eckert.Florian@googlemail.com
Subject: Re: [PATCH v7 2/2] trigger: ledtrig-tty: add additional modes
Date: Mon, 6 Mar 2023 10:35:24 +0100	[thread overview]
Message-ID: <20230306093524.amm7o4ppa7gon4ew@pengutronix.de> (raw)
In-Reply-To: <20230222083335.847655-3-fe@dev.tdt.de>

[-- Attachment #1: Type: text/plain, Size: 2453 bytes --]

On Wed, Feb 22, 2023 at 09:33:35AM +0100, Florian Eckert wrote:
> Add additional modes to trigger the selected LED.
> The following modes are supported:
> 
> Tx/Rx:	Flash LED on data transmission (default)
> CTS:	DCE Ready to accept data from the DTE.
> DSR:	DCE is ready to receive and send data.
> CAR:	DCE is receiving a carrier from a remote DTE.
> RNG:	DCE has detected an incoming ring signal.
> 
> The mode can be changed for example with the following command:
> echo "CTS" > /sys/class/leds/<led>/mode
> 
> This would turn on the LED, when the DTE(modem) signals the DCE that it
> is ready to accept data.
> 
> Signed-off-by: Florian Eckert <fe@dev.tdt.de>
> ---
>  .../ABI/testing/sysfs-class-led-trigger-tty   |  17 ++
>  drivers/leds/trigger/ledtrig-tty.c            | 145 ++++++++++++++++--
>  2 files changed, 147 insertions(+), 15 deletions(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-class-led-trigger-tty b/Documentation/ABI/testing/sysfs-class-led-trigger-tty
> index 2bf6b24e781b..1c28e6c61d19 100644
> --- a/Documentation/ABI/testing/sysfs-class-led-trigger-tty
> +++ b/Documentation/ABI/testing/sysfs-class-led-trigger-tty
> @@ -4,3 +4,20 @@ KernelVersion:	5.10
>  Contact:	linux-leds@vger.kernel.org
>  Description:
>  		Specifies the tty device name of the triggering tty
> +
> +What:		/sys/class/leds/<led>/mode
> +Date:		January 2023
> +KernelVersion:	6.3
> +Description:
> +		Specifies the operating to trigger the LED.
> +		The following operating modes are supported:
> +
> +		* Tx/Rx: Flash LED on data transmission (default)
> +		* CTS:   DCE Ready to accept data from the DTE.
> +		  LED on if line is high.
> +		* DSR:   DCE is ready to receive and send data.
> +		  LED on if line is high.
> +		* CAR:   DCE has detected a carrier from a remote DTE.
> +		  LED on if line is high.
> +		* RNG:   DCE has detected an incoming ring signal.
> +		  LED on if line is high.

Something I (still) don't like about this approach is that you cannot
make the LED flash on TX only (or CAR and DSR). Something like:

	led=/sys/class/leds/<led>/
	echo 1 > $led/TX
	echo 0 > $led/RX
	echo 1 > $led/CAR

would be a more flexible and IMHO nicer interface. (Maybe with improved
file names.)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2023-03-06  9:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22  8:33 [PATCH v7 0/2] leds: ledtrig-tty: add tty_led_mode xtension Florian Eckert
2023-02-22  8:33 ` [PATCH v7 1/2] tty: new helper function tty_get_mget Florian Eckert
2023-02-22  8:33 ` [PATCH v7 2/2] trigger: ledtrig-tty: add additional modes Florian Eckert
2023-03-03 14:11   ` Lee Jones
2023-03-06  6:57     ` Jiri Slaby
2023-03-06  7:13       ` Florian Eckert
2023-03-06  9:04       ` Lee Jones
2023-03-06  9:23         ` Uwe Kleine-König
2023-03-06  9:35         ` Jiri Slaby
2023-03-06 10:04           ` Lee Jones
2023-03-06  9:35   ` Uwe Kleine-König [this message]
2023-03-06 10:12     ` Florian Eckert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230306093524.amm7o4ppa7gon4ew@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=Eckert.Florian@googlemail.com \
    --cc=fe@dev.tdt.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox