hidparse.sys: Add HID_VALUE_CAPS_IS_(ABSOLUTE|CONSTANT) flags instead of checking bit_field.

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-09-17 09:18:57 +02:00 committed by Alexandre Julliard
parent 8eb6180d6c
commit 9ade4305f3
3 changed files with 7 additions and 3 deletions

View file

@ -647,7 +647,7 @@ static NTSTATUS get_button_caps( const struct hid_value_caps *caps, void *user )
dst->LinkUsage = caps->link_usage;
dst->BitField = caps->bit_field;
dst->IsAlias = FALSE;
dst->IsAbsolute = HID_VALUE_CAPS_IS_ABSOLUTE( caps );
dst->IsAbsolute = (caps->flags & HID_VALUE_CAPS_IS_ABSOLUTE) ? 1 : 0;
dst->IsRange = (caps->flags & HID_VALUE_CAPS_IS_RANGE) ? 1 : 0;
if (!dst->IsRange)
{
@ -704,7 +704,7 @@ static NTSTATUS get_value_caps( const struct hid_value_caps *caps, void *user )
dst->LinkUsage = caps->link_usage;
dst->BitField = caps->bit_field;
dst->IsAlias = FALSE;
dst->IsAbsolute = HID_VALUE_CAPS_IS_ABSOLUTE( caps );
dst->IsAbsolute = (caps->flags & HID_VALUE_CAPS_IS_ABSOLUTE) ? 1 : 0;
dst->HasNull = HID_VALUE_CAPS_HAS_NULL( caps );
dst->BitSize = caps->bit_size;
dst->UnitsExp = caps->units_exp;

View file

@ -357,6 +357,9 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY
if (!(is_array = HID_VALUE_CAPS_IS_ARRAY( &state->items ))) state->items.report_count -= usages_size - 1;
else start_bit -= state->items.report_count * state->items.bit_size;
if (!(state->items.bit_field & INPUT_ABS_REL)) state->items.flags |= HID_VALUE_CAPS_IS_ABSOLUTE;
if (state->items.bit_field & INPUT_DATA_CONST) state->items.flags |= HID_VALUE_CAPS_IS_CONSTANT;
while (usages_size--)
{
if (!is_array) start_bit -= state->items.report_count * state->items.bit_size;

View file

@ -62,11 +62,12 @@ struct hid_value_caps
/* named array continues on next caps */
#define HID_VALUE_CAPS_ARRAY_HAS_MORE 0x01
#define HID_VALUE_CAPS_IS_CONSTANT 0x02
#define HID_VALUE_CAPS_IS_ABSOLUTE 0x08
#define HID_VALUE_CAPS_IS_RANGE 0x10
#define HID_VALUE_CAPS_IS_STRING_RANGE 0x40
#define HID_VALUE_CAPS_IS_DESIGNATOR_RANGE 0x80
#define HID_VALUE_CAPS_IS_ABSOLUTE(x) (((x)->bit_field & 0x04) == 0)
#define HID_VALUE_CAPS_HAS_NULL(x) (((x)->bit_field & 0x40) != 0)
#define HID_VALUE_CAPS_IS_ARRAY(c) (((c)->bit_field & 2) == 0)
#define HID_VALUE_CAPS_IS_BUTTON(c) ((c)->bit_size == 1 || HID_VALUE_CAPS_IS_ARRAY(c))