Skip to content

UDEFX2: Convert g_UsbConfigDescriptorSet into a typed struct - #44

Open
forderud wants to merge 2 commits into
xxandy:masterfrom
forderud:g_UsbConfigDescriptorSet
Open

UDEFX2: Convert g_UsbConfigDescriptorSet into a typed struct#44
forderud wants to merge 2 commits into
xxandy:masterfrom
forderud:g_UsbConfigDescriptorSet

Conversation

@forderud

@forderud forderud commented May 6, 2024

Copy link
Copy Markdown
Contributor

Follow-up to #43.

It's safer to work directly with typed data instead of bytes-arrays. Remove associated NT_ASSERT checks that are now redundant, since they are checking obviously correct struct members.

Both USB_CONFIGURATION_DESCRIPTOR and USB_ENDPOINT_DESCRIPTOR have a USHORT member. Two UCHAR entries then need to be combined to form the USHORT member. This needs to be done in a little-endian way so that {0xAB, 0xCD} becomes 0xCDAB.

Fredrik Orderud added 2 commits April 5, 2024 09:49
Done to reduce the a amount of "magic" values in the implementation, and make the code easier to follow.

Also, remove g_UsbDeviceDescriptor from header, since it's not references in any other source file.
It's safer to work directly with typed data instead of bytes-arrays. Remove associated NT_ASSERT checks that are now redundant, since they are checking obviously correct struct members.

Both USB_CONFIGURATION_DESCRIPTOR and USB_ENDPOINT_DESCRIPTOR have a USHORT member. Two UCHAR entries then need to be combined to form the USHORT member. This needs to be done in a little-endian way so that {0xAB, 0xCD} becomes 0xCDAB.
@forderud

forderud commented Jun 6, 2024

Copy link
Copy Markdown
Contributor Author

@xxandy Would it be possible for you to consider this PR?

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.

1 participant