Skip to content

fix(8bitdo): serialize r8 edits, flag silent receiver - #338

Merged
onyxhq-dev merged 1 commit into
OpenMouse-Project:mainfrom
higorhgon:fix/8bitdo-r8-receiver-and-edits
Dec 3, 2026
Merged

onyxhq-dev merged 1 commit into
OpenMouse-Project:mainfrom
higorhgon:fix/8bitdo-r8-receiver-and-edits

Conversation

@higorhgon

@higorhgon higorhgon commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #326, for two review findings that came after it was merged. The third finding there (encode only the known receiver queries) is already on main from aef7535.

  • A silent receiver is no longer reported as a sleeping mouse. When the link query gets no reply at all, readStatus now says the receiver did not answer and suggests replugging it. Before, it asked the user to move the mouse, which does not fix a receiver that is not responding. A valid "not linked" reply still gets the asleep note.
  • Setting changes no longer interleave. setDpiStageValue, setActiveDpiStage and setDpi read whole DPI tables, change one slot and write them back. The request queue kept single reports apart but not these read-modify-write-verify sequences, so two concurrent calls on one client could undo each other's stage and then fail verification. Each setter (polling and lift-off included) now runs as one exclusive operation; setDpi calls the shared stage writer inside its own operation, so it cannot deadlock on itself.

No frames, layouts or UI hints change.

Testing

  • npm run check passes (3583 tests, build, pack) with an English locale.
  • New test: two concurrent setDpiStageValue calls on a stateful fake receiver keep both changes on both axes. It fails without the serialization.
  • The silent-receiver test now expects the receiver note instead of the asleep one.
  • The driver's reads and writes were verified on an R8 N Edition for feat(8bitdo): add retro r8 driver #326; this change does not alter what is sent.

🤖 Generated with Claude Code

Note

Serialize 8bitdo HID settings edits and flag silent receiver

  • Adds an exclusive helper in hid.ts that chains settings operations through a settingsQueue promise, so polling rate, lift-off distance, active DPI stage, stage values, and setDpi run one at a time per client. A failed operation does not block later queued ones.
  • Extracts the stage-value write logic into a private writeStageValue method shared by the queued stage setters; setDpi now determines the active stage and writes its DPI inside a single queued operation.
  • readStatus now distinguishes a null link result (receiver did not answer, recommends reconnecting) from a linked-but-idle receiver (asleep or switched-off mouse).
  • Behavioral Change: status note for a non-answering receiver changes from the asleep message to a receiver-not-answering message; concurrent setting writes no longer interleave.

Macroscope summarized 031cbc5.

Summary by CodeRabbit

  • Bug Fixes
    • DPI stage changes made at the same time now preserve both updates instead of overwriting one another.
    • A failed settings change no longer prevents later changes from being applied.
    • Receiver status messages now distinguish between no reply and a mouse that is asleep or switched off.

- tell a silent receiver apart from a sleeping mouse
- run each setting change to completion before the next
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The 8BitDo HID client now serializes settings changes through a separate queue. Its receiver status note distinguishes a missing response from a reply indicating no link.

Changes: 8BitDo HID client

Layer / File(s) Summary
Serialize settings operations
src/drivers/8bitdo/hid.ts, src/drivers/8bitdo/hid.test.ts
Setting methods run through a separate queue. A failed operation does not stop later queued operations. The concurrent DPI-stage test checks that edits to slots 0 and 5 remain in both stage tables.
Distinguish receiver responses
src/drivers/8bitdo/hid.ts, src/drivers/8bitdo/hid.test.ts
A null link response produces a receiver-problem note. A non-null reply indicating no link retains the asleep-or-switched-off note.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: macroscopeapp

Merge Risk: Minimal · up to 031cb

This change makes setting updates run one at a time so concurrent edits no longer undo each other, and it separates a silent receiver from a sleeping mouse in the status note. I found no remaining merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names two changes: serializing R8 setting edits and flagging a silent receiver. Both appear in the raw summary and PR objectives. The title covers the main change and a second real change, s…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names two changes: serializing R8 setting edits and flagging a silent receiver. Both appear in the raw summary and PR objectives. The title covers the main change and a second real change, so it is specific and accurate. The title is concise and uses the conventional prefix format.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 28b0526 and 031cbc5.

Files selected for processing: 2

  • src/drivers/8bitdo/hid.test.ts
  • src/drivers/8bitdo/hid.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@macroscopeapp

macroscopeapp Bot commented Dec 3, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved at 031cbc5

Macroscope's review found this PR approvable — The change serializes existing R8 setting edits and gives clearer guidance when the receiver is unresponsive. Existing validation and device readback safeguards remain intact, with targeted regression coverage for concurrent DPI edits.

Notes:

  • Your repo's Minimum Blocking Severity is Off, so correctness findings do not automatically block approval.

You can add or adjust custom eligibility rules. Learn more.

@onyxhq-dev
onyxhq-dev merged commit fe60dbd into OpenMouse-Project:main Dec 3, 2026
5 checks passed
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 0.64.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants