Skip to content

Navigation Menu

Sign in
Sign up

feat(gearhub): GearHub-V5 driver + Attack Shark R2 - #72

Merged
snekxs merged 3 commits into
OpenMouse-Project:main from
onyxhq-dev:feat/gearhub-v5-attack-shark-r2
Sep 7, 2026
Merged

feat(gearhub): GearHub-V5 driver + Attack Shark R2 #72
snekxs merged 3 commits into
OpenMouse-Project:main from
onyxhq-dev:feat/gearhub-v5-attack-shark-r2

Conversation

@onyxhq-dev

@onyxhq-dev onyxhq-dev commented Sep 7, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

What

Splits the lingbao driver into a vendor-neutral GearHub-V5 codec
(src/gearhub/) and WebHID driver (src/drivers/gearhub/), and adds
Attack Shark R2 support.

The R2 and the Lingbao M5 Pro ship on the same MicLink/mlzn ODM platform
(qmk.top's "GearHub-V5") and enumerate with the same VID:PID
0x3151:0x402D
. Driver selection can't tell them apart, so one driver
claims the pair and identifies the model from the GET_USB_VERSION device
id after connecting - the same key GearHub's own bundle uses (M5 Pro 2285,
R2 1893). An unrecognised id falls back to the M5 Pro profile, so the
existing M5 Pro path does not regress.

R2 features (verified on retail hardware, 2.4 GHz receiver)

notes
identity PixArt PAW3950, 42000 DPI, 8000 Hz, firmware v2.01
DPI stages OPTIONPARAM1 (unchanged from the M5 Pro path)
report rate was written with a phantom 0x03/0x83 opcode the firmware silently ignores; now read-modify-writes the OPTIONPARAM0 block (GET 0xD3 / SET 0x53, byte 9, bitmask codes 1000->1 ... 8000->129)
lift-off OPTIONPARAM0 byte 52, index into the sensor's stop list
debounce OPTIONPARAM0 byte 10
straight / ripple correction OPTIONPARAM0 byte 53 / flags-word bit 2
2.4 GHz + Bluetooth standby time OPTIONPARAM0 bytes 44-45 / 40-41 (seconds)
button remapping GET/SET_KEYMATRIX (0xD0 / 0x50), 6 buttons, mouse functions only (Left/Right/Middle/Back/Forward/DPI/Disabled) - matches OpenMouse's generic remapper

GET_KEYMATRIX is the one read with no echo byte, so its reply check is
relaxed to the all-zero guard only.

Other changes

  • waitReady's retry window 5 -> 8, and GET_KEYMATRIX retries once
    (it's the last exchange in readStatus and the relay is more likely to
    miss its ready window under load). This also makes the M5 Pro relay path
    a little more tolerant.
  • registry.ts / fantech / vendors.ts repointed to
    @openmouse/protocol/gearhub; tsconfig paths + package.json exports
    updated; lingbao/ removed.

Not tested

  • M5 Pro wired mode (PID 0x4026) - unchanged by this PR, though its
    transport entry moved.

R2 wired mode (PID 0x4026) has since been confirmed on hardware.

Checks

npm run check green - full suite 1102 tests.

Split the Lingbao M5 Pro driver into a vendor-neutral GearHub-V5 codec
(src/gearhub/) and WebHID driver (src/drivers/gearhub/), and add Attack
Shark R2 support. Both mice ship on the MicLink/mlzn ODM platform and share
VID:PID 0x3151:0x402D; they are told apart by the GET_USB_VERSION device id
(M5 Pro 2285, R2 1893) - the same key GearHub's own bundle uses. An
unrecognised id falls back to the M5 Pro profile, so nothing regresses.
R2 support, verified on retail hardware over the 2.4 GHz receiver:
- identity: PixArt PAW3950, 42000 DPI, 8000 Hz, firmware v2.01
- report rate: was written with a phantom 0x03/0x83 opcode the firmware
 ignores; now read-modify-writes the OPTIONPARAM0 block (GET 0xD3 / SET
 0x53, byte 9, bitmask codes)
- lift-off, debounce, straight/ripple correction, 2.4G + BT standby time:
 all fields of the same OPTIONPARAM0 block
- button remapping: GET/SET_KEYMATRIX (0xD0 / 0x50), 6 buttons, mouse
 functions only (Left/Right/Middle/Back/Forward/DPI/Disabled)
waitReady's retry window went 5 -> 8 and GET_KEYMATRIX retries once, which
also makes the M5 Pro relay path more tolerant under load. M5 Pro wired
mode (PID 0x4026) and the R2's wired mode were not tested.
registry.ts / fantech / vendors repointed to @openmouse/protocol/gearhub;
tsconfig paths and package exports updated. Full suite (1102 tests) green.
Claude-Session: https://claude.ai/code/session_01GbCML9iSWvPq9hweRx5wAn 
onyxhq-dev and others added 2 commits September 7, 2026 08:01
Resolve conflict in src/drivers/vendors.ts: keep LOGITECH_BLUETOOTH_FILTERS
from main alongside GEARHUB_HID_FILTERS, dropping the now-superseded
LINGBAO_HID_FILTERS (this branch already renamed/replaced the lingbao
driver with gearhub).
Claude-Session: https://claude.ai/code/session_01Dzm4PG7ruKhs5UygrBT4ye 
snekxs merged commit 3e044d0 into OpenMouse-Project:main Sep 7, 2026
1 check passed
snekxs pushed a commit to OpenMouse-Project/openmouse that referenced this pull request Sep 7, 2026
The R2 driver lands in OpenMouse-Project/mouse-protocol#72 (new gearhub
family). This wires up the OpenMouse side:
- supported-mice.ts: R2 row bridge -> supported. It is a GearHub-V5 ODM
 mouse on VID 0x3151 / PID 0x402D (shared with the Lingbao M5 Pro
 receiver); the gearhub driver identifies it by the protocol device id
 1893. PixArt PAW3950, 42000 DPI, 8000 Hz. DPI, polling, lift-off,
 debounce, move-correction, sleep and 6-button remapping all verified on
 hardware over the 2.4 GHz receiver.
- traits.ts: gearhub family entry (advancedSection + sleep + debounce), so
 the shared advanced/sleep/debounce cards and the generic button remapper
 render. Plain flags, not direct-mode - the driver publishes its own
 debounce/sleep option lists.
- device-images.ts: name-fallback mapping "Attack Shark R2" ->
 attackshark-r2.png. Can't key on PID 0x402D (shared with the M5 Pro), so
 it resolves from the reported name. Falls back to the placeholder until a
 maintainer uploads the render to the devices bucket; provenance stub
 added to public/devices/README.md.
Requires mouse-protocol#72 first; the @openmouse/protocol lockfile entry
needs a bump once that merges.
https://claude.ai/code/session_01GbCML9iSWvPq9hweRx5wAn 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /