Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3fa5d9eb
Commit
3fa5d9eb
authored
Sep 17, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hidparse.sys: Replace all is_*range members with a single flags member.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6fa0d127
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
31 deletions
+42
-31
hidp.c
dlls/hid/hidp.c
+20
-11
main.c
dlls/hidparse.sys/main.c
+17
-17
hid.h
include/wine/hid.h
+5
-3
No files found.
dlls/hid/hidp.c
View file @
3fa5d9eb
...
...
@@ -95,16 +95,17 @@ static NTSTATUS enum_value_caps( struct hid_preparsed_data *preparsed, HIDP_REPO
enum_value_caps_callback
callback
,
void
*
user
,
USHORT
*
count
)
{
const
struct
hid_value_caps
*
caps
,
*
caps_end
;
NTSTATUS
status
;
BOOL
incompatible
=
FALSE
;
BOOL
is_range
,
incompatible
=
FALSE
;
LONG
remaining
=
*
count
;
NTSTATUS
status
;
for
(
status
=
get_value_caps_range
(
preparsed
,
report_type
,
report_len
,
&
caps
,
&
caps_end
);
status
==
HIDP_STATUS_SUCCESS
&&
caps
!=
caps_end
;
caps
++
)
{
is_range
=
caps
->
flags
&
HID_VALUE_CAPS_IS_RANGE
;
if
(
!
match_value_caps
(
caps
,
filter
))
continue
;
if
(
filter
->
report_id
&&
caps
->
report_id
!=
filter
->
report_id
)
incompatible
=
TRUE
;
else
if
(
filter
->
array
&&
(
caps
->
is_range
||
caps
->
report_count
<=
1
))
return
HIDP_STATUS_NOT_VALUE_ARRAY
;
else
if
(
filter
->
array
&&
(
is_range
||
caps
->
report_count
<=
1
))
return
HIDP_STATUS_NOT_VALUE_ARRAY
;
else
if
(
remaining
--
>
0
)
status
=
callback
(
caps
,
user
);
}
...
...
@@ -634,7 +635,8 @@ static NTSTATUS get_button_caps( const struct hid_value_caps *caps, void *user )
dst
->
BitField
=
caps
->
bit_field
;
dst
->
IsAlias
=
FALSE
;
dst
->
IsAbsolute
=
HID_VALUE_CAPS_IS_ABSOLUTE
(
caps
);
if
(
!
(
dst
->
IsRange
=
caps
->
is_range
))
dst
->
IsRange
=
(
caps
->
flags
&
HID_VALUE_CAPS_IS_RANGE
)
?
1
:
0
;
if
(
!
dst
->
IsRange
)
{
dst
->
NotRange
.
Usage
=
caps
->
usage_min
;
dst
->
NotRange
.
DataIndex
=
caps
->
data_index_min
;
...
...
@@ -646,14 +648,16 @@ static NTSTATUS get_button_caps( const struct hid_value_caps *caps, void *user )
dst
->
Range
.
DataIndexMin
=
caps
->
data_index_min
;
dst
->
Range
.
DataIndexMax
=
caps
->
data_index_max
;
}
if
(
!
(
dst
->
IsStringRange
=
caps
->
is_string_range
))
dst
->
IsStringRange
=
(
caps
->
flags
&
HID_VALUE_CAPS_IS_STRING_RANGE
)
?
1
:
0
;
if
(
!
dst
->
IsStringRange
)
dst
->
NotRange
.
StringIndex
=
caps
->
string_min
;
else
{
dst
->
Range
.
StringMin
=
caps
->
string_min
;
dst
->
Range
.
StringMax
=
caps
->
string_max
;
}
if
((
dst
->
IsDesignatorRange
=
caps
->
is_designator_range
))
dst
->
IsDesignatorRange
=
(
caps
->
flags
&
HID_VALUE_CAPS_IS_DESIGNATOR_RANGE
)
?
1
:
0
;
if
(
!
dst
->
IsDesignatorRange
)
dst
->
NotRange
.
DesignatorIndex
=
caps
->
designator_min
;
else
{
...
...
@@ -690,33 +694,37 @@ static NTSTATUS get_value_caps( const struct hid_value_caps *caps, void *user )
dst
->
IsAbsolute
=
HID_VALUE_CAPS_IS_ABSOLUTE
(
caps
);
dst
->
HasNull
=
HID_VALUE_CAPS_HAS_NULL
(
caps
);
dst
->
BitSize
=
caps
->
bit_size
;
dst
->
ReportCount
=
caps
->
is_range
?
1
:
caps
->
report_count
;
dst
->
UnitsExp
=
caps
->
units_exp
;
dst
->
Units
=
caps
->
units
;
dst
->
LogicalMin
=
caps
->
logical_min
;
dst
->
LogicalMax
=
caps
->
logical_max
;
dst
->
PhysicalMin
=
caps
->
physical_min
;
dst
->
PhysicalMax
=
caps
->
physical_max
;
if
(
!
(
dst
->
IsRange
=
caps
->
is_range
))
dst
->
IsRange
=
(
caps
->
flags
&
HID_VALUE_CAPS_IS_RANGE
)
?
1
:
0
;
if
(
!
dst
->
IsRange
)
{
dst
->
ReportCount
=
caps
->
report_count
;
dst
->
NotRange
.
Usage
=
caps
->
usage_min
;
dst
->
NotRange
.
DataIndex
=
caps
->
data_index_min
;
}
else
{
dst
->
ReportCount
=
1
;
dst
->
Range
.
UsageMin
=
caps
->
usage_min
;
dst
->
Range
.
UsageMax
=
caps
->
usage_max
;
dst
->
Range
.
DataIndexMin
=
caps
->
data_index_min
;
dst
->
Range
.
DataIndexMax
=
caps
->
data_index_max
;
}
if
(
!
(
dst
->
IsStringRange
=
caps
->
is_string_range
))
dst
->
IsStringRange
=
(
caps
->
flags
&
HID_VALUE_CAPS_IS_STRING_RANGE
)
?
1
:
0
;
if
(
!
dst
->
IsStringRange
)
dst
->
NotRange
.
StringIndex
=
caps
->
string_min
;
else
{
dst
->
Range
.
StringMin
=
caps
->
string_min
;
dst
->
Range
.
StringMax
=
caps
->
string_max
;
}
if
((
dst
->
IsDesignatorRange
=
caps
->
is_designator_range
))
dst
->
IsDesignatorRange
=
(
caps
->
flags
&
HID_VALUE_CAPS_IS_DESIGNATOR_RANGE
)
?
1
:
0
;
if
(
!
dst
->
IsDesignatorRange
)
dst
->
NotRange
.
DesignatorIndex
=
caps
->
designator_min
;
else
{
...
...
@@ -810,7 +818,8 @@ NTSTATUS WINAPI HidP_GetUsagesEx( HIDP_REPORT_TYPE report_type, USHORT collectio
static
NTSTATUS
count_data
(
const
struct
hid_value_caps
*
caps
,
void
*
user
)
{
if
(
caps
->
is_range
||
HID_VALUE_CAPS_IS_BUTTON
(
caps
))
*
(
ULONG
*
)
user
+=
caps
->
report_count
;
BOOL
is_range
=
caps
->
flags
&
HID_VALUE_CAPS_IS_RANGE
;
if
(
is_range
||
HID_VALUE_CAPS_IS_BUTTON
(
caps
))
*
(
ULONG
*
)
user
+=
caps
->
report_count
;
else
*
(
ULONG
*
)
user
+=
1
;
return
HIDP_STATUS_SUCCESS
;
}
...
...
dlls/hidparse.sys/main.c
View file @
3fa5d9eb
...
...
@@ -102,11 +102,11 @@ enum
static
inline
const
char
*
debugstr_hid_value_caps
(
struct
hid_value_caps
*
caps
)
{
if
(
!
caps
)
return
"(null)"
;
return
wine_dbg_sprintf
(
"RId %d, Usg %02x:%02x-%02x Dat %02x-%02x
(%d), Str %d-%d (%d), Des %d-%d (%d)
, "
"Bits %02x, LCol %d LUsg %02x:%02x, BitSz %d, RCnt %d, Unit %x E%+d, Log %+d-%+d, Phy %+d-%+d"
,
caps
->
report_id
,
caps
->
usage_page
,
caps
->
usage_min
,
caps
->
usage_max
,
caps
->
data_index_min
,
caps
->
data_index_max
,
caps
->
is_range
,
caps
->
string_min
,
caps
->
string_max
,
caps
->
is_string_range
,
caps
->
designator_min
,
caps
->
designator_max
,
caps
->
is_designator_range
,
caps
->
bit_field
,
caps
->
link_collection
,
caps
->
link_usage_page
,
caps
->
link_usage
,
caps
->
bit_size
,
caps
->
report_count
,
return
wine_dbg_sprintf
(
"RId %d, Usg %02x:%02x-%02x Dat %02x-%02x
, Str %d-%d, Des %d-%d
, "
"Bits %02x
Flags %#x
, LCol %d LUsg %02x:%02x, BitSz %d, RCnt %d, Unit %x E%+d, Log %+d-%+d, Phy %+d-%+d"
,
caps
->
report_id
,
caps
->
usage_page
,
caps
->
usage_min
,
caps
->
usage_max
,
caps
->
data_index_min
,
caps
->
data_index_max
,
caps
->
string_min
,
caps
->
string_max
,
caps
->
designator_min
,
caps
->
designator_max
,
caps
->
bit_field
,
caps
->
flags
,
caps
->
link_collection
,
caps
->
link_usage_page
,
caps
->
link_usage
,
caps
->
bit_size
,
caps
->
report_count
,
caps
->
units
,
caps
->
units_exp
,
caps
->
logical_min
,
caps
->
logical_max
,
caps
->
physical_min
,
caps
->
physical_max
);
}
...
...
@@ -243,13 +243,13 @@ static BOOL parse_global_pop( struct hid_parser_state *state )
static
BOOL
parse_local_usage
(
struct
hid_parser_state
*
state
,
USAGE
usage_page
,
USAGE
usage
)
{
if
(
!
usage_page
)
usage_page
=
state
->
items
.
usage_page
;
if
(
state
->
items
.
is_range
)
state
->
usages_size
=
0
;
if
(
state
->
items
.
flags
&
HID_VALUE_CAPS_IS_RANGE
)
state
->
usages_size
=
0
;
state
->
usages_page
[
state
->
usages_size
]
=
usage_page
;
state
->
usages_min
[
state
->
usages_size
]
=
usage
;
state
->
usages_max
[
state
->
usages_size
]
=
usage
;
state
->
items
.
usage_min
=
usage
;
state
->
items
.
usage_max
=
usage
;
state
->
items
.
is_range
=
FALS
E
;
state
->
items
.
flags
&=
~
HID_VALUE_CAPS_IS_RANG
E
;
if
(
state
->
usages_size
++
==
255
)
ERR
(
"HID parser usages stack overflow!
\n
"
);
return
state
->
usages_size
<=
255
;
}
...
...
@@ -257,22 +257,22 @@ static BOOL parse_local_usage( struct hid_parser_state *state, USAGE usage_page,
static
void
parse_local_usage_min
(
struct
hid_parser_state
*
state
,
USAGE
usage_page
,
USAGE
usage
)
{
if
(
!
usage_page
)
usage_page
=
state
->
items
.
usage_page
;
if
(
!
state
->
items
.
is_range
)
state
->
usages_max
[
0
]
=
0
;
if
(
!
(
state
->
items
.
flags
&
HID_VALUE_CAPS_IS_RANGE
)
)
state
->
usages_max
[
0
]
=
0
;
state
->
usages_page
[
0
]
=
usage_page
;
state
->
usages_min
[
0
]
=
usage
;
state
->
items
.
usage_min
=
usage
;
state
->
items
.
is_range
=
TRU
E
;
state
->
items
.
flags
|=
HID_VALUE_CAPS_IS_RANG
E
;
state
->
usages_size
=
1
;
}
static
void
parse_local_usage_max
(
struct
hid_parser_state
*
state
,
USAGE
usage_page
,
USAGE
usage
)
{
if
(
!
usage_page
)
usage_page
=
state
->
items
.
usage_page
;
if
(
!
state
->
items
.
is_range
)
state
->
usages_min
[
0
]
=
0
;
if
(
!
(
state
->
items
.
flags
&
HID_VALUE_CAPS_IS_RANGE
)
)
state
->
usages_min
[
0
]
=
0
;
state
->
usages_page
[
0
]
=
usage_page
;
state
->
usages_max
[
0
]
=
usage
;
state
->
items
.
usage_max
=
usage
;
state
->
items
.
is_range
=
TRU
E
;
state
->
items
.
flags
|=
HID_VALUE_CAPS_IS_RANG
E
;
state
->
usages_size
=
1
;
}
...
...
@@ -579,27 +579,27 @@ struct hid_preparsed_data *parse_descriptor( BYTE *descriptor, unsigned int leng
break
;
case
SHORT_ITEM
(
TAG_LOCAL_DESIGNATOR_INDEX
,
TAG_TYPE_LOCAL
):
state
->
items
.
designator_min
=
state
->
items
.
designator_max
=
value
;
state
->
items
.
is_designator_range
=
FALS
E
;
state
->
items
.
flags
&=
~
HID_VALUE_CAPS_IS_DESIGNATOR_RANG
E
;
break
;
case
SHORT_ITEM
(
TAG_LOCAL_DESIGNATOR_MINIMUM
,
TAG_TYPE_LOCAL
):
state
->
items
.
designator_min
=
value
;
state
->
items
.
is_designator_range
=
TRU
E
;
state
->
items
.
flags
|=
HID_VALUE_CAPS_IS_DESIGNATOR_RANG
E
;
break
;
case
SHORT_ITEM
(
TAG_LOCAL_DESIGNATOR_MAXIMUM
,
TAG_TYPE_LOCAL
):
state
->
items
.
designator_max
=
value
;
state
->
items
.
is_designator_range
=
TRU
E
;
state
->
items
.
flags
|=
HID_VALUE_CAPS_IS_DESIGNATOR_RANG
E
;
break
;
case
SHORT_ITEM
(
TAG_LOCAL_STRING_INDEX
,
TAG_TYPE_LOCAL
):
state
->
items
.
string_min
=
state
->
items
.
string_max
=
value
;
state
->
items
.
is_string_range
=
FALS
E
;
state
->
items
.
flags
&=
~
HID_VALUE_CAPS_IS_STRING_RANG
E
;
break
;
case
SHORT_ITEM
(
TAG_LOCAL_STRING_MINIMUM
,
TAG_TYPE_LOCAL
):
state
->
items
.
string_min
=
value
;
state
->
items
.
is_string_range
=
TRU
E
;
state
->
items
.
flags
|=
HID_VALUE_CAPS_IS_STRING_RANG
E
;
break
;
case
SHORT_ITEM
(
TAG_LOCAL_STRING_MAXIMUM
,
TAG_TYPE_LOCAL
):
state
->
items
.
string_max
=
value
;
state
->
items
.
is_string_range
=
TRU
E
;
state
->
items
.
flags
|=
HID_VALUE_CAPS_IS_STRING_RANG
E
;
break
;
case
SHORT_ITEM
(
TAG_LOCAL_DELIMITER
,
TAG_TYPE_LOCAL
):
FIXME
(
"delimiter %d not implemented!
\n
"
,
value
);
...
...
include/wine/hid.h
View file @
3fa5d9eb
...
...
@@ -42,9 +42,7 @@ struct hid_value_caps
USHORT
string_max
;
USHORT
designator_min
;
USHORT
designator_max
;
BOOLEAN
is_range
;
BOOLEAN
is_string_range
;
BOOLEAN
is_designator_range
;
ULONG
flags
;
UCHAR
report_id
;
USHORT
link_collection
;
USAGE
link_usage_page
;
...
...
@@ -63,6 +61,10 @@ struct hid_value_caps
ULONG
units_exp
;
};
#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)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment