Skip to content

feat: add Redgear X13 Pro settings driver - #233

Merged
snekxs merged 4 commits into
OpenMouse-Project:mainfrom
AniketSpecter:feat/redgear-x13-pro
Nov 6, 2026
Merged

snekxs merged 4 commits into
OpenMouse-Project:mainfrom
AniketSpecter:feat/redgear-x13-pro

Conversation

@AniketSpecter

@AniketSpecter AniketSpecter commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds the owner-confirmed wired Redgear X13 Pro (1B80:B412, MECHREV Gaming Mouse / Jtech) with DPI, polling, corrected static RGB and standard button remapping. Direct Edge WebHID opens but cannot read the feature report on the tested Windows system; OpenMouse Bridge beta.15 works. The client falls back to identity with settings disabled on transport failure.

The codec uses independently recorded native reads and original vendor API arguments captured with every USB write blocked. It reads fresh, preserves unknown bytes, verifies complete replies and serializes transfers. Button edits preserve the full report, protect unknown/macro records and refuse to remove the last standard primary click. Physical channel trials identified R,B,G order; swapping the last two channels fixes the vendor UI's incorrect green/blue labels.

Hardware acceptance on this exact wired mouse:

  • 4000 -> 2400 -> 4000 DPI, native and actual local OpenMouse/Bridge UI.
  • 1000 -> 500 -> 1000 Hz, native and actual local OpenMouse/Bridge UI.
  • Three static channel writes with owner visual observations, exact read-back and original restoration; corrected green also exercised through the app and restored.
  • Forward -> Back -> Forward, native and actual local app; complete report-4 SHA-256 matches target/restoration.
  • Owner unplugged for five seconds and reconnected; final settings report and full button-report hash were retained.

Validation: protocol npm run check passes 2504 tests; consuming OpenMouse npm run check passes 383 tests with this local package. Twenty-one focused new tests cover framing, invalid values, independent captures, preservation, serialization, mismatch/failure handling, timeouts, disconnects and primary-click protection. No proprietary binary, raw macro report, serial or device path is included. Firmware version is unknown; USB revision is not reported as firmware.

Scope is deliberately limited: no macros/M-Macro, hardware profile banks, DPI indicator-colour editing, animated effects/brightness/speed, firmware or calibration. Overall verified stays false; narrow feature acceptance flags and docs describe actual evidence. Windows pointer/scroll/double-click controls belong to the separate native utility, not this HID driver.

Minimal sanitized fixtures and the standalone utility: https://github.com/AniketSpecter/redgear-x13-pro . Matching app PR: OpenMouse-Project/openmouse#1108

Summary by CodeRabbit

  • New Features
    • Added support for Redgear X13 Pro mice, including DPI, polling-rate, static-color, and button-mapping controls when the device’s settings are available.
    • Added Redgear protocol utilities for reading status and encoding settings.
  • Documentation
    • Added hardware testing notes covering verified behavior, limitations, and unsupported features.
  • Tests
    • Added coverage for device communication, settings, lighting, and button mappings.

Note

Add Redgear X13 Pro settings driver with HID client and codecs

  • Adds RedgearX13HidClient in hid.ts. It matches the X13 Pro VID/PID and status collection, reads status, and writes DPI, polling rate, static color, and button assignments with read-back verification. Transport failures, timeouts, or mismatches disable writes until reconnect.
  • Adds protocol codecs in index.ts and buttons.ts for DPI, polling rate, static color (corrected physical channel order), and button records. The button encoder refuses to overwrite unknown/macro records and protects the last left-click assignment.
  • Registers the driver in registry.ts and the vendor ID and HID picker filter in vendors.ts. Exposes the module via the redgear namespace in index.ts and the ./redgear subpath in package.json.
  • Adds extensive mocked-HID and codec tests, plus a hardware acceptance report in redgear-x13-pro-testing.md.
  • Behavioral Change: MouseStatus.brand in mouse-types.ts now accepts Redgear; support metadata is marked verified: false.

Macroscope summarized a267c7c.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9e12671 and a267c7c.

Files selected for processing: 15

  • docs/redgear-x13-pro-testing.md
  • package.json
  • src/drivers/mouse-types.ts
  • src/drivers/redgear/buttons.test.ts
  • src/drivers/redgear/hid.test.ts
  • src/drivers/redgear/hid.ts
  • src/drivers/redgear/settings.test.ts
  • src/drivers/redgear/status-fixture.ts
  • src/drivers/registry.test.ts
  • src/drivers/registry.ts
  • src/drivers/vendors.ts
  • src/index.ts
  • src/redgear/buttons.ts
  • src/redgear/index.ts
  • tsconfig.json

No actionable comments were generated in the recent review.

Walkthrough

Adds Redgear X13 Pro protocol codecs and a HID client for status reads and supported settings and button updates. The driver registry and package exports include Redgear support. Hardware acceptance results document one tested device; the overall verified flag remains false.

Changes: Redgear X13 Pro support

Layer / File(s) Summary
Status, settings, and button codecs
src/redgear/index.ts, src/redgear/buttons.ts, src/drivers/redgear/settings.test.ts, src/drivers/redgear/buttons.test.ts, src/drivers/redgear/status-fixture.ts
Adds report and payload decoding, DPI and polling-rate settings, static-color handling, and button mapping codecs. Tests cover captured payloads, validation, and preservation of unrelated bytes.
HID client reads and writes
src/drivers/redgear/hid.ts, src/drivers/redgear/hid.test.ts
Adds device matching, status reads, and serialized settings and button writes. Changed reports are read back for verification. Tests cover transport failures, timeouts, and disconnects.
Driver registration and package exposure
src/drivers/vendors.ts, src/drivers/registry.ts, src/drivers/registry.test.ts, src/drivers/mouse-types.ts, src/index.ts, package.json, tsconfig.json, docs/redgear-x13-pro-testing.md
Registers Redgear’s HID identifiers and client, adds the brand and package exports, and records hardware acceptance results and test limitations.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Application
  participant DriverRegistry
  participant RedgearX13HidClient
  participant HIDDevice
  Application->>DriverRegistry: Match supported X13 device
  DriverRegistry->>RedgearX13HidClient: Create client
  Application->>RedgearX13HidClient: Read status or update setting
  RedgearX13HidClient->>HIDDevice: Read feature report 3
  HIDDevice-->>RedgearX13HidClient: Return status report
  RedgearX13HidClient->>HIDDevice: Write changed report
  RedgearX13HidClient->>HIDDevice: Read report back for verification
Loading

Suggested reviewers: snekxs

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 41.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 12 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: adding a settings driver for the Redgear X13 Pro. It is concise and specific.
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: Docstring Coverage

Explanation

Docstring coverage is 41.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 12 files. (3 skipped: 3 unsupported.)

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

  • Configuration used: Repository: OpenMouse-Project/mouse-protocol/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aa0a178e-ac1f-42c2-b273-466d5b5b989a
📥 Commits

Reviewing files that changed from the base of the PR and between e53af6d and 9e12671.

📒 Files selected for processing: 15

  • docs/redgear-x13-pro-testing.md
  • package.json
  • src/drivers/mouse-types.ts
  • src/drivers/redgear/buttons.test.ts
  • src/drivers/redgear/hid.test.ts
  • src/drivers/redgear/hid.ts
  • src/drivers/redgear/settings.test.ts
  • src/drivers/redgear/status-fixture.ts
  • src/drivers/registry.test.ts
  • src/drivers/registry.ts
  • src/drivers/vendors.ts
  • src/index.ts
  • src/redgear/buttons.ts
  • src/redgear/index.ts
  • tsconfig.json

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

@github-actions github-actions Bot added area: protocol Protocol codecs and shared types area: drivers Device drivers and transport integration area: tests Protocol and driver tests area: documentation Documentation area: dependencies Dependency manifests and lockfiles area: ci Automation and build configuration labels Oct 15, 2026
@AniketSpecter
AniketSpecter marked this pull request as ready for review October 15, 2026 23:32
Copilot AI balanced review requested due to automatic review settings October 15, 2026 23:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@snekxs
snekxs force-pushed the feat/redgear-x13-pro branch from 9e12671 to 4c23c8b Compare November 6, 2026 07:25
@snekxs

snekxs commented Nov 6, 2026

Copy link
Copy Markdown
Member

Rebased onto main, preserving all registry/vendor/type entries. Fixed optional button-read failures disabling settings, reset pending reads and the transfer queue on close, reused Redgear identity constants, and aligned import extensions and brand union ordering. Added regression tests; build, all 2,931 tests, and package dry run pass (no lint script is configured).

Comment thread src/drivers/redgear/hid.ts Resolved
Comment thread src/drivers/redgear/hid.ts Resolved
@macroscopeapp

macroscopeapp Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Approvability

Verdict: Approved at a267c7c

Macroscope's review found this PR approvable — Adds Redgear X13 Pro settings support with narrowly matched device detection and verified, preservation-focused writes. Documented hardware restoration trials and failure lockouts limit risk, while firmware, calibration and macro editing remain excluded.

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.

Comment thread src/drivers/redgear/hid.ts Resolved
Comment thread src/drivers/redgear/hid.ts Resolved
@snekxs
snekxs force-pushed the feat/redgear-x13-pro branch 3 times, most recently from 50e00b2 to 8f10523 Compare November 6, 2026 07:50
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Nov 6, 2026
AniketSpecter and others added 4 commits November 6, 2026 01:55
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Keep optional button read failures from disabling settings, reset pending reads and the transfer queue on close, and use shared identity constants and source import conventions. Add regression coverage for optional reads, reconnection, and picker identity.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Treat optional transfer timeouts as connection failures while tolerating completed optional-report rejections. Validate settings and button payloads inside transfer failure handling so malformed read-backs clear cached state and block queued writes until reconnect.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Wait for an in-flight open to finish and close its cancelled handle before close returns. Accept both ID-less and correctly ID-prefixed feature replies for status and button reads while rejecting unexpected IDs, including write verification.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@snekxs
snekxs force-pushed the feat/redgear-x13-pro branch from 8f10523 to a267c7c Compare November 6, 2026 07:57
@macroscopeapp
macroscopeapp Bot dismissed their stale review November 6, 2026 07:57

Dismissing prior approval to re-evaluate a267c7c

@snekxs
snekxs merged commit f782974 into OpenMouse-Project:main Nov 6, 2026
7 checks passed
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 0.57.0 🎉

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

area: ci Automation and build configuration area: dependencies Dependency manifests and lockfiles area: documentation Documentation area: drivers Device drivers and transport integration area: protocol Protocol codecs and shared types area: tests Protocol and driver tests released type: enhancement PR title category: enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants