Skip to content

Return errors for undelivered HID reports - #1554

Draft
BenDManning wants to merge 4 commits into
jetkvm:fix/hidg0-write-timeout-recoveryfrom
BenDManning:fix/hid-report-acknowledgement
Draft

Return errors for undelivered HID reports#1554
BenDManning wants to merge 4 commits into
jetkvm:fix/hidg0-write-timeout-recoveryfrom
BenDManning:fix/hid-report-acknowledgement

Conversation

@BenDManning

@BenDManning BenDManning commented Aug 23, 2026

Copy link
Copy Markdown

Stacked on #1516 so its recovery work stays the starting point. This is not a competing PR to dev.

The additional contract needed by BenDManning/jetkvm-mcp#146 is synchronous: a report may only be acknowledged after its HID endpoint accepts the complete write. Later recovery cannot turn an already dropped report into success.

Changes:

  • require USB state configured before attempting keyboard, absolute mouse, relative mouse, or wheel reports;
  • return temporary HID errors and the first write timeout instead of suppressing them;
  • reject reports sent to disabled keyboard or mouse endpoints;
  • treat short writes as failures;
  • retain only successfully written keyboard state, preventing a rejected keyboard report from being replayed later by the recovery probe;
  • preserve Escalate USB recovery when keyboard HID writes time out #1516 recovery and make its timeout streak observe every HID endpoint, even after the failed file handle closes.

Tests deterministically fill a pipe to stall each endpoint and verify the first report returns os.ErrDeadlineExceeded. Companion cases read the exact bytes for every successful/acknowledged report. The common RPC/gadget seam verifies rejection for every non-configured USB state and exact write-error propagation.

Local checks:

  • GOMODCACHE=/tmp/jetkvm-kvm-146-gomod GOCACHE=/tmp/jetkvm-kvm-146-gocache go test -race ./internal/usbgadget -count=1
  • GOMODCACHE=/tmp/jetkvm-kvm-146-gomod GOCACHE=/tmp/jetkvm-kvm-146-gocache go vet ./internal/usbgadget
  • git diff --check

Independent review at exact head 2408a67f23a69f04c2758588f01ee836bf7222fb:

  • Standards: 0 findings after the duplicated-test-case finding was resolved
  • Spec: 0 findings; physical/post-install gates remain intentionally outstanding

Upstream checks at that exact head:

  • Build and test: pass
  • Go: pass
  • UI: pass
  • CLA: pass

No firmware was installed or flashed, and no device mutation occurred.

@CLAassistant

CLAassistant commented Aug 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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