Skip to content

Commit 65a0961

Browse files
authored
hid_parser: replace inconsistent usage length InvalidReportDescriptor error with HIDComplianceWarning
1 parent 8110427 commit 65a0961

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hid_parser/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -788,11 +788,11 @@ def _append_items(
788788
else:
789789
if len(usages) != report_count:
790790
error_str = f'Expecting {report_count} usages but got {len(usages)}'
791-
if len(usages) == 1:
792-
warnings.warn(HIDComplianceWarning(error_str))
793-
usages *= report_count
791+
warnings.warn(HIDComplianceWarning(error_str))
792+
if len(usages) > report_count:
793+
report_count = len(usages)
794794
else:
795-
raise InvalidReportDescriptor(error_str)
795+
usages += [] * report_count - len(usages)
796796

797797
for usage in usages:
798798
item = VariableItem(

0 commit comments

Comments
 (0)