1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

Merge pull request #18476 from benpicco/drivers/atwinc15x0-hang

drivers/atwinc15x0: reset device if m2m_wifi_handle_events() fails
This commit is contained in:
benpicco 2022-09-01 14:45:32 +02:00 committed by GitHub
commit 3e2dc46d4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -59,6 +59,7 @@
static void _atwinc15x0_wifi_cb(uint8_t event, void *msg);
static void _atwinc15x0_eth_cb(uint8_t type, void *msg, void *ctrl);
static int _atwinc15x0_connect(void);
static int _atwinc15x0_init(netdev_t *netdev);
static int _set_state(atwinc15x0_t *dev, netopt_state_t state);
/**
@ -455,6 +456,10 @@ static int _set_state(atwinc15x0_t *dev, netopt_state_t state)
dev->state = state;
_atwinc15x0_connect();
return sizeof(netopt_state_t);
case NETOPT_STATE_RESET:
_atwinc15x0_init(&dev->netdev);
dev->state = NETOPT_STATE_IDLE;
return sizeof(netopt_state_t);
default:
break;
}
@ -588,7 +593,10 @@ static void _atwinc15x0_isr(netdev_t *netdev)
DEBUG("%s dev=%p\n", __func__, (void *)dev);
/* handle pending ATWINC15x0 module events */
while (m2m_wifi_handle_events(NULL) != M2M_SUCCESS) { }
if (m2m_wifi_handle_events(NULL) != M2M_SUCCESS) {
DEBUG("%s handle events failed, reset device\n", __func__);
_atwinc15x0_init(netdev);
}
}
const netdev_driver_t atwinc15x0_netdev_driver = {