From aa3de05601d2984819bb30228d7f9abe43b96da4 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Tue, 31 Mar 2020 18:10:07 +0200 Subject: [PATCH 1/2] cpu/esp: fix netopt_enabled_t handling in esp_wifi/esp_eth --- cpu/esp32/esp-eth/esp_eth_netdev.c | 2 +- cpu/esp_common/esp-wifi/esp_wifi_netdev.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/esp32/esp-eth/esp_eth_netdev.c b/cpu/esp32/esp-eth/esp_eth_netdev.c index 4e75505620..8288b066ec 100644 --- a/cpu/esp32/esp-eth/esp_eth_netdev.c +++ b/cpu/esp32/esp-eth/esp_eth_netdev.c @@ -281,7 +281,7 @@ static int _esp_eth_get(netdev_t *netdev, netopt_t opt, void *val, size_t max_le esp_eth_get_mac((uint8_t *)val); return ETHERNET_ADDR_LEN; case NETOPT_LINK_CONNECTED: - assert(max_len == 1); + assert(max_len == sizeof(netopt_enable_t)); *((netopt_enable_t *)val) = (dev->link_up) ? NETOPT_ENABLE : NETOPT_DISABLE; return sizeof(netopt_enable_t); diff --git a/cpu/esp_common/esp-wifi/esp_wifi_netdev.c b/cpu/esp_common/esp-wifi/esp_wifi_netdev.c index fde2475347..e55c7c5e14 100644 --- a/cpu/esp_common/esp-wifi/esp_wifi_netdev.c +++ b/cpu/esp_common/esp-wifi/esp_wifi_netdev.c @@ -640,10 +640,10 @@ static int _esp_wifi_get(netdev_t *netdev, netopt_t opt, void *val, size_t max_l esp_wifi_get_mac(ESP_MAC_WIFI_STA,(uint8_t *)val); return ETHERNET_ADDR_LEN; case NETOPT_LINK_CONNECTED: - assert(max_len == 1); + assert(max_len == sizeof(netopt_enable_t)); *((netopt_enable_t *)val) = (dev->connected) ? NETOPT_ENABLE : NETOPT_DISABLE; - return 1; + return sizeof(netopt_enable_t); default: return netdev_eth_get(netdev, opt, val, max_len); } From 579de1a1e7582392921d7b245cb90b00545f20b2 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Tue, 31 Mar 2020 18:11:47 +0200 Subject: [PATCH 2/2] cpu/esp: deprecated NETOPT_LINK_CONNECTED renamed --- cpu/esp32/esp-eth/esp_eth_netdev.c | 2 +- cpu/esp_common/esp-wifi/esp_wifi_netdev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/esp32/esp-eth/esp_eth_netdev.c b/cpu/esp32/esp-eth/esp_eth_netdev.c index 8288b066ec..feab247592 100644 --- a/cpu/esp32/esp-eth/esp_eth_netdev.c +++ b/cpu/esp32/esp-eth/esp_eth_netdev.c @@ -280,7 +280,7 @@ static int _esp_eth_get(netdev_t *netdev, netopt_t opt, void *val, size_t max_le assert(max_len >= ETHERNET_ADDR_LEN); esp_eth_get_mac((uint8_t *)val); return ETHERNET_ADDR_LEN; - case NETOPT_LINK_CONNECTED: + case NETOPT_LINK: assert(max_len == sizeof(netopt_enable_t)); *((netopt_enable_t *)val) = (dev->link_up) ? NETOPT_ENABLE : NETOPT_DISABLE; diff --git a/cpu/esp_common/esp-wifi/esp_wifi_netdev.c b/cpu/esp_common/esp-wifi/esp_wifi_netdev.c index e55c7c5e14..a6fefa7acb 100644 --- a/cpu/esp_common/esp-wifi/esp_wifi_netdev.c +++ b/cpu/esp_common/esp-wifi/esp_wifi_netdev.c @@ -639,7 +639,7 @@ static int _esp_wifi_get(netdev_t *netdev, netopt_t opt, void *val, size_t max_l assert(max_len >= ETHERNET_ADDR_LEN); esp_wifi_get_mac(ESP_MAC_WIFI_STA,(uint8_t *)val); return ETHERNET_ADDR_LEN; - case NETOPT_LINK_CONNECTED: + case NETOPT_LINK: assert(max_len == sizeof(netopt_enable_t)); *((netopt_enable_t *)val) = (dev->connected) ? NETOPT_ENABLE : NETOPT_DISABLE;