You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
user32-rawinput-*: Updates from Rémi Bernon.
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
From 9b9134b94879a1e501d0337cdf6f607ebe2ff84f Mon Sep 17 00:00:00 2001
|
||||
From c9e0eb6e9625d7d8dc31a208c5bbff25e5eff4d5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 23 Mar 2021 10:11:07 +0100
|
||||
Subject: [PATCH] server: Add extra data to hardware_msg_data.
|
||||
Subject: [PATCH] server: Add extra data bytes to be added after
|
||||
hardware_msg_data.
|
||||
|
||||
The RIM_TYPEHID messages will have to carry the variable length HID
|
||||
report.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
|
||||
---
|
||||
server/queue.c | 33 +++++++++++++++++++++++----------
|
||||
1 file changed, 23 insertions(+), 10 deletions(-)
|
||||
server/queue.c | 27 ++++++++++++++++++---------
|
||||
1 file changed, 18 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index 9fe009b5cfe..248157ca7da 100644
|
||||
index 5d65e030112..c43386ee317 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -348,13 +348,13 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_
|
||||
@@ -52,7 +53,7 @@ index 9fe009b5cfe..248157ca7da 100644
|
||||
|
||||
msg->msg = WM_MOUSEMOVE;
|
||||
msg->x = x;
|
||||
@@ -1710,6 +1710,8 @@ struct rawinput_message
|
||||
@@ -1664,6 +1664,8 @@ struct rawinput_message
|
||||
unsigned int time;
|
||||
unsigned int message;
|
||||
struct hardware_msg_data data;
|
||||
@@ -61,36 +62,24 @@ index 9fe009b5cfe..248157ca7da 100644
|
||||
};
|
||||
|
||||
/* check if process is supposed to receive a WM_INPUT message and eventually queue it */
|
||||
@@ -1721,6 +1723,7 @@ static int queue_rawinput_message( struct process* process, void *arg )
|
||||
struct desktop *target_desktop = NULL, *desktop = NULL;
|
||||
struct thread *target_thread = NULL, *foreground = NULL;
|
||||
struct message *msg;
|
||||
+ struct hardware_msg_data *msg_data;
|
||||
int wparam = RIM_INPUT;
|
||||
|
||||
if (raw_msg->data.rawinput.type == RIM_TYPEMOUSE)
|
||||
@@ -1748,14 +1751,18 @@ static int queue_rawinput_message( struct process* process, void *arg )
|
||||
@@ -1702,7 +1704,7 @@ static int queue_rawinput_message( struct process* process, void *arg )
|
||||
wparam = RIM_INPUTSINK;
|
||||
}
|
||||
|
||||
- if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time )))
|
||||
+ if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time, raw_msg->extra_len )))
|
||||
goto done;
|
||||
+ msg_data = msg->data;
|
||||
|
||||
msg->win = device->target;
|
||||
msg->msg = raw_msg->message;
|
||||
@@ -1710,6 +1712,7 @@ static int queue_rawinput_message( struct process* process, void *arg )
|
||||
msg->wparam = wparam;
|
||||
msg->lparam = 0;
|
||||
- memcpy( msg->data, &raw_msg->data, sizeof(raw_msg->data) );
|
||||
+
|
||||
+ memcpy( msg_data, &raw_msg->data, sizeof(*msg_data) );
|
||||
+ if (raw_msg->extra_len && raw_msg->extra)
|
||||
+ memcpy( msg_data + 1, raw_msg->extra, raw_msg->extra_len );
|
||||
memcpy( msg->data, &raw_msg->data, sizeof(raw_msg->data) );
|
||||
+ if (raw_msg->extra) memcpy( (struct hardware_msg_data *)msg->data + 1, raw_msg->extra, raw_msg->extra_len );
|
||||
|
||||
if (raw_msg->message == WM_INPUT_DEVICE_CHANGE && raw_msg->data.rawinput.type == RIM_TYPEHID)
|
||||
{
|
||||
@@ -1837,6 +1844,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
@@ -1791,6 +1794,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
raw_msg.source = source;
|
||||
raw_msg.time = time;
|
||||
raw_msg.message = WM_INPUT;
|
||||
@@ -99,7 +88,7 @@ index 9fe009b5cfe..248157ca7da 100644
|
||||
|
||||
msg_data = &raw_msg.data;
|
||||
msg_data->info = input->mouse.info;
|
||||
@@ -1862,7 +1871,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
@@ -1816,7 +1821,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
if (!(flags & (1 << i))) continue;
|
||||
flags &= ~(1 << i);
|
||||
|
||||
@@ -108,7 +97,7 @@ index 9fe009b5cfe..248157ca7da 100644
|
||||
msg_data = msg->data;
|
||||
|
||||
msg->win = get_user_full_handle( win );
|
||||
@@ -1972,6 +1981,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
@@ -1926,6 +1931,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
raw_msg.source = source;
|
||||
raw_msg.time = time;
|
||||
raw_msg.message = WM_INPUT;
|
||||
@@ -117,7 +106,7 @@ index 9fe009b5cfe..248157ca7da 100644
|
||||
|
||||
msg_data = &raw_msg.data;
|
||||
msg_data->info = input->kbd.info;
|
||||
@@ -1991,7 +2002,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
@@ -1945,7 +1952,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -126,7 +115,7 @@ index 9fe009b5cfe..248157ca7da 100644
|
||||
msg_data = msg->data;
|
||||
|
||||
msg->win = get_user_full_handle( win );
|
||||
@@ -2039,6 +2050,8 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
@@ -1993,6 +2000,8 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
raw_msg.source = source;
|
||||
raw_msg.time = get_tick_count();
|
||||
raw_msg.message = input->hw.msg;
|
||||
@@ -135,10 +124,10 @@ index 9fe009b5cfe..248157ca7da 100644
|
||||
|
||||
msg_data = &raw_msg.data;
|
||||
msg_data->info = 0;
|
||||
@@ -2060,7 +2073,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
@@ -2005,7 +2014,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
return;
|
||||
}
|
||||
|
||||
if (!desktop) return;
|
||||
- if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return;
|
||||
+ if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return;
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
From c88f4c3f0b2ae90b8357419fe8f90a59c8982a3b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 14 May 2021 22:05:06 +0200
|
||||
Subject: [PATCH] server: Add HID reports count / length to rawinput union.
|
||||
|
||||
And send HID reports data in send_hardware_message request, then append
|
||||
the reports after hardware_msg_data.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
|
||||
---
|
||||
dlls/user32/message.c | 4 +++-
|
||||
server/protocol.def | 3 +++
|
||||
server/queue.c | 11 +++++++++--
|
||||
server/trace.c | 4 ++--
|
||||
tools/make_requests | 2 +-
|
||||
5 files changed, 18 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
|
||||
index 9af33c3291e..71d0be8913e 100644
|
||||
--- a/dlls/user32/message.c
|
||||
+++ b/dlls/user32/message.c
|
||||
@@ -3288,11 +3288,13 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
|
||||
switch (rawinput->header.dwType)
|
||||
{
|
||||
case RIM_TYPEHID:
|
||||
- assert( rawinput->data.hid.dwCount <= 1 );
|
||||
req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice );
|
||||
req->input.hw.rawinput.hid.param = rawinput->header.wParam;
|
||||
req->input.hw.rawinput.hid.usage_page = hid_usage_page;
|
||||
req->input.hw.rawinput.hid.usage = hid_usage;
|
||||
+ req->input.hw.rawinput.hid.count = rawinput->data.hid.dwCount;
|
||||
+ req->input.hw.rawinput.hid.length = rawinput->data.hid.dwSizeHid;
|
||||
+ wine_server_add_data( req, rawinput->data.hid.bRawData, rawinput->data.hid.dwCount * rawinput->data.hid.dwSizeHid );
|
||||
break;
|
||||
default:
|
||||
assert( 0 );
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index 4239be834d1..eb15cef6fdb 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -302,6 +302,8 @@ union rawinput
|
||||
unsigned int param; /* rawinput message param */
|
||||
unsigned short usage_page;/* HID usage page */
|
||||
unsigned short usage; /* HID usage */
|
||||
+ unsigned int count; /* HID report count */
|
||||
+ unsigned int length; /* HID report length */
|
||||
} hid;
|
||||
};
|
||||
|
||||
@@ -2032,6 +2034,7 @@ enum message_type
|
||||
user_handle_t win; /* window handle */
|
||||
hw_input_t input; /* input data */
|
||||
unsigned int flags; /* flags (see below) */
|
||||
+ VARARG(report,bytes); /* HID report data */
|
||||
@REPLY
|
||||
int wait; /* do we need to wait for a reply? */
|
||||
int prev_x; /* previous cursor position */
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index c43386ee317..4f1695c92cc 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -2000,8 +2000,15 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
raw_msg.source = source;
|
||||
raw_msg.time = get_tick_count();
|
||||
raw_msg.message = input->hw.msg;
|
||||
- raw_msg.extra = NULL;
|
||||
- raw_msg.extra_len = 0;
|
||||
+ raw_msg.extra = get_req_data();
|
||||
+ raw_msg.extra_len = get_req_data_size();
|
||||
+
|
||||
+ if (input->hw.rawinput.type == RIM_TYPEHID &&
|
||||
+ raw_msg.extra_len != input->hw.rawinput.hid.length * input->hw.rawinput.hid.count)
|
||||
+ {
|
||||
+ set_error( STATUS_INVALID_PARAMETER );
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
msg_data = &raw_msg.data;
|
||||
msg_data->info = 0;
|
||||
diff --git a/server/trace.c b/server/trace.c
|
||||
index 6b5946c2bcf..3b6c8387149 100644
|
||||
--- a/server/trace.c
|
||||
+++ b/server/trace.c
|
||||
@@ -408,9 +408,9 @@ static void dump_rawinput( const char *prefix, const union rawinput *rawinput )
|
||||
rawinput->kbd.message, rawinput->kbd.vkey, rawinput->kbd.scan );
|
||||
break;
|
||||
case RIM_TYPEHID:
|
||||
- fprintf( stderr, "%s{type=HID,device=%04x,param=%04x,page=%04hx,usage=%04hx}",
|
||||
+ fprintf( stderr, "%s{type=HID,device=%04x,param=%04x,page=%04hx,usage=%04hx,count=%u,length=%u}",
|
||||
prefix, rawinput->hid.device, rawinput->hid.param, rawinput->hid.usage_page,
|
||||
- rawinput->hid.usage );
|
||||
+ rawinput->hid.usage, rawinput->hid.count, rawinput->hid.length );
|
||||
break;
|
||||
default:
|
||||
fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type );
|
||||
diff --git a/tools/make_requests b/tools/make_requests
|
||||
index a70b29df3d2..1c4e5977c8b 100755
|
||||
--- a/tools/make_requests
|
||||
+++ b/tools/make_requests
|
||||
@@ -52,7 +52,7 @@ my %formats =
|
||||
"luid_t" => [ 8, 4, "&dump_luid" ],
|
||||
"generic_map_t" => [ 16, 4, "&dump_generic_map" ],
|
||||
"ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ],
|
||||
- "hw_input_t" => [ 32, 8, "&dump_hw_input" ],
|
||||
+ "hw_input_t" => [ 40, 8, "&dump_hw_input" ],
|
||||
);
|
||||
|
||||
my @requests = ();
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
From 508f296e7ae9804a34438fd0d03eafcdb1c888f4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 14 May 2021 22:05:06 +0200
|
||||
Subject: [PATCH] server: Add HID reports support in GetRawInputBuffer.
|
||||
|
||||
Returned by get_rawinput_buffer request after each hardware_msg_data.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
|
||||
---
|
||||
dlls/user32/rawinput.c | 28 +++++++++++++++++++++++++---
|
||||
server/queue.c | 11 ++++++-----
|
||||
2 files changed, 31 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
|
||||
index e4e7bad508f..716047b4599 100644
|
||||
--- a/dlls/user32/rawinput.c
|
||||
+++ b/dlls/user32/rawinput.c
|
||||
@@ -280,6 +280,8 @@ struct rawinput_thread_data *rawinput_thread_data(void)
|
||||
|
||||
BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data)
|
||||
{
|
||||
+ SIZE_T size;
|
||||
+
|
||||
rawinput->header.dwType = msg_data->rawinput.type;
|
||||
if (msg_data->rawinput.type == RIM_TYPEMOUSE)
|
||||
{
|
||||
@@ -371,6 +373,23 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
|
||||
rawinput->data.keyboard.Message = msg_data->rawinput.kbd.message;
|
||||
rawinput->data.keyboard.ExtraInformation = msg_data->info;
|
||||
}
|
||||
+ else if (msg_data->rawinput.type == RIM_TYPEHID)
|
||||
+ {
|
||||
+ size = msg_data->rawinput.hid.count * msg_data->rawinput.hid.length;
|
||||
+ if (size > RAWINPUT_BUFFER_SIZE - sizeof(*rawinput))
|
||||
+ {
|
||||
+ ERR( "Dropping unexpectedly large HID hardware message.\n" );
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ rawinput->header.dwSize = FIELD_OFFSET( RAWINPUT, data.hid.bRawData ) + size;
|
||||
+ rawinput->header.hDevice = ULongToHandle( msg_data->rawinput.hid.device );
|
||||
+ rawinput->header.wParam = 0;
|
||||
+
|
||||
+ rawinput->data.hid.dwCount = msg_data->rawinput.hid.count;
|
||||
+ rawinput->data.hid.dwSizeHid = msg_data->rawinput.hid.length;
|
||||
+ memcpy( rawinput->data.hid.bRawData, msg_data + 1, size );
|
||||
+ }
|
||||
else
|
||||
{
|
||||
FIXME("Unhandled rawinput type %#x.\n", msg_data->rawinput.type);
|
||||
@@ -564,7 +583,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
|
||||
struct hardware_msg_data *msg_data;
|
||||
struct rawinput_thread_data *thread_data;
|
||||
RAWINPUT *rawinput;
|
||||
- UINT count = 0, rawinput_size, next_size, overhead;
|
||||
+ UINT count = 0, rawinput_size, msg_size, next_size, overhead;
|
||||
BOOL is_wow64;
|
||||
int i;
|
||||
|
||||
@@ -619,12 +638,15 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
- rawinput_from_hardware_message(data, msg_data);
|
||||
+ if (!rawinput_from_hardware_message(data, msg_data)) break;
|
||||
if (overhead) memmove((char *)&data->data + overhead, &data->data,
|
||||
data->header.dwSize - sizeof(RAWINPUTHEADER));
|
||||
data->header.dwSize += overhead;
|
||||
data = NEXTRAWINPUTBLOCK(data);
|
||||
- msg_data++;
|
||||
+ msg_size = sizeof(*msg_data);
|
||||
+ if (msg_data->rawinput.type == RIM_TYPEHID)
|
||||
+ msg_size += msg_data->rawinput.hid.count * msg_data->rawinput.hid.length;
|
||||
+ msg_data = (struct hardware_msg_data *)((char *)msg_data + msg_size);
|
||||
}
|
||||
|
||||
if (count == 0 && next_size == 0) *data_size = 0;
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index 4f1695c92cc..ebbe4049ae8 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -3311,16 +3311,17 @@ DECL_HANDLER(get_rawinput_buffer)
|
||||
{
|
||||
struct message *msg = LIST_ENTRY( ptr, struct message, entry );
|
||||
struct hardware_msg_data *data = msg->data;
|
||||
+ data_size_t hid_size = data->rawinput.type != RIM_TYPEHID ? 0 : msg->data_size - sizeof(*data);
|
||||
|
||||
ptr = list_next( &input->msg_list, ptr );
|
||||
if (msg->msg != WM_INPUT) continue;
|
||||
|
||||
- next_size = req->rawinput_size;
|
||||
+ next_size = req->rawinput_size + hid_size;
|
||||
if (size + next_size > req->buffer_size) break;
|
||||
- if (cur + sizeof(*data) > buf + get_reply_max_size()) break;
|
||||
- if (cur + sizeof(*data) > buf + buf_size)
|
||||
+ if (cur + msg->data_size > buf + get_reply_max_size()) break;
|
||||
+ if (cur + msg->data_size > buf + buf_size)
|
||||
{
|
||||
- buf_size += buf_size / 2;
|
||||
+ buf_size += buf_size / 2 + hid_size;
|
||||
if (!(tmp = realloc( buf, buf_size )))
|
||||
{
|
||||
set_error( STATUS_NO_MEMORY );
|
||||
@@ -3330,7 +3331,7 @@ DECL_HANDLER(get_rawinput_buffer)
|
||||
buf = tmp;
|
||||
}
|
||||
|
||||
- memcpy(cur, data, sizeof(*data));
|
||||
+ memcpy( cur, data, msg->data_size );
|
||||
list_remove( &msg->entry );
|
||||
free_message( msg );
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
From efdc9faae44a7b2a60ab3d383f83c573a65b1c2e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 16 Apr 2021 12:54:16 +0200
|
||||
Subject: [PATCH] server: Implement WM_INPUT / RIM_TYPEHID message dispatch.
|
||||
|
||||
The messages are of variable size and carry the corresponding HID report
|
||||
data after each RAWINPUT struct.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
|
||||
---
|
||||
dlls/user32/message.c | 9 +++++++++
|
||||
dlls/user32/rawinput.c | 15 +++++++++++++++
|
||||
dlls/user32/user_private.h | 2 ++
|
||||
server/queue.c | 1 +
|
||||
server/trace.c | 1 +
|
||||
5 files changed, 28 insertions(+)
|
||||
|
||||
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
|
||||
index 71d0be8913e..a80fb8c57ea 100644
|
||||
--- a/dlls/user32/message.c
|
||||
+++ b/dlls/user32/message.c
|
||||
@@ -3254,6 +3254,14 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
|
||||
hid_usage_page = ((USAGE *)rawinput->data.hid.bRawData)[0];
|
||||
hid_usage = ((USAGE *)rawinput->data.hid.bRawData)[1];
|
||||
}
|
||||
+ if (input->u.hi.uMsg == WM_INPUT)
|
||||
+ {
|
||||
+ if (!rawinput_device_get_usages( rawinput->header.hDevice, &hid_usage_page, &hid_usage ))
|
||||
+ {
|
||||
+ WARN( "unable to get HID usages for device %p\n", rawinput->header.hDevice );
|
||||
+ return STATUS_INVALID_HANDLE;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
SERVER_START_REQ( send_hardware_message )
|
||||
@@ -3283,6 +3291,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
|
||||
req->input.hw.lparam = MAKELONG( input->u.hi.wParamL, input->u.hi.wParamH );
|
||||
switch (input->u.hi.uMsg)
|
||||
{
|
||||
+ case WM_INPUT:
|
||||
case WM_INPUT_DEVICE_CHANGE:
|
||||
req->input.hw.rawinput.type = rawinput->header.dwType;
|
||||
switch (rawinput->header.dwType)
|
||||
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
|
||||
index 716047b4599..103f2bb8a55 100644
|
||||
--- a/dlls/user32/rawinput.c
|
||||
+++ b/dlls/user32/rawinput.c
|
||||
@@ -267,6 +267,21 @@ static struct device *find_device_from_handle(HANDLE handle)
|
||||
}
|
||||
|
||||
|
||||
+BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage)
|
||||
+{
|
||||
+ struct device *device;
|
||||
+
|
||||
+ *usage_page = *usage = 0;
|
||||
+
|
||||
+ if (!(device = find_device_from_handle(handle))) return FALSE;
|
||||
+ if (device->info.dwType != RIM_TYPEHID) return FALSE;
|
||||
+
|
||||
+ *usage_page = device->info.u.hid.usUsagePage;
|
||||
+ *usage = device->info.u.hid.usUsage;
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+
|
||||
struct rawinput_thread_data *rawinput_thread_data(void)
|
||||
{
|
||||
struct user_thread_info *thread_info = get_user_thread_info();
|
||||
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
|
||||
index cb780f0c963..0838ba28b32 100644
|
||||
--- a/dlls/user32/user_private.h
|
||||
+++ b/dlls/user32/user_private.h
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "winternl.h"
|
||||
+#include "hidusage.h"
|
||||
#include "wine/heap.h"
|
||||
|
||||
#define GET_WORD(ptr) (*(const WORD *)(ptr))
|
||||
@@ -239,6 +240,7 @@ struct tagWND;
|
||||
|
||||
struct hardware_msg_data;
|
||||
extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data);
|
||||
+extern BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage);
|
||||
extern struct rawinput_thread_data *rawinput_thread_data(void);
|
||||
|
||||
extern void keyboard_init(void) DECLSPEC_HIDDEN;
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index ebbe4049ae8..3e6050686ae 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -1994,6 +1994,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
|
||||
switch (input->hw.msg)
|
||||
{
|
||||
+ case WM_INPUT:
|
||||
case WM_INPUT_DEVICE_CHANGE:
|
||||
raw_msg.foreground = NULL;
|
||||
raw_msg.desktop = NULL;
|
||||
diff --git a/server/trace.c b/server/trace.c
|
||||
index 3b6c8387149..d84f4c9543a 100644
|
||||
--- a/server/trace.c
|
||||
+++ b/server/trace.c
|
||||
@@ -440,6 +440,7 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
|
||||
dump_uint64( ",lparam=", &input->hw.lparam );
|
||||
switch (input->hw.msg)
|
||||
{
|
||||
+ case WM_INPUT:
|
||||
case WM_INPUT_DEVICE_CHANGE:
|
||||
dump_rawinput( ",rawinput=", &input->hw.rawinput );
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
From df872d2e07d188439a3fbe938a2d9c53c6e3d3a7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Wed, 7 Apr 2021 12:17:09 +0200
|
||||
Subject: [PATCH] server: Track known HID rawinput devices on addition and
|
||||
removal.
|
||||
|
||||
To track their usage page and usage bytes.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
|
||||
---
|
||||
server/queue.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 49 insertions(+)
|
||||
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index ca2f898492b..becfb8b94c6 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -1656,6 +1656,42 @@ static struct thread *get_foreground_thread( struct desktop *desktop, user_handl
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+static struct rawinput_device *hid_rawinput_devices;
|
||||
+static unsigned int hid_rawinput_device_count;
|
||||
+
|
||||
+static void insert_hid_rawinput_device( unsigned int index, const char *data, unsigned int data_len )
|
||||
+{
|
||||
+ unsigned int new_count;
|
||||
+
|
||||
+ if (data_len < 2) return;
|
||||
+
|
||||
+ if (!hid_rawinput_device_count)
|
||||
+ {
|
||||
+ hid_rawinput_device_count = 64;
|
||||
+ while (hid_rawinput_device_count < index) hid_rawinput_device_count *= 2;
|
||||
+ hid_rawinput_devices = mem_alloc( hid_rawinput_device_count * sizeof(*hid_rawinput_devices) );
|
||||
+ memset( hid_rawinput_devices, 0, hid_rawinput_device_count * sizeof(*hid_rawinput_devices) );
|
||||
+ }
|
||||
+ else if (hid_rawinput_device_count < index)
|
||||
+ {
|
||||
+ new_count = hid_rawinput_device_count;
|
||||
+ while (new_count < index) new_count *= 2;
|
||||
+ hid_rawinput_devices = realloc( hid_rawinput_devices, new_count * sizeof(*hid_rawinput_devices) );
|
||||
+ memset( hid_rawinput_devices + hid_rawinput_device_count, 0, (new_count - hid_rawinput_device_count) * sizeof(*hid_rawinput_devices) );
|
||||
+ hid_rawinput_device_count = new_count;
|
||||
+ }
|
||||
+
|
||||
+ hid_rawinput_devices[index].usage_page = data[0];
|
||||
+ hid_rawinput_devices[index].usage = data[1];
|
||||
+}
|
||||
+
|
||||
+static void remove_hid_rawinput_device( unsigned int index )
|
||||
+{
|
||||
+ if (hid_rawinput_device_count < index) return;
|
||||
+ hid_rawinput_devices[index].usage_page = 0;
|
||||
+ hid_rawinput_devices[index].usage = 0;
|
||||
+}
|
||||
+
|
||||
struct rawinput_message
|
||||
{
|
||||
struct thread *foreground;
|
||||
@@ -1969,6 +2005,19 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
struct hw_msg_source source = { IMDT_UNAVAILABLE, origin };
|
||||
struct message *msg;
|
||||
|
||||
+ switch (input->hw.msg)
|
||||
+ {
|
||||
+ case WM_INPUT_DEVICE_CHANGE:
|
||||
+ if (input->hw.rawinput.type == RIM_TYPEHID &&
|
||||
+ input->hw.rawinput.hid.param == GIDC_ARRIVAL)
|
||||
+ insert_hid_rawinput_device( input->hw.rawinput.hid.device, get_req_data(), get_req_data_size() );
|
||||
+
|
||||
+ if (input->hw.rawinput.type == RIM_TYPEHID &&
|
||||
+ input->hw.rawinput.hid.param == GIDC_REMOVAL)
|
||||
+ remove_hid_rawinput_device( input->hw.rawinput.hid.device );
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (!desktop) return;
|
||||
if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return;
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
From 478c213d97d8894d734d8f711f6d4c75d9ea84fa Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 5 Mar 2021 10:41:20 +0100
|
||||
Subject: [PATCH] hidclass.sys: Send rawinput messages with HID report.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
|
||||
---
|
||||
dlls/hidclass.sys/device.c | 35 +++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 35 insertions(+)
|
||||
|
||||
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
|
||||
index ec34b6b8068..887d7212c89 100644
|
||||
--- a/dlls/hidclass.sys/device.c
|
||||
+++ b/dlls/hidclass.sys/device.c
|
||||
@@ -171,6 +171,39 @@ static NTSTATUS copy_packet_into_buffer(HID_XFER_PACKET *packet, BYTE* buffer, U
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
+static void HID_Device_sendRawInput(DEVICE_OBJECT *device, HID_XFER_PACKET *packet)
|
||||
+{
|
||||
+ BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
|
||||
+ RAWINPUT *rawinput;
|
||||
+ UCHAR *report, id;
|
||||
+ ULONG data_size;
|
||||
+ INPUT input;
|
||||
+
|
||||
+ data_size = offsetof(RAWINPUT, data.hid.bRawData) + packet->reportBufferLen;
|
||||
+ if (!(id = ext->u.pdo.preparsed_data->reports[0].reportID)) data_size += 1;
|
||||
+
|
||||
+ rawinput = HeapAlloc(GetProcessHeap(), 0, data_size);
|
||||
+
|
||||
+ rawinput->header.dwType = RIM_TYPEHID;
|
||||
+ rawinput->header.dwSize = data_size;
|
||||
+ rawinput->header.hDevice = ULongToHandle(ext->u.pdo.rawinput_handle);
|
||||
+ rawinput->header.wParam = RIM_INPUT;
|
||||
+ rawinput->data.hid.dwCount = 1;
|
||||
+ rawinput->data.hid.dwSizeHid = data_size - offsetof(RAWINPUT, data.hid.bRawData);
|
||||
+
|
||||
+ report = rawinput->data.hid.bRawData;
|
||||
+ if (!id) *report++ = 0;
|
||||
+ memcpy(report, packet->reportBuffer, packet->reportBufferLen);
|
||||
+
|
||||
+ input.type = INPUT_HARDWARE;
|
||||
+ input.u.hi.uMsg = WM_INPUT;
|
||||
+ input.u.hi.wParamH = (WORD)(rawinput->header.dwSize >> 16);
|
||||
+ input.u.hi.wParamL = (WORD)(rawinput->header.dwSize >> 0);
|
||||
+ __wine_send_input(0, &input, rawinput);
|
||||
+
|
||||
+ HeapFree(GetProcessHeap(), 0, rawinput);
|
||||
+}
|
||||
+
|
||||
static void HID_Device_processQueue(DEVICE_OBJECT *device)
|
||||
{
|
||||
IRP *irp;
|
||||
@@ -242,6 +275,7 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
||||
if (irp_status.u.Status == STATUS_SUCCESS)
|
||||
{
|
||||
RingBuffer_Write(ext->u.pdo.ring_buffer, packet);
|
||||
+ HID_Device_sendRawInput(device, packet);
|
||||
HID_Device_processQueue(device);
|
||||
}
|
||||
|
||||
@@ -282,6 +316,7 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
||||
else
|
||||
packet->reportId = 0;
|
||||
RingBuffer_Write(ext->u.pdo.ring_buffer, packet);
|
||||
+ HID_Device_sendRawInput(device, packet);
|
||||
HID_Device_processQueue(device);
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
From 018a5cdacc44e5ff883a1d4f62705bf466d8d62c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 23 Mar 2021 10:42:07 +0100
|
||||
Subject: [PATCH] server: Implement WM_INPUT / RIM_TYPEHID message dispatch.
|
||||
|
||||
The messages are of variable size and carry the corresponding HID report
|
||||
data after each RAWINPUT struct.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
|
||||
---
|
||||
dlls/user32/message.c | 1 +
|
||||
dlls/user32/rawinput.c | 22 ++++++++++++++++++++--
|
||||
server/queue.c | 25 ++++++++++++++++++-------
|
||||
server/trace.c | 1 +
|
||||
4 files changed, 40 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
|
||||
index 9af33c3291e..e21ebf9d4d8 100644
|
||||
--- a/dlls/user32/message.c
|
||||
+++ b/dlls/user32/message.c
|
||||
@@ -3283,6 +3283,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
|
||||
req->input.hw.lparam = MAKELONG( input->u.hi.wParamL, input->u.hi.wParamH );
|
||||
switch (input->u.hi.uMsg)
|
||||
{
|
||||
+ case WM_INPUT:
|
||||
case WM_INPUT_DEVICE_CHANGE:
|
||||
req->input.hw.rawinput.type = rawinput->header.dwType;
|
||||
switch (rawinput->header.dwType)
|
||||
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
|
||||
index d95d29d7656..f28bde339eb 100644
|
||||
--- a/dlls/user32/rawinput.c
|
||||
+++ b/dlls/user32/rawinput.c
|
||||
@@ -371,6 +371,22 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
|
||||
rawinput->data.keyboard.Message = msg_data->rawinput.kbd.message;
|
||||
rawinput->data.keyboard.ExtraInformation = msg_data->info;
|
||||
}
|
||||
+ else if (msg_data->rawinput.type == RIM_TYPEHID)
|
||||
+ {
|
||||
+ if (sizeof(*rawinput) + msg_data->rawinput.hid.length > RAWINPUT_BUFFER_SIZE)
|
||||
+ {
|
||||
+ ERR( "unexpectedly large hardware message dropped\n" );
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ rawinput->header.dwSize = FIELD_OFFSET( RAWINPUT, data.hid.bRawData ) + msg_data->rawinput.hid.length;
|
||||
+ rawinput->header.hDevice = ULongToHandle( msg_data->rawinput.hid.device );
|
||||
+ rawinput->header.wParam = 0;
|
||||
+
|
||||
+ rawinput->data.hid.dwSizeHid = msg_data->rawinput.hid.length;
|
||||
+ rawinput->data.hid.dwCount = 1;
|
||||
+ memcpy( rawinput->data.hid.bRawData, msg_data + 1, msg_data->rawinput.hid.length );
|
||||
+ }
|
||||
else
|
||||
{
|
||||
FIXME("Unhandled rawinput type %#x.\n", msg_data->rawinput.type);
|
||||
@@ -564,7 +580,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
|
||||
struct hardware_msg_data *msg_data;
|
||||
struct rawinput_thread_data *thread_data;
|
||||
RAWINPUT *rawinput;
|
||||
- UINT count = 0, rawinput_size, next_size, overhead;
|
||||
+ UINT count = 0, rawinput_size, msg_size, next_size, overhead;
|
||||
BOOL is_wow64;
|
||||
int i;
|
||||
|
||||
@@ -624,7 +640,9 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
|
||||
data->header.dwSize - sizeof(RAWINPUTHEADER));
|
||||
data->header.dwSize += overhead;
|
||||
data = NEXTRAWINPUTBLOCK(data);
|
||||
- msg_data++;
|
||||
+ msg_size = sizeof(*msg_data);
|
||||
+ if (msg_data->rawinput.type == RIM_TYPEHID) msg_size += msg_data->rawinput.hid.length;
|
||||
+ msg_data = (struct hardware_msg_data *)((char *)msg_data + msg_size);
|
||||
}
|
||||
|
||||
if (count == 0 && next_size == 0) *data_size = 0;
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index 55bcded3aff..52627015584 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -2044,6 +2044,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
|
||||
switch (input->hw.msg)
|
||||
{
|
||||
+ case WM_INPUT:
|
||||
case WM_INPUT_DEVICE_CHANGE:
|
||||
raw_msg.foreground = get_foreground_thread( desktop, win );
|
||||
raw_msg.desktop = desktop;
|
||||
@@ -2053,18 +2054,26 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
raw_msg.extra = NULL;
|
||||
raw_msg.extra_len = 0;
|
||||
|
||||
+ if (input->hw.msg == WM_INPUT)
|
||||
+ {
|
||||
+ raw_msg.extra = get_req_data();
|
||||
+ raw_msg.extra_len = get_req_data_size();
|
||||
+ }
|
||||
+
|
||||
msg_data = &raw_msg.data;
|
||||
msg_data->info = 0;
|
||||
msg_data->flags = 0;
|
||||
msg_data->rawinput = input->hw.rawinput;
|
||||
|
||||
- if (input->hw.rawinput.type == RIM_TYPEHID &&
|
||||
+ if (input->hw.msg == WM_INPUT_DEVICE_CHANGE &&
|
||||
+ input->hw.rawinput.type == RIM_TYPEHID &&
|
||||
input->hw.rawinput.hid.param == GIDC_ARRIVAL)
|
||||
insert_hid_rawinput_device( input->hw.rawinput.hid.device, get_req_data(), get_req_data_size() );
|
||||
|
||||
enum_processes( queue_rawinput_message, &raw_msg );
|
||||
|
||||
- if (input->hw.rawinput.type == RIM_TYPEHID &&
|
||||
+ if (input->hw.msg == WM_INPUT_DEVICE_CHANGE &&
|
||||
+ input->hw.rawinput.type == RIM_TYPEHID &&
|
||||
input->hw.rawinput.hid.param == GIDC_REMOVAL)
|
||||
remove_hid_rawinput_device( input->hw.rawinput.hid.device );
|
||||
|
||||
@@ -3371,16 +3380,18 @@ DECL_HANDLER(get_rawinput_buffer)
|
||||
{
|
||||
struct message *msg = LIST_ENTRY( ptr, struct message, entry );
|
||||
struct hardware_msg_data *data = msg->data;
|
||||
+ data_size_t hid_size = data->rawinput.type != RIM_TYPEHID ? 0 : data->rawinput.hid.length;
|
||||
+ data_size_t data_size = sizeof(*data) + hid_size;
|
||||
|
||||
ptr = list_next( &input->msg_list, ptr );
|
||||
if (msg->msg != WM_INPUT) continue;
|
||||
|
||||
- next_size = req->rawinput_size;
|
||||
+ next_size = req->rawinput_size + hid_size;
|
||||
if (size + next_size > req->buffer_size) break;
|
||||
- if (cur + sizeof(*data) > buf + get_reply_max_size()) break;
|
||||
- if (cur + sizeof(*data) > buf + buf_size)
|
||||
+ if (cur + data_size > buf + get_reply_max_size()) break;
|
||||
+ if (cur + data_size > buf + buf_size)
|
||||
{
|
||||
- buf_size += buf_size / 2;
|
||||
+ buf_size += buf_size / 2 + hid_size;
|
||||
if (!(tmp = realloc( buf, buf_size )))
|
||||
{
|
||||
set_error( STATUS_NO_MEMORY );
|
||||
@@ -3390,7 +3401,7 @@ DECL_HANDLER(get_rawinput_buffer)
|
||||
buf = tmp;
|
||||
}
|
||||
|
||||
- memcpy(cur, data, sizeof(*data));
|
||||
+ memcpy( cur, data, data_size );
|
||||
list_remove( &msg->entry );
|
||||
free_message( msg );
|
||||
|
||||
diff --git a/server/trace.c b/server/trace.c
|
||||
index e40f0769a35..1fd32c8ab5f 100644
|
||||
--- a/server/trace.c
|
||||
+++ b/server/trace.c
|
||||
@@ -440,6 +440,7 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
|
||||
dump_uint64( ",lparam=", &input->hw.lparam );
|
||||
switch (input->hw.msg)
|
||||
{
|
||||
+ case WM_INPUT:
|
||||
case WM_INPUT_DEVICE_CHANGE:
|
||||
dump_rawinput( ",rawinput=", &input->hw.rawinput );
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
From 40f1c71a5b47e21741a5b8f33e98eea0c5e2d9f6 Mon Sep 17 00:00:00 2001
|
||||
From: Arkadiusz Hiler <ahiler@codeweavers.com>
|
||||
Date: Mon, 22 Feb 2021 15:41:46 +0200
|
||||
Subject: [PATCH] user32: Enumerate mouse rawinput device before HID devices.
|
||||
|
||||
---
|
||||
dlls/user32/rawinput.c | 56 ++++++++++++++++++++++--------------------
|
||||
1 file changed, 29 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
|
||||
index 9ca00504e5c..b05761cb326 100644
|
||||
--- a/dlls/user32/rawinput.c
|
||||
+++ b/dlls/user32/rawinput.c
|
||||
@@ -169,33 +169,7 @@ static void find_devices(void)
|
||||
}
|
||||
rawinput_devices_count = 0;
|
||||
|
||||
- set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
|
||||
-
|
||||
- for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &hid_guid, idx, &iface); ++idx)
|
||||
- {
|
||||
- if (!(device = add_device(set, &iface)))
|
||||
- continue;
|
||||
-
|
||||
- attr.Size = sizeof(HIDD_ATTRIBUTES);
|
||||
- if (!HidD_GetAttributes(device->file, &attr))
|
||||
- WARN("Failed to get attributes.\n");
|
||||
-
|
||||
- device->info.dwType = RIM_TYPEHID;
|
||||
- device->info.u.hid.dwVendorId = attr.VendorID;
|
||||
- device->info.u.hid.dwProductId = attr.ProductID;
|
||||
- device->info.u.hid.dwVersionNumber = attr.VersionNumber;
|
||||
-
|
||||
- if (!HidD_GetPreparsedData(device->file, &device->data))
|
||||
- WARN("Failed to get preparsed data.\n");
|
||||
-
|
||||
- if (!HidP_GetCaps(device->data, &caps))
|
||||
- WARN("Failed to get caps.\n");
|
||||
-
|
||||
- device->info.u.hid.usUsagePage = caps.UsagePage;
|
||||
- device->info.u.hid.usUsage = caps.Usage;
|
||||
- }
|
||||
-
|
||||
- SetupDiDestroyDeviceInfoList(set);
|
||||
+ /* add mice and keyboards first so we won't add the duplicated HID devices */
|
||||
|
||||
set = SetupDiGetClassDevsW(&GUID_DEVINTERFACE_MOUSE, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
|
||||
|
||||
@@ -227,6 +201,34 @@ static void find_devices(void)
|
||||
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
|
||||
+ set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
|
||||
+
|
||||
+ for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &hid_guid, idx, &iface); ++idx)
|
||||
+ {
|
||||
+ if (!(device = add_device(set, &iface)))
|
||||
+ continue;
|
||||
+
|
||||
+ attr.Size = sizeof(HIDD_ATTRIBUTES);
|
||||
+ if (!HidD_GetAttributes(device->file, &attr))
|
||||
+ WARN("Failed to get attributes.\n");
|
||||
+
|
||||
+ device->info.dwType = RIM_TYPEHID;
|
||||
+ device->info.u.hid.dwVendorId = attr.VendorID;
|
||||
+ device->info.u.hid.dwProductId = attr.ProductID;
|
||||
+ device->info.u.hid.dwVersionNumber = attr.VersionNumber;
|
||||
+
|
||||
+ if (!HidD_GetPreparsedData(device->file, &device->data))
|
||||
+ WARN("Failed to get preparsed data.\n");
|
||||
+
|
||||
+ if (!HidP_GetCaps(device->data, &caps))
|
||||
+ WARN("Failed to get caps.\n");
|
||||
+
|
||||
+ device->info.u.hid.usUsagePage = caps.UsagePage;
|
||||
+ device->info.u.hid.usUsage = caps.Usage;
|
||||
+ }
|
||||
+
|
||||
+ SetupDiDestroyDeviceInfoList(set);
|
||||
+
|
||||
LeaveCriticalSection(&rawinput_devices_cs);
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
Fixes: [50506] WM_INPUT messages are not received for HID devices registered with RegisterRawInputDevices
|
||||
Depends: loader-KeyboardLayouts
|
||||
# In the process of upstreaming.
|
||||
Disabled: true
|
||||
|
||||
Reference in New Issue
Block a user