FIX: Use correct data format for composite stick axes in HID layout builder #2245
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.
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: