UDEFX2: Convert g_UsbConfigDescriptorSet into a typed struct - #44
Open
forderud wants to merge 2 commits into
Open
UDEFX2: Convert g_UsbConfigDescriptorSet into a typed struct#44forderud wants to merge 2 commits into
forderud wants to merge 2 commits into
Conversation
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.
Contributor
Author
|
@xxandy Would it be possible for you to consider this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_DESCRIPTORandUSB_ENDPOINT_DESCRIPTORhave 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.