From 8562a21657a577472a436f6e8263444d69b7a411 Mon Sep 17 00:00:00 2001 From: Simon Wittber Date: Tue, 1 Oct 2024 11:15:41 +0800 Subject: [PATCH 1/2] removed redundant warning --- Packages/com.unity.inputsystem/CHANGELOG.md | 3 +++ .../com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index d06a397cfb..dfb5b3de6e 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -14,6 +14,9 @@ however, it has to be formatted properly to pass verification tests. - Added the display of the device flag `CanRunInBackground` in device debug view. - Added analytics for programmatic `InputAction` setup via `InputActionSetupExtensions` when exiting play-mode. +### Fixed +- Removed a redundant warning when using fallback code to parse a HID descriptor. (UUM-71260) + ## [1.11.1] - 2024-09-26 ### Fixed diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs index 6be81a61cd..07521dc768 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs @@ -6,6 +6,7 @@ using UnityEngine.InputSystem.LowLevel; using UnityEngine.InputSystem.Utilities; using Unity.Collections.LowLevel.Unsafe; +using Unity.Profiling; using UnityEngine.InputSystem.Layouts; using UnityEngine.Scripting; #if UNITY_2021_2_OR_NEWER @@ -83,6 +84,8 @@ public HIDDeviceDescriptor hidDescriptor private bool m_HaveParsedHIDDescriptor; private HIDDeviceDescriptor m_HIDDescriptor; + + private static readonly ProfilerMarker k_HIDParseDescriptorFallback = new ProfilerMarker("HIDParseDescriptorFallback"); // This is the workhorse for figuring out fallback options for HIDs attached to the system. // If the system cannot find a more specific layout for a given HID, this method will try @@ -1130,8 +1133,10 @@ public static HIDDeviceDescriptor FromJson(string json) } catch (Exception) { - Debug.LogWarning($"Couldn't parse HID descriptor with fast parser. Using fallback"); - return JsonUtility.FromJson(json); + k_HIDParseDescriptorFallback.Begin(); + var descriptor = JsonUtility.FromJson(json); + k_HIDParseDescriptorFallback.End(); + return descriptor; } #else return JsonUtility.FromJson(json); From c3db7f861e564e4131f18e6627ecb617203c63c9 Mon Sep 17 00:00:00 2001 From: Simon Wittber Date: Tue, 1 Oct 2024 11:30:06 +0800 Subject: [PATCH 2/2] format fix --- Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs index 07521dc768..3e7354584b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs @@ -84,7 +84,7 @@ public HIDDeviceDescriptor hidDescriptor private bool m_HaveParsedHIDDescriptor; private HIDDeviceDescriptor m_HIDDescriptor; - + private static readonly ProfilerMarker k_HIDParseDescriptorFallback = new ProfilerMarker("HIDParseDescriptorFallback"); // This is the workhorse for figuring out fallback options for HIDs attached to the system.