From e3e9a6ae82a339ed65209050a7e38c163842bc2f Mon Sep 17 00:00:00 2001 From: Pascal COMBES Date: Mon, 27 Feb 2023 21:34:55 +0100 Subject: [PATCH 1/3] Use the last usage for remaing reports This is implemented accoring to the "Device Class Definition for HID" version 1.11: In the remarks in section 6.2.2.8, it is stated: "While *Local* items do not carry over to the next *Main* item, they may apply to more than one control within a single item. For example, if an *Input* item defining five controls is preceded by three *Usage* tags, the three usages would be assigned sequentially to the first three controls, and the third usage would also be assigned to the fourth and fifth controls." --- hid_parser/__init__.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/hid_parser/__init__.py b/hid_parser/__init__.py index 448d46f..77eb2c4 100644 --- a/hid_parser/__init__.py +++ b/hid_parser/__init__.py @@ -782,20 +782,11 @@ def _append_items( ) self._append_item(offset_list, pool, report_id, item) else: - if len(usages) != report_count: - error_str = f'Expecting {report_count} usages but got {len(usages)}' - warnings.warn(HIDComplianceWarning(error_str), stacklevel=2) - if len(usages) > report_count: - report_count = len(usages) - else: - missing_usage_count = report_count - len(usages) - usages += [] * missing_usage_count - - for usage in usages: + for r in range(0, report_count): item = VariableItem( offset=offset_list[report_id], size=report_size, - usage=usage, + usage=usages[min(r, len(usages) - 1)], flags=flags, **data, ) From 6679221bb67b38863860ae652eb51942bdfca6f6 Mon Sep 17 00:00:00 2001 From: Pascal COMBES Date: Tue, 28 Feb 2023 20:09:48 +0100 Subject: [PATCH 2/3] .gitignore file --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c85c697 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Caches: +__pycache__/ From a27d550abf197c91183552e82dc335bd87a57aec Mon Sep 17 00:00:00 2001 From: Pascal COMBES Date: Tue, 17 Nov 2026 21:46:47 +0100 Subject: [PATCH 3/3] Update python versions in workflow files and nox file. --- .github/workflows/checks.yml | 2 +- .github/workflows/tests.yml | 2 +- noxfile.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c8135ae..9f8d6c9 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - python: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15'] env: VIRTUAL_ENV: .venv steps: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c397359..d268e97 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - python: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15'] env: VIRTUAL_ENV: .venv steps: diff --git a/noxfile.py b/noxfile.py index a3d5a56..d78d28e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -18,7 +18,7 @@ def mypy(session): session.run('mypy', '-p', 'hid_parser') -@nox.session(python=['3.9', '3.10', '3.11', '3.12', '3.13']) +@nox.session(python=['3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15']) def test(session): htmlcov_output = os.path.join(session.virtualenv.location, 'htmlcov') xmlcov_output = os.path.join(session.virtualenv.location, f'coverage-{session.python}.xml')