Skip to content

Commit 0dece4c

Browse files
committed
[nrf fromtree] wifi: shell: Use case insensitive comparison
The help text uses the capital case as its an acronym, but passing capital case fails. Also extend that to others as well. Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit 9e6542b)
1 parent e1a7167 commit 0dece4c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

subsys/net/l2/wifi/wifi_shell.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF);
1515
#include <stdio.h>
1616
#include <stdlib.h>
1717
#include <string.h>
18+
#include <strings.h>
1819
#include <zephyr/shell/shell.h>
1920
#include <zephyr/sys/printk.h>
2021
#include <zephyr/init.h>
@@ -886,9 +887,9 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[])
886887
return 0;
887888
}
888889

889-
if (!strncmp(argv[1], "on", 2)) {
890+
if (!strncasecmp(argv[1], "on", 2)) {
890891
params.enabled = WIFI_PS_ENABLED;
891-
} else if (!strncmp(argv[1], "off", 3)) {
892+
} else if (!strncasecmp(argv[1], "off", 3)) {
892893
params.enabled = WIFI_PS_DISABLED;
893894
} else {
894895
shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n");
@@ -917,9 +918,9 @@ static int cmd_wifi_ps_mode(const struct shell *sh, size_t argc, char *argv[])
917918

918919
context.sh = sh;
919920

920-
if (!strncmp(argv[1], "legacy", 6)) {
921+
if (!strncasecmp(argv[1], "legacy", 6)) {
921922
params.mode = WIFI_PS_MODE_LEGACY;
922-
} else if (!strncmp(argv[1], "wmm", 3)) {
923+
} else if (!strncasecmp(argv[1], "WMM", 4)) {
923924
params.mode = WIFI_PS_MODE_WMM;
924925
} else {
925926
shell_fprintf(sh, SHELL_WARNING, "Invalid PS mode\n");
@@ -1405,9 +1406,9 @@ static int cmd_wifi_ps_wakeup_mode(const struct shell *sh, size_t argc, char *ar
14051406

14061407
context.sh = sh;
14071408

1408-
if (!strncmp(argv[1], "dtim", 4)) {
1409+
if (!strncasecmp(argv[1], "dtim", 4)) {
14091410
params.wakeup_mode = WIFI_PS_WAKEUP_MODE_DTIM;
1410-
} else if (!strncmp(argv[1], "listen_interval", 15)) {
1411+
} else if (!strncasecmp(argv[1], "listen_interval", 15)) {
14111412
params.wakeup_mode = WIFI_PS_WAKEUP_MODE_LISTEN_INTERVAL;
14121413
} else {
14131414
shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n");

0 commit comments

Comments
 (0)