From 9ade4305f33988feabb5a8b797d0b8231863dadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 17 Sep 2021 09:18:57 +0200 Subject: [PATCH] hidparse.sys: Add HID_VALUE_CAPS_IS_(ABSOLUTE|CONSTANT) flags instead of checking bit_field. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/hid/hidp.c | 4 ++-- dlls/hidparse.sys/main.c | 3 +++ include/wine/hid.h | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index 4a1771e586c..662d3da9d58 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -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; diff --git a/dlls/hidparse.sys/main.c b/dlls/hidparse.sys/main.c index 2f7f417a7aa..ea4d84a6e81 100644 --- a/dlls/hidparse.sys/main.c +++ b/dlls/hidparse.sys/main.c @@ -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; diff --git a/include/wine/hid.h b/include/wine/hid.h index a6c585b2ff4..7661850efc6 100644 --- a/include/wine/hid.h +++ b/include/wine/hid.h @@ -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))