public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rajkumar Vadhyar <rajkumarvad@gmail.com>
To: jacek.anaszewski@gmail.com, rbmarliere@gmail.com,
	skhan@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, Rajkumar Vadhyar <rajkumarvad@gmail.com>
Subject: [PATCH 2/2] tools/leds: Add '-h' & '--help' cmd options to led_hw_brightness_mon
Date: Tue, 20 Aug 2024 12:53:41 +0530	[thread overview]
Message-ID: <20240820072341.41153-3-rajkumarvad@gmail.com> (raw)
In-Reply-To: <20240820072341.41153-1-rajkumarvad@gmail.com>

Add '-h' and '--help' command line options to led_hw_brightness_mon

Signed-off-by: Rajkumar Vadhyar <rajkumarvad@gmail.com> 
---
 tools/leds/led_hw_brightness_mon.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/leds/led_hw_brightness_mon.c b/tools/leds/led_hw_brightness_mon.c
index eb65ae988839..712a4f8edb98 100644
--- a/tools/leds/led_hw_brightness_mon.c
+++ b/tools/leds/led_hw_brightness_mon.c
@@ -12,6 +12,7 @@
  * CTRL+C will exit.
  */
 
+#define	USAGE_LED_HW_BRIGHTNESS_MON	"Usage: ./led_hw_brightness_mon <device-name>\n"
 #include <errno.h>
 #include <fcntl.h>
 #include <poll.h>
@@ -36,6 +37,11 @@ int main(int argc, char const *argv[])
 		return 1;
 	}
 
+	if (!(strcmp(argv[1], "-h")) || !(strcmp(argv[1], "--help"))) {
+		fprintf(stderr, USAGE_LED_HW_BRIGHTNESS_MON);
+		return 1;
+	}
+
 	snprintf(brightness_file_path, LED_MAX_NAME_SIZE,
 		 "/sys/class/leds/%s/brightness_hw_changed", argv[1]);
 
-- 
2.40.1

      parent reply	other threads:[~2024-08-20  7:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  7:23 [PATCH 0/2] tools/leds: Adding '-h' and '--help' command line options to uledmon and led_hw_brightness_mon Rajkumar Vadhyar
2024-08-20  7:23 ` [PATCH 1/2] tools/leds: Add '-h' & '--help' cmd line options to uledmon Rajkumar Vadhyar
2024-08-25 11:55   ` Jacek Anaszewski
     [not found]     ` <CAPTF_YM5CS5-5sdceU598uY16LaGy1hJMKwVmr75Cqsemjs38g@mail.gmail.com>
2024-09-20 21:01       ` Jacek Anaszewski
2024-08-20  7:23 ` Rajkumar Vadhyar [this message]

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=20240820072341.41153-3-rajkumarvad@gmail.com \
    --to=rajkumarvad@gmail.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rbmarliere@gmail.com \
    --cc=skhan@linuxfoundation.org \
    /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