Skip to content

Commit

Permalink
[nrf fromtree] wifi: shell: Use case insensitive comparison
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
krish2718 committed Jan 17, 2024
1 parent e1a7167 commit 0dece4c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions subsys/net/l2/wifi/wifi_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <zephyr/shell/shell.h>
#include <zephyr/sys/printk.h>
#include <zephyr/init.h>
Expand Down Expand Up @@ -886,9 +887,9 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[])
return 0;
}

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

context.sh = sh;

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

context.sh = sh;

if (!strncmp(argv[1], "dtim", 4)) {
if (!strncasecmp(argv[1], "dtim", 4)) {
params.wakeup_mode = WIFI_PS_WAKEUP_MODE_DTIM;
} else if (!strncmp(argv[1], "listen_interval", 15)) {
} else if (!strncasecmp(argv[1], "listen_interval", 15)) {
params.wakeup_mode = WIFI_PS_WAKEUP_MODE_LISTEN_INTERVAL;
} else {
shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n");
Expand Down

0 comments on commit 0dece4c

Please sign in to comment.