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

pio_usb: mask endp with b'111 (d'7) #123

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rouming
Copy link

@rouming rouming commented Jun 17, 2024

This does not fix any issue, but makes token packet creation according to the usb 2.0 spec, where the third byte contains:

   ENDP  CRC5
      3     5

so make ENDP & 0x7 and not ENDP & 0x1f. This actually could be a nasty bug, but the code a few lines above makes sure that dat has exactly 11 bits, so incorrect mask does not make any effect.

This patch makes mask according to the spec.

This does not fix any issue, but makes a token packet creation
according to the usb 2.0 spec, where the third byte contains:

   ENDP  CRC5
      3     5

so make `ENDP & 0x7` and not `ENDP & 0x1f`. This actually could
be a nasty bug, but the code a few lines above makes sure that
`dat` has exactly 11 bits, so actual incorrect mask does not
make any effect.

This patch makes mask according to the spec.

Signed-off-by: Roman Penyaev <[email protected]>
@shuffle2
Copy link

i think using dat there instead of ep_num is more clear.
it would also probably be more clear to not do any masking here at all - it's wasted code anyway, as you point out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants