rp2/cyw43_configport: Fix cyw43 mDNS by properly starting mDNS on netif.
The rp2 port has an incomplete mDNS implementation. The code in `main.c` calls `mdns_resp_init()` which opens the UDP socket for mDNS. However, no code in the cyw43 driver makes the proper calls to `mdns_resp_add_netif()` and `mdns_resp_remove_netif()` to send the announce packets. The wiznet5k driver does make these calls and was used as a model for these changes. This commit attempts to address this by very small changes to the `ports/rp2/cyw43_configport.h` file. The change uses new cyw43 driver hooks to map the driver macros `CYW43_CB_TCPIP_INIT_EXTRA` and `CYW43_CB_TCPIP_DEINIT_EXTRA` to the appropriate lwIP mDNS calls. Fixes issue #15297. Signed-off-by: Mark Seminatore <nebula_peeps4t@icloud.com>
This commit is contained in:
parent
5eee5a67dc
commit
f96417dbf2
1 changed files with 16 additions and 0 deletions
|
|
@ -33,6 +33,7 @@
|
|||
#include "py/mphal.h"
|
||||
#include "py/runtime.h"
|
||||
#include "extmod/modnetwork.h"
|
||||
#include "lwip/apps/mdns.h"
|
||||
#include "pendsv.h"
|
||||
|
||||
#define CYW43_INCLUDE_LEGACY_F1_OVERFLOW_WORKAROUND_VARIABLES (1)
|
||||
|
|
@ -167,4 +168,19 @@ static inline void cyw43_delay_ms(uint32_t ms) {
|
|||
|
||||
#define CYW43_EVENT_POLL_HOOK mp_event_handle_nowait()
|
||||
|
||||
#if LWIP_MDNS_RESPONDER == 1
|
||||
|
||||
// Hook for any additional TCP/IP initialization than needs to be done.
|
||||
// Called after the netif specified by `itf` has been set up.
|
||||
#ifndef CYW43_CB_TCPIP_INIT_EXTRA
|
||||
#define CYW43_CB_TCPIP_INIT_EXTRA(self, itf) mdns_resp_add_netif(&self->netif[itf], mod_network_hostname_data)
|
||||
#endif
|
||||
|
||||
// Hook for any additional TCP/IP deinitialization than needs to be done.
|
||||
// Called before the netif specified by `itf` is removed.
|
||||
#ifndef CYW43_CB_TCPIP_DEINIT_EXTRA
|
||||
#define CYW43_CB_TCPIP_DEINIT_EXTRA(self, itf) mdns_resp_remove_netif(&self->netif[itf])
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // MICROPY_INCLUDED_RP2_CYW43_CONFIGPORT_H
|
||||
|
|
|
|||
Loading…
Reference in a new issue