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

gateware.usb.request.windows: add MicrosoftOS10RequestHandler #251

Merged
merged 1 commit into from
May 17, 2024

Conversation

mndza
Copy link
Contributor

@mndza mndza commented May 16, 2024

This PR adds a request handler for Microsoft OS 1.0 descriptors.

greatscottgadgets/python-usb-protocol#41

Usage for a single interface:

Add OS string descriptor to the DeviceDescriptorCollection. The byte after MSFT100 defines the request value (bMS_VendorCode) for retrieving the OS descriptors:

descriptors.add_descriptor(get_string_descriptor("MSFT100\xee"), index=0xee)

Then add the request handler to the control endpoint:

msft_descriptors = MicrosoftOS10DescriptorCollection()

with msft_descriptors.ExtendedCompatIDDescriptor() as c:
    with c.Function() as f:
        f.bFirstInterfaceNumber = 0
        f.compatibleID          = 'WINUSB'
 
control_ep.add_request_handler(MicrosoftOS10RequestHandler(msft_descriptors, request_code=0xee))

NOTE: If LUNA complains about non-contiguous descriptors, you can pass avoid_blockram=True to the standard request handler as a temporary fix:

control_ep = usb.add_standard_control_endpoint(descriptors, avoid_blockram=True)

Copy link
Member

@mossmann mossmann left a comment

Choose a reason for hiding this comment

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

Great work! I've marked this ready for review and am merging this so we can merge Cynthion #92..

@mossmann mossmann merged commit 75cc3c2 into greatscottgadgets:main May 17, 2024
8 checks passed
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