Skip to content

Commit bd3ed2e

Browse files
authored
Merge pull request #7075 from jepler/picow-fix-ipv4addr-unconnected
picow: ask at a lower level if the interface is up
2 parents 029e57d + 47541af commit bd3ed2e

File tree

1 file changed

+7
-7
lines changed
  • ports/raspberrypi/common-hal/wifi

1 file changed

+7
-7
lines changed

ports/raspberrypi/common-hal/wifi/Radio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,50 +202,50 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) {
202202
}
203203

204204
mp_obj_t common_hal_wifi_radio_get_ipv4_gateway(wifi_radio_obj_t *self) {
205-
if (!netif_is_up(NETIF_STA)) {
205+
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP) {
206206
return mp_const_none;
207207
}
208208
return common_hal_ipaddress_new_ipv4address(NETIF_STA->gw.addr);
209209
}
210210

211211
mp_obj_t common_hal_wifi_radio_get_ipv4_gateway_ap(wifi_radio_obj_t *self) {
212-
if (!netif_is_up(NETIF_AP)) {
212+
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_UP) {
213213
return mp_const_none;
214214
}
215215
return common_hal_ipaddress_new_ipv4address(NETIF_AP->gw.addr);
216216
}
217217

218218
mp_obj_t common_hal_wifi_radio_get_ipv4_subnet(wifi_radio_obj_t *self) {
219-
if (!netif_is_up(NETIF_STA)) {
219+
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP) {
220220
return mp_const_none;
221221
}
222222
return common_hal_ipaddress_new_ipv4address(NETIF_STA->netmask.addr);
223223
}
224224

225225
mp_obj_t common_hal_wifi_radio_get_ipv4_subnet_ap(wifi_radio_obj_t *self) {
226-
if (!netif_is_up(NETIF_AP)) {
226+
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_UP) {
227227
return mp_const_none;
228228
}
229229
return common_hal_ipaddress_new_ipv4address(NETIF_AP->netmask.addr);
230230
}
231231

232232
mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) {
233-
if (!netif_is_up(NETIF_STA)) {
233+
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP) {
234234
return mp_const_none;
235235
}
236236
return common_hal_ipaddress_new_ipv4address(NETIF_STA->ip_addr.addr);
237237
}
238238

239239
mp_obj_t common_hal_wifi_radio_get_ipv4_address_ap(wifi_radio_obj_t *self) {
240-
if (!netif_is_up(NETIF_AP)) {
240+
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_UP) {
241241
return mp_const_none;
242242
}
243243
return common_hal_ipaddress_new_ipv4address(NETIF_AP->ip_addr.addr);
244244
}
245245

246246
mp_obj_t common_hal_wifi_radio_get_ipv4_dns(wifi_radio_obj_t *self) {
247247
uint32_t addr = dns_getserver(0)->addr;
248-
if (!netif_is_up(NETIF_STA) || addr == 0) {
248+
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP || addr == 0) {
249249
return mp_const_none;
250250
}
251251
return common_hal_ipaddress_new_ipv4address(addr);

0 commit comments

Comments
 (0)