-
Notifications
You must be signed in to change notification settings - Fork 328
FIX: Use correct data format for composite stick axes in HID layout builder #2245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…builder The generic HID layout builder made a faulty assumption that the X and Y axes of a composite "Stick" control always used a simple bitfield format (`SBIT`/`BIT`). This assumption is incorrect for many modern devices, most notably 6DoF controllers like the 3Dconnexion SpaceMouse, which report their axes as 16-bit shorts (`SHRT`). This bug caused the builder to apply the wrong data format, resulting in incorrect parsing and unusable stick input for these devices. This commit resolves the issue by replacing the brittle, hardcoded format logic with a call to the `element.DetermineFormat()` helper method. This is the same robust method used by the general-purpose element processor later in the same function. This change: - Fixes axis detection for 6DoF controllers and other HID devices that use `SHRT` or `BYTE` formats. - Makes the special-case "Stick" logic consistent with the rest of the HID parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding this @myss , yes assuming the format specifier is just a format bit is definitely incorrect, good catch. I suggest we pick this PR up, complement it with a unit test with a HID descriptor using this format, e.g. 3D connexion space mouse, update the changeling to reflect the change and land this.c
|
Merged develop into this branch to get critical CI fix from #2260. Hope this doesn't caused any inconvenience for you. |
No, not a problem. This is a simple change, which is now being handled in #2246. Feel free to close this PR. |
Or feel free to reopen if needed. |
Thanks a lot for the contribution @myss |
The generic HID layout builder made a faulty assumption that the X and Y axes of a composite "Stick" control always used a simple bitfield format (
SBIT
/BIT
).This assumption is incorrect for many modern devices, most notably 6DoF controllers like the 3Dconnexion SpaceMouse, which report their axes as 16-bit shorts (
SHRT
). This bug caused the builder to apply the wrong data format, resulting in incorrect parsing and unusable stick input for these devices.This commit resolves the issue by replacing the brittle, hardcoded format logic with a call to the
element.DetermineFormat()
helper method. This is the same robust method used by the general-purpose element processor later in the same function.This change:
SHRT
orBYTE
formats.Description
Fix HID handling for 3dconnexion SpaceMouse. Without the fix, the "/stick", "/stick/x" and "/stick/y" values contained garbage.
Testing status & QA
Only tested on a 3dconnexion SpaceMouse Wireless.
Overall Product Risks
Comments to reviewers
Checklist
Before review:
Changed
,Fixed
,Added
sections.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: