Skip to content

etas: mask filter can_id with can_mask before passing it to BOA - #2178

Merged
zariiii9003 merged 1 commit into
hardbyte:mainfrom
zariiii9003:etas-mask-filter-value
Dec 1, 2026
Merged

zariiii9003 merged 1 commit into
hardbyte:mainfrom
zariiii9003:etas-mask-filter-value

Conversation

@zariiii9003

Copy link
Copy Markdown
Collaborator

Summary of Changes

EtasBus._apply_filters passed the raw can_id to BOA as frameIDValue. The ETAS BOA OCI CAN API (BOA v2.50.0, OCI_CANRxFilterEx::frameIDValue) allows only the lower 11 (standard) or 29 (extended) bits and states that "setting bits out of range will result in a filter that can not pass any frames". A filter whose can_id has such bits outside can_mask therefore received nothing. _recv_internal reports filtered=True, so no software filter catches this and frames are dropped without any error.

 for each filter:
-  frameIDValue = can_id
+  frameIDValue = can_id & can_mask
   frameIDMask  = can_mask

This matches the rule BusABC._matches_filters already applies: can_id bits outside can_mask are ignored. Filters whose can_id is already within can_mask (including the accept-all filter) are unchanged.

  • Fix in can/interfaces/etas/__init__.py
  • Test test_filter_id_bits_outside_mask_are_ignored in test/test_etas.py
  • News fragment doc/changelog.d/+etas-filter-id-mask.fixed.rst

Evidence, filter {"can_id": 0x18FF0123, "can_mask": 0x7FF, "extended": False}:

installed frameIDValue test_filter_id_bits_outside_mask_are_ignored
Before 0x18FF0123 (out of range, passes no frames) ❌ [(419365155, 2047, 0, 5)] != [(291, 2047, 0, 5)]
After 0x123 ✅

Related Issues / Pull Requests

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • Other (please describe):

Checklist

  • I have followed the contribution guide.
  • I have added or updated tests as appropriate.
  • I have added or updated documentation as appropriate.
  • I have added a news fragment for towncrier.
  • All checks and tests pass (tox).

@zariiii9003
zariiii9003 merged commit 86e70bc into hardbyte:main Dec 1, 2026
24 of 26 checks passed
@zariiii9003
zariiii9003 deleted the etas-mask-filter-value branch December 1, 2026 20:24
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.

1 participant