Skip to content

serial: do not read a payload for remote frames - #2151

Open
DanShinde wants to merge 2 commits into
hardbyte:mainfrom
DanShinde:serial-remote-frame-dlc
Open

DanShinde wants to merge 2 commits into
hardbyte:mainfrom
DanShinde:serial-remote-frame-dlc

Conversation

@DanShinde

Copy link
Copy Markdown
Contributor

Summary of Changes

  • SerialBus.send() writes a remote frame with its DLC (the requested length) and no payload, but _recv_internal() read DLC payload bytes for every frame. A remote frame with DLC > 0 therefore ate the end-of-frame byte and the start of the next frame, and recv() failed with TypeError: ord() expected a character once the port ran dry. Reproducible with SerialBus("loop://") and Message(is_remote_frame=True, dlc=8).
  • _recv_internal() now reads no payload when the RTR flag is set. The existing remote frame test only used DLC 0; the new test sends DLC 1 and 8 through the mock and loop:// buses.
  • The serial frame docs now say how remote frames are encoded.

Related Issues / Pull Requests

  • None found.

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).

send() writes a remote frame with its DLC (the requested length) but no
payload. _recv_internal() then read DLC payload bytes, so a remote frame
with DLC > 0 swallowed the end-of-frame byte and the following frame,
and recv() failed with TypeError.

Read no payload for remote frames and document the encoding.
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