Skip to content

Commit 3da7808

Browse files
Gregor Copoixnashif
authored andcommitted
driver: wifi: esp32: fix send data for AP_STA mode
Fixes the check for connected interface if CONFIG_ESP32_WIFI_AP_STA_MODE=y (different data objects for STA (esp32_data) and AP (esp32_ap_sta_data)). As the correct data object is linked to device object, we can check for ESP32_STA_CONNECTED or ESP32_AP_CONNECTED in dev->data. This fixes AP mode in samples/net/wifi/apsta_mode if STA WIFI_SSID/WIFI_PSK are invalid and no STA connection can be established before (samples/net/wifi/apsta_mode/src/main.c#L28-L29) for all ESP32 derivates. Fixes false check from 183b74c Signed-off-by: Gregor Copoix <gregor.copoix@ithinx.io>
1 parent 8409e42 commit 3da7808

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/wifi/esp32/src/esp_wifi_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static int esp32_wifi_send(const struct device *dev, struct net_pkt *pkt)
9595
const int pkt_len = net_pkt_get_len(pkt);
9696
esp_interface_t ifx = data->state == ESP32_AP_CONNECTED ? ESP_IF_WIFI_AP : ESP_IF_WIFI_STA;
9797

98-
if (esp32_data.state != ESP32_STA_CONNECTED && esp32_data.state != ESP32_AP_CONNECTED) {
98+
if (data->state != ESP32_STA_CONNECTED && data->state != ESP32_AP_CONNECTED) {
9999
return -EIO;
100100
}
101101

0 commit comments

Comments
 (0)