diff --git a/components/esp32/esp_adapter.c b/components/esp32/esp_adapter.c index 410a73025b..961b1d30f7 100644 --- a/components/esp32/esp_adapter.c +++ b/components/esp32/esp_adapter.c @@ -588,6 +588,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._get_time = get_time_wrapper, ._random = os_random, ._log_write = esp_log_write, + ._log_writev = esp_log_writev, ._log_timestamp = esp_log_timestamp, ._malloc_internal = malloc_internal_wrapper, ._realloc_internal = realloc_internal_wrapper, diff --git a/components/esp_wifi/include/esp_private/wifi_os_adapter.h b/components/esp_wifi/include/esp_private/wifi_os_adapter.h index bcae79f03c..3b14ca8a18 100644 --- a/components/esp_wifi/include/esp_private/wifi_os_adapter.h +++ b/components/esp_wifi/include/esp_private/wifi_os_adapter.h @@ -106,6 +106,7 @@ typedef struct { int32_t (* _get_time)(void *t); unsigned long (* _random)(void); void (* _log_write)(uint32_t level, const char* tag, const char* format, ...); + void (* _log_writev)(uint32_t level, const char* tag, const char* format, va_list args); uint32_t (* _log_timestamp)(void); void * (* _malloc_internal)(size_t size); void * (* _realloc_internal)(void *ptr, size_t size); diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index fe93f19c34..0f9d9643ea 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/include/esp_wifi_types.h @@ -207,7 +207,7 @@ typedef struct { uint8_t channel; /**< Channel of ESP32 soft-AP */ wifi_auth_mode_t authmode; /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */ uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */ - uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */ + uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 10 */ uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */ } wifi_ap_config_t; diff --git a/components/esp_wifi/lib_esp32 b/components/esp_wifi/lib_esp32 index 11a7716888..674f73c44a 160000 --- a/components/esp_wifi/lib_esp32 +++ b/components/esp_wifi/lib_esp32 @@ -1 +1 @@ -Subproject commit 11a77168887c3e0ec8e1c8508a13cd561f57d622 +Subproject commit 674f73c44a1c9f96292fa468b1c47a16d55a40a2 diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index 9958354235..610dbff458 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -104,6 +104,7 @@ esp_err_t esp_wifi_deinit(void) err = esp_wifi_deinit_internal(); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to deinit Wi-Fi driver (0x%x)", err); + return err; } tcpip_adapter_clear_default_wifi_handlers(); diff --git a/components/idf_test/integration_test/TC_IT_WIFI_CONN.yml b/components/idf_test/integration_test/TC_IT_WIFI_CONN.yml index 6906252fcc..d941039efe 100644 --- a/components/idf_test/integration_test/TC_IT_WIFI_CONN.yml +++ b/components/idf_test/integration_test/TC_IT_WIFI_CONN.yml @@ -78,7 +78,7 @@ test cases: - - SSC SSC2 sta -C -s - - R SSC2 RE "\+JAP:CONNECTED,%%s"%%() - - SSC SSC1 ap -S -s -n 15 - - - R SSC1 C +SAP:OK + - - R SSC1 C +SAP:ERROR - - SSC SSC2 sta -C -s - - R SSC2 RE "\+JAP:CONNECTED,%%s"%%() - - SSC SSC2 sta -D diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h index 21ebbdf236..09df53b61e 100644 --- a/components/log/include/esp_log.h +++ b/components/log/include/esp_log.h @@ -106,6 +106,15 @@ uint32_t esp_log_early_timestamp(void); */ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, ...) __attribute__ ((format (printf, 3, 4))); +/** + * @brief Write message into the log, va_list variant + * @see esp_log_write() + * + * This function is provided to ease integration toward other logging framework, + * so that esp_log can be used as a log sink. + */ +void esp_log_writev(esp_log_level_t level, const char* tag, const char* format, va_list args); + /** @cond */ #include "esp_log_internal.h" diff --git a/components/log/log.c b/components/log/log.c index b256e936b3..20b99b5307 100644 --- a/components/log/log.c +++ b/components/log/log.c @@ -186,9 +186,10 @@ void clear_log_level_list() #endif } -void IRAM_ATTR esp_log_write(esp_log_level_t level, +void IRAM_ATTR esp_log_writev(esp_log_level_t level, const char* tag, - const char* format, ...) + const char* format, + va_list args) { if (!s_log_mutex) { s_log_mutex = xSemaphoreCreateMutex(); @@ -212,9 +213,16 @@ void IRAM_ATTR esp_log_write(esp_log_level_t level, return; } + (*s_log_print_func)(format, args); +} + +void IRAM_ATTR esp_log_write(esp_log_level_t level, + const char* tag, + const char* format, ...) +{ va_list list; va_start(list, format); - (*s_log_print_func)(format, list); + esp_log_writev(level, tag, format, list); va_end(list); }