Skip to content

{bp-19371} drivers/usbdev: re-assert soft connect in cdcecm/cdcncm disconnect() - #19670

Merged
xiaoxiang781216 merged 1 commit into
apache:releases/13.0from
jerpelea:bp-19371
Aug 4, 2026
Merged

{bp-19371} drivers/usbdev: re-assert soft connect in cdcecm/cdcncm disconnect()#19670
xiaoxiang781216 merged 1 commit into
apache:releases/13.0from
jerpelea:bp-19371

Conversation

@jerpelea

@jerpelea jerpelea commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

The USB device controller drivers invoke CLASS_DISCONNECT() on every USB bus reset, and a bus reset is the first step of normal host enumeration. Every other class driver (cdcacm, usbmsc, rndis) re-asserts DEV_CONNECT() at the end of its disconnect() handler so that the device remains attached; cdcecm and cdcncm did not, so on controllers that soft-disconnect around bus reset (e.g. rp2040, which drops the pull-up in its bus-reset handler) a standalone CDC-ECM or CDC-NCM device is left soft-disconnected by the first bus reset and never enumerates on the host.

Mirror the cdcacm behavior and perform the soft connect in the disconnect() methods, unless part of a composite device (composite.c already re-connects in its own disconnect handler).

Fixes the standalone CDC-ECM case of issue #15880.

Validated on raspberrypi-pico (RP2040): with this change a standalone CONFIG_NET_CDCECM device that previously never appeared on the host enumerates via cdc_ether and pings with 0% loss. cdcncm has the identical defect and receives the identical fix.

Impact

RELEASE

Testing

CI

The USB device controller drivers invoke CLASS_DISCONNECT() on every
USB bus reset, and a bus reset is the first step of normal host
enumeration.  Every other class driver (cdcacm, usbmsc, rndis)
re-asserts DEV_CONNECT() at the end of its disconnect() handler so
that the device remains attached; cdcecm and cdcncm did not, so on
controllers that soft-disconnect around bus reset (e.g. rp2040, which
drops the pull-up in its bus-reset handler) a standalone CDC-ECM or
CDC-NCM device is left soft-disconnected by the first bus reset and
never enumerates on the host.

Mirror the cdcacm behavior and perform the soft connect in the
disconnect() methods, unless part of a composite device (composite.c
already re-connects in its own disconnect handler).

Fixes the standalone CDC-ECM case of issue apache#15880.

Validated on raspberrypi-pico (RP2040): with this change a standalone
CONFIG_NET_CDCECM device that previously never appeared on the host
enumerates via cdc_ether and pings with 0% loss.  cdcncm has the
identical defect and receives the identical fix.

Signed-off-by: Ricard Rosson <ricard@groundbits.com>
Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>
Assisted-by: Claude (Anthropic Claude Code)
@github-actions github-actions Bot added Size: S The size of the change in this PR is small Area: USB labels Aug 3, 2026
@xiaoxiang781216
xiaoxiang781216 merged commit a2b3cbe into apache:releases/13.0 Aug 4, 2026
16 of 41 checks passed
@jerpelea
jerpelea deleted the bp-19371 branch August 4, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: USB Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants