Skip to contentSkip to conversation

tools/leds: Adding '-h' and '--help' command line options to uledmon and led_hw_brightness_mon

PATCH In review Rajkumar Vadhyar 2 participants 5 messages Aug 20, 2024 – Sep 20, 2024 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover tools/leds: Adding '-h' and '--help' command line options to uledmon and led_hw_brightness_mon

Hi everyone,
This is a cover letter for a 2 patch series(uledmon.c and led_hw_brightness.c) The 2 patches include option for "-h" and "--help" for the given tools.

regards,
Rajkumar

#1 lore raw

PATCH 1/2 tools/leds: Add '-h' & '--help' cmd line options to uledmon

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

---
 tools/leds/uledmon.c | 7 +++++++
 1 file changed, 7 insertions(+)
tools/leds/uledmon.c +7 -0
index c15a39c1f271..6609235d80b0 100644
@@ -11,6 +11,8 @@
  * CTRL+C will exit.
  */
 
+#define	ULEDMON_USAGE	"Usage: ./uledmon <device-name>\n"
+
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
@@ -19,6 +21,7 @@
 
 #include <linux/uleds.h>
 
+
 int main(int argc, char const *argv[])
 {
 	struct uleds_user_dev uleds_dev;
@@ -30,6 +33,10 @@ int main(int argc, char const *argv[])
 		fprintf(stderr, "Requires <device-name> argument\n");
 		return 1;
 	}
+	if (!(strcmp(argv[1], "-h")) || !(strcmp(argv[1], "--help"))) {
+		fprintf(stderr, ULEDMON_USAGE);
+		return 1;
+	}
 
 	strncpy(uleds_dev.name, argv[1], LED_MAX_NAME_SIZE);
 	uleds_dev.max_brightness = 100;
Signature · 1 line
2.40.1
#5 lore raw

PATCH 2/2 tools/leds: Add '-h' & '--help' cmd options to led_hw_brightness_mon

In reply to Rajkumar Vadhyar

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

---
 tools/leds/led_hw_brightness_mon.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/leds/led_hw_brightness_mon.c +6 -0
index eb65ae988839..712a4f8edb98 100644
@@ -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]);
 
Signature · 1 line
2.40.1
#2 lore raw

Re: [PATCH 1/2] tools/leds: Add '-h' & '--help' cmd line options to uledmon

In reply to Rajkumar Vadhyar

Hi Rajkumar,

You should send it to [email protected] and to LEDs maintainer.

Signature · 2 lines
Best regards,
Jacek Anaszewski
Quoted 39 lines · Rajkumar Vadhyar

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

---
  tools/leds/uledmon.c | 7 +++++++
  1 file changed, 7 insertions(+)
tools/leds/uledmon.c +7 -0
index c15a39c1f271..6609235d80b0 100644
@@ -11,6 +11,8 @@
   * CTRL+C will exit.
   */
 
+#define	ULEDMON_USAGE	"Usage: ./uledmon <device-name>\n"
+
  #include <fcntl.h>
  #include <stdio.h>
  #include <string.h>
@@ -19,6 +21,7 @@
 
  #include <linux/uleds.h>
 
+
  int main(int argc, char const *argv[])
  {
  	struct uleds_user_dev uleds_dev;
@@ -30,6 +33,10 @@ int main(int argc, char const *argv[])
  		fprintf(stderr, "Requires <device-name> argument\n");
  		return 1;
  	}
+	if (!(strcmp(argv[1], "-h")) || !(strcmp(argv[1], "--help"))) {
+		fprintf(stderr, ULEDMON_USAGE);
+		return 1;
+	}
 
  	strncpy(uleds_dev.name, argv[1], LED_MAX_NAME_SIZE);
  	uleds_dev.max_brightness = 100;
#4 lore raw

Re: [PATCH 1/2] tools/leds: Add '-h' & '--help' cmd line options to uledmon

In reply to a message not in the archive

Hi Rajkumar,

LED maintainers are responsible also for tools/leds. MAINTAINERS file say today the following:

LED SUBSYSTEM

M:  Pavel Machek <[email protected]>
M:  Lee Jones <[email protected]>
Signature · 2 lines
Best regards,
Jacek Anaszewski
Quoted 61 lines · Rajkumar Vadhyar

Hi Jacek,
Actually when I did getmaintainer.pl <http://getmaintainer.pl> on the patch I was only getting the mailing list email id. Also when I did git blame I saw your name as the committer of the led file so I thought you might be the maintainer also. Would you know who is the maintainer of this tools/leds? Thank you

Regards,
Rajkumar

On Sun, 25 Aug 2024, 17:25 Jacek Anaszewski, <[email protected] <mailto:[email protected]>> wrote:

    https://www.royalmail.com/track-your-item#/tracking-results/LE879811818GB

    You should send it to [email protected]
    <mailto:[email protected]> and to LEDs maintainer.

    -- 
    Best regards,
    Jacek Anaszewski

    On 8/20/24 09:23, Rajkumar Vadhyar wrote:
     > Add '-h' and '--help' command line options to uledmon
     >
     > Signed-off-by: Rajkumar Vadhyar <[email protected]
    <mailto:[email protected]>>
     > ---
     >   tools/leds/uledmon.c | 7 +++++++
     >   1 file changed, 7 insertions(+)
     >
     > diff --git a/tools/leds/uledmon.c b/tools/leds/uledmon.c
     > index c15a39c1f271..6609235d80b0 100644
     > --- a/tools/leds/uledmon.c
     > +++ b/tools/leds/uledmon.c
     > @@ -11,6 +11,8 @@
     >    * CTRL+C will exit.
     >    */
     >
     > +#define      ULEDMON_USAGE   "Usage: ./uledmon <device-name>\n"
     > +
     >   #include <fcntl.h>
     >   #include <stdio.h>
     >   #include <string.h>
     > @@ -19,6 +21,7 @@
     >
     >   #include <linux/uleds.h>
     >
     > +
     >   int main(int argc, char const *argv[])
     >   {
     >       struct uleds_user_dev uleds_dev;
     > @@ -30,6 +33,10 @@ int main(int argc, char const *argv[])
     >               fprintf(stderr, "Requires <device-name> argument\n");
     >               return 1;
     >       }
     > +     if (!(strcmp(argv[1], "-h")) || !(strcmp(argv[1], "--help"))) {
     > +             fprintf(stderr, ULEDMON_USAGE);
     > +             return 1;
     > +     }
     >
     >       strncpy(uleds_dev.name <http://uleds_dev.name>, argv[1],
    LED_MAX_NAME_SIZE);
     >       uleds_dev.max_brightness = 100;