hidclass.sys: Fix nary usage collections index ordering.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-08-25 18:08:31 +02:00 committed by Alexandre Julliard
parent 6b504fe778
commit b117f6548a
2 changed files with 2 additions and 5 deletions

View File

@ -354,14 +354,13 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY
}
value = state->values[type] + *value_idx;
state->items.start_index = 0;
state->items.start_index = usages_size;
if (!(is_array = HID_VALUE_CAPS_IS_ARRAY( &state->items ))) state->items.report_count -= usages_size - 1;
else state->items.start_bit -= state->items.report_count * state->items.bit_size;
while (usages_size--)
{
if (!is_array) state->items.start_bit -= state->items.report_count * state->items.bit_size;
else state->items.start_index += 1;
state->items.usage_page = state->usages_page[usages_size];
state->items.usage_min = state->usages_min[usages_size];
state->items.usage_max = state->usages_max[usages_size];
@ -371,6 +370,7 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY
*value++ = state->items;
*value_idx += 1;
if (!is_array) state->items.report_count = 1;
else state->items.start_index -= 1;
}
state->items.usage_page = usage_page;

View File

@ -2340,10 +2340,8 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
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;
@ -2353,7 +2351,6 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
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]);