feat(wlmouse): expose the DPI stage table to the shared stage editor - #51
Closed
ydw1904 wants to merge 1 commit into
Closed
feat(wlmouse): expose the DPI stage table to the shared stage editor#51ydw1904 wants to merge 1 commit into
ydw1904 wants to merge 1 commit into
Conversation
The mouse has always sent its whole stage table in one packet and the driver has always decoded it, but only the active stage reached the app, so the panel could edit one DPI value where the vendor software edits six. The control app already ships a generic stage editor for exactly this shape (Keychron and Teevolution use it), so this reports `dpiStages`, `activeDpiStage`, and the `dpiStageEditor` hint, and adds the three setters that editor calls. `setDpiStageCount` and `setDpiStageValue` reuse the write `setDpi` was already making: the count and every stage travel together in one packet, so a value edit is a full table write either way. Editing a stage keeps a Y that already differs from X, because the shared editor shows a single value per stage and must not quietly undo a separate-axis setup. `setActiveDpiStage` writes a command that is not in any capture: it is the `0x82` read with the high bit cleared, which is how every other command in this driver pairs up. That guess is verified by reading the active stage back, and an unknown command comes back `unsupported`, so a wrong byte surfaces as an error rather than a silent no-op. It wants a run on real hardware before anyone trusts it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
WLmouse mice hold six onboard DPI stages and send the whole table in one
packet, and the driver has always decoded it — but only the active stage
reached the app, so OpenMouse could edit one DPI value where the vendor
software edits six.
The control app already ships a generic stage editor for exactly this shape
(Keychron M6 and Teevolution use it), so this reports
dpiStages,activeDpiStageand thedpiStageEditorhint, and adds the three settersthat editor calls.
How
setDpiStageCountandsetDpiStageValuereuse the writesetDpiwas alreadymaking: count and stages travel together in one packet, so a single-value edit
is a full table write either way. That write and its read moved into
writeStages/readStages, whichsetDpinow uses too.Editing one stage keeps a Y that already differs from X. The shared editor
shows a single value per stage, and it must not quietly flatten a separate-axis
setup.
The one guess
setActiveDpiStagewrites profile-page command0x02, which is not in anycapture. It is the
0x82read with the high bit cleared, which is how everyother command in this driver pairs up (
0x80/0x00,0x81/0x01,0x84/0x04,0x88/0x08,0x89/0x09,0x8a/0x0a). The write isverified by reading the active stage back, and the mouse answers an unknown
command with
unsupported, so a wrong byte surfaces as a plain error ratherthan a silent no-op — but it would be good to have someone else confirm it on
hardware before trusting it.
Testing
npm run checkclean,npm test829 passing.src/drivers/wlmouse/hid.test.tscover the table roundtrip, the Y-preservation rule, and the rejection paths, against a fake device
that now models a mutable stage table.
receiver (
36a7:a882), reporting the same six stages its vendor softwareshows (screenshot above).
Per-stage DPI colours are the obvious follow-up. The command that carries them
is still unknown, so they are deliberately out of scope here.
🤖 Generated with Claude Code