Closed meeuw closed 1 year ago
Things will break when using the rest of the functionality when we don't parse, we should have checks for that. However, I think it would be better if instead of allowing the user to disable the parsing, to just delay the parsing until needed.
For that, we should probably turn
https://github.com/usb-tools/python-hid-parser/blob/main/hid_parser/__init__.py#L603-L605
into a NamedTuple
class _Pools(NamedTuple):
input = _ITEM_POOL
output = _ITEM_POOL
feature = _ITEM_POOL
And then make it a property, where we trigger the parsing when accessed
@property
def _pools(self) -> _Pools:
if not self._parsed:
self.__pools = _Pools({}, {}, {})
self._parse()
self._parsed = True
return self.__pools
After some hacking I found out that I actually need some information from _parse
and I shouldn't re-implement it.
I'll try to create another PR to see if I can fix the parser or at least let it fail gracefully.
I'd like to python-hid-parser with some descriptors that can't be parsed by the default parser (similar to #10).
With these changes
ReportDescriptor.print()
is usable though and allows me to extendReportDescriptor
and useself._iterate_raw
.