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

Gracefully handle SETUP packets whose wLength > 255. #1

Merged
merged 1 commit into from
Jan 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions valentyusb/usbcore/cpu/cdc_eptri.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ def add(self, wRequestAndType, wValue, mem):
# 4: wIndex.eq(data_recv_payload_delayed),
# 5: wIndex.eq(Cat(wIndex[0:8], data_recv_payload_delayed)),
6: NextValue(wLength,usb.setup_data.fields.data),
# Windows can and will send SETUP packets to this device with
# wLength > 255. Pretend the request length is 255 in this case
# since we don't ever send packets > 255 back. This avoids
# interpreting wLength as modulo 256.
7: If(usb.setup_data.fields.data > 0, NextValue(wLength, 255))
# 7: wLength.eq(Cat(wLength[0:8], data_recv_payload_delayed)),
}),
usb.setup_data.we.eq(1)
Expand Down