feat(keychron): claim the M6 with its own driver instead of Pulsar's - #128
Draft
ydw1904 wants to merge 1 commit into
Draft
feat(keychron): claim the M6 with its own driver instead of Pulsar's#128ydw1904 wants to merge 1 commit into
ydw1904 wants to merge 1 commit into
Conversation
The M6 driver in @openmouse/protocol is enough for the registry to detect
the mouse, but not for the app to drive it: the sidebar lists it as
"Keychron · Available" and activating it fails with
client.describeCollections is not a function
pulsarClient() is a negative check — any active client not listed in
DEDICATED is assumed to be a Pulsar client and routed into
showPulsarExplorer(), which calls describeCollections(), a method only the
Pulsar drivers have. A new driver class is therefore broken by default
until it is named here, and the error points nowhere near the cause.
KeychronM6HidClient joins NEEDS_OPEN, next to the Nape Pro's
KeychronHidClient: its open() is what attaches the input-report listener
its query/reply exchanges depend on, and NEEDS_OPEN feeds DEDICATED, so
one entry covers both.
Verified on a wired Keychron M6: the device connects and reports 800 DPI,
500 Hz, and battery, and a DPI change flashes to the mouse and reads back.
Needs the M6 driver from OpenMouse-Project/mouse-protocol#33.
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.
Why
The M6 driver in mouse-protocol is enough for the registry to detect the mouse, but not for the app to drive it. The sidebar lists it as "Keychron · Available", and activating it fails with:
pulsarClient()is a negative check: any active client not listed inDEDICATEDis assumed to be a Pulsar client and routed intoshowPulsarExplorer(), which callsdescribeCollections()— a method only the Pulsar drivers have. So a new driver class is broken by default until it is named in that list, and the error message points nowhere near the cause.This is not specific to any one transport: the M6 fails the same way in Chrome over WebHID as it does through OpenMouse Bridge.
What changes
KeychronM6HidClientjoinsNEEDS_OPEN, next to the Nape Pro'sKeychronHidClient. Itsopen()is what attaches the input-report listener its query/reply exchanges depend on, andNEEDS_OPENfeedsDEDICATED, so one entry covers both needs.Verification
Wired Keychron M6 on macOS. Before: sidebar row stuck at "Keychron · Available", activation throwing. After: connects and reports 800 DPI, 500 Hz, and battery, and a DPI change (800 → 1600 → 800) flashes to the mouse and reads back.
Locally
npm run buildandnpm testpass with the #33 driver installed.Worth considering separately
pulsarClient()treating "unclaimed" as "Pulsar" means every future driver hits this same trap, with an error that names a Pulsar-only method. Inverting it — an explicit Pulsar list, with unclaimed clients reported as unsupported — would turn a confusing runtime failure into an obvious one. Out of scope here.🤖 Generated with Claude Code