Skip to content

Possibility of parse errors in the ADK USB receive call #25

@psigen

Description

@psigen

https://github.com/platypusllc/firmware/blob/master/firmware/firmware.ino#L283

Currently, we assume that adk.read() will always receive the entire contents of a single command. This is not guaranteed, it could receive half of a packet, and append the other half to the beginning of the next read operation.

If this fragmentation continues, it can corrupt a chain of packets indefinitely if they happen to alias against the USB receive buffer size.

We should treat USB input like any other serial input:

  • read into the buffer
  • manually checking for EOL characters
  • process any completed substring
  • memmove() the unused remaining buffer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions