Commit 6b504fe7 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

ntoskrnl.exe/tests: Add more HID usage nary tests.

parent c3884531
...@@ -299,6 +299,16 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) ...@@ -299,6 +299,16 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
REPORT_COUNT(1, 8), REPORT_COUNT(1, 8),
REPORT_SIZE(1, 1), REPORT_SIZE(1, 1),
INPUT(1, Data|Var|Abs), 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, END_COLLECTION,
USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS),
...@@ -477,7 +487,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) ...@@ -477,7 +487,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
case IOCTL_HID_READ_REPORT: case IOCTL_HID_READ_REPORT:
{ {
ULONG expected_size = 23; ULONG expected_size = 25;
ok(!in_size, "got input size %u\n", in_size); ok(!in_size, "got input size %u\n", in_size);
ok(out_size == expected_size, "got output size %u\n", out_size); ok(out_size == expected_size, "got output size %u\n", out_size);
......
...@@ -1684,13 +1684,13 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled ...@@ -1684,13 +1684,13 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
{ {
.Usage = HID_USAGE_GENERIC_JOYSTICK, .Usage = HID_USAGE_GENERIC_JOYSTICK,
.UsagePage = HID_USAGE_PAGE_GENERIC, .UsagePage = HID_USAGE_PAGE_GENERIC,
.InputReportByteLength = 24, .InputReportByteLength = 26,
.OutputReportByteLength = 3, .OutputReportByteLength = 3,
.FeatureReportByteLength = 18, .FeatureReportByteLength = 18,
.NumberLinkCollectionNodes = 10, .NumberLinkCollectionNodes = 10,
.NumberInputButtonCaps = 13, .NumberInputButtonCaps = 17,
.NumberInputValueCaps = 7, .NumberInputValueCaps = 7,
.NumberInputDataIndices = 43, .NumberInputDataIndices = 47,
.NumberFeatureButtonCaps = 1, .NumberFeatureButtonCaps = 1,
.NumberFeatureValueCaps = 5, .NumberFeatureValueCaps = 5,
.NumberFeatureDataIndices = 7, .NumberFeatureDataIndices = 7,
...@@ -1699,13 +1699,13 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled ...@@ -1699,13 +1699,13 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
{ {
.Usage = HID_USAGE_GENERIC_JOYSTICK, .Usage = HID_USAGE_GENERIC_JOYSTICK,
.UsagePage = HID_USAGE_PAGE_GENERIC, .UsagePage = HID_USAGE_PAGE_GENERIC,
.InputReportByteLength = 23, .InputReportByteLength = 25,
.OutputReportByteLength = 2, .OutputReportByteLength = 2,
.FeatureReportByteLength = 17, .FeatureReportByteLength = 17,
.NumberLinkCollectionNodes = 10, .NumberLinkCollectionNodes = 10,
.NumberInputButtonCaps = 13, .NumberInputButtonCaps = 17,
.NumberInputValueCaps = 7, .NumberInputValueCaps = 7,
.NumberInputDataIndices = 43, .NumberInputDataIndices = 47,
.NumberFeatureButtonCaps = 1, .NumberFeatureButtonCaps = 1,
.NumberFeatureValueCaps = 5, .NumberFeatureValueCaps = 5,
.NumberFeatureDataIndices = 7, .NumberFeatureDataIndices = 7,
...@@ -1872,12 +1872,12 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled ...@@ -1872,12 +1872,12 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
HIDP_LINK_COLLECTION_NODE collections[16]; HIDP_LINK_COLLECTION_NODE collections[16];
PHIDP_PREPARSED_DATA preparsed_data; PHIDP_PREPARSED_DATA preparsed_data;
USAGE_AND_PAGE usage_and_pages[16]; 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]; HIDP_VALUE_CAPS value_caps[16];
char buffer[200], report[200]; char buffer[200], report[200];
DWORD collection_count; DWORD collection_count;
DWORD waveform_list; DWORD waveform_list;
HIDP_DATA data[32]; HIDP_DATA data[64];
USAGE usages[16]; USAGE usages[16];
NTSTATUS status; NTSTATUS status;
HIDP_CAPS caps; HIDP_CAPS caps;
...@@ -2186,7 +2186,7 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled ...@@ -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); 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); ok(value == 0, "HidP_MaxUsageListLength(HidP_Feature + 1, 0) returned %d, expected %d\n", value, 0);
value = HidP_MaxUsageListLength(HidP_Input, 0, preparsed_data); 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); 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); 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); 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 ...@@ -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); value = HidP_MaxDataListLength(HidP_Feature + 1, preparsed_data);
ok(value == 0, "HidP_MaxDataListLength(HidP_Feature + 1) returned %d, expected %d\n", value, 0); ok(value == 0, "HidP_MaxDataListLength(HidP_Feature + 1) returned %d, expected %d\n", value, 0);
value = HidP_MaxDataListLength(HidP_Input, preparsed_data); 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); value = HidP_MaxDataListLength(HidP_Output, preparsed_data);
ok(value == 0, "HidP_MaxDataListLength(HidP_Output) returned %d, expected %d\n", value, 0); ok(value == 0, "HidP_MaxDataListLength(HidP_Output) returned %d, expected %d\n", value, 0);
value = HidP_MaxDataListLength(HidP_Feature, preparsed_data); 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 ...@@ -2328,6 +2328,35 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
winetest_pop_context(); 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)); memset(report, 0xcd, sizeof(report));
status = HidP_InitializeReportForID(HidP_Feature, 3, preparsed_data, report, caps.FeatureReportByteLength); 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); ok(status == HIDP_STATUS_REPORT_DOES_NOT_EXIST, "HidP_InitializeReportForID returned %#x\n", status);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment