From 46b70b59b47d07099f27073f40f4d05a2a138a61 Mon Sep 17 00:00:00 2001 From: Hui Bai Date: Thu, 27 Jun 2024 15:49:25 +0800 Subject: [PATCH] net: l2: wifi: Fix issue command wifi connect fail. Increase wifi connect input parameters max count to 13. Previous count 7 is not enough if other security type is supported. When enabling softAP, the parameter cnx_params in cmd_wifi_ap_enable() is with static key word. Then the parameter will always save configurations of last time. Remove static keyword to eliminate effects of configs from last tim and do memset before setting up softAP. Signed-off-by: Hui Bai --- subsys/net/l2/wifi/wifi_shell.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 643a896de1d07be..9c7d0f392628a27 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1295,9 +1295,10 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_wifi_sap(); - static struct wifi_connect_req_params cnx_params; + struct wifi_connect_req_params cnx_params; int ret; + memset(&cnx_params, 0, sizeof(struct wifi_connect_req_params)); context.sh = sh; if (__wifi_args_to_params(sh, argc, &argv[0], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); @@ -2050,7 +2051,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-t, --timeout]: Timeout for the connection attempt (in seconds).\n" "[-h, --help]: Print out the help for the connect command.\n", cmd_wifi_connect, - 2, 7), + 2, 13), SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP.\n", cmd_wifi_disconnect, 1, 0),