chore: checkpoint current IDF 5.5 remediation state

This commit is contained in:
Sebastien L
2026-02-11 20:23:37 +00:00
parent 73bd096f37
commit 71a9c06fe4
197 changed files with 19719 additions and 1015 deletions

View File

@@ -9,7 +9,7 @@ endif()
idf_component_register( SRC_DIRS . UML-State-Machine-in-C/src
INCLUDE_DIRS . UML-State-Machine-in-C/src
REQUIRES squeezelite-ota json mdns
REQUIRES squeezelite-ota json mdns esp_eth
PRIV_REQUIRES tools services platform_config esp_common json newlib freertos spi_flash nvs_flash mdns pthread wpa_supplicant platform_console esp_http_server console ${target_requires}
)
@@ -46,4 +46,4 @@ file(GLOB_RECURSE WEBAPP_FILES
# # Ensure the destination directory exists
# add_custom_command(TARGET copy_webapp PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${WEBAPP_DEST_DIR}" )
# add_dependencies(${COMPONENT_LIB} copy_webapp)
# add_dependencies(${COMPONENT_LIB} copy_webapp)

View File

@@ -97,7 +97,6 @@ char* http_alloc_get_socket_address(httpd_req_t* req, u8_t local, in_port_t* por
socklen_t len;
union sockaddr_aligned addr;
len = sizeof(addr);
ip_addr_t* ip_addr = NULL;
char* ipstr = malloc_init_external(INET6_ADDRSTRLEN);
typedef int (*getaddrname_fn_t)(int s, struct sockaddr* name, socklen_t* namelen);
getaddrname_fn_t get_addr = NULL;
@@ -114,19 +113,15 @@ char* http_alloc_get_socket_address(httpd_req_t* req, u8_t local, in_port_t* por
ESP_LOGE_LOC(TAG, "Failed to retrieve socket address");
sprintf(ipstr, "N/A (0.0.0.%u)", local);
} else {
if (addr.sin.sin_family != AF_INET) {
ip_addr = (ip_addr_t*)&(addr.sin6.sin6_addr);
inet_ntop(addr.sa.sa_family, ip_addr, ipstr, INET6_ADDRSTRLEN);
if (addr.sin.sin_family == AF_INET6) {
inet_ntop(AF_INET6, &addr.sin6.sin6_addr, ipstr, INET6_ADDRSTRLEN);
ESP_LOGV_LOC(TAG, "Processing an IPV6 address : %s", ipstr);
*portl = addr.sin6.sin6_port;
unmap_ipv4_mapped_ipv6(ip_2_ip4(ip_addr), ip_2_ip6(ip_addr));
} else {
ip_addr = (ip_addr_t*)&(addr.sin.sin_addr);
inet_ntop(addr.sa.sa_family, ip_addr, ipstr, INET6_ADDRSTRLEN);
ESP_LOGV_LOC(TAG, "Processing an IPV6 address : %s", ipstr);
inet_ntop(AF_INET, &addr.sin.sin_addr, ipstr, INET6_ADDRSTRLEN);
ESP_LOGV_LOC(TAG, "Processing an IPV4 address : %s", ipstr);
*portl = addr.sin.sin_port;
}
inet_ntop(AF_INET, ip_addr, ipstr, INET6_ADDRSTRLEN);
ESP_LOGV_LOC(TAG, "Retrieved ip address:port = %s:%u", ipstr, *portl);
}
return ipstr;
@@ -170,7 +165,7 @@ bool is_captive_portal_host_name(httpd_req_t* req) {
memset(ap_ip_address, 0x00, IP4ADDR_STRLEN_MAX);
if (ap_ip_address) {
ESP_LOGD_LOC(TAG, "Converting soft ip address to string");
ip4addr_ntoa_r(&ip_info.ip, ap_ip_address, IP4ADDR_STRLEN_MAX);
esp_ip4addr_ntoa(&ip_info.ip, ap_ip_address, IP4ADDR_STRLEN_MAX);
ESP_LOGD_LOC(
TAG, "TCPIP_ADAPTER_IF_AP is up and has ip address %s ", ap_ip_address);
}
@@ -971,7 +966,7 @@ char* get_ap_ip_address() {
ESP_LOGE_LOC(TAG, "Unable to get local AP ip address. Error: %s", esp_err_to_name(err));
} else {
ESP_LOGV_LOC(TAG, "Converting soft ip address to string");
ip4addr_ntoa_r(&ip_info.ip, ap_ip_address, IP4ADDR_STRLEN_MAX);
esp_ip4addr_ntoa(&ip_info.ip, ap_ip_address, IP4ADDR_STRLEN_MAX);
ESP_LOGD_LOC(TAG, "TCPIP_ADAPTER_IF_AP is up and has ip address %s ", ap_ip_address);
}
} else {

View File

@@ -23,7 +23,9 @@ static esp_err_t start(spi_device_handle_t spi_handle, sys_dev_eth_config* ether
#ifdef CONFIG_ETH_SPI_ETHERNET_DM9051
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
eth_dm9051_config_t eth_config = ETH_DM9051_DEFAULT_CONFIG(spi_handle);
spi_host_device_t spi_host = ethernet_config->ethType.spi.host - sys_dev_common_hosts_Host0;
eth_dm9051_config_t eth_config = ETH_DM9051_DEFAULT_CONFIG(spi_host, &devcfg);
(void)spi_handle;
// we assume that isr has been installed already
eth_config.int_gpio_num = ethernet_config->ethType.spi.intr;
phy_config.phy_addr = -1;

View File

@@ -1,4 +1,5 @@
#include "esp_eth.h"
#include "esp_eth_mac_esp.h"
#include "network_ethernet.h"
static EXT_RAM_ATTR network_ethernet_driver_t LAN8720;
@@ -22,15 +23,17 @@ static esp_err_t start(spi_device_handle_t spi_handle, sys_dev_eth_config * ethe
#ifdef CONFIG_ETH_PHY_INTERFACE_RMII
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
(void)spi_handle;
mac_config.smi_mdc_gpio_num = ethernet_config->ethType.rmii.mdc;
mac_config.smi_mdio_gpio_num = ethernet_config->ethType.rmii.mdio;
esp32_emac_config.smi_gpio.mdc_num = ethernet_config->ethType.rmii.mdc;
esp32_emac_config.smi_gpio.mdio_num = ethernet_config->ethType.rmii.mdio;
phy_config.phy_addr = 1;
phy_config.reset_gpio_num = ethernet_config->common.rst;
rst = phy_config.reset_gpio_num;
esp_eth_mac_t* mac = esp_eth_mac_new_esp32(&mac_config);
esp_eth_phy_t* phy = esp_eth_phy_new_lan8720(&phy_config);
esp_eth_mac_t* mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
esp_eth_phy_t* phy = esp_eth_phy_new_lan87xx(&phy_config);
phy->reset_hw = reset_hw;
esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy);
return esp_eth_driver_install(&config, &LAN8720.handle);

View File

@@ -21,9 +21,11 @@ static esp_err_t reset_hw(esp_eth_phy_t *phy)
static esp_err_t start(spi_device_handle_t spi_handle, sys_dev_eth_config * ethernet_config) {
#ifdef CONFIG_ETH_SPI_ETHERNET_W5500
eth_w5500_config_t eth_config = ETH_W5500_DEFAULT_CONFIG(spi_handle);
spi_host_device_t spi_host = ethernet_config->ethType.spi.host - sys_dev_common_hosts_Host0;
eth_w5500_config_t eth_config = ETH_W5500_DEFAULT_CONFIG(spi_host, &devcfg);
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
(void)spi_handle;
eth_config.int_gpio_num = ethernet_config->ethType.spi.intr;
phy_config.phy_addr = -1; // let the system automatically find out the phy address

View File

@@ -5,6 +5,7 @@
#include "Config.h"
#include "accessors.h"
#include "esp_log.h"
#include "esp_mac.h"
#include "freertos/timers.h"
#include "globdefs.h"
#include "messaging.h"
@@ -61,7 +62,7 @@ bool network_ethernet_wait_for_link(uint16_t max_wait_ms) {
return link_up;
}
static void ETH_Timeout(void* timer_id);
static void ETH_Timeout(TimerHandle_t timer);
void destroy_network_ethernet() {}
static void network_ethernet_print_config(const network_ethernet_driver_t* eth_config) {
@@ -113,16 +114,7 @@ void init_network_ethernet() {
esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, &eth_event_handler, NULL);
ethernet_event_group = xEventGroupCreate();
xEventGroupClearBits(ethernet_event_group, LINK_UP_BIT);
spi_device_handle_t spi_handle = NULL;
if (sys_eth->which_ethType == sys_dev_eth_config_spi_tag) {
err = spi_bus_add_device(sys_eth->ethType.spi.host - sys_dev_common_hosts_Host0, network_driver->devcfg, &spi_handle);
if (err != ESP_OK) {
ESP_LOGE(TAG, "SPI host failed : %s", esp_err_to_name(err));
}
}
if (err == ESP_OK) {
err = network_driver->start(spi_handle, sys_eth);
}
err = network_driver->start(NULL, sys_eth);
if (err == ESP_OK) {
uint8_t mac_address[6];
esp_read_mac(mac_address, ESP_MAC_ETH);
@@ -141,9 +133,6 @@ void init_network_ethernet() {
}
if (err != ESP_OK) {
messaging_post_message(MESSAGING_ERROR, MESSAGING_CLASS_SYSTEM, "Configuring Ethernet failed: %s", esp_err_to_name(err));
if (spi_handle) {
spi_bus_remove_device(spi_handle);
}
network_driver->handle = NULL;
}
}
@@ -184,4 +173,7 @@ static void eth_event_handler(void* arg, esp_event_base_t event_base, int32_t ev
}
}
static void ETH_Timeout(void* timer_id) { network_async_fail(); }
static void ETH_Timeout(TimerHandle_t timer) {
(void)timer;
network_async_fail();
}

View File

@@ -13,6 +13,7 @@ Copyright (c) 2017-2021 Sebastien L
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/queue.h>
#include "dns_server.h"
#include "esp_log.h"
@@ -69,7 +70,7 @@ network_t NM;
//! Create and initialize the array of state machines.
state_machine_t* const SM[] = {(state_machine_t*)&NM};
static void network_timer_cb(void* timer_id);
static void network_timer_cb(TimerHandle_t timer_id);
int get_root_id(const state_t* state);
const state_t* get_root(const state_t* const state);
static void network_task(void* pvParameters);
@@ -590,7 +591,7 @@ void network_reboot_ota(char* url) {
network_t* network_get_state_machine() { return &NM; }
static void network_timer_cb(void* timer_id) { network_async_timer(); }
static void network_timer_cb(TimerHandle_t timer_id) { network_async_timer(); }
esp_netif_t* network_get_active_interface() {
if (NM.wifi_ap_netif && (network_wifi_is_ap_mode() || network_wifi_is_ap_sta_mode())) {
return NM.wifi_ap_netif;

View File

@@ -236,14 +236,6 @@ void filter_unique( wifi_ap_record_t * aplist, uint16_t * ap_num);
/**
* @brief A standard wifi event handler as recommended by Espressif
*/
esp_err_t network_manager_event_handler(void *ctx, system_event_t *event);
/**
* @brief Start the mDNS service
*/
@@ -306,4 +298,3 @@ void network_manager_format_state_machine(esp_log_level_t level, const char* pre
}
#endif

View File

@@ -24,6 +24,7 @@
#pragma once
#include "esp_netif.h"
#include "tcpip_adapter_compat.h"
#ifdef __cplusplus
extern "C" {
@@ -94,5 +95,3 @@ esp_err_t network_get_ip_info(tcpip_adapter_ip_info_t* ipInfo);
#ifdef __cplusplus
}
#endif