From d24d73dadf466bbc888905916b0071f6618592a1 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 13 Jan 2019 17:06:04 +0100
Subject: [PATCH] cpu/esp32: fixes NETOPT_LINK_CONNECTED in esp_wifi

esp_wifi was simply returning the connection state instead of filling the referenced value.
---
 cpu/esp32/esp-wifi/esp_wifi_netdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cpu/esp32/esp-wifi/esp_wifi_netdev.c b/cpu/esp32/esp-wifi/esp_wifi_netdev.c
index 2d55d1233d..89efab343f 100644
--- a/cpu/esp32/esp-wifi/esp_wifi_netdev.c
+++ b/cpu/esp32/esp-wifi/esp_wifi_netdev.c
@@ -358,7 +358,10 @@ static int _esp_wifi_get(netdev_t *netdev, netopt_t opt, void *val, size_t max_l
         case NETOPT_IS_WIRED:
             return false;
         case NETOPT_LINK_CONNECTED:
-            return dev->connected;
+            assert(max_len == 1);
+            *((netopt_enable_t *)val) = (dev->connected) ? NETOPT_ENABLE
+                                                         : NETOPT_DISABLE;
+            return 1;
         default:
             return netdev_eth_get(netdev, opt, val, max_len);
     }
-- 
GitLab