-
Notifications
You must be signed in to change notification settings - Fork 331
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.
ekcoh
left a comment
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 |
## [1.16.0] - 2025-11-10 ### Changed - Replaced "Look" rebinding button for "Keyboard" control scheme with a mouse sensitivity slider in `RebindingUISample` to illustrate how to support customizing scaling of mouse deltas and how to reapply the persisted setting between runs. - Changed: Input System no longer depends the obsolete com.unity.modules.vr package. - Removed code that had to do with Unity versions older than Unity 2021.3 LTS. ### Added - Added an example of how to swap two similar controls to the `RebindingUISample`. This is accessible via a button with two arrows at the right hand-side of the screen. Pressing the button allows swapping the current bindings of the "Move" and "Look" gamepad bindings via the new `RebindActionUI.SwapBinding(RebindActionUI other)` method. - Added support for (MonoBehavior OnMouse events) [https://docs.unity3d.com/ScriptReference/MonoBehaviour.html] when running the Input System on Unity 6000.4 or newer. - Added tests and a sample for MonoBehavior OnMouse events using the InputSystem package. - Added support for all the existing InputControl types in InputTestFixture.Trigger [ISXB-1716] ### Fixed - Fixed warnings being generated on Unity 6.3 (beta). (ISXB-1718). - Fixed an issue in `DeltaStateEvent.From` where unsafe code would throw exception or crash if internal pointer `currentStatePtr` was `null`. [ISXB-1637](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1637). - Fixed an issue in `InputTestFixture.Set` where attempting to change state of a device not belonging to the test fixture context would result in null pointer exception or crash. [ISXB-1637](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1637). - Fixed an issue where input action parameter overrides applied via `InputActionRebindingExtensions.ApplyParameterOverride` would not be applied if the associated binding has the empty string as `InputBinding.name`and the binding mask also has the empty string as name. (ISXB-1721). - Fixed an issue in `InputActionReference` where `Set` was not updating the cached action leading to incorrect evaluation of `InputActionReference.action` after first being cached, then set, then read again. This could lead to reference not being reset if set programmatically during play-mode. [ISXB-1584](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1584). - Fixed an issue where `InputActionSetupExtensions.Remove` will result in `NullReferenceException` if the action being removed has no bindings. (ISXB-1688). - Fixed an issue where assigning a ``MonoBehaviour` field of type `InputActionReference` to an instance stored in `.inputactions` asset via `InputActionReference.Set` in playmode corrupts the originally referenced asset. (ISXB-1692). - Fixed an issue where `InputActionReference.Create(null)` returns `null` instead "of a reference object to the given action" as documented behaviour for the API. (ISXB-1693) - Fixed an issue where `InputActionReference.Set(null)` does not update the cached input action reference nor the `ScriptableObject.name` leading to incorrect action being returned and reference showing up as the path to the previously assigned action in Inspector. (ISXB-1694) - Fixed an issue where Inspector field of type `InputActionReference` isn't reflecting broken reference in case action is deleted from asset, action map is deleted from asset, or the asset itself is deleted. (ISXB-1701) - Fixed HID parsing not handling logical minimum and maximum values correctly when they are negative. This applies for platforms that parse HID descriptors in the package, e.g. macOS at the moment. - Fix usage of correct data format for stick axes in HID Layout Builder ([User contribution](Unity-Technologies/InputSystem#2245)) - Fixed InputSystemUIInputModule calling pointer events on parent objects even when the "Send Pointer Hover To Parent" is off on 2022.3.XX. This was was previously only available on Unity 6 versions since 1.11.0. [ISXB-1296] - Limited the Add Control Scheme popup window max size to be its parent window, so that it won't resize beyond the visible area. [ISXB-1733](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1733) - Fixed an issue where the action icon would shrink or disappear from UI when an action has a very long name. [ISXB-1650](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1650). - Fixed upgrading input actions containing multiple processors [ISXB-1674](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1674). - Fixed an issue that led to non-deterministic behaviour during `.inputaction` asset imports that could lead to corrupted assets or Unity hanging during asset import when "Generate C# Scripts" was active in importer settings. [ISXB-1746](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1746)
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:
SHRTorBYTEformats.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,Addedsections.Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.After merge: