From ec99e11f5efddf08b37c9ccb54450ef57b8e1e64 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Wed, 25 Aug 2021 14:56:25 -0300 Subject: [PATCH] esp32/softap: Enable the WPA2 by default to ask user password Signed-off-by: Kapil Gupta Co-author: Alan Carvalho de Assis --- arch/xtensa/src/esp32/esp32_wifi_adapter.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/xtensa/src/esp32/esp32_wifi_adapter.c b/arch/xtensa/src/esp32/esp32_wifi_adapter.c index 84af1029ad..20c441e481 100644 --- a/arch/xtensa/src/esp32/esp32_wifi_adapter.c +++ b/arch/xtensa/src/esp32/esp32_wifi_adapter.c @@ -6297,9 +6297,17 @@ int esp_wifi_softap_password(struct iwreq *iwr, bool set) if (set) { + /* Clear the password field and copy the user password to it */ + memset(wifi_cfg.ap.password, 0x0, PWD_MAX_LEN); memcpy(wifi_cfg.ap.password, pdata, len); + /* Enable the WPA2 password by default */ + + wifi_cfg.ap.authmode = WIFI_AUTH_WPA_WPA2_PSK; + + /* Setup the config to the SoftAP */ + ret = esp_wifi_set_config(WIFI_IF_AP, &wifi_cfg); if (ret) {