Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
7650f877
Commit
7650f877
authored
Jun 25, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hid: Rewrite HidP_GetUsageValue using enum_value_caps.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
cb585669
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
19 deletions
+12
-19
hidp.c
dlls/hid/hidp.c
+11
-15
ntoskrnl.c
dlls/ntoskrnl.exe/tests/ntoskrnl.c
+1
-4
No files found.
dlls/hid/hidp.c
View file @
7650f877
...
...
@@ -347,25 +347,21 @@ static NTSTATUS get_usage_value( const struct hid_value_caps *caps, void *user )
return
HIDP_STATUS_NULL
;
}
NTSTATUS
WINAPI
HidP_GetUsageValue
(
HIDP_REPORT_TYPE
ReportType
,
USAGE
UsagePage
,
USHORT
LinkCollection
,
USAGE
Usage
,
PULONG
UsageValue
,
PHIDP_PREPARSED_DATA
PreparsedData
,
PCHAR
Report
,
ULONG
ReportLength
)
NTSTATUS
WINAPI
HidP_GetUsageValue
(
HIDP_REPORT_TYPE
report_type
,
USAGE
usage_page
,
USHORT
collection
,
USAGE
usage
,
ULONG
*
value
,
PHIDP_PREPARSED_DATA
preparsed_data
,
char
*
report_buf
,
ULONG
report_len
)
{
WINE_HID_ELEMENT
element
;
NTSTATUS
rc
;
TRACE
(
"(%i, %x, %i, %i, %p, %p, %p, %i)
\n
"
,
ReportType
,
UsagePage
,
LinkCollection
,
Usage
,
UsageValue
,
PreparsedData
,
Report
,
ReportLength
);
struct
usage_value_params
params
=
{.
value_buf
=
value
,
.
value_len
=
sizeof
(
*
value
),
.
report_buf
=
report_buf
};
WINE_HIDP_PREPARSED_DATA
*
preparsed
=
(
WINE_HIDP_PREPARSED_DATA
*
)
preparsed_data
;
struct
caps_filter
filter
=
{.
values
=
TRUE
,
.
usage_page
=
usage_page
,
.
collection
=
collection
,
.
usage
=
usage
};
USHORT
count
=
1
;
rc
=
find_usage
(
ReportType
,
UsagePage
,
LinkCollection
,
Usage
,
PreparsedData
,
Report
,
0
,
&
element
);
TRACE
(
"report_type %d, usage_page %x, collection %d, usage %x, value %p, preparsed_data %p, report_buf %p, report_len %u.
\n
"
,
report_type
,
usage_page
,
collection
,
usage
,
value
,
preparsed_data
,
report_buf
,
report_len
);
if
(
rc
==
HIDP_STATUS_SUCCESS
)
{
return
get_report_data
((
BYTE
*
)
Report
,
ReportLength
,
element
.
valueStartBit
,
element
.
bitCount
,
UsageValue
);
}
if
(
!
report_len
)
return
HIDP_STATUS_INVALID_REPORT_LENGTH
;
return
rc
;
filter
.
report_id
=
report_buf
[
0
];
return
enum_value_caps
(
preparsed
,
report_type
,
report_len
,
&
filter
,
get_usage_value
,
&
params
,
&
count
);
}
NTSTATUS
WINAPI
HidP_GetUsageValueArray
(
HIDP_REPORT_TYPE
report_type
,
USAGE
usage_page
,
USHORT
collection
,
...
...
dlls/ntoskrnl.exe/tests/ntoskrnl.c
View file @
7650f877
...
...
@@ -2330,12 +2330,11 @@ static void test_hidp(HANDLE file, int report_id)
ok
(
status
==
HIDP_STATUS_INVALID_REPORT_TYPE
,
"HidP_GetUsageValue returned %#x
\n
"
,
status
);
status
=
HidP_GetUsageValue
(
HidP_Feature
,
HID_USAGE_PAGE_ORDINAL
,
waveform_list
,
3
,
&
value
,
preparsed_data
,
report
,
caps
.
FeatureReportByteLength
+
1
);
todo_wine
ok
(
status
==
HIDP_STATUS_INVALID_REPORT_LENGTH
,
"HidP_GetUsageValue returned %#x
\n
"
,
status
);
report
[
0
]
=
1
-
report_id
;
status
=
HidP_GetUsageValue
(
HidP_Feature
,
HID_USAGE_PAGE_ORDINAL
,
waveform_list
,
3
,
&
value
,
preparsed_data
,
report
,
caps
.
FeatureReportByteLength
);
todo_wine
todo_wine
_if
(
!
report_id
)
ok
(
status
==
(
report_id
?
HIDP_STATUS_SUCCESS
:
HIDP_STATUS_INCOMPATIBLE_REPORT_ID
),
"HidP_GetUsageValue returned %#x
\n
"
,
status
);
report
[
0
]
=
2
;
...
...
@@ -2346,14 +2345,12 @@ static void test_hidp(HANDLE file, int report_id)
report
[
0
]
=
report_id
;
status
=
HidP_GetUsageValue
(
HidP_Feature
,
HID_USAGE_PAGE_ORDINAL
,
0xdead
,
3
,
&
value
,
preparsed_data
,
report
,
caps
.
FeatureReportByteLength
);
todo_wine
ok
(
status
==
HIDP_STATUS_USAGE_NOT_FOUND
,
"HidP_GetUsageValue returned %#x
\n
"
,
status
);
value
=
0xdeadbeef
;
status
=
HidP_GetUsageValue
(
HidP_Feature
,
HID_USAGE_PAGE_ORDINAL
,
waveform_list
,
3
,
&
value
,
preparsed_data
,
report
,
caps
.
FeatureReportByteLength
);
ok
(
status
==
HIDP_STATUS_SUCCESS
,
"HidP_GetUsageValue returned %#x
\n
"
,
status
);
todo_wine
ok
(
value
==
HID_USAGE_HAPTICS_WAVEFORM_RUMBLE
,
"got value %x, expected %#x
\n
"
,
value
,
HID_USAGE_HAPTICS_WAVEFORM_RUMBLE
);
...
...
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