Skip to content

Commit 332a6f0

Browse files
Jordan Yatesmbolivar-nordic
authored andcommitted
wifi: esp_at: reset the modem in device init
Reset the ESP modem inside the device initialisation function so that errors can be detected through the use of `device_is_ready`. Fixes #43891 for this driver. Signed-off-by: Jordan Yates <[email protected]>
1 parent 0696075 commit 332a6f0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/wifi/esp_at/esp.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,13 +1063,8 @@ static int esp_reset(struct esp_data *dev)
10631063

10641064
static void esp_iface_init(struct net_if *iface)
10651065
{
1066-
const struct device *dev = net_if_get_device(iface);
1067-
struct esp_data *data = dev->data;
1068-
10691066
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
1070-
data->net_iface = iface;
10711067
esp_offload_init(iface);
1072-
esp_reset(data);
10731068
}
10741069

10751070
static const struct net_wifi_mgmt_offload esp_api = {
@@ -1166,6 +1161,12 @@ static int esp_init(const struct device *dev)
11661161
K_NO_WAIT);
11671162
k_thread_name_set(&esp_rx_thread, "esp_rx");
11681163

1164+
/* Retrieve associated network interface so asynchronous messages can be processed early */
1165+
data->net_iface = NET_IF_GET(Z_DEVICE_DT_DEV_NAME(DT_DRV_INST(0)), 0);
1166+
1167+
/* Reset the modem */
1168+
ret = esp_reset(data);
1169+
11691170
error:
11701171
return ret;
11711172
}

0 commit comments

Comments
 (0)