From 54574d4baf572f5c36c80e01abb6dbb220c4f1e5 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 9 Jan 2024 12:13:38 +0530 Subject: [PATCH 1/4] [nrf fromtree] net: wifi_utils: Fix max channels allow for scan Fix the maximum channels allow for scan command input. Signed-off-by: Kapil Bhatt (cherry picked from commit 3e8dbaf75fd0c239e00e33eb5970843341dad0f0) --- subsys/net/l2/wifi/wifi_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_utils.c b/subsys/net/l2/wifi/wifi_utils.c index 76e93fc33e0..bd47205e4f9 100644 --- a/subsys/net/l2/wifi/wifi_utils.c +++ b/subsys/net/l2/wifi/wifi_utils.c @@ -368,7 +368,7 @@ int wifi_utils_parse_scan_chan(char *scan_chan_str, memset(chan_str, 0, sizeof(chan_str)); if (chan_start) { - if ((chan_idx + (chan_val - chan_start)) >= max_channels) { + if ((chan_idx + (chan_val - chan_start)) > max_channels) { NET_ERR("Too many channels specified (%d)", max_channels); return -EINVAL; } From a602804bfb3fd7ca08ac99f25551bfcbcf8fd55f Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 9 Jan 2024 12:34:26 +0530 Subject: [PATCH 2/4] [nrf fromtree] net: wifi_shell: Update scan argument shell Update the example of scan -c argument. Default value for max channels is set to 3, So, update the example according to that. Add closing bracket in -s. Signed-off-by: Kapil Bhatt (cherry picked from commit 773ebe9c41903ce458eb2609c3c5668ef3976466) --- subsys/net/l2/wifi/wifi_shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index f470e700f8c..d3f573a28d6 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1903,9 +1903,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-b, --bands ] : Bands to be scanned where 2: 2.4 GHz, 5: 5 GHz, 6: 6 GHz\n" "[-a, --dwell_time_active ] : Active scan dwell time (in ms) on a channel. Range 5 ms to 1000 ms\n" "[-p, --dwell_time_passive ] : Passive scan dwell time (in ms) on a channel. Range 10 ms to 1000 ms\n" - "[-s, --ssid : SSID to scan for. Can be provided multiple times\n" + "[-s, --ssid] : SSID to scan for. Can be provided multiple times\n" "[-m, --max_bss ] : Maximum BSSes to scan for. Range 1 - 65535\n" - "[-c, --chans ] : Channels to be scanned. The channels must be specified in the form band1:chan1,chan2_band2:chan3,..etc. band1, band2 must be valid band values and chan1, chan2, chan3 must be specified as a list of comma separated values where each value is either a single channel or a channel range specified as chan_start-chan_end. Each band channel set has to be separated by a _. For example, a valid channel specification can be 2:1,6-11,14_5:36,149-165,44\n" + "[-c, --chans ] : Channels to be scanned. The channels must be specified in the form band1:chan1,chan2_band2:chan3,..etc. band1, band2 must be valid band values and chan1, chan2, chan3 must be specified as a list of comma separated values where each value is either a single channel or a channel range specified as chan_start-chan_end. Each band channel set has to be separated by a _. For example, a valid channel specification can be 2:1,6_5:36\n" "[-h, --help] : Print out the help for the scan command.\n", cmd_wifi_scan, 1, 8), From 18e0421d10322fcfda15eeb81a0621c0dafb27d3 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 11 Jan 2024 15:29:23 +0530 Subject: [PATCH 3/4] [nrf fromtree] net: wifi_shell: Add example of scan option Add an example of the scan's -c parameter to help with understanding. Signed-off-by: Kapil Bhatt (cherry picked from commit d8c362253dab3304e54704be029a7518f8f19adc) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d3f573a28d6..1e1ab4a3724 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1905,7 +1905,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-p, --dwell_time_passive ] : Passive scan dwell time (in ms) on a channel. Range 10 ms to 1000 ms\n" "[-s, --ssid] : SSID to scan for. Can be provided multiple times\n" "[-m, --max_bss ] : Maximum BSSes to scan for. Range 1 - 65535\n" - "[-c, --chans ] : Channels to be scanned. The channels must be specified in the form band1:chan1,chan2_band2:chan3,..etc. band1, band2 must be valid band values and chan1, chan2, chan3 must be specified as a list of comma separated values where each value is either a single channel or a channel range specified as chan_start-chan_end. Each band channel set has to be separated by a _. For example, a valid channel specification can be 2:1,6_5:36\n" + "[-c, --chans ] : Channels to be scanned. The channels must be specified in the form band1:chan1,chan2_band2:chan3,..etc. band1, band2 must be valid band values and chan1, chan2, chan3 must be specified as a list of comma separated values where each value is either a single channel or a channel range specified as chan_start-chan_end. Each band channel set has to be separated by a _. For example, a valid channel specification can be 2:1,6_5:36 or 2:1,6-11,14_5:36,163-177,52\n" "[-h, --help] : Print out the help for the scan command.\n", cmd_wifi_scan, 1, 8), From a638c4fd49ce18c214c3a598fd12ea46004929f8 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 18 Jan 2024 15:41:09 +0530 Subject: [PATCH 4/4] [nrf fromtree] net: wifi_shell: Add help for maximum channels in scan Add a line for scan's -c parameter which specify to take care of maximum channels. Signed-off-by: Kapil Bhatt (cherry picked from commit c22ce801e7fd6badde988e52e65a4b5c10bcef88) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1e1ab4a3724..1f13ae864ae 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1905,7 +1905,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-p, --dwell_time_passive ] : Passive scan dwell time (in ms) on a channel. Range 10 ms to 1000 ms\n" "[-s, --ssid] : SSID to scan for. Can be provided multiple times\n" "[-m, --max_bss ] : Maximum BSSes to scan for. Range 1 - 65535\n" - "[-c, --chans ] : Channels to be scanned. The channels must be specified in the form band1:chan1,chan2_band2:chan3,..etc. band1, band2 must be valid band values and chan1, chan2, chan3 must be specified as a list of comma separated values where each value is either a single channel or a channel range specified as chan_start-chan_end. Each band channel set has to be separated by a _. For example, a valid channel specification can be 2:1,6_5:36 or 2:1,6-11,14_5:36,163-177,52\n" + "[-c, --chans ] : Channels to be scanned. The channels must be specified in the form band1:chan1,chan2_band2:chan3,..etc. band1, band2 must be valid band values and chan1, chan2, chan3 must be specified as a list of comma separated values where each value is either a single channel or a channel range specified as chan_start-chan_end. Each band channel set has to be separated by a _. For example, a valid channel specification can be 2:1,6_5:36 or 2:1,6-11,14_5:36,163-177,52. Care should be taken to ensure that configured channels don't exceed CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL\n" "[-h, --help] : Print out the help for the scan command.\n", cmd_wifi_scan, 1, 8),