Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: udc_nrf: handle overwritten Set Address commands #80666

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

tmon-nordic
Copy link
Contributor

USBD peripheral automatically handles Set Address command which can lead to state mismatch between USB stack and the host. Keep track of device address and issue fake Set Address commands on mismatch.

This fixes default vs addressed state mismatch that can occur due to sufficently high SETUP handling latency. The state mismatch was most commonly seen as SET CONFIGURATION failure when the enumeration happened during periods with increased latency.

Set Address behavior is not specified when wValue is greater than 127,
or if wIndex or wLength are non-zero. USB stack did check wValue and
wLength but didn't care about wIndex value. Extend the check so non-zero
wIndex also results in STALL response.

Signed-off-by: Tomasz Moń <[email protected]>
@carlescufi carlescufi added the bug The issue is a bug, or the PR is fixing a bug label Nov 4, 2024
@carlescufi carlescufi added this to the v4.0.0 milestone Nov 4, 2024
drivers/usb/udc/udc_nrf.c Outdated Show resolved Hide resolved
drivers/usb/udc/udc_nrf.c Outdated Show resolved Hide resolved
USBD peripheral automatically handles Set Address command which can
lead to state mismatch between USB stack and the host. Keep track of
device address and issue fake Set Address commands on mismatch.

This fixes default vs addressed state mismatch that can occur due to
sufficently high SETUP handling latency. The state mismatch was most
commonly seen as SET CONFIGURATION failure when the enumeration happened
during periods with increased latency.

Signed-off-by: Tomasz Moń <[email protected]>
@dkalowsk
Copy link
Contributor

@carlescufi and @tmon-nordic is this really needing to be in 4.0? it doesn't have enough approvals and RC3 is already done. I'd like move to 4.1.0 and pull it into a 4.0.1 backport if it is that needed.

@mmahadevan108 mmahadevan108 modified the milestones: v4.0.0, v4.1.0 Nov 12, 2024
Copy link
Collaborator

@MarekPieta MarekPieta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix. I confirmed locally that issues reported by me no longer replicate

@nashif nashif merged commit e3acf5f into zephyrproject-rtos:main Nov 19, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants