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
14caae21
Commit
14caae21
authored
Jun 24, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hid: Rewrite HidP_MaxUsageListLength using enum_value_caps.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dae8caf9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
50 deletions
+12
-50
hidp.c
dlls/hid/hidp.c
+12
-46
ntoskrnl.c
dlls/ntoskrnl.exe/tests/ntoskrnl.c
+0
-4
No files found.
dlls/hid/hidp.c
View file @
14caae21
...
...
@@ -524,56 +524,22 @@ NTSTATUS WINAPI HidP_InitializeReportForID( HIDP_REPORT_TYPE report_type, UCHAR
return
HIDP_STATUS_SUCCESS
;
}
ULONG
WINAPI
HidP_MaxUsageListLength
(
HIDP_REPORT_TYPE
ReportType
,
USAGE
UsagePage
,
PHIDP_PREPARSED_DATA
PreparsedData
)
static
NTSTATUS
get_usage_list_length
(
const
struct
hid_value_caps
*
caps
,
void
*
data
)
{
PWINE_HIDP_PREPARSED_DATA
data
=
(
PWINE_HIDP_PREPARSED_DATA
)
PreparsedData
;
WINE_HID_ELEMENT
*
elems
=
HID_ELEMS
(
data
);
WINE_HID_REPORT
*
report
=
NULL
;
int
r_count
;
int
i
;
int
count
=
0
;
TRACE
(
"(%i, %x, %p)
\n
"
,
ReportType
,
UsagePage
,
PreparsedData
);
if
(
data
->
magic
!=
HID_MAGIC
)
return
0
;
switch
(
ReportType
)
{
case
HidP_Input
:
report
=
HID_INPUT_REPORTS
(
data
);
break
;
case
HidP_Output
:
report
=
HID_OUTPUT_REPORTS
(
data
);
break
;
case
HidP_Feature
:
report
=
HID_FEATURE_REPORTS
(
data
);
break
;
default:
return
HIDP_STATUS_INVALID_REPORT_TYPE
;
}
r_count
=
data
->
reportCount
[
ReportType
];
*
(
ULONG
*
)
data
+=
caps
->
report_count
;
return
HIDP_STATUS_SUCCESS
;
}
ULONG
WINAPI
HidP_MaxUsageListLength
(
HIDP_REPORT_TYPE
report_type
,
USAGE
usage_page
,
PHIDP_PREPARSED_DATA
preparsed_data
)
{
WINE_HIDP_PREPARSED_DATA
*
preparsed
=
(
WINE_HIDP_PREPARSED_DATA
*
)
preparsed_data
;
struct
caps_filter
filter
=
{.
buttons
=
TRUE
,
.
usage_page
=
usage_page
};
USHORT
limit
=
-
1
;
ULONG
count
=
0
;
if
(
!
r_count
)
return
0
;
TRACE
(
"report_type %d, usage_page %x, preparsed_data %p.
\n
"
,
report_type
,
usage_page
,
preparsed_data
);
for
(
i
=
0
;
i
<
r_count
;
i
++
)
{
int
j
;
for
(
j
=
0
;
j
<
report
[
i
].
elementCount
;
j
++
)
{
if
(
elems
[
report
[
i
].
elementIdx
+
j
].
caps
.
BitSize
==
1
&&
(
UsagePage
==
0
||
elems
[
report
[
i
].
elementIdx
+
j
].
caps
.
UsagePage
==
UsagePage
))
{
if
(
elems
[
report
[
i
].
elementIdx
+
j
].
caps
.
IsRange
)
count
+=
(
elems
[
report
[
i
].
elementIdx
+
j
].
caps
.
Range
.
UsageMax
-
elems
[
report
[
i
].
elementIdx
+
j
].
caps
.
Range
.
UsageMin
)
+
1
;
else
count
++
;
}
}
}
enum_value_caps
(
preparsed
,
report_type
,
&
filter
,
get_usage_list_length
,
&
count
,
&
limit
);
return
count
;
}
...
...
dlls/ntoskrnl.exe/tests/ntoskrnl.c
View file @
14caae21
...
...
@@ -2140,18 +2140,14 @@ static void test_hidp(HANDLE file, int report_id)
ok
(
value
==
0
,
"got value %x, expected %#x
\n
"
,
value
,
0
);
value
=
HidP_MaxUsageListLength
(
HidP_Feature
+
1
,
0
,
preparsed_data
);
todo_wine
ok
(
value
==
0
,
"HidP_MaxUsageListLength(HidP_Feature + 1, 0) returned %d, expected %d
\n
"
,
value
,
0
);
value
=
HidP_MaxUsageListLength
(
HidP_Input
,
0
,
preparsed_data
);
todo_wine
ok
(
value
==
42
,
"HidP_MaxUsageListLength(HidP_Input, 0) returned %d, expected %d
\n
"
,
value
,
42
);
value
=
HidP_MaxUsageListLength
(
HidP_Input
,
HID_USAGE_PAGE_BUTTON
,
preparsed_data
);
todo_wine
ok
(
value
==
32
,
"HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_BUTTON) returned %d, expected %d
\n
"
,
value
,
32
);
value
=
HidP_MaxUsageListLength
(
HidP_Input
,
HID_USAGE_PAGE_LED
,
preparsed_data
);
ok
(
value
==
8
,
"HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_LED) returned %d, expected %d
\n
"
,
value
,
8
);
value
=
HidP_MaxUsageListLength
(
HidP_Feature
,
HID_USAGE_PAGE_BUTTON
,
preparsed_data
);
todo_wine
ok
(
value
==
8
,
"HidP_MaxUsageListLength(HidP_Feature, HID_USAGE_PAGE_BUTTON) returned %d, expected %d
\n
"
,
value
,
8
);
value
=
HidP_MaxUsageListLength
(
HidP_Feature
,
HID_USAGE_PAGE_LED
,
preparsed_data
);
ok
(
value
==
0
,
"HidP_MaxUsageListLength(HidP_Feature, HID_USAGE_PAGE_LED) returned %d, expected %d
\n
"
,
value
,
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