Commit fc64aa7e authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

server: Send HID report data with the WM_INPUT messages.

parent 109de608
...@@ -3298,11 +3298,14 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r ...@@ -3298,11 +3298,14 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
switch (rawinput->header.dwType) switch (rawinput->header.dwType)
{ {
case RIM_TYPEHID: case RIM_TYPEHID:
assert( rawinput->data.hid.dwCount <= 1 );
req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice ); req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice );
req->input.hw.rawinput.hid.param = rawinput->header.wParam; 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_page = hid_usage_page;
req->input.hw.rawinput.hid.usage = hid_usage; 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; break;
default: default:
assert( 0 ); assert( 0 );
......
...@@ -397,8 +397,8 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms ...@@ -397,8 +397,8 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
rawinput->header.hDevice = ULongToHandle( msg_data->rawinput.hid.device ); rawinput->header.hDevice = ULongToHandle( msg_data->rawinput.hid.device );
rawinput->header.wParam = 0; rawinput->header.wParam = 0;
rawinput->data.hid.dwCount = 0; rawinput->data.hid.dwCount = msg_data->rawinput.hid.count;
rawinput->data.hid.dwSizeHid = 0; rawinput->data.hid.dwSizeHid = msg_data->rawinput.hid.length;
memcpy( rawinput->data.hid.bRawData, msg_data + 1, size ); memcpy( rawinput->data.hid.bRawData, msg_data + 1, size );
} }
else else
......
...@@ -286,6 +286,8 @@ union rawinput ...@@ -286,6 +286,8 @@ union rawinput
unsigned int param; unsigned int param;
unsigned short usage_page; unsigned short usage_page;
unsigned short usage; unsigned short usage;
unsigned int count;
unsigned int length;
} hid; } hid;
}; };
...@@ -2763,7 +2765,8 @@ struct send_hardware_message_request ...@@ -2763,7 +2765,8 @@ struct send_hardware_message_request
user_handle_t win; user_handle_t win;
hw_input_t input; hw_input_t input;
unsigned int flags; unsigned int flags;
char __pad_52[4]; /* VARARG(report,bytes); */
char __pad_60[4];
}; };
struct send_hardware_message_reply struct send_hardware_message_reply
{ {
...@@ -6309,7 +6312,7 @@ union generic_reply ...@@ -6309,7 +6312,7 @@ union generic_reply
/* ### protocol_version begin ### */ /* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 709 #define SERVER_PROTOCOL_VERSION 710
/* ### protocol_version end ### */ /* ### protocol_version end ### */
......
...@@ -302,6 +302,8 @@ union rawinput ...@@ -302,6 +302,8 @@ union rawinput
unsigned int param; /* rawinput message param */ unsigned int param; /* rawinput message param */
unsigned short usage_page;/* HID usage page */ unsigned short usage_page;/* HID usage page */
unsigned short usage; /* HID usage */ unsigned short usage; /* HID usage */
unsigned int count; /* HID report count */
unsigned int length; /* HID report length */
} hid; } hid;
}; };
...@@ -2068,6 +2070,7 @@ enum message_type ...@@ -2068,6 +2070,7 @@ enum message_type
user_handle_t win; /* window handle */ user_handle_t win; /* window handle */
hw_input_t input; /* input data */ hw_input_t input; /* input data */
unsigned int flags; /* flags (see below) */ unsigned int flags; /* flags (see below) */
VARARG(report,bytes); /* HID report data */
@REPLY @REPLY
int wait; /* do we need to wait for a reply? */ int wait; /* do we need to wait for a reply? */
int prev_x; /* previous cursor position */ int prev_x; /* previous cursor position */
......
...@@ -1995,6 +1995,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ ...@@ -1995,6 +1995,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
struct hardware_msg_data *msg_data; struct hardware_msg_data *msg_data;
struct rawinput_message raw_msg; struct rawinput_message raw_msg;
struct message *msg; struct message *msg;
data_size_t report_size = 0;
switch (input->hw.msg) switch (input->hw.msg)
{ {
...@@ -2007,9 +2008,21 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ ...@@ -2007,9 +2008,21 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
raw_msg.message = input->hw.msg; raw_msg.message = input->hw.msg;
raw_msg.hid_report = NULL; raw_msg.hid_report = NULL;
if (input->hw.rawinput.type == RIM_TYPEHID)
{
raw_msg.hid_report = get_req_data();
report_size = input->hw.rawinput.hid.length * input->hw.rawinput.hid.count;
}
if (report_size != get_req_data_size())
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
msg_data = &raw_msg.data; msg_data = &raw_msg.data;
msg_data->info = 0; msg_data->info = 0;
msg_data->size = sizeof(*msg_data); msg_data->size = sizeof(*msg_data) + report_size;
msg_data->flags = 0; msg_data->flags = 0;
msg_data->rawinput = input->hw.rawinput; msg_data->rawinput = input->hw.rawinput;
......
...@@ -693,7 +693,7 @@ C_ASSERT( sizeof(client_ptr_t) == 8 ); ...@@ -693,7 +693,7 @@ C_ASSERT( sizeof(client_ptr_t) == 8 );
C_ASSERT( sizeof(data_size_t) == 4 ); C_ASSERT( sizeof(data_size_t) == 4 );
C_ASSERT( sizeof(file_pos_t) == 8 ); C_ASSERT( sizeof(file_pos_t) == 8 );
C_ASSERT( sizeof(generic_map_t) == 16 ); C_ASSERT( sizeof(generic_map_t) == 16 );
C_ASSERT( sizeof(hw_input_t) == 32 ); C_ASSERT( sizeof(hw_input_t) == 40 );
C_ASSERT( sizeof(int) == 4 ); C_ASSERT( sizeof(int) == 4 );
C_ASSERT( sizeof(ioctl_code_t) == 4 ); C_ASSERT( sizeof(ioctl_code_t) == 4 );
C_ASSERT( sizeof(irp_params_t) == 32 ); C_ASSERT( sizeof(irp_params_t) == 32 );
...@@ -1355,8 +1355,8 @@ C_ASSERT( FIELD_OFFSET(struct post_quit_message_request, exit_code) == 12 ); ...@@ -1355,8 +1355,8 @@ C_ASSERT( FIELD_OFFSET(struct post_quit_message_request, exit_code) == 12 );
C_ASSERT( sizeof(struct post_quit_message_request) == 16 ); C_ASSERT( sizeof(struct post_quit_message_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, win) == 12 ); C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, win) == 12 );
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, input) == 16 ); C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, input) == 16 );
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, flags) == 48 ); C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, flags) == 56 );
C_ASSERT( sizeof(struct send_hardware_message_request) == 56 ); C_ASSERT( sizeof(struct send_hardware_message_request) == 64 );
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, wait) == 8 ); C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, wait) == 8 );
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, prev_x) == 12 ); C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, prev_x) == 12 );
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, prev_y) == 16 ); C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, prev_y) == 16 );
......
...@@ -404,9 +404,9 @@ static void dump_rawinput( const char *prefix, const union rawinput *rawinput ) ...@@ -404,9 +404,9 @@ static void dump_rawinput( const char *prefix, const union rawinput *rawinput )
rawinput->kbd.message, rawinput->kbd.vkey, rawinput->kbd.scan ); rawinput->kbd.message, rawinput->kbd.vkey, rawinput->kbd.scan );
break; break;
case RIM_TYPEHID: 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, prefix, rawinput->hid.device, rawinput->hid.param, rawinput->hid.usage_page,
rawinput->hid.usage ); rawinput->hid.usage, rawinput->hid.count, rawinput->hid.length );
break; break;
default: default:
fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type ); fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type );
...@@ -2727,6 +2727,7 @@ static void dump_send_hardware_message_request( const struct send_hardware_messa ...@@ -2727,6 +2727,7 @@ static void dump_send_hardware_message_request( const struct send_hardware_messa
fprintf( stderr, " win=%08x", req->win ); fprintf( stderr, " win=%08x", req->win );
dump_hw_input( ", input=", &req->input ); dump_hw_input( ", input=", &req->input );
fprintf( stderr, ", flags=%08x", req->flags ); fprintf( stderr, ", flags=%08x", req->flags );
dump_varargs_bytes( ", report=", cur_size );
} }
static void dump_send_hardware_message_reply( const struct send_hardware_message_reply *req ) static void dump_send_hardware_message_reply( const struct send_hardware_message_reply *req )
......
...@@ -52,7 +52,7 @@ my %formats = ...@@ -52,7 +52,7 @@ my %formats =
"luid_t" => [ 8, 4, "&dump_luid" ], "luid_t" => [ 8, 4, "&dump_luid" ],
"generic_map_t" => [ 16, 4, "&dump_generic_map" ], "generic_map_t" => [ 16, 4, "&dump_generic_map" ],
"ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ], "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 = (); my @requests = ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment