Skip to content

Add framing and versioning to the app-to-UHID event protocol #20

Description

@guaje

Hi @anasvhora284, this follow-up comes from strengthening UHID event decoding in #10.

Background

The current local-socket protocol sends an event type followed by a fixed-size payload. It has no frame length or protocol version. The decoder can identify a truncated event, but an extra or missing byte may misalign the stream and cause every following byte to be interpreted as the wrong event.

The socket is local and peer-verified, so this is mainly a reliability and compatibility concern rather than a request for network-level complexity.

Goal

Define a small framed and versioned event format so malformed or future events can be rejected or skipped without corrupting the rest of the stream.

Proposed scope

  • Inventory the app-side writer and UHID-side reader for every current event.
  • Define a compact header containing at least protocol version, event type, and payload length.
  • Set a conservative maximum payload length before allocating or reading data.
  • Validate exact payload lengths for known event types.
  • Decide whether unknown event types can be skipped safely by length.
  • Include shutdown behavior in the framed protocol design.
  • Define compatibility and rollout behavior while the app and generated UHID DEX may be on different versions.
  • Add deterministic codec tests for valid, truncated, oversized, unknown, and consecutive frames.
  • Test that one malformed frame does not misalign the next valid frame where recovery is supported.
  • Update the generated UHID DEX asset through the normal build task.

Non-goals

  • Adding encryption or checksums without a demonstrated need on the peer-verified local socket.
  • Depending on Android sockets or hardware in ordinary JVM tests.
  • Mixing pointer sensitivity or scroll-speed settings into the wire-format change.

The format should remain intentionally small and should be agreed before implementation because both sides must migrate together.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions