Skip to content

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.

@zephyrbot zephyrbot added the area: USB Universal Serial Bus label Oct 31, 2024
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
@carlescufi carlescufi requested a review from MarekPieta November 4, 2024 12:37
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
Contributor

@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