glorious: fix classic-line connection and write failures on a real Model O 2 Wired - #102
Closed
onyxhq-dev wants to merge 2 commits into
Closed
onyxhq-dev wants to merge 2 commits into
onyxhq-dev wants to merge 2 commits into
Conversation
…ng 0 A real 0x320f:0x823a (Model O V2 Wired) carried its config channel as numbered report 7, not the unnumbered report every other classic-family device uses - isSupported() rejected it outright since the check was hardcoded to report id 0. Now discovered per device at connect time and used for every send/ receive call. WebHID takes the report id separately from the payload bytes, so existing devices (report id 0) are unaffected.
Connecting to the real 0x320f:0x823a unit worked after the report-id fix, but every write then failed with "Failed to write the feature report.": its numbered report 7 declares a shorter byte length than the 64-byte buffer every payload builder in glorious-classic/index.ts assumes, and WebHID rejects a feature report whose length does not match the device's own descriptor. Same fix shape as the report-id discovery: read the declared length off the same collection at connect time and resize (truncate or zero-pad) every payload to fit before sending. The actual command bytes are always well under the shortest length seen in practice, so truncating never touches meaningful data.
Contributor
Author
|
Closing - the report-id/length fix connects the device and stops the write from erroring, but a diagnostic just confirmed the mouse doesn't actually apply any of it (DPI/polling rate unchanged). The 263-byte report needs its real byte layout captured before this is actually correct; reopening once that's sorted. |
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.
Fixes a real 0x320f:0x823a ("Model O 2 Wired Mouse") unit that could not connect at all, then could not write any setting once it could.
Two bugs found in sequence, both from user-submitted diagnostics rather than physical hardware:
Connection failure. The driver assumed the config channel is always the unnumbered feature report (id 0), but this unit carries it as numbered report 7.
isSupported()/the constructor now discover the real report id from the device's own collections at connect time instead of assuming.Every write then failed with "Failed to write the feature report." The driver builds every payload at a fixed 64 bytes (true for every previously-confirmed classic-line device), but this unit's report 7 declares a 263-byte length in its own descriptor. WebHID rejects a feature-report write whose length doesn't match the device's declared length. Payloads are now resized (truncated or zero-padded) to the discovered length before sending.
Both fixes read the real values from the device's descriptor rather than hardcoding a second assumption, so any other classic-line unit with its own report id/length combination should be covered by the same code path.
Confirmed working against the real hardware after these two fixes.