Skip to contentSkip to conversation

cmd/led: check subcommand "list" instead "l"

PATCH New Heiko Schocher 2 participants 2 messages May 27, 2019 – Jun 5, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd/led: check subcommand "list" instead "l"

current implementation for checking if "led list" command is called checks only if "l" is passed to the led command. This prevents switching leds with name which starts also with a "l". So check for passing "list".

While at it, also fix a typo in led command usage.

---
clean travis build, see:
https://travis-ci.org/hsdenx/u-boot-test/builds/537359553

 cmd/led.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
cmd/led.c +2 -2
index fc07ca95a3..403abbc6bc 100644
@@ -85,7 +85,7 @@ int do_led(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (argc < 2)
 		return CMD_RET_USAGE;
 	led_label = argv[1];
-	if (*led_label == 'l')
+	if (strncmp(led_label, "list", 4) == 0)
 		return list_leds();
 
 	cmd = argc > 2 ? get_led_cmd(argv[2]) : LEDST_COUNT;
@@ -137,6 +137,6 @@ U_BOOT_CMD(
 	led, 4, 1, do_led,
 	"manage LEDs",
 	"<led_label> on|off|toggle" BLINK "\tChange LED state\n"
-	"led [<led_label>\tGet LED state\n"
+	"led [<led_label>]\tGet LED state\n"
 	"led list\t\tshow a list of LEDs"
 );
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 cmd/led: check subcommand "list" instead "l"

Quoted 9 lines · Heiko Schocher

current implementation for checking if "led list" command is called checks only if "l" is passed to the led command. This prevents switching leds with name which starts also with a "l". So check for passing "list".

While at it, also fix a typo in led command usage.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190605/90445ca5/attachment.sig>