Extends the link state control feature to CDC-ECM mode.
RNDIS mode prints state changes but doesn't send notifications
to the host yet (would require RNDIS_INDICATE_STATUS_MSG).
For ECM:
- Tracks link state and sends proper CDC notifications
- Handles notification endpoint busy conditions
- Only sends connection notification when link is actually up
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
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 <noreply@anthropic.com>
TinyUSB does not provide any locking means to protect the DCD variables.
This can lead to race conditions when the user is trying to submit
a transfer while the device is being disconnected. This can cause
the device to be in an inconsistent state, leading to a crash or
undefined behavior.
This commit adds a spin-lock to protect the DCD variables during
device disconnect.
Closes https://github.com/espressif/esp-idf/issues/9691
Also reported in https://github.com/espressif/esp-usb/pull/131
hub: add hub_port_get_status_local(), ignore resp in hub_port_get_status(pot != 0)
usbh properly deboucning with hub/rootport accordingly to usb specs, also add 10ms of reset recovery
replace dev0.enumerating by enumerating_daddr for better clean up on unplugging while enumerating
move controller_id & enumerating_daddr into _usbh_data struct
- if a previous enumeration failed _ctrl_xfer status could stuck, it needs to be cleared before next attempt.
- after _dev0.enumerating is reset in hcd_event_handler(), if an attach event arrived before _ctrl_xfer clean up in remove event, a racing condition will happen.
Signed-off-by: HiFiPhile <admin@hifiphile.com>