From eb38eb670cc0203322cced5ba05b639b977a8db4 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 22 Apr 2021 12:11:09 +1000 Subject: [PATCH] system: Return ESP_ERR_NOT_SUPPORTED for esp_read_mac(ESP_MAC_BT, ...) on ESP32-S2 Previously this function returned ESP_OK but no MAC was set. --- components/esp_hw_support/mac_addr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/esp_hw_support/mac_addr.c b/components/esp_hw_support/mac_addr.c index 81e80f5f3a..477e69a80f 100644 --- a/components/esp_hw_support/mac_addr.c +++ b/components/esp_hw_support/mac_addr.c @@ -182,13 +182,15 @@ esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type) #endif // IDF_TARGET_ESP32S2 #else esp_derive_local_mac(mac, efuse_mac); -#endif +#endif // CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP break; case ESP_MAC_BT: #if CONFIG_ESP_MAC_ADDR_UNIVERSE_BT memcpy(mac, efuse_mac, 6); mac[5] += MAC_ADDR_UNIVERSE_BT_OFFSET; -#endif +#else + return ESP_ERR_NOT_SUPPORTED; +#endif // CONFIG_ESP_MAC_ADDR_UNIVERSE_BT break; case ESP_MAC_ETH: #if CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH @@ -197,7 +199,7 @@ esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type) #else efuse_mac[5] += 1; esp_derive_local_mac(mac, efuse_mac); -#endif +#endif // CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH break; default: ESP_LOGE(TAG, "unsupported mac type");