-
Couldn't load subscription status.
- Fork 328
FIX: Incorrect HID Stick values for LogicalMinimum with negative values (ISXB-1735) #2246
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
Changes from 1 commit
0f183f3
20fe0b8
50bf200
e723cb2
2f57bfd
38b2f72
461811e
5c31f56
02e42ff
6859f7e
d36d756
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -299,7 +299,7 @@ | |
| (id, commandPtr) => | ||
| { | ||
| if (commandPtr == null) | ||
| return InputDeviceCommand.GenericFailure; | ||
|
|
||
| if (commandPtr->type == HID.QueryHIDReportDescriptorSizeDeviceCommandType) | ||
| return reportDescriptor.Length; | ||
|
|
@@ -342,10 +342,14 @@ | |
| [TestCase(24, new byte[] {0x15, 0x00}, new byte[] {0x27, 0xFF, 0xFF, 0xFF, 0x00}, 0, 16777215)] | ||
| // Logical min -8388608, logical max 8388607 (24 bit) | ||
| [TestCase(24, new byte[] {0x17, 0x00, 0x00, 0x80, 0xFF}, new byte[] {0x27, 0xFF, 0xFF, 0x7F, 0x00}, -8388608, 8388607)] | ||
| public void Devices_CanParseHIDDescritpor_WithSignedLogicalMinAndMaxSticks(byte reportSizeBits, byte[] logicalMinBytes, byte[] logicalMaxBytes, int logicalMinExpected, int logicalMaxExpected) | ||
| { | ||
| // Dynamically create HID report descriptor for two analog sticks with parameterized logical min/max | ||
| // Logical min -72, logical max -35 | ||
| [TestCase(8, new byte[] {0x15, 0xB8}, new byte[] {0x25, 0xDD}, -72, -35)] | ||
| // Logical min 30, logical max 78 | ||
| [TestCase(8, new byte[] {0x15, 0x1E}, new byte[] {0x25, 0x4E}, 30, 78)] | ||
|
|
||
| public void Devices_CanParseHIDDescriptor_WithSignedLogicalMinAndMaxValues(byte reportSizeBits, byte[] logicalMinBytes, byte[] logicalMaxBytes, int logicalMinExpected, int logicalMaxExpected) | ||
| { | ||
| // Dynamically create HID report descriptor for one X-axis with parameterized logical min/max | ||
| var reportDescriptorStart = new byte[] | ||
| { | ||
| 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) | ||
|
|
@@ -393,9 +397,8 @@ | |
|
|
||
| InputSystem.Update(); | ||
|
|
||
| var device = (Joystick)InputSystem.GetDeviceById(deviceId); | ||
| var device = InputSystem.GetDeviceById(deviceId); | ||
| Assert.That(device, Is.Not.Null); | ||
| Assert.That(device, Is.TypeOf<Joystick>()); | ||
|
|
||
| var parsedDescriptor = JsonUtility.FromJson<HID.HIDDeviceDescriptor>(device.description.capabilities); | ||
|
|
||
|
|
@@ -408,11 +411,8 @@ | |
| Assert.That(element.logicalMax, Is.EqualTo(logicalMaxExpected)); | ||
| } | ||
| else | ||
| Assert.Fail("Could not find X and Y elements in descriptor"); | ||
| Assert.Fail("Could not find X element in descriptor"); | ||
| } | ||
|
|
||
| // Stick vector 2 should be centered at (0,0) when initialized | ||
| Assert.That(device.stick.ReadValue(), Is.EqualTo(new Vector2(0f, 0f)).Using(Vector2EqualityComparer.Instance)); | ||
|
||
| } | ||
|
|
||
| [Test] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.