greatscottgadgets / python-usb-protocol

python library providing utilities, data structures, constants, parsers, and tools for working with USB data
BSD 3-Clause "New" or "Revised" License
56 stars 32 forks source link

descriptors: add types.descriptors.partial for parsing potentially incomplete data #9

Closed Qyriad closed 4 years ago

Qyriad commented 4 years ago

This re-allows parsing partial descriptors, which had previously been allowed until 7672fb522182dabe6afa71a1ee2653a792507359.

With this, whenever a descriptor format is created with DescriptorFormat(), it will automatically create a version of that format that supports parsing incomplete data as the attribute .Partial. So DeviceDescriptor.Partial is a copy of the device descriptor DescriptorFormat that supports partial parsing. These partial versions are re-exported in the types.descriptors.partial module.