diff options
| author | Andrew Leech <[email protected]> | 2025-05-27 15:06:05 +1000 |
|---|---|---|
| committer | Andrew Leech <[email protected]> | 2025-05-29 09:36:38 +1000 |
| commit | 5de4a23abe315ecc5f9387ced910f54e29e0e69e (patch) | |
| tree | 62b387c0addd059f67823fade738851d9f9d48b3 /src/class/net/net_device.h | |
| parent | 8f077f9295838d6a7e7a5151cb46605df14a630d (diff) | |
Add USB NCM link state control support
This adds the ability to dynamically control the network link state
for NCM devices. The host OS will see the network interface as
connected/disconnected based on the link state.
New API:
- tud_network_link_state(rhport, is_up): Set link up/down state
Example updates:
- Added button control to toggle link state
- Fixed LWIP integration to properly handle link state changes
- Added printf to show correct protocol (NCM vs RNDIS/ECM)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Diffstat (limited to 'src/class/net/net_device.h')
| -rw-r--r-- | src/class/net/net_device.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/class/net/net_device.h b/src/class/net/net_device.h index 4c9a92f2d..fff2623b7 100644 --- a/src/class/net/net_device.h +++ b/src/class/net/net_device.h @@ -87,6 +87,11 @@ void tud_network_init_cb(void); // TODO removed later since it is not part of tinyusb stack extern uint8_t tud_network_mac_address[6]; +//------------- NCM -------------// + +// Set the network link state (up/down) and notify the host +void tud_network_link_state(uint8_t rhport, bool is_up); + //--------------------------------------------------------------------+ // INTERNAL USBD-CLASS DRIVER API //--------------------------------------------------------------------+ |
