Rémi Bernon : ntoskrnl.exe/tests: Add more HID usage nary tests.
Alexandre Julliard
julliard at winehq.org
Thu Aug 26 15:22:32 CDT 2021
Module: wine
Branch: master
Commit: 6b504fe7783b3680b911d739b60dedcbeec0e2f3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6b504fe7783b3680b911d739b60dedcbeec0e2f3
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Wed Aug 25 18:08:30 2021 +0200
ntoskrnl.exe/tests: Add more HID usage nary tests.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntoskrnl.exe/tests/driver_hid.c | 12 ++++++++-
dlls/ntoskrnl.exe/tests/ntoskrnl.c | 49 ++++++++++++++++++++++++++++--------
2 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c
index 8111af23c06..ce942815dcb 100644
--- a/dlls/ntoskrnl.exe/tests/driver_hid.c
+++ b/dlls/ntoskrnl.exe/tests/driver_hid.c
@@ -299,6 +299,16 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
REPORT_COUNT(1, 8),
REPORT_SIZE(1, 1),
INPUT(1, Data|Var|Abs),
+
+ USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8c),
+ USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8d),
+ USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8e),
+ USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8f),
+ LOGICAL_MINIMUM(1, 1),
+ LOGICAL_MAXIMUM(1, 16),
+ REPORT_COUNT(1, 2),
+ REPORT_SIZE(1, 8),
+ INPUT(1, Data|Ary|Abs),
END_COLLECTION,
USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS),
@@ -477,7 +487,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
case IOCTL_HID_READ_REPORT:
{
- ULONG expected_size = 23;
+ ULONG expected_size = 25;
ok(!in_size, "got input size %u\n", in_size);
ok(out_size == expected_size, "got output size %u\n", out_size);
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 9886be69ccb..85380cd9df2 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -1684,13 +1684,13 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
{
.Usage = HID_USAGE_GENERIC_JOYSTICK,
.UsagePage = HID_USAGE_PAGE_GENERIC,
- .InputReportByteLength = 24,
+ .InputReportByteLength = 26,
.OutputReportByteLength = 3,
.FeatureReportByteLength = 18,
.NumberLinkCollectionNodes = 10,
- .NumberInputButtonCaps = 13,
+ .NumberInputButtonCaps = 17,
.NumberInputValueCaps = 7,
- .NumberInputDataIndices = 43,
+ .NumberInputDataIndices = 47,
.NumberFeatureButtonCaps = 1,
.NumberFeatureValueCaps = 5,
.NumberFeatureDataIndices = 7,
@@ -1699,13 +1699,13 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
{
.Usage = HID_USAGE_GENERIC_JOYSTICK,
.UsagePage = HID_USAGE_PAGE_GENERIC,
- .InputReportByteLength = 23,
+ .InputReportByteLength = 25,
.OutputReportByteLength = 2,
.FeatureReportByteLength = 17,
.NumberLinkCollectionNodes = 10,
- .NumberInputButtonCaps = 13,
+ .NumberInputButtonCaps = 17,
.NumberInputValueCaps = 7,
- .NumberInputDataIndices = 43,
+ .NumberInputDataIndices = 47,
.NumberFeatureButtonCaps = 1,
.NumberFeatureValueCaps = 5,
.NumberFeatureDataIndices = 7,
@@ -1872,12 +1872,12 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
HIDP_LINK_COLLECTION_NODE collections[16];
PHIDP_PREPARSED_DATA preparsed_data;
USAGE_AND_PAGE usage_and_pages[16];
- HIDP_BUTTON_CAPS button_caps[16];
+ HIDP_BUTTON_CAPS button_caps[32];
HIDP_VALUE_CAPS value_caps[16];
char buffer[200], report[200];
DWORD collection_count;
DWORD waveform_list;
- HIDP_DATA data[32];
+ HIDP_DATA data[64];
USAGE usages[16];
NTSTATUS status;
HIDP_CAPS caps;
@@ -2186,7 +2186,7 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
value = HidP_MaxUsageListLength(HidP_Feature + 1, 0, preparsed_data);
ok(value == 0, "HidP_MaxUsageListLength(HidP_Feature + 1, 0) returned %d, expected %d\n", value, 0);
value = HidP_MaxUsageListLength(HidP_Input, 0, preparsed_data);
- ok(value == 42, "HidP_MaxUsageListLength(HidP_Input, 0) returned %d, expected %d\n", value, 42);
+ ok(value == 50, "HidP_MaxUsageListLength(HidP_Input, 0) returned %d, expected %d\n", value, 50);
value = HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_BUTTON, preparsed_data);
ok(value == 32, "HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_BUTTON) returned %d, expected %d\n", value, 32);
value = HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_LED, preparsed_data);
@@ -2307,7 +2307,7 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
value = HidP_MaxDataListLength(HidP_Feature + 1, preparsed_data);
ok(value == 0, "HidP_MaxDataListLength(HidP_Feature + 1) returned %d, expected %d\n", value, 0);
value = HidP_MaxDataListLength(HidP_Input, preparsed_data);
- ok(value == 50, "HidP_MaxDataListLength(HidP_Input) returned %d, expected %d\n", value, 50);
+ ok(value == 58, "HidP_MaxDataListLength(HidP_Input) returned %d, expected %d\n", value, 58);
value = HidP_MaxDataListLength(HidP_Output, preparsed_data);
ok(value == 0, "HidP_MaxDataListLength(HidP_Output) returned %d, expected %d\n", value, 0);
value = HidP_MaxDataListLength(HidP_Feature, preparsed_data);
@@ -2328,6 +2328,35 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
winetest_pop_context();
}
+ /* HID nary usage collections are set with 1-based usage index in their declaration order */
+
+ memset(report, 0, caps.InputReportByteLength);
+ status = HidP_InitializeReportForID(HidP_Input, report_id, preparsed_data, report,
+ caps.InputReportByteLength);
+ ok(status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#x\n", status);
+ value = 2;
+ usages[0] = 0x8e;
+ usages[1] = 0x8f;
+ status = HidP_SetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
+ report, caps.InputReportByteLength);
+ ok(status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status);
+ todo_wine
+ ok(report[caps.InputReportByteLength - 2] == 3, "unexpected usage index %d, expected 3\n",
+ report[caps.InputReportByteLength - 2]);
+ todo_wine
+ ok(report[caps.InputReportByteLength - 1] == 4, "unexpected usage index %d, expected 4\n",
+ report[caps.InputReportByteLength - 1]);
+ report[caps.InputReportByteLength - 2] = 0;
+ report[caps.InputReportByteLength - 1] = 0;
+ value = 1;
+ usages[0] = 0x8c;
+ status = HidP_SetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
+ report, caps.InputReportByteLength);
+ ok(status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status);
+ todo_wine
+ ok(report[caps.InputReportByteLength - 2] == 1, "unexpected usage index %d, expected 1\n",
+ report[caps.InputReportByteLength - 2]);
+
memset(report, 0xcd, sizeof(report));
status = HidP_InitializeReportForID(HidP_Feature, 3, preparsed_data, report, caps.FeatureReportByteLength);
ok(status == HIDP_STATUS_REPORT_DOES_NOT_EXIST, "HidP_InitializeReportForID returned %#x\n", status);
More information about the wine-cvs
mailing list