Skip to content

Ignore unknown WHB04 button codes#677

Draft
righteousgambit wants to merge 2 commits into
Carvera-Community:developfrom
righteousgambit:agent/ignore-invalid-whb04-buttons
Draft

Ignore unknown WHB04 button codes#677
righteousgambit wants to merge 2 commits into
Carvera-Community:developfrom
righteousgambit:agent/ignore-invalid-whb04-buttons

Conversation

@righteousgambit

Copy link
Copy Markdown

Closes #668

Summary

  • parse the two WHB04 button slots independently
  • ignore unknown nonzero button values, matching the existing defensive behavior for transient axis and step-selector values
  • preserve and dispatch any valid button carried by the same packet
  • add focused STOP/RESET coverage for both button-slot orderings
  • add the unreleased changelog entry

The change is intentionally limited to enum values the controller does not recognize. Known buttons and normal release handling are unchanged.

Validation

Validated against develop@2ea66c10e96d88013a04441134d3d4f8e8c88510 with Python 3.11:

  • regression test on the base: 4 failed, all at Button(0xFF)
  • regression test with this change: 4 passed
  • ruff check passed for the source and test
  • git diff --check passed

Targeted command:

poetry run python -m pytest -q tests/unit/test_whb04_input.py

Changelog

- Fixed: Ignore unknown WHB04 button values without reconnecting or dropping valid paired inputs

Real branch verification

The repository's locked Poetry environment was installed from poetry.lock. The targeted suite passed on real fork commit 51de21689dcf, whose sole parent is pinned upstream develop@2ea66c10e96d88013a04441134d3d4f8e8c88510.

poetry run python -m pytest -q tests/unit/test_whb04_input.py

Result: 4 passed.

Quality gates on the real branch:

  • Ruff check: passed
  • Ruff format --check: passed
  • git diff --check 2ea66c10e96d88013a04441134d3d4f8e8c88510..51de21689dcf7bf98c0f2db0a9136a2ada91114e: passed

@SergeBakharev

Copy link
Copy Markdown
Contributor

This will fail CI driven tests until we install the appropriate libusb library into the runner. On the Linux runner it needs libhidapi-hidraw0. This would be met by running scripts/install_linux_prereqs.sh

Can you please revise the CI workflow for the quality gate to do this?

@righteousgambit

Copy link
Copy Markdown
Author

Revised in commit dba9568: the Quality Gate now runs poetry run ./scripts/install_linux_prereqs.sh after bootstrapping Poetry, while retaining the explicit Xvfb/OpenGL packages needed by the test job.

Local verification:

  • tests/unit/test_whb04_input.py: 4 passed
  • Ruff check and format: passed
  • strict machine-layer mypy: passed
  • import-linter: passed
  • workflow validation and shell syntax: passed

The exact-head Quality Gate run is currently awaiting upstream approval (action_required, zero jobs): https://github.com/Carvera-Community/Carvera_Controller/actions/runs/29295919067

Once approved, I will verify that collection proceeds past the prior native hidapi import failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants