diff options
| author | Cedric Van den Bergh <[email protected]> | 2026-06-16 23:28:07 +0100 |
|---|---|---|
| committer | Cedric Van den Bergh <[email protected]> | 2026-06-16 23:28:07 +0100 |
| commit | 6d3d33d997cd73a565e8355c84b67f0366d752ce (patch) | |
| tree | c2799f70dcaa4f3c889054f0e2e9db24494e3433 /src/class/net/net_device.h | |
| parent | d9f736dcf9c6b71aac470d281cd2fc05a3f7e793 (diff) | |
ncm: add weak callback for initial link state
netd_init resets link_is_up to a compile-time default, which is
incorrect when the host reboots without power-cycling the device.
Add tud_network_default_link_state_cb() so applications can return
the actual physical link state. The weak default preserves existing
CFG_TUD_NCM_DEFAULT_LINK_UP behaviour.
Diffstat (limited to 'src/class/net/net_device.h')
| -rw-r--r-- | src/class/net/net_device.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/class/net/net_device.h b/src/class/net/net_device.h index 332df09b3..1ad069d92 100644 --- a/src/class/net/net_device.h +++ b/src/class/net/net_device.h @@ -106,6 +106,10 @@ extern uint8_t tud_network_mac_address[6]; // Optional callback: informs the application about host requested packet filter bits void tud_network_set_packet_filter_cb(uint16_t packet_filter); +// Optional callback: called during netd_init() to get the initial link state. +// Override to return the actual physical link state instead of the compile-time default. +bool tud_network_default_link_state_cb(void); + // Set the network link state (up/down) and notify the host void tud_network_link_state(uint8_t rhport, bool is_up); |
