From e9128b3b5b55c52bfc5cddde6951cf992ad95882 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Mon, 6 Jun 2022 11:01:02 +0530 Subject: [PATCH] wpa_supplicant: Removed ESP32 reference from generic APIs/Code --- .../esp_supplicant/include/esp_wpa.h | 2 +- .../esp_supplicant/include/esp_wpa2.h | 4 ++-- .../esp_supplicant/include/esp_wps.h | 2 +- .../esp_supplicant/src/esp_wps.c | 18 ++++++++++++++++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h b/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h index f79f5c55a6..5e232486c5 100644 --- a/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h +++ b/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h @@ -26,7 +26,7 @@ extern "C" { */ /** \defgroup WPA_APIs WPS APIs - * @brief ESP32 Supplicant APIs + * @brief Supplicant APIs * */ diff --git a/components/wpa_supplicant/esp_supplicant/include/esp_wpa2.h b/components/wpa_supplicant/esp_supplicant/include/esp_wpa2.h index 8de7e07c63..f5fe1d9c1d 100644 --- a/components/wpa_supplicant/esp_supplicant/include/esp_wpa2.h +++ b/components/wpa_supplicant/esp_supplicant/include/esp_wpa2.h @@ -32,7 +32,7 @@ extern "C" { /** * @brief Enable wpa2 enterprise authentication. * - * @attention 1. wpa2 enterprise authentication can only be used when ESP32 station is enabled. + * @attention 1. wpa2 enterprise authentication can only be used when station mode is enabled. * @attention 2. wpa2 enterprise authentication can only support TLS, PEAP-MSCHAPv2 and TTLS-MSCHAPv2 method. * * @return @@ -44,7 +44,7 @@ esp_err_t esp_wifi_sta_wpa2_ent_enable(void); /** * @brief Disable wpa2 enterprise authentication. * - * @attention 1. wpa2 enterprise authentication can only be used when ESP32 station is enabled. + * @attention 1. wpa2 enterprise authentication can only be used when station mode is enabled. * @attention 2. wpa2 enterprise authentication can only support TLS, PEAP-MSCHAPv2 and TTLS-MSCHAPv2 method. * * @return diff --git a/components/wpa_supplicant/esp_supplicant/include/esp_wps.h b/components/wpa_supplicant/esp_supplicant/include/esp_wps.h index 3b5af6a031..2437f28bfc 100644 --- a/components/wpa_supplicant/esp_supplicant/include/esp_wps.h +++ b/components/wpa_supplicant/esp_supplicant/include/esp_wps.h @@ -63,7 +63,7 @@ typedef struct { .wps_type = type, \ .factory_info = { \ ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(manufacturer, "ESPRESSIF") \ - ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(model_number, "ESP32") \ + ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(model_number, CONFIG_IDF_TARGET) \ ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(model_name, "ESPRESSIF IOT") \ ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(device_name, "ESP DEVICE") \ }, \ diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c index ac8faefad6..41ddbf1e33 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c @@ -29,6 +29,20 @@ #include "eap_common/eap_wsc_common.h" #include "esp_wpas_glue.h" +#if CONFIG_IDF_TARGET_ESP32 +const char *wps_model_number = "ESP32"; +#elif CONFIG_IDF_TARGET_ESP32S2 +const char *wps_model_number = "ESP32S2"; +#elif CONFIG_IDF_TARGET_ESP32S3 +const char *wps_model_number = "ESP32S3"; +#elif CONFIG_IDF_TARGET_ESP32C3 +const char *wps_model_number = "ESP32C3"; +#elif CONFIG_IDF_TARGET_ESP32C2 +const char *wps_model_number = "ESP32C2"; +#elif CONFIG_IDF_TARGET_ESP32H2 +const char *wps_model_number = "ESP32H2"; +#endif + void *s_wps_api_lock = NULL; /* Used in WPS public API only, never be freed */ void *s_wps_api_sem = NULL; /* Sync semaphore used between WPS publi API caller task and WPS task */ bool s_wps_enabled = false; @@ -1054,8 +1068,8 @@ int wps_set_default_factory(void) os_snprintf(s_factory_info->manufacturer, WPS_MAX_MANUFACTURER_LEN, "ESPRESSIF"); os_snprintf(s_factory_info->model_name, WPS_MAX_MODEL_NUMBER_LEN, "ESPRESSIF IOT"); - os_snprintf(s_factory_info->model_number, WPS_MAX_MODEL_NAME_LEN, "ESP32"); - os_snprintf(s_factory_info->device_name, WPS_MAX_DEVICE_NAME_LEN, "ESP32 STATION"); + os_snprintf(s_factory_info->model_number, WPS_MAX_MODEL_NAME_LEN, wps_model_number); + os_snprintf(s_factory_info->device_name, WPS_MAX_DEVICE_NAME_LEN, "%s STATION", wps_model_number); return ESP_OK; }