Although we don't need them, it fixes a few todo_wine and reduces the test output.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 7 ------- dlls/hidparse.sys/main.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index d29cad5690f..371edc99251 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3151,10 +3151,8 @@ static void test_hidp_kdr(void) check_member( kdr->caps[i], expect_caps[i], "%d", bit_size ); check_member( kdr->caps[i], expect_caps[i], "%d", report_count ); check_member( kdr->caps[i], expect_caps[i], "%d", start_byte ); - todo_wine check_member( kdr->caps[i], expect_caps[i], "%d", total_bits ); check_member( kdr->caps[i], expect_caps[i], "%#x", bit_field ); - todo_wine_if( expect_caps[i].end_byte ) check_member( kdr->caps[i], expect_caps[i], "%d", end_byte ); check_member( kdr->caps[i], expect_caps[i], "%d", link_collection ); check_member( kdr->caps[i], expect_caps[i], "%04x", link_usage_page ); @@ -3176,16 +3174,11 @@ static void test_hidp_kdr(void) check_member( kdr->caps[i], expect_caps[i], "%d", designator_max ); check_member( kdr->caps[i], expect_caps[i], "%#x", data_index_min ); check_member( kdr->caps[i], expect_caps[i], "%#x", data_index_max ); - todo_wine_if( expect_caps[i].null_value ) check_member( kdr->caps[i], expect_caps[i], "%d", null_value ); check_member( kdr->caps[i], expect_caps[i], "%d", unknown ); - todo_wine_if( !(kdr->caps[i].bit_field & 2) ) check_member( kdr->caps[i], expect_caps[i], "%d", logical_min ); - todo_wine_if( kdr->caps[i].flags & HIDP_KDR_CAPS_IS_BUTTON ) check_member( kdr->caps[i], expect_caps[i], "%d", logical_max ); - todo_wine_if( kdr->caps[i].flags & HIDP_KDR_CAPS_IS_BUTTON ) check_member( kdr->caps[i], expect_caps[i], "%d", physical_min ); - todo_wine_if( kdr->caps[i].flags & HIDP_KDR_CAPS_IS_BUTTON ) check_member( kdr->caps[i], expect_caps[i], "%d", physical_max ); check_member( kdr->caps[i], expect_caps[i], "%#x", units ); check_member( kdr->caps[i], expect_caps[i], "%#x", units_exp ); diff --git a/dlls/hidparse.sys/main.c b/dlls/hidparse.sys/main.c index f577ef952c3..ca15a91c75a 100644 --- a/dlls/hidparse.sys/main.c +++ b/dlls/hidparse.sys/main.c @@ -335,6 +335,8 @@ static void add_new_value_caps( struct hid_parser_state *state, struct hid_value
state->items.start_byte = start_bit / 8; state->items.start_bit = start_bit % 8; + state->items.total_bits = state->items.report_count * state->items.bit_size; + state->items.end_byte = (start_bit + state->items.total_bits + 7) / 8; state->items.usage_page = state->usages_page[usages_size - 1 - i]; state->items.usage_min = state->usages_min[usages_size - 1 - i]; state->items.usage_max = state->usages_max[usages_size - 1 - i]; @@ -343,6 +345,15 @@ static void add_new_value_caps( struct hid_parser_state *state, struct hid_value state->items.data_index_min = state->items.data_index_max + 1; state->items.data_index_max = state->items.data_index_min + count; values[i] = state->items; + + if (values[i].flags & HID_VALUE_CAPS_IS_BUTTON) + { + if (!HID_VALUE_CAPS_IS_ARRAY( values + i )) values[i].logical_min = 0; + else values[i].logical_min = values[i].logical_max; + values[i].logical_max = 0; + values[i].physical_min = 0; + values[i].physical_max = 0; + } }
static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TYPE type ) @@ -380,6 +391,10 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY if (state->items.bit_field & INPUT_DATA_CONST) state->items.flags |= HID_VALUE_CAPS_IS_CONSTANT; if (state->items.bit_size == 1 || is_array) state->items.flags |= HID_VALUE_CAPS_IS_BUTTON;
+ if (is_array) state->items.null_value = state->items.logical_min; + else if (!(state->items.bit_field & INPUT_NULL)) state->items.null_value = 0; + else state->items.null_value = 1; + state->items.data_index_max = state->data_count[type] - 1; for (i = 0; i < usages_size; ++i) {