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
3b40a032
Commit
3b40a032
authored
Aug 25, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Aug 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hid: Implement HidP_UnsetUsages.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b117f654
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
3 deletions
+71
-3
hid.spec
dlls/hid/hid.spec
+1
-1
hidp.c
dlls/hid/hidp.c
+59
-0
ntoskrnl.c
dlls/ntoskrnl.exe/tests/ntoskrnl.c
+10
-2
hidpi.h
include/ddk/hidpi.h
+1
-0
No files found.
dlls/hid/hid.spec
View file @
3b40a032
...
@@ -40,5 +40,5 @@
...
@@ -40,5 +40,5 @@
@ stdcall HidP_SetUsageValueArray(long long long long ptr long ptr ptr long)
@ stdcall HidP_SetUsageValueArray(long long long long ptr long ptr ptr long)
@ stdcall HidP_SetUsages(long long long ptr ptr ptr ptr long)
@ stdcall HidP_SetUsages(long long long ptr ptr ptr ptr long)
@ stdcall HidP_TranslateUsagesToI8042ScanCodes(ptr long long ptr ptr ptr)
@ stdcall HidP_TranslateUsagesToI8042ScanCodes(ptr long long ptr ptr ptr)
@ st
ub HidP_UnsetUsages
@ st
dcall HidP_UnsetUsages(long long long ptr ptr ptr ptr long)
@ stub HidP_UsageListDifference
@ stub HidP_UsageListDifference
dlls/hid/hidp.c
View file @
3b40a032
...
@@ -481,6 +481,65 @@ NTSTATUS WINAPI HidP_SetUsages( HIDP_REPORT_TYPE report_type, USAGE usage_page,
...
@@ -481,6 +481,65 @@ NTSTATUS WINAPI HidP_SetUsages( HIDP_REPORT_TYPE report_type, USAGE usage_page,
return
HIDP_STATUS_SUCCESS
;
return
HIDP_STATUS_SUCCESS
;
}
}
struct
unset_usage_params
{
USAGE
usage
;
char
*
report_buf
;
BOOL
found
;
};
static
NTSTATUS
unset_usage
(
const
struct
hid_value_caps
*
caps
,
void
*
user
)
{
struct
unset_usage_params
*
params
=
user
;
ULONG
bit
,
index
,
last
;
if
(
HID_VALUE_CAPS_IS_ARRAY
(
caps
))
{
for
(
bit
=
caps
->
start_bit
,
last
=
bit
+
caps
->
report_count
*
caps
->
bit_size
-
1
;
bit
<=
last
;
bit
+=
8
)
{
index
=
caps
->
start_index
+
params
->
usage
-
caps
->
usage_min
;
if
(
params
->
report_buf
[
bit
/
8
]
!=
index
)
continue
;
params
->
report_buf
[
bit
/
8
]
=
0
;
params
->
found
=
TRUE
;
break
;
}
return
HIDP_STATUS_NULL
;
}
bit
=
caps
->
start_bit
+
params
->
usage
-
caps
->
usage_min
;
if
(
params
->
report_buf
[
bit
/
8
]
&
(
1
<<
(
bit
%
8
)))
params
->
found
=
TRUE
;
params
->
report_buf
[
bit
/
8
]
&=
~
(
1
<<
(
bit
%
8
));
return
HIDP_STATUS_NULL
;
}
NTSTATUS
WINAPI
HidP_UnsetUsages
(
HIDP_REPORT_TYPE
report_type
,
USAGE
usage_page
,
USHORT
collection
,
USAGE
*
usages
,
ULONG
*
usage_count
,
PHIDP_PREPARSED_DATA
preparsed_data
,
char
*
report_buf
,
ULONG
report_len
)
{
struct
hid_preparsed_data
*
preparsed
=
(
struct
hid_preparsed_data
*
)
preparsed_data
;
struct
unset_usage_params
params
=
{.
report_buf
=
report_buf
,
.
found
=
FALSE
};
struct
caps_filter
filter
=
{.
buttons
=
TRUE
,
.
usage_page
=
usage_page
,
.
collection
=
collection
};
NTSTATUS
status
;
USHORT
limit
=
1
;
ULONG
i
,
count
=
*
usage_count
;
TRACE
(
"report_type %d, usage_page %x, collection %d, usages %p, usage_count %p, preparsed_data %p, "
"report_buf %p, report_len %u.
\n
"
,
report_type
,
usage_page
,
collection
,
usages
,
usage_count
,
preparsed_data
,
report_buf
,
report_len
);
if
(
!
report_len
)
return
HIDP_STATUS_INVALID_REPORT_LENGTH
;
filter
.
report_id
=
report_buf
[
0
];
for
(
i
=
0
;
i
<
count
;
++
i
)
{
params
.
usage
=
filter
.
usage
=
usages
[
i
];
status
=
enum_value_caps
(
preparsed
,
report_type
,
report_len
,
&
filter
,
unset_usage
,
&
params
,
&
limit
);
if
(
status
!=
HIDP_STATUS_SUCCESS
)
return
status
;
}
if
(
!
params
.
found
)
return
HIDP_STATUS_BUTTON_NOT_PRESSED
;
return
HIDP_STATUS_SUCCESS
;
}
NTSTATUS
WINAPI
HidP_TranslateUsagesToI8042ScanCodes
(
USAGE
*
ChangedUsageList
,
NTSTATUS
WINAPI
HidP_TranslateUsagesToI8042ScanCodes
(
USAGE
*
ChangedUsageList
,
ULONG
UsageListLength
,
HIDP_KEYBOARD_DIRECTION
KeyAction
,
ULONG
UsageListLength
,
HIDP_KEYBOARD_DIRECTION
KeyAction
,
...
...
dlls/ntoskrnl.exe/tests/ntoskrnl.c
View file @
3b40a032
...
@@ -2344,8 +2344,16 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
...
@@ -2344,8 +2344,16 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
report
[
caps
.
InputReportByteLength
-
2
]);
report
[
caps
.
InputReportByteLength
-
2
]);
ok
(
report
[
caps
.
InputReportByteLength
-
1
]
==
4
,
"unexpected usage index %d, expected 4
\n
"
,
ok
(
report
[
caps
.
InputReportByteLength
-
1
]
==
4
,
"unexpected usage index %d, expected 4
\n
"
,
report
[
caps
.
InputReportByteLength
-
1
]);
report
[
caps
.
InputReportByteLength
-
1
]);
report
[
caps
.
InputReportByteLength
-
2
]
=
0
;
status
=
HidP_UnsetUsages
(
HidP_Input
,
HID_USAGE_PAGE_KEYBOARD
,
0
,
usages
,
&
value
,
preparsed_data
,
report
[
caps
.
InputReportByteLength
-
1
]
=
0
;
report
,
caps
.
InputReportByteLength
);
ok
(
status
==
HIDP_STATUS_SUCCESS
,
"HidP_UnsetUsages returned %#x
\n
"
,
status
);
ok
(
report
[
caps
.
InputReportByteLength
-
2
]
==
0
,
"unexpected usage index %d, expected 0
\n
"
,
report
[
caps
.
InputReportByteLength
-
2
]);
ok
(
report
[
caps
.
InputReportByteLength
-
1
]
==
0
,
"unexpected usage index %d, expected 0
\n
"
,
report
[
caps
.
InputReportByteLength
-
1
]);
status
=
HidP_UnsetUsages
(
HidP_Input
,
HID_USAGE_PAGE_KEYBOARD
,
0
,
usages
,
&
value
,
preparsed_data
,
report
,
caps
.
InputReportByteLength
);
ok
(
status
==
HIDP_STATUS_BUTTON_NOT_PRESSED
,
"HidP_UnsetUsages returned %#x
\n
"
,
status
);
value
=
1
;
value
=
1
;
usages
[
0
]
=
0x8c
;
usages
[
0
]
=
0x8c
;
status
=
HidP_SetUsages
(
HidP_Input
,
HID_USAGE_PAGE_KEYBOARD
,
0
,
usages
,
&
value
,
preparsed_data
,
status
=
HidP_SetUsages
(
HidP_Input
,
HID_USAGE_PAGE_KEYBOARD
,
0
,
usages
,
&
value
,
preparsed_data
,
...
...
include/ddk/hidpi.h
View file @
3b40a032
...
@@ -209,6 +209,7 @@ NTSTATUS WINAPI HidP_SetUsageValueArray( HIDP_REPORT_TYPE ReportType, USAGE Usag
...
@@ -209,6 +209,7 @@ NTSTATUS WINAPI HidP_SetUsageValueArray( HIDP_REPORT_TYPE ReportType, USAGE Usag
NTSTATUS
WINAPI
HidP_SetUsages
(
HIDP_REPORT_TYPE
ReportType
,
USAGE
UsagePage
,
NTSTATUS
WINAPI
HidP_SetUsages
(
HIDP_REPORT_TYPE
ReportType
,
USAGE
UsagePage
,
USHORT
LinkCollection
,
PUSAGE
UsageList
,
PULONG
UsageLength
,
USHORT
LinkCollection
,
PUSAGE
UsageList
,
PULONG
UsageLength
,
PHIDP_PREPARSED_DATA
PreparsedData
,
PCHAR
Report
,
ULONG
ReportLength
);
PHIDP_PREPARSED_DATA
PreparsedData
,
PCHAR
Report
,
ULONG
ReportLength
);
NTSTATUS
WINAPI
HidP_UnsetUsages
(
HIDP_REPORT_TYPE
ReportType
,
USAGE
UsagePage
,
USHORT
LinkCollection
,
PUSAGE
UsageList
,
PULONG
UsageLength
,
PHIDP_PREPARSED_DATA
PreparsedData
,
PCHAR
Report
,
ULONG
ReportLength
);
NTSTATUS
WINAPI
HidP_TranslateUsagesToI8042ScanCodes
(
USAGE
*
ChangedUsageList
,
ULONG
UsageListLength
,
HIDP_KEYBOARD_DIRECTION
KeyAction
,
HIDP_KEYBOARD_MODIFIER_STATE
*
ModifierState
,
PHIDP_INSERT_SCANCODES
InsertCodesProcedure
,
VOID
*
InsertCodesContext
);
NTSTATUS
WINAPI
HidP_TranslateUsagesToI8042ScanCodes
(
USAGE
*
ChangedUsageList
,
ULONG
UsageListLength
,
HIDP_KEYBOARD_DIRECTION
KeyAction
,
HIDP_KEYBOARD_MODIFIER_STATE
*
ModifierState
,
PHIDP_INSERT_SCANCODES
InsertCodesProcedure
,
VOID
*
InsertCodesContext
);
NTSTATUS
WINAPI
HidP_GetSpecificButtonCaps
(
HIDP_REPORT_TYPE
ReportType
,
USAGE
UsagePage
,
USHORT
LinkCollection
,
USAGE
Usage
,
HIDP_BUTTON_CAPS
*
ButtonCaps
,
USHORT
*
ButtonCapsLength
,
PHIDP_PREPARSED_DATA
PreparsedData
);
NTSTATUS
WINAPI
HidP_GetSpecificButtonCaps
(
HIDP_REPORT_TYPE
ReportType
,
USAGE
UsagePage
,
USHORT
LinkCollection
,
USAGE
Usage
,
HIDP_BUTTON_CAPS
*
ButtonCaps
,
USHORT
*
ButtonCapsLength
,
PHIDP_PREPARSED_DATA
PreparsedData
);
NTSTATUS
WINAPI
HidP_GetSpecificValueCaps
(
HIDP_REPORT_TYPE
ReportType
,
USAGE
UsagePage
,
USHORT
LinkCollection
,
USAGE
Usage
,
HIDP_VALUE_CAPS
*
ValueCaps
,
USHORT
*
ValueCapsLength
,
PHIDP_PREPARSED_DATA
PreparsedData
);
NTSTATUS
WINAPI
HidP_GetSpecificValueCaps
(
HIDP_REPORT_TYPE
ReportType
,
USAGE
UsagePage
,
USHORT
LinkCollection
,
USAGE
Usage
,
HIDP_VALUE_CAPS
*
ValueCaps
,
USHORT
*
ValueCapsLength
,
PHIDP_PREPARSED_DATA
PreparsedData
);
...
...
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