From 12f4f8f7f8503ac8076e7a25c965f342b5d079b0 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 18 Oct 2021 12:58:24 +0200 Subject: [PATCH] Examples/PPPoS: Fixed missed NETIF_PPP_STATUS event unregister NETIF_PPP_STATUS is registerd while modem gets attached to the related netif. we don't have any network detach functionality in the modem component, so we unregister the event during esp_modem_netif_clear_default_handlers(). Related https://esp32.com/viewtopic.php?f=13&t=23632 Related https://github.com/espressif/esp-idf/issues/7469 --- .../pppos_client/components/modem/src/esp_modem_netif.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c b/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c index 9dd081ab6b..0aab9c2d36 100644 --- a/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c +++ b/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c @@ -153,6 +153,10 @@ esp_err_t esp_modem_netif_clear_default_handlers(void *h) goto clear_event_failed; } + // this event is registered while modem gets attached to netif. + // we don't have any detach functionality, so we unregister here and ignore potential error + esp_event_handler_unregister(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, on_ppp_changed); + return ESP_OK; clear_event_failed: