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

hidclass.sys: Fix nary usage collections index ordering.

parent 6b504fe7
......@@ -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;
......
......@@ -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]);
......
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