Commit 2183b8ac authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

hidclass.sys: Help make the logic around feature input flags more apparent.

parent 87eedf41
...@@ -33,16 +33,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(hid); ...@@ -33,16 +33,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(hid);
#define USAGE_MAX 10 #define USAGE_MAX 10
/* Flags that are defined in the document
"Device Class Definition for Human Interface Devices" */
enum { enum {
INPUT_DATA = 0x01, INPUT_DATA_CONST = 0x01, /* Data (0) | Constant (1) */
INPUT_ARRAY = 0x02, INPUT_ARRAY_VAR = 0x02, /* Array (0) | Variable (1) */
INPUT_ABS = 0x04, INPUT_ABS_REL = 0x04, /* Absolute (0) | Relative (1) */
INPUT_WRAP = 0x08, INPUT_WRAP = 0x08, /* No Wrap (0) | Wrap (1) */
INPUT_LINEAR = 0x10, INPUT_LINEAR = 0x10, /* Linear (0) | Non Linear (1) */
INPUT_PREFSTATE = 0x20, INPUT_PREFSTATE = 0x20, /* Preferred State (0) | No Preferred (1) */
INPUT_NULL = 0x40, INPUT_NULL = 0x40, /* No Null position (0) | Null state(1) */
INPUT_VOLATILE = 0x80, INPUT_VOLATILE = 0x80, /* Non Volatile (0) | Volatile (1) */
INPUT_BITFIELD = 0x100 INPUT_BITFIELD = 0x100 /* Bit Field (0) | Buffered Bytes (1) */
}; };
enum { enum {
...@@ -407,48 +409,21 @@ void parse_io_feature(unsigned int bSize, int itemVal, int bTag, unsigned int *f ...@@ -407,48 +409,21 @@ void parse_io_feature(unsigned int bSize, int itemVal, int bTag, unsigned int *f
} }
else else
{ {
if ((itemVal & INPUT_DATA) == 0) feature->isData = ((itemVal & INPUT_DATA_CONST) == 0);
feature->isData = TRUE; feature->isArray = ((itemVal & INPUT_ARRAY_VAR) == 0);
else feature->IsAbsolute = ((itemVal & INPUT_ABS_REL) == 0);
feature->isData = FALSE; /* Const */ feature->Wrap = ((itemVal & INPUT_WRAP) != 0);
if ((itemVal & INPUT_ARRAY) == 0) feature->Linear = ((itemVal & INPUT_LINEAR) == 0);
feature->isArray= TRUE; feature->prefState = ((itemVal & INPUT_PREFSTATE) == 0);
else feature->HasNull = ((itemVal & INPUT_NULL) != 0);
feature->isArray= FALSE; /* Var */
if ((itemVal & INPUT_ABS) == 0)
feature->IsAbsolute = TRUE;
else
feature->IsAbsolute = FALSE; /* Rel */
if ((itemVal & INPUT_WRAP) == 0)
feature->Wrap = FALSE;
else
feature->Wrap = TRUE;
if ((itemVal & INPUT_LINEAR) == 0)
feature->Linear = TRUE;
else
feature->Linear = FALSE;
if ((itemVal & INPUT_PREFSTATE) == 0)
feature->prefState = TRUE;
else
feature->prefState = FALSE;
if ((itemVal & INPUT_NULL) == 0)
feature->HasNull = FALSE;
else
feature->HasNull = TRUE;
if (bTag != TAG_MAIN_INPUT) if (bTag != TAG_MAIN_INPUT)
{ {
if ((itemVal & INPUT_VOLATILE) == 0) feature->Volatile = ((itemVal & INPUT_VOLATILE) != 0);
feature->Volatile = FALSE;
else
feature->Volatile = TRUE;
} }
if (bSize > 1) if (bSize > 1)
{ {
if ((itemVal & INPUT_BITFIELD) == 0) feature->BitField = ((itemVal & INPUT_BITFIELD) == 0);
feature->BitField = TRUE;
else
feature->BitField = FALSE; /* Buffered Bytes */
} }
feature->index = *feature_index; feature->index = *feature_index;
*feature_index = *feature_index + 1; *feature_index = *feature_index + 1;
......
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